diff options
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r-- | src/opengl/qgl.cpp | 60 |
1 files changed, 15 insertions, 45 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index f1fb2b4e7f..d045bf55d1 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -70,17 +70,12 @@ #if !defined(QT_OPENGL_ES_1) #include "gl2paintengineex/qpaintengineex_opengl2_p.h" -#include <private/qwindowsurface_gl_p.h> #endif #ifndef QT_OPENGL_ES_2 #include <private/qpaintengine_opengl_p.h> #endif -#ifdef Q_WS_QWS -#include <private/qglwindowsurface_qws_p.h> -#endif - #ifdef Q_WS_QPA #include <QtGui/QPlatformGLContext> #endif @@ -89,8 +84,7 @@ #include <qglframebufferobject.h> #include <private/qimage_p.h> -#include <private/qpixmapdata_p.h> -#include <private/qpixmapdata_gl_p.h> +#include <qplatformpixmap_qpa.h> #include <private/qglpixelbuffer_p.h> #include <private/qimagepixmapcleanuphooks_p.h> #include "qcolormap.h" @@ -101,9 +95,6 @@ #if defined(QT_OPENGL_ES) && !defined(QT_NO_EGL) #include <EGL/egl.h> #endif -#ifdef QGL_USE_TEXTURE_POOL -#include <private/qgltexturepool_p.h> -#endif // #define QT_GL_CONTEXT_RESOURCE_DEBUG @@ -1711,7 +1702,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) vi = 0; #endif #if defined(Q_WS_QPA) - platformContext = 0; + guiGlContext = 0; #endif #if !defined(QT_NO_EGL) ownsEglContext = false; @@ -1845,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); } @@ -1912,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); } @@ -2547,18 +2538,8 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #endif const QImage &constRef = img; // to avoid detach in bits()... -#ifdef QGL_USE_TEXTURE_POOL - QGLTexturePool::instance()->createPermanentTexture(tx_id, - target, - 0, internalFormat, - img.width(), img.height(), - externalFormat, - pixel_type, - constRef.bits()); -#else glTexImage2D(target, 0, internalFormat, img.width(), img.height(), 0, externalFormat, pixel_type, constRef.bits()); -#endif #if defined(QT_OPENGL_ES_2) if (genMipmap) glGenerateMipmap(target); @@ -2601,19 +2582,8 @@ 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(); -#if !defined(QT_OPENGL_ES_1) - if (target == GL_TEXTURE_2D && pd->classId() == QPixmapData::OpenGLClass) { - const QGLPixmapData *data = static_cast<const QGLPixmapData *>(pd); - - if (data->isValidContext(q)) { - data->bind(); - return data->texture(); - } - } -#else + QPlatformPixmap *pd = pixmap.handle(); Q_UNUSED(pd); -#endif const qint64 key = pixmap.cacheKey(); QGLTexture *texture = textureCacheLookup(key, target); @@ -2631,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()) @@ -3330,7 +3300,7 @@ bool QGLContext::create(const QGLContext* shareContext) { Q_D(QGLContext); #ifdef Q_WS_QPA - if (!d->paintDevice && !d->platformContext) + if (!d->paintDevice && !d->guiGlContext) #else if (!d->paintDevice) #endif @@ -3420,8 +3390,8 @@ void QGLContext::setInitialized(bool on) const QGLContext* QGLContext::currentContext() { #ifdef Q_WS_QPA - if (const QPlatformGLContext *threadContext = QPlatformGLContext::currentContext()) { - return QGLContext::fromPlatformGLContext(const_cast<QPlatformGLContext *>(threadContext)); + if (const QGuiGLContext *threadContext = QGuiGLContext::currentContext()) { + return QGLContext::fromGuiGLContext(const_cast<QGuiGLContext *>(threadContext)); } return 0; #else @@ -4472,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; |