diff options
author | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-06-22 11:02:54 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-07-02 10:25:02 (GMT) |
commit | 80a2ebd93346f885d904e4e1020e112cc635dbaf (patch) | |
tree | d84a7d29f51a140a047bacff7139ffa340c2cd8d /src/opengl/qglframebufferobject.cpp | |
parent | 4c3ac765b26e56fbf08c9f70cf43aa00a6565cae (diff) | |
download | Qt-80a2ebd93346f885d904e4e1020e112cc635dbaf.zip Qt-80a2ebd93346f885d904e4e1020e112cc635dbaf.tar.gz Qt-80a2ebd93346f885d904e4e1020e112cc635dbaf.tar.bz2 |
Redesigned how GL resource management works.
The usage of QGLContextResource has changed: You're now have to
subclass QGLContextResource and reimplement the freeResource() function
and add your cleanup code there instead of using a plain callback
function. It's now also possible to delete a QGLContextResource
*before* the QGLContextGroup it refers to is destroyed, as the
resource will remove itself from the context groups it's a member of.
The QGLTextureGlyphCache is no longer a QObject, and it no longer
depends on the aboutToDestroyContext() signal. That concept doesn't
work in a threaded environment, as it relies on an eventloop to
dispatch the signal to the thread. It's common to *not* have an
eventloop running in a thread, which means the signal might never
be delivered. QGLTextureGlyphCache now inherits from
QGLContextResource, and gets cleaned up correctly when the group
context is destroyed. Note that up until now the glyph cache has never
been shared among sharing contexts for the GL 2 engine.
Made the gradient and pixmap blur caches use the new QGLContextResource
scheme.
Added a template that wraps the common init code for paintEngine()
function implementations for QGLWidget, QGLPixelBuffer and
QGLFramebufferObject.
Fixed a bug in QFontCache where the font caches weren't cleared
when a thread other than the main thread exited (backported to 4.6.3),
which caused resource leaks.
Diffstat (limited to 'src/opengl/qglframebufferobject.cpp')
-rw-r--r-- | src/opengl/qglframebufferobject.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index deffc20..fe60e83 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -984,11 +984,11 @@ QImage QGLFramebufferObject::toImage() const } #if !defined(QT_OPENGL_ES_1) -Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_buffer_2_engine) +Q_GLOBAL_STATIC(QGLEngineThreadStorage<QGL2PaintEngineEx>, qt_buffer_2_engine) #endif #ifndef QT_OPENGL_ES_2 -Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_engine) +Q_GLOBAL_STATIC(QGLEngineThreadStorage<QOpenGLPaintEngine>, qt_buffer_engine) #endif /*! \reimp */ @@ -1002,7 +1002,7 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const #if !defined (QT_OPENGL_ES_2) if (qt_gl_preferGL2Engine()) { #endif - QPaintEngine *engine = qt_buffer_2_engine(); + QPaintEngine *engine = qt_buffer_2_engine()->engine(); if (engine->isActive() && engine->paintDevice() != this) { d->engine = new QGL2PaintEngineEx; return d->engine; @@ -1014,7 +1014,7 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const #endif #if !defined(QT_OPENGL_ES_2) - QPaintEngine *engine = qt_buffer_engine(); + QPaintEngine *engine = qt_buffer_engine()->engine(); if (engine->isActive() && engine->paintDevice() != this) { d->engine = new QOpenGLPaintEngine; return d->engine; |