34 static QOpenGLTextureCache *cacheForContext(QOpenGLContext *context);
36 QOpenGLTextureCache(QOpenGLContext *);
37 ~QOpenGLTextureCache();
39 enum class BindResultFlag : quint8 {
42 Q_DECLARE_FLAGS(BindResultFlags, BindResultFlag)
46 BindResultFlags flags;
49 BindResult bindTexture(QOpenGLContext *context,
const QPixmap &pixmap,
50 QOpenGLTextureUploader::BindOptions options = QOpenGLTextureUploader::PremultipliedAlphaBindOption);
51 BindResult bindTexture(QOpenGLContext *context,
const QImage &image,
52 QOpenGLTextureUploader::BindOptions options = QOpenGLTextureUploader::PremultipliedAlphaBindOption);
54 void invalidate(qint64 key);
56 void invalidateResource() override;
57 void freeResource(QOpenGLContext *ctx) override;
60 BindResult bindTexture(QOpenGLContext *context, qint64 key,
const QImage &image, QOpenGLTextureUploader::BindOptions options);
63 QCache<quint64, QOpenGLCachedTexture> m_cache;
68class QOpenGLCachedTexture
71 QOpenGLCachedTexture(GLuint id, QOpenGLTextureUploader::BindOptions options, QOpenGLContext *context);
72 ~QOpenGLCachedTexture() { m_resource->free(); }
74 GLuint id()
const {
return m_resource->id(); }
75 QOpenGLTextureUploader::BindOptions options()
const {
return m_options; }
78 QOpenGLSharedResourceGuard *m_resource;
79 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)