Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qopenglgradientcache_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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QOPENGLGRADIENTCACHE_P_H
6
#
define
QOPENGLGRADIENTCACHE_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QMultiHash
>
20
#
include
<
QObject
>
21
#
include
<
private
/
qopenglcontext_p
.
h
>
22
#
include
<
QtCore
/
qmutex
.
h
>
23
#
include
<
QGradient
>
24
#
include
<
qrgba64
.
h
>
25
26
QT_BEGIN_NAMESPACE
27
28
class
QOpenGL2GradientCache
:
public
QOpenGLSharedResource
29
{
30
struct
CacheInfo
31
{
32
inline
CacheInfo(QGradientStops s, qreal op, QGradient::InterpolationMode mode) :
33
stops(std::move(s)), opacity(op), interpolationMode(mode) {}
34
35
GLuint texId;
36
QGradientStops stops;
37
qreal opacity;
38
QGradient::InterpolationMode interpolationMode;
39
};
40
41
typedef
QMultiHash<quint64, CacheInfo> QOpenGLGradientColorTableHash;
42
43
public
:
44
static
QOpenGL2GradientCache
*
cacheForContext
(QOpenGLContext *context);
45
46
QOpenGL2GradientCache
(QOpenGLContext *);
47
~
QOpenGL2GradientCache
();
48
49
GLuint
getBuffer
(
const
QGradient &gradient, qreal opacity);
50
inline
int
paletteSize
()
const
{
return
1024; }
51
52
void
invalidateResource
()
override
;
53
void
freeResource
(QOpenGLContext *ctx)
override
;
54
55
private
:
56
inline
int
maxCacheSize()
const
{
return
60; }
57
inline
void
generateGradientColorTable(
const
QGradient& gradient,
58
QRgba64
*colorTable,
59
int
size, qreal opacity)
const
;
60
inline
void
generateGradientColorTable(
const
QGradient& gradient,
61
uint *colorTable,
62
int
size, qreal opacity)
const
;
63
GLuint addCacheElement(quint64 hash_val,
const
QGradient &gradient, qreal opacity);
64
void
cleanCache();
65
66
QOpenGLGradientColorTableHash cache;
67
QMutex m_mutex;
68
};
69
70
QT_END_NAMESPACE
71
72
#
endif
// QOPENGLGRADIENTCACHE_P_H
QOpenGL2GradientCacheWrapper
Definition
qopenglgradientcache.cpp:21
QOpenGL2GradientCacheWrapper::cacheForContext
QOpenGL2GradientCache * cacheForContext(QOpenGLContext *context)
Definition
qopenglgradientcache.cpp:23
QOpenGL2GradientCache
Definition
qopenglgradientcache_p.h:29
QOpenGL2GradientCache::cacheForContext
static QOpenGL2GradientCache * cacheForContext(QOpenGLContext *context)
Definition
qopenglgradientcache.cpp:45
QOpenGL2GradientCache::~QOpenGL2GradientCache
~QOpenGL2GradientCache()
Definition
qopenglgradientcache.cpp:40
QOpenGL2GradientCache::getBuffer
GLuint getBuffer(const QGradient &gradient, qreal opacity)
Definition
qopenglgradientcache.cpp:73
QOpenGL2GradientCache::QOpenGL2GradientCache
QOpenGL2GradientCache(QOpenGLContext *)
Definition
qopenglgradientcache.cpp:35
QOpenGL2GradientCache::freeResource
void freeResource(QOpenGLContext *ctx) override
Definition
qopenglgradientcache.cpp:56
QOpenGL2GradientCache::paletteSize
int paletteSize() const
Definition
qopenglgradientcache_p.h:50
QOpenGL2GradientCache::invalidateResource
void invalidateResource() override
Definition
qopenglgradientcache.cpp:50
QOpenGLContext
\inmodule QtGui
Definition
qopenglcontext.h:68
QOpenGLSharedResource
The QOpenGLSharedResource class is used to keep track of resources that are shared between OpenGL con...
Definition
qopenglcontext_p.h:41
QRgba64
Definition
qrgba64.h:15
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
GL_RGBA16
#define GL_RGBA16
Definition
qopenglframebufferobject.cpp:102
qPremultiply
constexpr QRgba64 qPremultiply(QRgba64 c)
Definition
qrgba64.h:196
qtbase
src
opengl
qopenglgradientcache_p.h
Generated on
for Qt by
1.18.0