diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-08-16 09:29:44 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-08-29 10:24:55 +0200 |
commit | aaa4a26f82f99fa8724841eba91bad029306e0ce (patch) | |
tree | 3d24e874bff00efc0e73af610bc80e645d14f789 /src/opengl/gl2paintengineex/qglgradientcache_p.h | |
parent | 00fd783a39d55d2365ddead4fab2cc06091c119f (diff) |
Move GL resource handling enablers to QtGui.
Made resource handling more robust by attempting to free GL resources in
the correct thread, and not forcing a context to become current to free
resources.
Change-Id: Ie81d4005b608972375755571d9b50ce82080709b
Reviewed-on: http://codereview.qt.nokia.com/3258
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/opengl/gl2paintengineex/qglgradientcache_p.h')
-rw-r--r-- | src/opengl/gl2paintengineex/qglgradientcache_p.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h index 1c2d0a029a..1b001c3405 100644 --- a/src/opengl/gl2paintengineex/qglgradientcache_p.h +++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class QGL2GradientCache +class QGL2GradientCache : public QGLSharedResource { struct CacheInfo { @@ -76,12 +76,15 @@ class QGL2GradientCache public: static QGL2GradientCache *cacheForContext(const QGLContext *context); - QGL2GradientCache(const QGLContext *) {} - ~QGL2GradientCache() { cleanCache(); } + QGL2GradientCache(QGuiGLContext *); + ~QGL2GradientCache(); GLuint getBuffer(const QGradient &gradient, qreal opacity); inline int paletteSize() const { return 1024; } + void invalidateResource(); + void freeResource(QGuiGLContext *ctx); + private: inline int maxCacheSize() const { return 60; } inline void generateGradientColorTable(const QGradient& gradient, |