diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-09 13:09:34 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-09 13:09:34 (GMT) |
commit | ec0f388dfb14712a144d534296b33df7e6a2df7f (patch) | |
tree | ab4d6b9da547a6439ae6f434a69ee3f202d328d7 /src/opengl/qgl.cpp | |
parent | 6165ab0203fa80d31f3488ead7e7f7c088c8668c (diff) | |
parent | 3b1a0c4877faa9d1d50372f2128c06530ae4b2d4 (diff) | |
download | Qt-ec0f388dfb14712a144d534296b33df7e6a2df7f.zip Qt-ec0f388dfb14712a144d534296b33df7e6a2df7f.tar.gz Qt-ec0f388dfb14712a144d534296b33df7e6a2df7f.tar.bz2 |
Merge remote branch 'qt/4.6' into qt-master-from-4.6
Conflicts:
src/gui/kernel/qcocoapanel_mac.mm
src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r-- | src/opengl/qgl.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e9ca4c4..3e5c4fc 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1688,10 +1688,8 @@ QGLTextureCache::QGLTextureCache() Q_ASSERT(qt_gl_texture_cache == 0); qt_gl_texture_cache = this; - QImagePixmapCleanupHooks::instance()->addPixmapModificationHook(cleanupTextures); -#ifdef Q_WS_X11 - QImagePixmapCleanupHooks::instance()->addPixmapDestructionHook(cleanupPixmapSurfaces); -#endif + QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(cleanupTextures); + QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->addImageHook(imageCleanupHook); } @@ -1699,10 +1697,8 @@ QGLTextureCache::~QGLTextureCache() { qt_gl_texture_cache = 0; - QImagePixmapCleanupHooks::instance()->removePixmapModificationHook(cleanupTextures); -#ifdef Q_WS_X11 - QImagePixmapCleanupHooks::instance()->removePixmapDestructionHook(cleanupPixmapSurfaces); -#endif + QImagePixmapCleanupHooks::instance()->removePixmapDataModificationHook(cleanupTextures); + QImagePixmapCleanupHooks::instance()->removePixmapDataDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->removeImageHook(imageCleanupHook); } @@ -1770,30 +1766,29 @@ void QGLTextureCache::imageCleanupHook(qint64 cacheKey) } -void QGLTextureCache::cleanupTextures(QPixmap* pixmap) +void QGLTextureCache::cleanupTextures(QPixmapData* pmd) { // ### remove when the GL texture cache becomes thread-safe if (qApp->thread() == QThread::currentThread()) { - const qint64 cacheKey = pixmap->cacheKey(); + const qint64 cacheKey = pmd->cacheKey(); QGLTexture *texture = instance()->getTexture(cacheKey); if (texture && texture->options & QGLContext::MemoryManagedBindOption) instance()->remove(cacheKey); } } -#if defined(Q_WS_X11) -void QGLTextureCache::cleanupPixmapSurfaces(QPixmap* pixmap) +void QGLTextureCache::cleanupBeforePixmapDestruction(QPixmapData* pmd) { // Remove any bound textures first: - cleanupTextures(pixmap); + cleanupTextures(pmd); - QPixmapData *pd = pixmap->data_ptr().data(); - if (pd->classId() == QPixmapData::X11Class) { - Q_ASSERT(pd->ref == 1); // Make sure reference counting isn't broken - QGLContextPrivate::destroyGlSurfaceForPixmap(pd); +#if defined(Q_WS_X11) + if (pmd->classId() == QPixmapData::X11Class) { + Q_ASSERT(pmd->ref == 0); // Make sure reference counting isn't broken + QGLContextPrivate::destroyGlSurfaceForPixmap(pmd); } -} #endif +} void QGLTextureCache::deleteIfEmpty() { |