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
qrhibackingstore.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 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
5#include <private/qimage_p.h>
6
8
13
17
18void QRhiBackingStore::flush(QWindow *flushedWindow, const QRegion &region, const QPoint &offset)
19{
20 Q_UNUSED(region);
22
23 if (flushedWindow->surfaceType() != window()->surfaceType()) {
24 qWarning() << "Cannot flush child window" << flushedWindow
25 << "with surface type" << flushedWindow->surfaceType() << ";"
26 << "Must match" << window()->surfaceType() << "of" << window();
27
28 // FIXME: Support different surface types by not tying the
29 // RHI config to the backing store itself (per window config).
30 return;
31 }
32
33 if (!rhi()) {
35 switch (window()->surfaceType()) {
38 break;
41 break;
42 default:
43 Q_UNREACHABLE();
44 }
45 rhiConfig.setEnabled(true);
46 setRhiConfig(rhiConfig);
47 }
48
49 static QPlatformTextureList emptyTextureList;
50 bool translucentBackground = m_image.hasAlphaChannel();
51 rhiFlush(flushedWindow, flushedWindow->devicePixelRatio(),
52 region, offset, &emptyTextureList, translucentBackground);
53}
54
56{
58
59 // With render-to-texture widgets and QRhi-based flushing the backingstore
60 // image must have an alpha channel. Hence upgrading the format. Matches
61 // what other platforms (Windows, xcb) do.
64
65 return fmt;
66}
67
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false.
Definition qimage.cpp:4589
static QPixelFormat toPixelFormat(QImage::Format format) noexcept
Converts format into a QPixelFormat.
Definition qimage.cpp:6392
Format
The following image formats are available in Qt.
Definition qimage.h:41
void setRhiConfig(const QPlatformBackingStoreRhiConfig &config)
QWindow * window() const
Returns a pointer to the top-level window associated with this surface.
virtual FlushResult rhiFlush(QWindow *window, qreal sourceDevicePixelRatio, const QRegion &region, const QPoint &offset, QPlatformTextureList *textures, bool translucentBackground)
Flushes the given region from the specified window, and compositing it with the specified textures li...
\inmodule QtCore\reentrant
Definition qpoint.h:25
virtual QImage::Format format() const
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
QRhiBackingStore(QWindow *window)
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
QImage::Format format() const override
@ OpenGLSurface
Definition qsurface.h:32
@ MetalSurface
Definition qsurface.h:36
\inmodule QtGui
Definition qwindow.h:63
SurfaceType surfaceType() const override
Returns the surface type of the window.
Definition qwindow.cpp:665
Combined button and popup list for selecting options.
QImage::Format qt_maybeDataCompatibleAlphaVersion(QImage::Format format)
Definition qimage_p.h:478
#define qWarning
Definition qlogging.h:166
GLenum GLuint GLintptr offset
#define Q_UNUSED(x)
QVideoFrameFormat::PixelFormat fmt
aWidget window() -> setWindowTitle("New Window Title")
[2]