We should return texture id 0 for invalid images and pixmaps

in the texture cache

Change-Id: Ib9bb136fa451c571fce2adbee29998b3f3593b31
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
bb10
Jørgen Lind 2012-01-09 08:54:11 +01:00 committed by Qt by Nokia
parent f85b9f8242
commit 58bdf5c49c
1 changed files with 4 additions and 0 deletions

View File

@ -107,6 +107,8 @@ QOpenGLTextureCache::~QOpenGLTextureCache()
GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &pixmap)
{
if (pixmap.isNull())
return 0;
QMutexLocker locker(&m_mutex);
qint64 key = pixmap.cacheKey();
@ -128,6 +130,8 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &
GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &image)
{
if (image.isNull())
return 0;
QMutexLocker locker(&m_mutex);
qint64 key = image.cacheKey();