diff options
author | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-07-07 13:10:13 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-07-07 13:10:13 (GMT) |
commit | f2077762cffba8c66cc3880c486161201421e074 (patch) | |
tree | a1e03a3111bd3174b4dba1f5fe0ca4f988c28a19 /src/opengl/gl2paintengineex/qglgradientcache_p.h | |
parent | 6d337a3dd715597aa8ec797f6aeb8f42db129a00 (diff) | |
download | Qt-f2077762cffba8c66cc3880c486161201421e074.zip Qt-f2077762cffba8c66cc3880c486161201421e074.tar.gz Qt-f2077762cffba8c66cc3880c486161201421e074.tar.bz2 |
Made QGL2GradientCache thread safe.
This can be improved by using a QReadWriteLocker, but it means
restructuring the find/insert code. Use a QMutex for now.
Diffstat (limited to 'src/opengl/gl2paintengineex/qglgradientcache_p.h')
-rw-r--r-- | src/opengl/gl2paintengineex/qglgradientcache_p.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h index 8ecb34e..7e93d87 100644 --- a/src/opengl/gl2paintengineex/qglgradientcache_p.h +++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h @@ -54,6 +54,7 @@ #include <QObject> #include <QtOpenGL/QtOpenGL> #include <private/qgl_p.h> +#include <QtCore/qmutex.h> QT_BEGIN_NAMESPACE @@ -81,16 +82,16 @@ public: GLuint getBuffer(const QGradient &gradient, qreal opacity); inline int paletteSize() const { return 1024; } -protected: +private: inline int maxCacheSize() const { return 60; } inline void generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, qreal opacity) const; GLuint addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity); - void cleanCache(); QGLGradientColorTableHash cache; + QMutex m_mutex; }; QT_END_NAMESPACE |