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
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
4#ifndef QPLATFORMBACKINGSTORE_H
5#define QPLATFORMBACKINGSTORE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QPA API and is not meant to be used
12// in applications. Usage of this API may make your code
13// source and binary incompatible with future versions of Qt.
14//
15
16#include <QtGui/qtguiglobal.h>
17#include <QtCore/qloggingcategory.h>
18#include <QtCore/qrect.h>
19#include <QtCore/qobject.h>
20
21#include <QtGui/qwindow.h>
22#include <QtGui/qregion.h>
23
25
26Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcQpaBackingStore, Q_GUI_EXPORT)
27
28class QRegion;
29class QRect;
30class QPoint;
31class QImage;
36class QRhi;
37class QRhiTexture;
39
41{
50
52 : m_enable(false)
53 { }
54
56 : m_enable(true),
57 m_api(api)
58 { }
59
60 bool isEnabled() const { return m_enable; }
61 void setEnabled(bool enable) { m_enable = enable; }
62
63 Api api() const { return m_api; }
64 void setApi(Api api) { m_api = api; }
65
66 bool isDebugLayerEnabled() const { return m_debugLayer; }
67 void setDebugLayer(bool enable) { m_debugLayer = enable; }
68
69private:
70 bool m_enable;
71 Api m_api = Null;
72 bool m_debugLayer = false;
74};
75
77{
78 return a.m_enable == b.m_enable
79 && a.m_api == b.m_api
80 && a.m_debugLayer == b.m_debugLayer;
81}
82
84{
85 return !(a == b);
86}
87
88class Q_GUI_EXPORT QPlatformTextureList : public QObject
89{
91 Q_DECLARE_PRIVATE(QPlatformTextureList)
92public:
93 enum Flag {
94 StacksOnTop = 0x01,
95 TextureIsSrgb = 0x02,
96 NeedsPremultipliedAlphaBlending = 0x04,
97 MirrorVertically = 0x08
98 };
100
101 explicit QPlatformTextureList(QObject *parent = nullptr);
103
104 int count() const;
105 bool isEmpty() const { return count() == 0; }
106 QRhiTexture *texture(int index) const;
107 QRhiTexture *textureExtra(int index) const;
108 QRect geometry(int index) const;
109 QRect clipRect(int index) const;
110 void *source(int index);
111 Flags flags(int index) const;
112 void lock(bool on);
113 bool isLocked() const;
114
115 void appendTexture(void *source, QRhiTexture *texture, const QRect &geometry,
116 const QRect &clipRect = QRect(), Flags flags = { });
117
118 void appendTexture(void *source, QRhiTexture *textureLeft, QRhiTexture *textureRight, const QRect &geometry,
119 const QRect &clipRect = QRect(), Flags flags = { });
120 void clear();
121
122 Q_SIGNALS:
123 void locked(bool);
124};
125Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformTextureList::Flags)
126
127class Q_GUI_EXPORT QPlatformBackingStore
128{
129public:
133 FlushFailedDueToLostDevice
134 };
135
137 virtual ~QPlatformBackingStore();
138
139 QWindow *window() const;
140 QBackingStore *backingStore() const;
141
142 virtual QPaintDevice *paintDevice() = 0;
143
144 virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset);
145
146 virtual FlushResult rhiFlush(QWindow *window,
147 qreal sourceDevicePixelRatio,
148 const QRegion &region,
149 const QPoint &offset,
151 bool translucentBackground);
152
153 virtual QImage toImage() const;
154
156 TextureSwizzle = 0x01,
157 TextureFlip = 0x02,
158 TexturePremultiplied = 0x04
159 };
160 Q_DECLARE_FLAGS(TextureFlags, TextureFlag)
161 virtual QRhiTexture *toTexture(QRhiResourceUpdateBatch *resourceUpdates,
162 const QRegion &dirtyRegion,
163 TextureFlags *flags) const;
164
165 virtual QPlatformGraphicsBuffer *graphicsBuffer() const;
166
167 virtual void resize(const QSize &size, const QRegion &staticContents) = 0;
168
169 virtual bool scroll(const QRegion &area, int dx, int dy);
170
171 virtual void beginPaint(const QRegion &);
172 virtual void endPaint();
173
174 void setRhiConfig(const QPlatformBackingStoreRhiConfig &config);
175 QRhi *rhi() const;
177 void graphicsDeviceReportedLost();
178
179private:
181
182 void setBackingStore(QBackingStore *);
183 friend class QBackingStore;
184};
185
186Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformBackingStore::TextureFlags)
187
189
190#endif // QPLATFORMBACKINGSTORE_H
The QBackingStore class provides a drawing area for QWindow.
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore
Definition qobject.h:103
The QPlatformBackingStore class provides the drawing area for top-level windows.
virtual QPaintDevice * paintDevice()=0
Implement this function to return the appropriate paint device.
void surfaceAboutToBeDestroyed()
virtual void resize(const QSize &size, const QRegion &staticContents)=0
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
\inmodule QtGui
Definition qrhi.h:1731
\inmodule QtGui
Definition qrhi.h:895
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
\inmodule QtCore
Definition qsize.h:25
\inmodule QtGui
Definition qwindow.h:63
b clear()
Combined button and popup list for selecting options.
EGLConfig config
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
Flags
static int area(const QSize &s)
Definition qicon.cpp:153
#define Q_DECLARE_EXPORTED_LOGGING_CATEGORY(name, export_macro)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLuint const GLuint GLuint const GLuint * textures
GLenum GLenum GLsizei count
GLbitfield flags
GLboolean enable
GLenum GLuint texture
GLenum GLuint GLintptr offset
GLsizei GLsizei GLchar * source
bool operator!=(const QPlatformBackingStoreRhiConfig &a, const QPlatformBackingStoreRhiConfig &b)
bool operator==(const QPlatformBackingStoreRhiConfig &a, const QPlatformBackingStoreRhiConfig &b)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define Q_OBJECT
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
QReadWriteLock lock
[0]
aWidget window() -> setWindowTitle("New Window Title")
[2]
QNetworkRequestFactory api
[0]