33 static QOpenGLTextureCache *cacheForContext(QOpenGLContext *context);
35 QOpenGLTextureCache(QOpenGLContext *);
36 ~QOpenGLTextureCache();
38 enum class BindResultFlag : quint8 {
41 Q_DECLARE_FLAGS(BindResultFlags, BindResultFlag)
45 BindResultFlags flags;
48 BindResult bindTexture(QOpenGLContext *context,
const QPixmap &pixmap,
49 QOpenGLTextureUploader::BindOptions options = QOpenGLTextureUploader::PremultipliedAlphaBindOption);
50 BindResult bindTexture(QOpenGLContext *context,
const QImage &image,
51 QOpenGLTextureUploader::BindOptions options = QOpenGLTextureUploader::PremultipliedAlphaBindOption);
53 void invalidate(qint64 key);
55 void invalidateResource() override;
56 void freeResource(QOpenGLContext *ctx) override;
59 BindResult bindTexture(QOpenGLContext *context, qint64 key,
const QImage &image, QOpenGLTextureUploader::BindOptions options);
62 QCache<quint64, QOpenGLCachedTexture> m_cache;
67class QOpenGLCachedTexture
70 QOpenGLCachedTexture(GLuint id, QOpenGLTextureUploader::BindOptions options, QOpenGLContext *context);
71 ~QOpenGLCachedTexture() { m_resource->free(); }
73 GLuint id()
const {
return m_resource->id(); }
74 QOpenGLTextureUploader::BindOptions options()
const {
return m_options; }
77 QOpenGLSharedResourceGuard *m_resource;
78 QOpenGLTextureUploader::BindOptions m_options;
static void cleanupTexturesForPixmapData(QPlatformPixmap *pmd)
~QOpenGLTextureCacheWrapper()
QOpenGLTextureCache * cacheForContext(QOpenGLContext *context)
QOpenGLTextureCacheWrapper()
static void cleanupTexturesForCacheKey(qint64 key)
static void freeTexture(QOpenGLFunctions *funcs, GLuint id)