summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-11-05 08:23:14 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-11-05 08:23:14 (GMT)
commit334347669839844468d19a297ed780c3e8fdcfa5 (patch)
treedbad5ab92ec900fc143ab054538adff95f01c492 /src/opengl
parentc791b300b288635ed018d50c5e6e28859b374b5e (diff)
parentc32ec4e928895a85aa10ce47a73c2bd439e7fc89 (diff)
downloadQt-334347669839844468d19a297ed780c3e8fdcfa5.zip
Qt-334347669839844468d19a297ed780c3e8fdcfa5.tar.gz
Qt-334347669839844468d19a297ed780c3e8fdcfa5.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: More fix for QTBUG-14640:oci performance problem with qlonglong Doc: Fixing typo Fixed grabWidget sometimes returning uninitialized memory. Fix Malayalam Rendering - 'Ra' is PreBase Update .def files for QtGui and QtOpenVG Use 32bit textures for alpha textures after all. One more fix for dithering. Doc: Fixing typo Fix QTBUG-14640:oci performance problem with qlonglong 32bit => 16bit conversion has 4byte-aligned output. Fix gcc bug in qReallocAligned Prevented threading related crash in OpenGL module. Fix possible crash in QStaticText and QDeclarativeTextLayout Fix QTBUG-14132 oracle (xe) stored procedures with bind variables get errors
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp24
-rw-r--r--src/opengl/qgl.cpp7
-rw-r--r--src/opengl/qgl_p.h68
-rw-r--r--src/opengl/qpaintengine_opengl.cpp8
4 files changed, 67 insertions, 40 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 84c7fed..1dcb773 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1350,8 +1350,8 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
ensureActive();
- QFontEngineGlyphCache::Type glyphType = textItem->fontEngine->glyphFormat >= 0
- ? QFontEngineGlyphCache::Type(textItem->fontEngine->glyphFormat)
+ QFontEngineGlyphCache::Type glyphType = textItem->fontEngine()->glyphFormat >= 0
+ ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat)
: d->glyphCacheType;
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
if (d->device->alphaRequested() || state()->matrix.type() > QTransform::TxTranslate
@@ -1430,7 +1430,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
{
QStaticTextItem staticTextItem;
staticTextItem.chars = const_cast<QChar *>(ti.chars);
- staticTextItem.fontEngine = ti.fontEngine;
+ staticTextItem.setFontEngine(ti.fontEngine);
staticTextItem.glyphs = glyphs.data();
staticTextItem.numChars = ti.num_chars;
staticTextItem.numGlyphs = glyphs.size();
@@ -1475,18 +1475,18 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
QOpenGL2PaintEngineState *s = q->state();
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) staticTextItem->fontEngine->glyphCache(ctx, glyphType, QTransform());
+ (QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(ctx, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType) {
cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
- staticTextItem->fontEngine->setGlyphCache(ctx, cache);
+ staticTextItem->fontEngine()->setGlyphCache(ctx, cache);
}
bool recreateVertexArrays = false;
if (staticTextItem->userDataNeedsUpdate)
recreateVertexArrays = true;
- else if (staticTextItem->userData == 0)
+ else if (staticTextItem->userData() == 0)
recreateVertexArrays = true;
- else if (staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData)
+ else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData)
recreateVertexArrays = true;
// We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays.
@@ -1494,8 +1494,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
// cache so this text is performed before we test if the cache size has changed.
if (recreateVertexArrays) {
cache->setPaintEnginePrivate(this);
- cache->populate(staticTextItem->fontEngine, staticTextItem->numGlyphs, staticTextItem->glyphs,
- staticTextItem->glyphPositions);
+ cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
+ staticTextItem->glyphs, staticTextItem->glyphPositions);
}
if (cache->width() == 0 || cache->height() == 0)
@@ -1515,14 +1515,14 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
if (staticTextItem->useBackendOptimizations) {
QOpenGLStaticTextUserData *userData = 0;
- if (staticTextItem->userData == 0
- || staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData) {
+ if (staticTextItem->userData() == 0
+ || staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
userData = new QOpenGLStaticTextUserData();
staticTextItem->setUserData(userData);
} else {
- userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData);
+ userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData());
}
// Use cache if backend optimizations is turned on
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index dbd295f..84cfa97 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -127,7 +127,12 @@ Q_GLOBAL_STATIC(QGLDefaultOverlayFormat, defaultOverlayFormatInstance)
Q_GLOBAL_STATIC(QGLSignalProxy, theSignalProxy)
QGLSignalProxy *QGLSignalProxy::instance()
{
- return theSignalProxy();
+ QGLSignalProxy *proxy = theSignalProxy();
+ if (proxy && proxy->thread() != qApp->thread()) {
+ if (proxy->thread() == QThread::currentThread())
+ proxy->moveToThread(qApp->thread());
+ }
+ return proxy;
}
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index f86c77f..18b2765 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -434,20 +434,6 @@ public:
static void setCurrentContext(QGLContext *context);
};
-// ### make QGLContext a QObject in 5.0 and remove the proxy stuff
-class Q_OPENGL_EXPORT QGLSignalProxy : public QObject
-{
- Q_OBJECT
-public:
- QGLSignalProxy() : QObject() {}
- void emitAboutToDestroyContext(const QGLContext *context) {
- emit aboutToDestroyContext(context);
- }
- static QGLSignalProxy *instance();
-Q_SIGNALS:
- void aboutToDestroyContext(const QGLContext *context);
-};
-
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions)
// Temporarily make a context current if not already current or
@@ -490,6 +476,48 @@ private:
QGLContext *m_ctx;
};
+// ### make QGLContext a QObject in 5.0 and remove the proxy stuff
+class Q_OPENGL_EXPORT QGLSignalProxy : public QObject
+{
+ Q_OBJECT
+public:
+ QGLSignalProxy() : QObject() {
+ qRegisterMetaType<GLuint>("GLuint");
+ connect(this, SIGNAL(freeTexture(QGLContext *, QPixmapData *, GLuint)),
+ this, SLOT(freeTexture_slot(QGLContext *, QPixmapData *, GLuint)));
+ }
+ void emitAboutToDestroyContext(const QGLContext *context) {
+ emit aboutToDestroyContext(context);
+ }
+ void emitFreeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id) {
+ emit freeTexture(context, boundPixmap, id);
+ }
+ static QGLSignalProxy *instance();
+Q_SIGNALS:
+ void aboutToDestroyContext(const QGLContext *context);
+ void freeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id);
+
+private slots:
+ void freeTexture_slot(QGLContext *context, QPixmapData *boundPixmap, GLuint id) {
+#if defined(Q_WS_X11)
+ if (boundPixmap) {
+ QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
+ context->makeCurrent();
+ // Although glXReleaseTexImage is a glX call, it must be called while there
+ // is a current context - the context the pixmap was bound to a texture in.
+ // Otherwise the release doesn't do anything and you get BadDrawable errors
+ // when you come to delete the context.
+ QGLContextPrivate::unbindPixmapFromTexture(boundPixmap);
+ glDeleteTextures(1, &id);
+ oldContext->makeCurrent();
+ return;
+ }
+#endif
+ QGLShareContextScope scope(context);
+ glDeleteTextures(1, &id);
+ }
+};
+
class QGLTexture {
public:
QGLTexture(QGLContext *ctx = 0, GLuint tx_id = 0, GLenum tx_target = GL_TEXTURE_2D,
@@ -506,16 +534,10 @@ public:
~QGLTexture() {
if (options & QGLContext::MemoryManagedBindOption) {
Q_ASSERT(context);
- QGLShareContextScope scope(context);
-#if defined(Q_WS_X11)
- // Although glXReleaseTexImage is a glX call, it must be called while there
- // is a current context - the context the pixmap was bound to a texture in.
- // Otherwise the release doesn't do anything and you get BadDrawable errors
- // when you come to delete the context.
- if (boundPixmap)
- QGLContextPrivate::unbindPixmapFromTexture(boundPixmap);
+#if !defined(Q_WS_X11)
+ QPixmapData *boundPixmap = 0;
#endif
- glDeleteTextures(1, &id);
+ QGLSignalProxy::instance()->emitFreeTexture(context, boundPixmap, id);
}
}
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 74b6b9a..a04d930 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -4918,7 +4918,7 @@ void QOpenGLPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
d->flushDrawQueue();
// make sure the glyphs we want to draw are in the cache
- qt_glyph_cache()->cacheGlyphs(d->device->context(), textItem->fontEngine, textItem->glyphs,
+ qt_glyph_cache()->cacheGlyphs(d->device->context(), textItem->fontEngine(), textItem->glyphs,
textItem->numGlyphs);
d->setGradientOps(Qt::SolidPattern, QRectF()); // turns off gradient ops
@@ -4941,13 +4941,13 @@ void QOpenGLPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- bool antialias = !(textItem->fontEngine->fontDef.styleStrategy & QFont::NoAntialias)
+ bool antialias = !(textItem->fontEngine()->fontDef.styleStrategy & QFont::NoAntialias)
&& (d->matrix.type() > QTransform::TxTranslate);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, antialias ? GL_LINEAR : GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, antialias ? GL_LINEAR : GL_NEAREST);
for (int i=0; i< textItem->numGlyphs; ++i) {
- QGLGlyphCoord *g = qt_glyph_cache()->lookup(textItem->fontEngine, textItem->glyphs[i]);
+ QGLGlyphCoord *g = qt_glyph_cache()->lookup(textItem->fontEngine(), textItem->glyphs[i]);
// we don't cache glyphs with no width/height
if (!g)
@@ -5003,7 +5003,7 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
{
QStaticTextItem staticTextItem;
staticTextItem.chars = const_cast<QChar *>(ti.chars);
- staticTextItem.fontEngine = ti.fontEngine;
+ staticTextItem.setFontEngine(ti.fontEngine);
staticTextItem.glyphs = glyphs.data();
staticTextItem.numChars = ti.num_chars;
staticTextItem.numGlyphs = glyphs.size();