summaryrefslogtreecommitdiffstats
path: root/src/opengl/qpixmapdata_poolgl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/qpixmapdata_poolgl.cpp')
-rw-r--r--src/opengl/qpixmapdata_poolgl.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/opengl/qpixmapdata_poolgl.cpp b/src/opengl/qpixmapdata_poolgl.cpp
index 64de29e..44d9c84 100644
--- a/src/opengl/qpixmapdata_poolgl.cpp
+++ b/src/opengl/qpixmapdata_poolgl.cpp
@@ -49,6 +49,7 @@
#include <private/qgl_p.h>
#include <private/qdrawhelper_p.h>
#include <private/qimage_p.h>
+#include <private/qnativeimagehandleprovider_p.h>
#include <private/qpaintengineex_opengl2_p.h>
@@ -254,6 +255,8 @@ QGLPixmapData::QGLPixmapData(PixelType type)
, m_renderFbo(0)
, m_engine(0)
, m_ctx(0)
+ , nativeImageHandleProvider(0)
+ , nativeImageHandle(0)
, m_dirty(false)
, m_hasFillColor(false)
, m_hasAlpha(false)
@@ -292,6 +295,8 @@ void QGLPixmapData::destroyTexture()
}
m_texture.id = 0;
inTexturePool = false;
+
+ releaseNativeImageHandle();
}
QPixmapData *QGLPixmapData::createCompatiblePixmapData() const
@@ -342,6 +347,9 @@ void QGLPixmapData::ensureCreated() const
m_dirty = false;
+ if (nativeImageHandleProvider && !nativeImageHandle)
+ const_cast<QGLPixmapData *>(this)->createFromNativeImageHandleProvider();
+
QGLShareContextScope ctx(qt_gl_share_widget()->context());
m_ctx = ctx;
@@ -860,9 +868,16 @@ void QGLPixmapData::detachTextureFromPool()
void QGLPixmapData::hibernate()
{
- // If the texture was imported (e.g, from an SgImage under Symbian),
- // then we cannot copy it back to main memory for storage.
- if (m_texture.id && m_source.isNull())
+ // If the image was imported (e.g, from an SgImage under Symbian), then
+ // skip the hibernation, there is no sense in copying it back to main
+ // memory because the data is most likely shared between several processes.
+ bool skipHibernate = (m_texture.id && m_source.isNull());
+#if defined(Q_OS_SYMBIAN)
+ // However we have to proceed normally if the image was retrieved via
+ // a handle provider.
+ skipHibernate &= !nativeImageHandleProvider;
+#endif
+ if (skipHibernate)
return;
forceToImage();