diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qgl.cpp | 22 | ||||
-rw-r--r-- | src/opengl/qgl_egl.cpp | 10 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 24 | ||||
-rw-r--r-- | src/opengl/qgl_symbian.cpp | 28 | ||||
-rw-r--r-- | src/opengl/qgl_x11.cpp | 50 | ||||
-rw-r--r-- | src/opengl/qgl_x11egl.cpp | 78 | ||||
-rw-r--r-- | src/opengl/qglpixmapfilter.cpp | 10 |
7 files changed, 111 insertions, 111 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 31a4b77047..d045bf55d1 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -84,7 +84,7 @@ #include <qglframebufferobject.h> #include <private/qimage_p.h> -#include <private/qpixmapdata_p.h> +#include <qplatformpixmap_qpa.h> #include <private/qglpixelbuffer_p.h> #include <private/qimagepixmapcleanuphooks_p.h> #include "qcolormap.h" @@ -1836,15 +1836,15 @@ Q_GLOBAL_STATIC(QGLTextureCache, qt_gl_texture_cache) QGLTextureCache::QGLTextureCache() : m_cache(64*1024) // cache ~64 MB worth of textures - this is not accurate though { - QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(cleanupTexturesForPixampData); - QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(cleanupBeforePixmapDestruction); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(cleanupTexturesForPixampData); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey); } QGLTextureCache::~QGLTextureCache() { - QImagePixmapCleanupHooks::instance()->removePixmapDataModificationHook(cleanupTexturesForPixampData); - QImagePixmapCleanupHooks::instance()->removePixmapDataDestructionHook(cleanupBeforePixmapDestruction); + QImagePixmapCleanupHooks::instance()->removePlatformPixmapModificationHook(cleanupTexturesForPixampData); + QImagePixmapCleanupHooks::instance()->removePlatformPixmapDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey); } @@ -1903,18 +1903,18 @@ void QGLTextureCache::cleanupTexturesForCacheKey(qint64 cacheKey) } -void QGLTextureCache::cleanupTexturesForPixampData(QPixmapData* pmd) +void QGLTextureCache::cleanupTexturesForPixampData(QPlatformPixmap* pmd) { cleanupTexturesForCacheKey(pmd->cacheKey()); } -void QGLTextureCache::cleanupBeforePixmapDestruction(QPixmapData* pmd) +void QGLTextureCache::cleanupBeforePixmapDestruction(QPlatformPixmap* pmd) { // Remove any bound textures first: cleanupTexturesForPixampData(pmd); #if defined(Q_WS_X11) - if (pmd->classId() == QPixmapData::X11Class) { + if (pmd->classId() == QPlatformPixmap::X11Class) { Q_ASSERT(pmd->ref == 0); // Make sure reference counting isn't broken QGLContextPrivate::destroyGlSurfaceForPixmap(pmd); } @@ -2582,7 +2582,7 @@ QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum targe QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options) { Q_Q(QGLContext); - QPixmapData *pd = pixmap.pixmapData(); + QPlatformPixmap *pd = pixmap.handle(); Q_UNUSED(pd); const qint64 key = pixmap.cacheKey(); @@ -2601,7 +2601,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, #if defined(Q_WS_X11) // Try to use texture_from_pixmap const QX11Info *xinfo = qt_x11Info(paintDevice); - if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType + if (pd->classId() == QPlatformPixmap::X11Class && pd->pixelType() == QPlatformPixmap::PixmapType && xinfo && xinfo->screen() == pixmap.x11Info().screen() && target == GL_TEXTURE_2D && QApplication::instance()->thread() == QThread::currentThread()) @@ -4442,7 +4442,7 @@ QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext) int old_depth = qt_x11_preferred_pixmap_depth; qt_x11_preferred_pixmap_depth = x11Info().depth(); - QPixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); + QPlatformPixmap *data = new QX11PlatformPixmap(QPlatformPixmap::PixmapType); data->resize(sz.width(), sz.height()); QPixmap pm(data); qt_x11_preferred_pixmap_depth = old_depth; diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 34b448e048..dcf340fb10 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -280,16 +280,16 @@ void QGLContextPrivate::destroyEglSurfaceForDevice() EGLSurface QGLContextPrivate::eglSurfaceForDevice() const { - // If a QPixmapData had to create the QGLContext, we don't have a paintDevice + // If a QPlatformPixmap had to create the QGLContext, we don't have a paintDevice if (!paintDevice) return eglSurface; #ifdef Q_WS_X11 if (paintDevice->devType() == QInternal::Pixmap) { - QPixmapData *pmd = static_cast<QPixmap*>(paintDevice)->data_ptr().data(); - if (pmd->classId() == QPixmapData::X11Class) { - QX11PixmapData* x11PixmapData = static_cast<QX11PixmapData*>(pmd); - return (EGLSurface)x11PixmapData->gl_surface; + QPlatformPixmap *pmd = static_cast<QPixmap*>(paintDevice)->data_ptr().data(); + if (pmd->classId() == QPlatformPixmap::X11Class) { + QX11PlatformPixmap* x11PlatformPixmap = static_cast<QX11PlatformPixmap*>(pmd); + return (EGLSurface)x11PlatformPixmap->gl_surface; } } #endif diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 5b69caeb3e..f2590e82b1 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -382,11 +382,11 @@ public: void* pbuf; quint32 gpm; int screen; - QHash<QPixmapData*, QPixmap> boundPixmaps; + QHash<QPlatformPixmap*, QPixmap> boundPixmaps; QGLTexture *bindTextureFromNativePixmap(QPixmap*, const qint64 key, QGLContext::BindOptions options); - static void destroyGlSurfaceForPixmap(QPixmapData*); - static void unbindPixmapFromTexture(QPixmapData*); + static void destroyGlSurfaceForPixmap(QPlatformPixmap*); + static void unbindPixmapFromTexture(QPlatformPixmap*); #endif #if defined(Q_WS_MAC) bool update; @@ -502,18 +502,18 @@ class Q_OPENGL_EXPORT QGLTextureDestroyer : public QObject public: QGLTextureDestroyer() : QObject() { qRegisterMetaType<GLuint>("GLuint"); - connect(this, SIGNAL(freeTexture(QGLContext *, QPixmapData *, GLuint)), - this, SLOT(freeTexture_slot(QGLContext *, QPixmapData *, GLuint))); + connect(this, SIGNAL(freeTexture(QGLContext *, QPlatformPixmap *, GLuint)), + this, SLOT(freeTexture_slot(QGLContext *, QPlatformPixmap *, GLuint))); } - void emitFreeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { + void emitFreeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) { emit freeTexture(context, boundPixmap, id); } Q_SIGNALS: - void freeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id); + void freeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id); private slots: - void freeTexture_slot(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { + void freeTexture_slot(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) { Q_UNUSED(boundPixmap); #if defined(Q_WS_X11) if (boundPixmap) { @@ -565,7 +565,7 @@ public: if (options & QGLContext::MemoryManagedBindOption) { Q_ASSERT(context); #if !defined(Q_WS_X11) - QPixmapData *boundPixmap = 0; + QPlatformPixmap *boundPixmap = 0; #endif context->d_ptr->texture_destroyer->emitFreeTexture(context, boundPixmap, id); } @@ -578,7 +578,7 @@ public: QGLContext::BindOptions options; #if defined(Q_WS_X11) - QPixmapData* boundPixmap; + QPlatformPixmap* boundPixmap; #endif bool canBindCompressedTexture @@ -623,8 +623,8 @@ public: void removeContextTextures(QGLContext *ctx); static QGLTextureCache *instance(); static void cleanupTexturesForCacheKey(qint64 cacheKey); - static void cleanupTexturesForPixampData(QPixmapData* pixmap); - static void cleanupBeforePixmapDestruction(QPixmapData* pixmap); + static void cleanupTexturesForPixampData(QPlatformPixmap* pixmap); + static void cleanupBeforePixmapDestruction(QPlatformPixmap* pixmap); private: QCache<QGLTextureCacheKey, QGLTexture> m_cache; diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp index bc65bcd44a..de44607bb5 100644 --- a/src/opengl/qgl_symbian.cpp +++ b/src/opengl/qgl_symbian.cpp @@ -50,7 +50,7 @@ #include <private/qwidget_p.h> // to access QWExtra #include <private/qnativeimagehandleprovider_p.h> #include "qgl_egl_p.h" -#include "qpixmapdata_gl_p.h" +#include "qplatformpixmap_gl_p.h" #include "qgltexturepool_p.h" #include "qcolormap.h" #include <QDebug> @@ -381,9 +381,9 @@ static inline bool knownGoodFormat(QImage::Format format) } } -void QGLPixmapData::fromNativeType(void* pixmap, NativeType type) +void QGLPlatformPixmap::fromNativeType(void* pixmap, NativeType type) { - if (type == QPixmapData::FbsBitmap) { + if (type == QPlatformPixmap::FbsBitmap) { CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap *>(pixmap); QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight); if (size.width() == w && size.height() == h) @@ -402,7 +402,7 @@ void QGLPixmapData::fromNativeType(void* pixmap, NativeType type) m_hasFillColor = false; m_dirty = true; - } else if (type == QPixmapData::VolatileImage && pixmap) { + } else if (type == QPlatformPixmap::VolatileImage && pixmap) { // Support QS60Style in more efficient skin graphics retrieval. QVolatileImage *img = static_cast<QVolatileImage *>(pixmap); if (img->width() == w && img->height() == h) @@ -412,7 +412,7 @@ void QGLPixmapData::fromNativeType(void* pixmap, NativeType type) m_hasAlpha = m_source.hasAlphaChannel(); m_hasFillColor = false; m_dirty = true; - } else if (type == QPixmapData::NativeImageHandleProvider && pixmap) { + } else if (type == QPlatformPixmap::NativeImageHandleProvider && pixmap) { destroyTexture(); nativeImageHandleProvider = static_cast<QNativeImageHandleProvider *>(pixmap); // Cannot defer the retrieval, we need at least the size right away. @@ -420,9 +420,9 @@ void QGLPixmapData::fromNativeType(void* pixmap, NativeType type) } } -void* QGLPixmapData::toNativeType(NativeType type) +void* QGLPlatformPixmap::toNativeType(NativeType type) { - if (type == QPixmapData::FbsBitmap) { + if (type == QPlatformPixmap::FbsBitmap) { if (m_source.isNull()) m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied); return m_source.duplicateNativeImage(); @@ -431,19 +431,19 @@ void* QGLPixmapData::toNativeType(NativeType type) return 0; } -bool QGLPixmapData::initFromNativeImageHandle(void *handle, const QString &type) +bool QGLPlatformPixmap::initFromNativeImageHandle(void *handle, const QString &type) { if (type == QLatin1String("RSgImage")) { - fromNativeType(handle, QPixmapData::SgImage); + fromNativeType(handle, QPlatformPixmap::SgImage); return true; } else if (type == QLatin1String("CFbsBitmap")) { - fromNativeType(handle, QPixmapData::FbsBitmap); + fromNativeType(handle, QPlatformPixmap::FbsBitmap); return true; } return false; } -void QGLPixmapData::createFromNativeImageHandleProvider() +void QGLPlatformPixmap::createFromNativeImageHandleProvider() { void *handle = 0; QString type; @@ -453,14 +453,14 @@ void QGLPixmapData::createFromNativeImageHandleProvider() nativeImageHandle = handle; nativeImageType = type; } else { - qWarning("QGLPixmapData: Unknown native image type '%s'", qPrintable(type)); + qWarning("QGLPlatformPixmap: Unknown native image type '%s'", qPrintable(type)); } } else { - qWarning("QGLPixmapData: Native handle is null"); + qWarning("QGLPlatformPixmap: Native handle is null"); } } -void QGLPixmapData::releaseNativeImageHandle() +void QGLPlatformPixmap::releaseNativeImageHandle() { if (nativeImageHandleProvider && nativeImageHandle) { nativeImageHandleProvider->release(nativeImageHandle, nativeImageType); diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 18b6eaaf91..1fd9e373ed 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1769,17 +1769,17 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons Q_Q(QGLContext); - QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data()); - Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); + QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pixmap->data_ptr().data()); + Q_ASSERT(handle->classId() == QPlatformPixmap::X11Class); // We can't use TFP if the pixmap has a separate X11 mask - if (pixmapData->x11_mask) + if (handle->x11_mask) return 0; if (!qt_resolveTextureFromPixmap(paintDevice)) return 0; - const QX11Info &x11Info = pixmapData->xinfo; + const QX11Info &x11Info = handle->xinfo; // Store the configs (Can be static because configs aren't dependent on current context) static GLXFBConfig glxRGBPixmapConfig = 0; @@ -1787,7 +1787,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons static GLXFBConfig glxRGBAPixmapConfig = 0; static bool RGBAConfigInverted = false; - bool hasAlpha = pixmapData->hasAlphaChannel(); + bool hasAlpha = handle->hasAlphaChannel(); // Check to see if we need a config if ( (hasAlpha && !glxRGBAPixmapConfig) || (!hasAlpha && !glxRGBPixmapConfig) ) { @@ -1822,15 +1822,15 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons } // Check to see if the surface is still valid - if (pixmapData->gl_surface && - hasAlpha != (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) + if (handle->gl_surface && + hasAlpha != (handle->flags & QX11PlatformPixmap::GlSurfaceCreatedWithAlpha)) { // Surface is invalid! - destroyGlSurfaceForPixmap(pixmapData); + destroyGlSurfaceForPixmap(handle); } // Check to see if we need a surface - if (!pixmapData->gl_surface) { + if (!handle->gl_surface) { GLXPixmap glxPixmap; int pixmapAttribs[] = { GLX_TEXTURE_FORMAT_EXT, hasAlpha ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT, @@ -1842,21 +1842,21 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons // Wrap the X Pixmap into a GLXPixmap: glxPixmap = glXCreatePixmap(x11Info.display(), hasAlpha ? glxRGBAPixmapConfig : glxRGBPixmapConfig, - pixmapData->handle(), pixmapAttribs); + handle->handle(), pixmapAttribs); if (!glxPixmap) return 0; - pixmapData->gl_surface = (void*)glxPixmap; + handle->gl_surface = (void*)glxPixmap; // Make sure the cleanup hook gets called so we can delete the glx pixmap - QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); + QImagePixmapCleanupHooks::enableCleanupHooks(handle); } GLuint textureId; glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); - glXBindTexImageEXT(x11Info.display(), (GLXPixmap)pixmapData->gl_surface, GLX_FRONT_LEFT_EXT, 0); + glXBindTexImageEXT(x11Info.display(), (GLXPixmap)handle->gl_surface, GLX_FRONT_LEFT_EXT, 0); glBindTexture(GL_TEXTURE_2D, textureId); GLuint filtering = (options & QGLContext::LinearFilteringBindOption) ? GL_LINEAR : GL_NEAREST; @@ -1868,7 +1868,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); if (texture->options & QGLContext::InvertedYBindOption) - pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; + handle->flags |= QX11PlatformPixmap::InvertedWhenBoundToTexture; // We assume the cost of bound pixmaps is zero QGLTextureCache::instance()->insert(q, key, texture, 0); @@ -1878,26 +1878,26 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons } -void QGLContextPrivate::destroyGlSurfaceForPixmap(QPixmapData* pmd) +void QGLContextPrivate::destroyGlSurfaceForPixmap(QPlatformPixmap* pmd) { #if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd); - if (pixmapData->gl_surface) { - glXDestroyPixmap(QX11Info::display(), (GLXPixmap)pixmapData->gl_surface); - pixmapData->gl_surface = 0; + Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class); + QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pmd); + if (handle->gl_surface) { + glXDestroyPixmap(QX11Info::display(), (GLXPixmap)handle->gl_surface); + handle->gl_surface = 0; } #endif } -void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd) +void QGLContextPrivate::unbindPixmapFromTexture(QPlatformPixmap* pmd) { #if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); + Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class); Q_ASSERT(QGLContext::currentContext()); - QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd); - if (pixmapData->gl_surface) - glXReleaseTexImageEXT(QX11Info::display(), (GLXPixmap)pixmapData->gl_surface, GLX_FRONT_LEFT_EXT); + QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pmd); + if (handle->gl_surface) + glXReleaseTexImageEXT(QX11Info::display(), (GLXPixmap)handle->gl_surface, GLX_FRONT_LEFT_EXT); #endif } diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index a491bef4c6..e8520414d6 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -171,13 +171,13 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) int devType = device()->devType(); - QX11PixmapData *x11PixmapData = 0; + QX11PlatformPixmap *x11PlatformPixmap = 0; if (devType == QInternal::Pixmap) { - QPixmapData *pmd = static_cast<QPixmap*>(device())->data_ptr().data(); - if (pmd->classId() == QPixmapData::X11Class) - x11PixmapData = static_cast<QX11PixmapData*>(pmd); + QPlatformPixmap *pmd = static_cast<QPixmap*>(device())->data_ptr().data(); + if (pmd->classId() == QPlatformPixmap::X11Class) + x11PlatformPixmap = static_cast<QX11PlatformPixmap*>(pmd); else { - // TODO: Replace the pixmap's data with a new QX11PixmapData + // TODO: Replace the pixmap's data with a new QX11PlatformPixmap qWarning("WARNING: Creating a QGLContext on a QPixmap is only supported for X11 pixmap backend"); return false; } @@ -234,7 +234,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Do don't create the EGLSurface for everything. // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface // QGLWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface - // QPixmap - yes, create the EGLSurface but store it in QX11PixmapData::gl_surface + // QPixmap - yes, create the EGLSurface but store it in QX11PlatformPixmap::gl_surface // QGLPixelBuffer - no, it creates the surface itself and stores it in QGLPixelBufferPrivate::pbuf if (devType == QInternal::Widget) { @@ -246,12 +246,12 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) setWindowCreated(true); } - if (x11PixmapData) { + if (x11PlatformPixmap) { // TODO: Actually check to see if the existing surface can be re-used - if (x11PixmapData->gl_surface) - eglDestroySurface(d->eglContext->display(), (EGLSurface)x11PixmapData->gl_surface); + if (x11PlatformPixmap->gl_surface) + eglDestroySurface(d->eglContext->display(), (EGLSurface)x11PlatformPixmap->gl_surface); - x11PixmapData->gl_surface = (void*)QEgl::createSurface(device(), d->eglContext->config()); + x11PlatformPixmap->gl_surface = (void*)QEgl::createSurface(device(), d->eglContext->config()); } return true; @@ -415,17 +415,17 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons return 0; - QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data()); - Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); - bool hasAlpha = pixmapData->hasAlphaChannel(); + QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pixmap->data_ptr().data()); + Q_ASSERT(handle->classId() == QPlatformPixmap::X11Class); + bool hasAlpha = handle->hasAlphaChannel(); bool pixmapHasValidSurface = false; bool textureIsBound = false; GLuint textureId; glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); - if (haveTFP && pixmapData->gl_surface && - hasAlpha == (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) + if (haveTFP && handle->gl_surface && + hasAlpha == (handle->flags & QX11PlatformPixmap::GlSurfaceCreatedWithAlpha)) { pixmapHasValidSurface = true; } @@ -433,11 +433,11 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons // If we already have a valid EGL surface for the pixmap, we should use it if (pixmapHasValidSurface) { EGLBoolean success; - success = eglBindTexImage(QEgl::display(), (EGLSurface)pixmapData->gl_surface, EGL_BACK_BUFFER); + success = eglBindTexImage(QEgl::display(), (EGLSurface)handle->gl_surface, EGL_BACK_BUFFER); if (success == EGL_FALSE) { qWarning() << "eglBindTexImage() failed:" << QEgl::errorString(); - eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); - pixmapData->gl_surface = (void*)EGL_NO_SURFACE; + eglDestroySurface(QEgl::display(), (EGLSurface)handle->gl_surface); + handle->gl_surface = (void*)EGL_NO_SURFACE; } else textureIsBound = true; } @@ -469,29 +469,29 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons if (!textureIsBound && haveTFP) { // Check to see if the surface is still valid - if (pixmapData->gl_surface && - hasAlpha != (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) + if (handle->gl_surface && + hasAlpha != (handle->flags & QX11PlatformPixmap::GlSurfaceCreatedWithAlpha)) { // Surface is invalid! - destroyGlSurfaceForPixmap(pixmapData); + destroyGlSurfaceForPixmap(handle); } - if (pixmapData->gl_surface == 0) { + if (handle->gl_surface == 0) { EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap, QEgl::OpenGL, hasAlpha ? QEgl::Translucent : QEgl::NoOptions); - pixmapData->gl_surface = (void*)QEgl::createSurface(pixmap, config); - if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE) + handle->gl_surface = (void*)QEgl::createSurface(pixmap, config); + if (handle->gl_surface == (void*)EGL_NO_SURFACE) return false; } EGLBoolean success; - success = eglBindTexImage(QEgl::display(), (EGLSurface)pixmapData->gl_surface, EGL_BACK_BUFFER); + success = eglBindTexImage(QEgl::display(), (EGLSurface)handle->gl_surface, EGL_BACK_BUFFER); if (success == EGL_FALSE) { qWarning() << "eglBindTexImage() failed:" << QEgl::errorString(); - eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); - pixmapData->gl_surface = (void*)EGL_NO_SURFACE; + eglDestroySurface(QEgl::display(), (EGLSurface)handle->gl_surface); + handle->gl_surface = (void*)EGL_NO_SURFACE; haveTFP = false; // If TFP isn't working, disable it's use } else textureIsBound = true; @@ -501,7 +501,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons if (textureIsBound) { texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); - pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; + handle->flags |= QX11PlatformPixmap::InvertedWhenBoundToTexture; // We assume the cost of bound pixmaps is zero QGLTextureCache::instance()->insert(q, key, texture, 0); @@ -514,29 +514,29 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons } -void QGLContextPrivate::destroyGlSurfaceForPixmap(QPixmapData* pmd) +void QGLContextPrivate::destroyGlSurfaceForPixmap(QPlatformPixmap* pmd) { - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd); - if (pixmapData->gl_surface) { + Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class); + QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pmd); + if (handle->gl_surface) { EGLBoolean success; - success = eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); + success = eglDestroySurface(QEgl::display(), (EGLSurface)handle->gl_surface); if (success == EGL_FALSE) { qWarning() << "destroyGlSurfaceForPixmap() - Error deleting surface: " << QEgl::errorString(); } - pixmapData->gl_surface = 0; + handle->gl_surface = 0; } } -void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd) +void QGLContextPrivate::unbindPixmapFromTexture(QPlatformPixmap* pmd) { - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd); - if (pixmapData->gl_surface) { + Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class); + QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pmd); + if (handle->gl_surface) { EGLBoolean success; success = eglReleaseTexImage(QEgl::display(), - (EGLSurface)pixmapData->gl_surface, + (EGLSurface)handle->gl_surface, EGL_BACK_BUFFER); if (success == EGL_FALSE) { qWarning() << "unbindPixmapFromTexture() - Unable to release bound texture: " diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index c9815ec91a..6c807248ee 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -42,7 +42,7 @@ #include "private/qpixmapfilter_p.h" #include "private/qpaintengineex_opengl2_p.h" #include "private/qglengineshadermanager_p.h" -#include "private/qpixmapdata_p.h" +#include "qplatformpixmap_qpa.h" #include "private/qimagepixmapcleanuphooks_p.h" #include "qglpixmapfilter_p.h" #include "qpaintengine_opengl_p.h" @@ -324,7 +324,7 @@ public: void timerEvent(QTimerEvent *event); private: - static void pixmapDestroyed(QPixmapData *pixmap); + static void pixmapDestroyed(QPlatformPixmap *pixmap); QCache<quint64, QGLBlurTextureInfo > cache; @@ -380,8 +380,8 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe { static bool hookAdded = false; if (!hookAdded) { - QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(pixmapDestroyed); - QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(pixmapDestroyed); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(pixmapDestroyed); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(pixmapDestroyed); hookAdded = true; } @@ -394,7 +394,7 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe timerId = startTimer(8000); } -void QGLBlurTextureCache::pixmapDestroyed(QPixmapData *pmd) +void QGLBlurTextureCache::pixmapDestroyed(QPlatformPixmap *pmd) { foreach (QGLBlurTextureCache *cache, blurTextureCaches) { if (cache->hasBlurTextureInfo(pmd->cacheKey())) |