diff options
author | David Boddie <dboddie@trolltech.com> | 2010-01-20 16:48:45 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2010-01-20 16:48:45 (GMT) |
commit | ed760b619ed0748d1428b9f08b785913883b560c (patch) | |
tree | 1afc57deb86fa711c54ce53c987d7f612a6f7574 /src/opengl | |
parent | c3637e53cb4e4d64a60664874f15292982acbdbd (diff) | |
parent | 304c70a03406eb16b9a08719769655b75bf6d8e3 (diff) | |
download | Qt-ed760b619ed0748d1428b9f08b785913883b560c.zip Qt-ed760b619ed0748d1428b9f08b785913883b560c.tar.gz Qt-ed760b619ed0748d1428b9f08b785913883b560c.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 2 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h | 2 | ||||
-rw-r--r-- | src/opengl/qpixmapdata_gl.cpp | 12 | ||||
-rw-r--r-- | src/opengl/qpixmapdata_x11gl_egl.cpp | 51 |
4 files changed, 55 insertions, 12 deletions
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 0720170..fed1658 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h index 393893c..2a8a782 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 1bfb6e3..6d47687 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -252,6 +252,10 @@ QGLPixmapData::QGLPixmapData(PixelType type) { setSerialNumber(++qt_gl_pixmap_serial); m_glDevice.setPixmapData(this); + + // Set InteralBindOptions minus the memory managed, since this + // QGLTexture is not managed as part of the internal texture cache + m_texture.options = QGLContext::PremultipliedAlphaBindOption; } QGLPixmapData::~QGLPixmapData() @@ -340,18 +344,18 @@ void QGLPixmapData::ensureCreated() const } if (!m_source.isNull()) { + glBindTexture(target, m_texture.id); if (external_format == GL_RGB) { const QImage tx = m_source.convertToFormat(QImage::Format_RGB888); - - glBindTexture(target, m_texture.id); glTexSubImage2D(target, 0, 0, 0, w, h, external_format, GL_UNSIGNED_BYTE, tx.bits()); } else { const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format); - - glBindTexture(target, m_texture.id); glTexSubImage2D(target, 0, 0, 0, w, h, external_format, GL_UNSIGNED_BYTE, tx.bits()); + // convertToGLFormat will flip the Y axis, so it needs to + // be drawn upside down + m_texture.options |= QGLContext::InvertedYBindOption; } if (useFramebufferObjects()) diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp index a5e0239..55aa1d0 100644 --- a/src/opengl/qpixmapdata_x11gl_egl.cpp +++ b/src/opengl/qpixmapdata_x11gl_egl.cpp @@ -39,10 +39,19 @@ ** ****************************************************************************/ +#include <QDebug> + #include <private/qgl_p.h> #include <private/qegl_p.h> #include <private/qeglproperties_p.h> + +#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) #include <private/qpaintengineex_opengl2_p.h> +#endif + +#ifndef QT_OPENGL_ES_2 +#include <private/qpaintengine_opengl_p.h> +#endif #include "qpixmapdata_x11gl_p.h" @@ -187,7 +196,14 @@ QX11GLPixmapData::~QX11GLPixmapData() { } -static QGL2PaintEngineEx* qt_gl2_engine_for_pixmaps = 0; +#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) +Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_pixmap_2_engine) +#endif + +#ifndef QT_OPENGL_ES_2 +Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_gl_pixmap_engine) +#endif + QPaintEngine* QX11GLPixmapData::paintEngine() const { @@ -202,18 +218,41 @@ QPaintEngine* QX11GLPixmapData::paintEngine() const : qPixmapRGBSharedEglContext); } - if (!qt_gl2_engine_for_pixmaps) - qt_gl2_engine_for_pixmaps = new QGL2PaintEngineEx(); + QPaintEngine* engine; + +#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) + engine = qt_gl_pixmap_engine(); +#elif defined(QT_OPENGL_ES_2) + engine = qt_gl_pixmap_2_engine(); +#else + if (qt_gl_preferGL2Engine()) + engine = qt_gl_pixmap_2_engine(); + else + engine = qt_gl_pixmap_engine(); +#endif + + // Support multiple painters on multiple pixmaps simultaniously - if (qt_gl2_engine_for_pixmaps->isActive()) { + if (engine->isActive()) { qWarning("Pixmap paint engine already active"); - QPaintEngine* engine = new QGL2PaintEngineEx(); + +#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) + engine = new QOpenGLPaintEngine; +#elif defined(QT_OPENGL_ES_2) + engine = new QGL2PaintEngineEx; +#else + if (qt_gl_preferGL2Engine()) + engine = new QGL2PaintEngineEx; + else + engine = new QOpenGLPaintEngine; +#endif + engine->setAutoDestruct(true); return engine; } - return qt_gl2_engine_for_pixmaps; + return engine; } void QX11GLPixmapData::beginPaint() |