Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qopengltexturecache_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
//
5
// W A R N I N G
6
// -------------
7
//
8
// This file is not part of the Qt API. It exists purely as an
9
// implementation detail. This header file may change from version to
10
// version without notice, or even be removed.
11
//
12
// We mean it.
13
//
14
15
#ifndef QOPENGLTEXTURECACHE_P_H
16
#define QOPENGLTEXTURECACHE_P_H
17
18
#include <QtOpenGL/qtopenglglobal.h>
19
#include <QHash>
20
#include <QObject>
21
#include <QCache>
22
#include <private/qopenglcontext_p.h>
23
#include <private/qopengltextureuploader_p.h>
24
#include <QtCore/qmutex.h>
25
26
QT_BEGIN_NAMESPACE
27
28
class
QOpenGLCachedTexture
;
29
30
class
Q_OPENGL_EXPORT
QOpenGLTextureCache
:
public
QOpenGLSharedResource
31
{
32
public
:
33
static
QOpenGLTextureCache
*cacheForContext(
QOpenGLContext
*
context
);
34
35
QOpenGLTextureCache
(
QOpenGLContext
*);
36
~QOpenGLTextureCache
();
37
38
enum class
BindResultFlag
:
quint8
{
39
NewTexture = 0x01
40
};
41
Q_DECLARE_FLAGS
(BindResultFlags, BindResultFlag)
42
43
struct
BindResult
{
44
GLuint
id
;
45
BindResultFlags
flags
;
46
};
47
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
);
52
53
void
invalidate(
qint64
key
);
54
55
void
invalidateResource()
override
;
56
void
freeResource(
QOpenGLContext
*
ctx
)
override
;
57
58
private
:
59
BindResult
bindTexture(
QOpenGLContext
*
context
,
qint64
key
,
const
QImage
&
image
, QOpenGLTextureUploader::BindOptions options);
60
61
QMutex
m_mutex;
62
QCache<quint64, QOpenGLCachedTexture> m_cache;
63
};
64
65
Q_DECLARE_OPERATORS_FOR_FLAGS
(QOpenGLTextureCache::BindResultFlags)
66
67
class
QOpenGLCachedTexture
68
{
69
public
:
70
QOpenGLCachedTexture
(
GLuint
id
, QOpenGLTextureUploader::BindOptions options,
QOpenGLContext
*
context
);
71
~QOpenGLCachedTexture
() { m_resource->free(); }
72
73
GLuint
id
()
const
{
return
m_resource->id(); }
74
QOpenGLTextureUploader::BindOptions
options
()
const
{
return
m_options
; }
75
76
private
:
77
QOpenGLSharedResourceGuard
*m_resource;
78
QOpenGLTextureUploader::BindOptions
m_options
;
79
};
80
81
QT_END_NAMESPACE
82
83
#endif
84
QImage
\inmodule QtGui
Definition
qimage.h:37
QMutex
\inmodule QtCore
Definition
qmutex.h:281
QOpenGLCachedTexture
Definition
qopengltexturecache_p.h:68
QOpenGLCachedTexture::~QOpenGLCachedTexture
~QOpenGLCachedTexture()
Definition
qopengltexturecache_p.h:71
QOpenGLCachedTexture::id
GLuint id() const
Definition
qopengltexturecache_p.h:73
QOpenGLCachedTexture::options
QOpenGLTextureUploader::BindOptions options() const
Definition
qopengltexturecache_p.h:74
QOpenGLContext
\inmodule QtGui
Definition
qopenglcontext.h:67
QOpenGLSharedResourceGuard
The QOpenGLSharedResourceGuard class is a convenience sub-class of QOpenGLSharedResource to be used t...
Definition
qopenglcontext_p.h:68
QOpenGLSharedResource
The QOpenGLSharedResource class is used to keep track of resources that are shared between OpenGL con...
Definition
qopenglcontext_p.h:40
QOpenGLTextureCache
Definition
qopengltexturecache_p.h:31
QOpenGLTextureCache::BindResultFlag
BindResultFlag
Definition
qopengltexturecache_p.h:38
QOpenGLTextureUploader::PremultipliedAlphaBindOption
@ PremultipliedAlphaBindOption
Definition
qopengltextureuploader_p.h:31
QPixmap
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition
qpixmap.h:27
ctx
EGLContext ctx
Definition
dmabufserverbufferintegration.h:20
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
image
Definition
image.cpp:4
context
static void * context
Definition
qandroidaudiosource.cpp:42
m_options
SharedPointerFileDialogOptions m_options
Definition
qcocoafiledialoghelper.mm:61
Q_DECLARE_FLAGS
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition
qflags.h:174
Q_DECLARE_OPERATORS_FOR_FLAGS
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition
qflags.h:194
key
GLuint64 key
Definition
qopengles2ext.h:2268
GLuint
#define GLuint
Definition
qsgabstractrenderer_p.h:23
qint64
long long qint64
Definition
qtypes.h:60
quint8
unsigned char quint8
Definition
qtypes.h:46
pixmap
widget render & pixmap
Definition
src_gui_kernel_qwidget.cpp:32
QOpenGLTextureCache::BindResult
Definition
qopengltexturecache_p.h:43
QOpenGLTextureCache::BindResult::flags
BindResultFlags flags
Definition
qopengltexturecache_p.h:45
QOpenGLTextureCache::BindResult::id
GLuint id
Definition
qopengltexturecache_p.h:44
qtbase
src
opengl
qopengltexturecache_p.h
Generated by
1.10.0