diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-16 16:25:47 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-16 16:25:47 (GMT) |
commit | 580e3d9968e12fb38348af503ef9ede50691c24c (patch) | |
tree | 2ae55db9989bd8147de9d25071cecbd279b847d7 /src/opengl/gl2paintengineex | |
parent | e318b0276c3d4a0db8660b4fa6d68f1784aee522 (diff) | |
parent | b8ded0df9c85558b93ee5ec5abd5774c87c4deed (diff) | |
download | Qt-580e3d9968e12fb38348af503ef9ede50691c24c.zip Qt-580e3d9968e12fb38348af503ef9ede50691c24c.tar.gz Qt-580e3d9968e12fb38348af503ef9ede50691c24c.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into HEAD
Conflicts:
configure
mkspecs/symbian-gcce/qmake.conf
qmake/generators/metamakefile.cpp
qmake/generators/win32/mingw_make.cpp
src/corelib/global/global.pri
src/corelib/global/qglobal.h
src/opengl/qgl.cpp
src/opengl/qwindowsurface_gl.cpp
src/plugins/platforms/wayland/qwaylandbuffer.h
tests/auto/qnetworkreply/tst_qnetworkreply.cpp
tools/designer/src/components/formeditor/qdesigner_resource.cpp
Diffstat (limited to 'src/opengl/gl2paintengineex')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index fa38b5d..a134078 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1349,11 +1349,14 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c ensureActive(); d->transferMode(ImageDrawingMode); + QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption|QGLContext::CanFlipNativePixmapBindOption; +#ifdef QGL_USE_TEXTURE_POOL + bindOptions |= QGLContext::TemporarilyCachedBindOption; +#endif + glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); QGLTexture *texture = - ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, - QGLContext::InternalBindOption - | QGLContext::CanFlipNativePixmapBindOption); + ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, bindOptions); GLfloat top = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.top()) : src.top(); GLfloat bottom = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.bottom()) : src.bottom(); @@ -1365,6 +1368,12 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap); + + if (texture->options&QGLContext::TemporarilyCachedBindOption) { + // pixmap was temporarily cached as a QImage texture by pooling system + // and should be destroyed immediately + QGLTextureCache::instance()->remove(ctx, texture->id); + } } void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QRectF& src, @@ -1389,12 +1398,23 @@ void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); - QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + QGLContext::BindOptions bindOptions = QGLContext::InternalBindOption; +#ifdef QGL_USE_TEXTURE_POOL + bindOptions |= QGLContext::TemporarilyCachedBindOption; +#endif + + QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, bindOptions); GLuint id = texture->id; d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, id); d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel()); + + if (texture->options&QGLContext::TemporarilyCachedBindOption) { + // image was temporarily cached by texture pooling system + // and should be destroyed immediately + QGLTextureCache::instance()->remove(ctx, texture->id); + } } void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) |