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
qplatformbackingstore.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
QPLATFORMBACKINGSTORE_H
6
#
define
QPLATFORMBACKINGSTORE_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is part of the QPA API and is not meant to be used
13
// in applications. Usage of this API may make your code
14
// source and binary incompatible with future versions of Qt.
15
//
16
17
#
include
<
QtGui
/
qtguiglobal
.
h
>
18
#
include
<
QtCore
/
qloggingcategory
.
h
>
19
#
include
<
QtCore
/
qrect
.
h
>
20
#
include
<
QtCore
/
qobject
.
h
>
21
22
#
include
<
QtGui
/
qwindow
.
h
>
23
#
include
<
QtGui
/
qregion
.
h
>
24
25
QT_BEGIN_NAMESPACE
26
27
QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY
(
lcQpaBackingStore
,
Q_GUI_EXPORT
)
28
29
class
QRegion;
30
class
QRect;
31
class
QPoint
;
32
class
QImage;
33
class
QPlatformBackingStorePrivate
;
34
class
QPlatformTextureList;
35
class
QPlatformTextureListPrivate
;
36
class
QPlatformGraphicsBuffer;
37
class
QRhi;
38
class
QRhiTexture;
39
class
QRhiResourceUpdateBatch;
40
41
struct
Q_GUI_EXPORT
QPlatformBackingStoreRhiConfig
42
{
43
Q_GADGET
44
public
:
45
enum
Api {
46
OpenGL,
47
Metal,
48
Vulkan,
49
D3D11,
50
D3D12,
51
Null
52
};
53
Q_ENUM(Api)
54
55
QPlatformBackingStoreRhiConfig()
56
: m_enable(
false
)
57
{ }
58
59
QPlatformBackingStoreRhiConfig(Api api)
60
: m_enable(
true
),
61
m_api(api)
62
{ }
63
64
bool
isEnabled()
const
{
return
m_enable; }
65
void
setEnabled(
bool
enable) { m_enable = enable; }
66
67
Api api()
const
{
return
m_api; }
68
void
setApi(Api api) { m_api = api; }
69
70
bool
isDebugLayerEnabled()
const
{
return
m_debugLayer; }
71
void
setDebugLayer(
bool
enable) { m_debugLayer = enable; }
72
73
private
:
74
bool
m_enable;
75
Api m_api = Null;
76
bool
m_debugLayer =
false
;
77
friend
bool
operator==(
const
QPlatformBackingStoreRhiConfig &a,
const
QPlatformBackingStoreRhiConfig &b);
78
};
79
80
inline
bool
operator
==(
const
QPlatformBackingStoreRhiConfig &a,
const
QPlatformBackingStoreRhiConfig &b)
81
{
82
return
a.m_enable == b.m_enable
83
&& a.m_api == b.m_api
84
&& a.m_debugLayer == b.m_debugLayer;
85
}
86
87
inline
bool
operator
!=(
const
QPlatformBackingStoreRhiConfig &a,
const
QPlatformBackingStoreRhiConfig &b)
88
{
89
return
!(a == b);
90
}
91
92
class
Q_GUI_EXPORT
QPlatformTextureList
:
public
QObject
93
{
94
Q_OBJECT
95
Q_DECLARE_PRIVATE(QPlatformTextureList)
96
public
:
97
enum
Flag {
98
StacksOnTop = 0x01,
99
TextureIsSrgb = 0x02,
100
NeedsPremultipliedAlphaBlending = 0x04,
101
MirrorVertically = 0x08
102
};
103
Q_DECLARE_FLAGS(Flags, Flag)
104
105
explicit
QPlatformTextureList(QObject *parent =
nullptr
);
106
~QPlatformTextureList();
107
108
int
count()
const
;
109
bool
isEmpty()
const
{
return
count() == 0; }
110
QRhiTexture *texture(
int
index)
const
;
111
QRhiTexture *textureExtra(
int
index)
const
;
112
QRect geometry(
int
index)
const
;
113
QRect clipRect(
int
index)
const
;
114
void
*source(
int
index);
115
Flags flags(
int
index)
const
;
116
void
lock(
bool
on);
117
bool
isLocked()
const
;
118
119
void
appendTexture(
void
*source, QRhiTexture *texture,
const
QRect &geometry,
120
const
QRect &clipRect = QRect(), Flags flags = { });
121
122
void
appendTexture(
void
*source, QRhiTexture *textureLeft, QRhiTexture *textureRight,
const
QRect &geometry,
123
const
QRect &clipRect = QRect(), Flags flags = { });
124
void
clear();
125
126
Q_SIGNALS:
127
void
locked(
bool
);
128
};
129
Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformTextureList::Flags)
130
131
class
Q_GUI_EXPORT QPlatformBackingStore
132
{
133
public
:
134
enum
FlushResult {
135
FlushSuccess,
136
FlushFailed,
137
FlushFailedDueToLostDevice
138
};
139
140
explicit
QPlatformBackingStore(QWindow *window);
141
virtual
~QPlatformBackingStore();
142
143
QWindow *window()
const
;
144
QBackingStore *backingStore()
const
;
145
146
virtual
QPaintDevice *paintDevice() = 0;
147
148
virtual
void
flush(QWindow *window,
const
QRegion ®ion,
const
QPoint &offset);
149
150
virtual
FlushResult rhiFlush(QWindow *window,
151
qreal sourceDevicePixelRatio,
152
const
QRegion ®ion,
153
const
QPoint &offset,
154
QPlatformTextureList *textures,
155
bool
translucentBackground,
156
qreal sourceTransformFactor = 0);
157
158
virtual
QImage toImage()
const
;
159
160
enum
TextureFlag {
161
TextureSwizzle = 0x01,
162
TextureFlip = 0x02,
163
TexturePremultiplied = 0x04
164
};
165
Q_DECLARE_FLAGS(TextureFlags, TextureFlag)
166
virtual
QRhiTexture *toTexture(QRhiResourceUpdateBatch *resourceUpdates,
167
const
QRegion &dirtyRegion,
168
TextureFlags *flags)
const
;
169
170
virtual
QPlatformGraphicsBuffer *graphicsBuffer()
const
;
171
172
virtual
void
resize(
const
QSize &size,
const
QRegion &staticContents) = 0;
173
174
virtual
bool
scroll(
const
QRegion &area,
int
dx,
int
dy);
175
176
virtual
void
beginPaint(
const
QRegion &);
177
virtual
void
endPaint();
178
179
void
createRhi(QWindow *window, QPlatformBackingStoreRhiConfig config);
180
QRhi *rhi(QWindow *window)
const
;
181
void
surfaceAboutToBeDestroyed();
182
void
graphicsDeviceReportedLost(QWindow *window);
183
184
private
:
185
QPlatformBackingStorePrivate *d_ptr;
186
187
void
setBackingStore(QBackingStore *);
188
friend
class
QBackingStore;
189
};
190
191
Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformBackingStore::TextureFlags)
192
193
QT_END_NAMESPACE
194
195
#
endif
// QPLATFORMBACKINGSTORE_H
QByteArray::FromBase64Result::operator==
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
Definition
qbytearray.h:842
QByteArray::FromBase64Result::operator!=
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
Definition
qbytearray.h:853
QPlatformBackingStorePrivate
Definition
qplatformbackingstore.cpp:21
QPlatformBackingStorePrivate::backingStore
QBackingStore * backingStore
Definition
qplatformbackingstore.cpp:30
QPlatformBackingStorePrivate::window
QWindow * window
Definition
qplatformbackingstore.cpp:29
QPlatformBackingStorePrivate::QPlatformBackingStorePrivate
QPlatformBackingStorePrivate(QWindow *w)
Definition
qplatformbackingstore.cpp:23
QPlatformBackingStorePrivate::surfaceSupport
std::unordered_map< QSurface::SurfaceType, SurfaceSupport > surfaceSupport
Definition
qplatformbackingstore.cpp:39
QPlatformTextureListPrivate
Definition
qplatformbackingstore.cpp:55
QPlatformTextureListPrivate::QPlatformTextureListPrivate
QPlatformTextureListPrivate()
Definition
qplatformbackingstore.cpp:57
QPlatformTextureListPrivate::locked
bool locked
Definition
qplatformbackingstore.cpp:63
QPlatformTextureListPrivate::textures
QList< QBackingstoreTextureInfo > textures
Definition
qplatformbackingstore.cpp:62
QPlatformTextureList
Definition
qplatformbackingstore.h:93
QPoint
\inmodule QtCore\reentrant
Definition
qpoint.h:30
Q_LOGGING_CATEGORY
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(QBackingstoreTextureInfo, Q_RELOCATABLE_TYPE)
QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY
QT_BEGIN_NAMESPACE QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(lcAotCompiler, Q_QMLCOMPILER_EXPORT)
QBackingstoreTextureInfo
Definition
qplatformbackingstore.cpp:43
QBackingstoreTextureInfo::texture
QRhiTexture * texture
Definition
qplatformbackingstore.cpp:45
QBackingstoreTextureInfo::source
void * source
Definition
qplatformbackingstore.cpp:44
QBackingstoreTextureInfo::flags
QPlatformTextureList::Flags flags
Definition
qplatformbackingstore.cpp:49
QBackingstoreTextureInfo::clipRect
QRect clipRect
Definition
qplatformbackingstore.cpp:48
QBackingstoreTextureInfo::rect
QRect rect
Definition
qplatformbackingstore.cpp:47
QBackingstoreTextureInfo::textureExtra
QRhiTexture * textureExtra
Definition
qplatformbackingstore.cpp:46
QPlatformBackingStorePrivate::SurfaceSupport
Definition
qplatformbackingstore.cpp:32
QPlatformBackingStorePrivate::SurfaceSupport::rhiSupport
QBackingStoreRhiSupport rhiSupport
Definition
qplatformbackingstore.cpp:36
QPlatformBackingStorePrivate::SurfaceSupport::compositor
QBackingStoreDefaultCompositor compositor
Definition
qplatformbackingstore.cpp:37
QPlatformBackingStoreRhiConfig
Definition
qplatformbackingstore.h:42
qtbase
src
gui
painting
qplatformbackingstore.h
Generated on
for Qt by
1.18.0