diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-20 07:42:16 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-20 07:42:16 (GMT) |
commit | f0eb658611f549470f0d90e141eda61ab9301838 (patch) | |
tree | e234b73e10490e297033d645b744a7cbd26da4b9 /src/opengl/qgl_p.h | |
parent | ba9c21f7a1398ddcdeee6f010b1477d79f5bb8ce (diff) | |
parent | 8f10ca802dee1ed110f301191c4a56a85575033c (diff) | |
download | Qt-f0eb658611f549470f0d90e141eda61ab9301838.zip Qt-f0eb658611f549470f0d90e141eda61ab9301838.tar.gz Qt-f0eb658611f549470f0d90e141eda61ab9301838.tar.bz2 |
Merge remote branch 'origin/master'
Conflicts:
doc/src/declarative/advtutorial1.qdoc
Diffstat (limited to 'src/opengl/qgl_p.h')
-rw-r--r-- | src/opengl/qgl_p.h | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index efd2090..5c4638e 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -528,14 +528,14 @@ public: ~QGLTextureCache(); void insert(QGLContext *ctx, qint64 key, QGLTexture *texture, int cost); - void remove(quint64 key) { m_cache.remove(key); } + inline void remove(quint64 key); + inline int size(); + inline void setMaxCost(int newMax); + inline int maxCost(); + inline QGLTexture* getTexture(quint64 key); + bool remove(QGLContext *ctx, GLuint textureId); void removeContextTextures(QGLContext *ctx); - int size() { return m_cache.size(); } - void setMaxCost(int newMax) { m_cache.setMaxCost(newMax); } - int maxCost() {return m_cache.maxCost(); } - QGLTexture* getTexture(quint64 key) { return m_cache.object(key); } - static QGLTextureCache *instance(); static void deleteIfEmpty(); static void imageCleanupHook(qint64 cacheKey); @@ -544,8 +544,38 @@ public: private: QCache<qint64, QGLTexture> m_cache; + QReadWriteLock m_lock; }; +int QGLTextureCache::size() { + QReadLocker locker(&m_lock); + return m_cache.size(); +} + +void QGLTextureCache::setMaxCost(int newMax) +{ + QWriteLocker locker(&m_lock); + m_cache.setMaxCost(newMax); +} + +int QGLTextureCache::maxCost() +{ + QReadLocker locker(&m_lock); + return m_cache.maxCost(); +} + +QGLTexture* QGLTextureCache::getTexture(quint64 key) +{ + QReadLocker locker(&m_lock); + return m_cache.object(key); +} + +void QGLTextureCache::remove(quint64 key) +{ + QWriteLocker locker(&m_lock); + m_cache.remove(key); +} + extern Q_OPENGL_EXPORT QPaintEngine* qt_qgl_paint_engine(); |