![]() |
Qt 6.x
The Qt SDK
|
The QPlatformBackingStore class provides the drawing area for top-level windows. More...
#include <qplatformbackingstore.h>
Public Types | |
enum | FlushResult { FlushSuccess , FlushFailed , FlushFailedDueToLostDevice } |
enum | TextureFlag { TextureSwizzle = 0x01 , TextureFlip = 0x02 , TexturePremultiplied = 0x04 } |
Public Member Functions | |
QPlatformBackingStore (QWindow *window) | |
Constructs an empty surface for the given top-level window. | |
virtual | ~QPlatformBackingStore () |
Destroys this surface. | |
QWindow * | window () const |
Returns a pointer to the top-level window associated with this surface. | |
QBackingStore * | backingStore () const |
Returns a pointer to the backing store associated with this surface. | |
virtual QPaintDevice * | paintDevice ()=0 |
Implement this function to return the appropriate paint device. | |
virtual void | flush (QWindow *window, const QRegion ®ion, const QPoint &offset) |
Flushes the given region from the specified window. | |
virtual FlushResult | rhiFlush (QWindow *window, qreal sourceDevicePixelRatio, const QRegion ®ion, const QPoint &offset, QPlatformTextureList *textures, bool translucentBackground) |
Flushes the given region from the specified window, and compositing it with the specified textures list. | |
virtual QImage | toImage () const |
Implemented in subclasses to return the content of the backingstore as a QImage. | |
virtual QRhiTexture * | toTexture (QRhiResourceUpdateBatch *resourceUpdates, const QRegion &dirtyRegion, TextureFlags *flags) const |
May be reimplemented in subclasses to return the content of the backingstore as an QRhiTexture. | |
virtual QPlatformGraphicsBuffer * | graphicsBuffer () const |
Accessor for a backingstores graphics buffer abstraction. | |
virtual void | resize (const QSize &size, const QRegion &staticContents)=0 |
virtual bool | scroll (const QRegion &area, int dx, int dy) |
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative. | |
virtual void | beginPaint (const QRegion &) |
This function is called before painting onto the surface begins, with the region in which the painting will occur. | |
virtual void | endPaint () |
This function is called after painting onto the surface has ended. | |
void | setRhiConfig (const QPlatformBackingStoreRhiConfig &config) |
QRhi * | rhi () const |
QRhiSwapChain * | rhiSwapChain () const |
void | surfaceAboutToBeDestroyed () |
void | graphicsDeviceReportedLost () |
Friends | |
class | QBackingStore |
The QPlatformBackingStore class provides the drawing area for top-level windows.
\preliminary
Definition at line 127 of file qplatformbackingstore.h.
Enumerator | |
---|---|
FlushSuccess | |
FlushFailed | |
FlushFailedDueToLostDevice |
Definition at line 130 of file qplatformbackingstore.h.
Enumerator | |
---|---|
TextureSwizzle | |
TextureFlip | |
TexturePremultiplied |
Definition at line 155 of file qplatformbackingstore.h.
|
explicit |
Constructs an empty surface for the given top-level window.
Definition at line 276 of file qplatformbackingstore.cpp.
|
virtual |
Destroys this surface.
Definition at line 284 of file qplatformbackingstore.cpp.
QBackingStore * QPlatformBackingStore::backingStore | ( | ) | const |
Returns a pointer to the backing store associated with this surface.
Definition at line 310 of file qplatformbackingstore.cpp.
References QPlatformBackingStorePrivate::backingStore.
Referenced by QWasmBackingStore::beginPaint().
This function is called before painting onto the surface begins, with the region in which the painting will occur.
Reimplemented in QFbBackingStore, QWindowsDirect2DBackingStore, QMinimalEglBackingStore, QWasmBackingStore, QWindowsBackingStore, QXcbBackingStore, QXcbSystemTrayBackingStore, QRasterBackingStore, QOpenGLCompositorBackingStore, QCALayerBackingStore, QQnxRasterBackingStore, QXcbNativeBackingStore, and QtWaylandClient::QWaylandShmBackingStore.
Definition at line 322 of file qplatformbackingstore.cpp.
Referenced by QBackingStore::beginPaint().
|
virtual |
This function is called after painting onto the surface has ended.
Reimplemented in QFbBackingStore, QCALayerBackingStore, QWindowsDirect2DBackingStore, QMinimalEglBackingStore, QQnxRasterBackingStore, QXcbBackingStore, and QtWaylandClient::QWaylandShmBackingStore.
Definition at line 332 of file qplatformbackingstore.cpp.
Referenced by QBackingStore::endPaint().
|
virtual |
Flushes the given region from the specified window.
Unlike rhiFlush(), this function's default implementation does nothing. It is expected that subclasses provide a platform-specific (non-QRhi-based) implementation, if applicable on the given platform.
Reimplemented in QCALayerBackingStore, QWindowsDirect2DBackingStore, QRhiBackingStore, QOpenGLCompositorBackingStore, QFbBackingStore, QAndroidPlatformBackingStore, QDirectFbBackingStore, QHaikuRasterBackingStore, QMinimalBackingStore, QMinimalEglBackingStore, QOffscreenBackingStore, QQnxRasterBackingStore, QVkKhrDisplayBackingStore, QWasmBackingStore, QWindowsBackingStore, QXcbNativeBackingStore, QXcbBackingStore, and QtWaylandClient::QWaylandShmBackingStore.
Definition at line 185 of file qplatformbackingstore.cpp.
References Q_UNUSED, and window().
Referenced by QBackingStore::flush().
|
virtual |
Accessor for a backingstores graphics buffer abstraction.
Reimplemented in QCALayerBackingStore, and QXcbBackingStore.
Definition at line 339 of file qplatformbackingstore.cpp.
Referenced by QBackingStoreDefaultCompositor::flush().
void QPlatformBackingStore::graphicsDeviceReportedLost | ( | ) |
Definition at line 376 of file qplatformbackingstore.cpp.
References QPlatformBackingStorePrivate::compositor, QBackingStoreRhiSupport::create(), qWarning, QBackingStoreDefaultCompositor::reset(), QBackingStoreRhiSupport::reset(), QBackingStoreRhiSupport::rhi(), and QPlatformBackingStorePrivate::rhiSupport.
|
pure virtual |
Implement this function to return the appropriate paint device.
Implemented in QRasterBackingStore, QOpenGLCompositorBackingStore, QFbBackingStore, QAndroidPlatformBackingStore, QCALayerBackingStore, QWindowsDirect2DBackingStore, QDirectFbBackingStore, QHaikuRasterBackingStore, QMinimalBackingStore, QMinimalEglBackingStore, QOffscreenBackingStore, QQnxRasterBackingStore, QVkKhrDisplayBackingStore, QWasmBackingStore, QWindowsBackingStore, QXcbNativeBackingStore, QXcbBackingStore, and QtWaylandClient::QWaylandShmBackingStore.
Referenced by QBackingStore::beginPaint(), and QBackingStore::paintDevice().
|
pure virtual |
Implemented in QWindowsBackingStore, QFbBackingStore, QRasterBackingStore, QOpenGLCompositorBackingStore, QAndroidPlatformBackingStore, QCALayerBackingStore, QWindowsDirect2DBackingStore, QDirectFbBackingStore, QHaikuRasterBackingStore, QMinimalBackingStore, QMinimalEglBackingStore, QOffscreenBackingStore, QQnxRasterBackingStore, QVkKhrDisplayBackingStore, QWasmBackingStore, QXcbNativeBackingStore, QXcbBackingStore, and QtWaylandClient::QWaylandShmBackingStore.
Referenced by QBackingStore::resize().
QRhi * QPlatformBackingStore::rhi | ( | ) | const |
Definition at line 370 of file qplatformbackingstore.cpp.
References QBackingStoreRhiSupport::rhi(), and QPlatformBackingStorePrivate::rhiSupport.
Referenced by QRhiBackingStore::flush(), QOpenGLCompositorBackingStore::flush(), QWidgetRepaintManager::rhi(), and QOpenGLCompositorBackingStore::rhiFlush().
|
virtual |
Flushes the given region from the specified window, and compositing it with the specified textures list.
The default implementation retrieves the contents using toTexture() and composes using QRhi with OpenGL, Metal, Vulkan, or Direct 3D underneath. May be reimplemented in subclasses if customization is desired.
Reimplemented in QOpenGLCompositorBackingStore, QCALayerBackingStore, and QXcbBackingStore.
Definition at line 206 of file qplatformbackingstore.cpp.
References QPlatformBackingStorePrivate::compositor, QBackingStoreDefaultCompositor::flush(), QBackingStoreRhiSupport::rhi(), QPlatformBackingStorePrivate::rhiSupport, QBackingStoreRhiSupport::swapChainForWindow(), and window().
Referenced by QRhiBackingStore::flush(), QCALayerBackingStore::rhiFlush(), and QXcbBackingStore::rhiFlush().
QRhiSwapChain * QPlatformBackingStore::rhiSwapChain | ( | ) | const |
|
virtual |
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative.
Returns true
if the area was scrolled successfully; false otherwise.
Reimplemented in QRasterBackingStore, QDirectFbBackingStore, QOffscreenBackingStore, QQnxRasterBackingStore, QWindowsBackingStore, QXcbNativeBackingStore, QXcbBackingStore, and QCALayerBackingStore.
Definition at line 350 of file qplatformbackingstore.cpp.
References area(), and Q_UNUSED.
Referenced by QBackingStore::scroll().
void QPlatformBackingStore::setRhiConfig | ( | const QPlatformBackingStoreRhiConfig & | config | ) |
Definition at line 359 of file qplatformbackingstore.cpp.
References QBackingStoreRhiSupport::create(), QWindow::format(), QPlatformBackingStorePrivate::rhiSupport, QBackingStoreRhiSupport::setConfig(), QBackingStoreRhiSupport::setFormat(), QBackingStoreRhiSupport::setWindow(), and QPlatformBackingStorePrivate::window.
Referenced by QWidgetPrivate::create(), QRhiBackingStore::flush(), QOpenGLCompositorBackingStore::flush(), and QOpenGLCompositorBackingStore::rhiFlush().
void QPlatformBackingStore::surfaceAboutToBeDestroyed | ( | ) |
|
virtual |
Implemented in subclasses to return the content of the backingstore as a QImage.
If composition via a 3D graphics API is supported, either this function or toTexture() must be implemented.
The returned image is only valid until the next operation (resize, paint, scroll, or flush) on the backingstore. The caller must not store the return value between calls, but instead call this function before each use, or make an explicit copy.
Reimplemented in QRasterBackingStore, QOpenGLCompositorBackingStore, QFbBackingStore, QAndroidPlatformBackingStore, QCALayerBackingStore, QWindowsDirect2DBackingStore, QDirectFbBackingStore, QOffscreenBackingStore, QWasmBackingStore, QWindowsBackingStore, QXcbNativeBackingStore, and QXcbBackingStore.
Definition at line 229 of file qplatformbackingstore.cpp.
Referenced by QSGSoftwareRenderThread::event(), and QBackingStoreDefaultCompositor::toTexture().
|
virtual |
May be reimplemented in subclasses to return the content of the backingstore as an QRhiTexture.
dirtyRegion is the part of the backingstore which may have changed since the last call to this function. The caller of this function must ensure that there is a current context.
The ownership of the texture is not transferred. The caller must not store the return value between calls, but instead call this function before each use.
The default implementation returns a cached texture if dirtyRegion is empty and the existing texture's size matches the backingstore size, otherwise it retrieves the content using toImage() and performs a texture upload.
If the red and blue components have to swapped, flags will be set to include TextureSwizzle
. This allows creating textures from images in formats like QImage::Format_RGB32 without any further image conversion. Instead, the swizzling will be done in the shaders when performing composition. Other formats, that do not need such swizzling due to being already byte ordered RGBA, for example QImage::Format_RGBA8888, must result in having needsSwizzle set to false.
If the image has to be flipped (e.g. because the texture is attached to an FBO), flags will be set to include TextureFlip
.
Definition at line 260 of file qplatformbackingstore.cpp.
References QPlatformBackingStorePrivate::compositor, QBackingStoreRhiSupport::rhi(), QPlatformBackingStorePrivate::rhiSupport, and QBackingStoreDefaultCompositor::toTexture().
QWindow * QPlatformBackingStore::window | ( | ) | const |
Returns a pointer to the top-level window associated with this surface.
Definition at line 293 of file qplatformbackingstore.cpp.
References QPlatformBackingStorePrivate::window.
Referenced by QAndroidPlatformBackingStore::QAndroidPlatformBackingStore(), QCALayerBackingStore::QCALayerBackingStore(), QDirectFbBackingStore::QDirectFbBackingStore(), QFbBackingStore::QFbBackingStore(), QMinimalEglBackingStore::QMinimalEglBackingStore(), QQnxRasterBackingStore::QQnxRasterBackingStore(), QWasmBackingStore::QWasmBackingStore(), QtWaylandClient::QWaylandShmBackingStore::QWaylandShmBackingStore(), QWindowsBackingStore::QWindowsBackingStore(), QXcbBackingStore::QXcbBackingStore(), QXcbBackingStoreImage::QXcbBackingStoreImage(), QXcbNativeBackingStore::QXcbNativeBackingStore(), QXcbSystemTrayBackingStore::QXcbSystemTrayBackingStore(), QQnxRasterBackingStore::~QQnxRasterBackingStore(), QWasmBackingStore::~QWasmBackingStore(), QFbScreen::addWindow(), QWindowsDirect2DBackingStore::beginPaint(), QMinimalEglBackingStore::beginPaint(), QWasmBackingStore::beginPaint(), QRasterBackingStore::beginPaint(), QCALayerBackingStore::beginPaint(), QQnxRasterBackingStore::beginPaint(), QCocoaBackingStore::colorSpace(), QWindowsDirect2DBackingStore::endPaint(), QQnxRasterBackingStore::endPaint(), QXcbBackingStore::endPaint(), QtWaylandClient::QWaylandShmBackingStore::endPaint(), QCALayerBackingStore::eventFilter(), QCALayerBackingStore::flush(), QWindowsDirect2DBackingStore::flush(), flush(), QRhiBackingStore::flush(), QOpenGLCompositorBackingStore::flush(), QFbBackingStore::flush(), QAndroidPlatformBackingStore::flush(), QHaikuRasterBackingStore::flush(), QMinimalBackingStore::flush(), QMinimalEglBackingStore::flush(), QOffscreenBackingStore::flush(), QQnxRasterBackingStore::flush(), QVkKhrDisplayBackingStore::flush(), QWasmBackingStore::flush(), QWindowsBackingStore::flush(), QXcbNativeBackingStore::flush(), QXcbBackingStore::flush(), QtWaylandClient::QWaylandShmBackingStore::flush(), QRasterBackingStore::format(), QWasmBackingStore::getUpdatedWebImage(), QOffscreenBackingStore::grabWindow(), QWindowsDirect2DBackingStore::paintDevice(), QXcbBackingStore::render(), QXcbSystemTrayBackingStore::render(), QXcbBackingStoreImage::resize(), QtWaylandClient::QWaylandShmBackingStore::resize(), QWindowsBackingStore::resize(), QFbBackingStore::resize(), QAndroidPlatformBackingStore::resize(), QWindowsDirect2DBackingStore::resize(), QQnxRasterBackingStore::resize(), QWasmBackingStore::resize(), QXcbBackingStore::resize(), rhiFlush(), QOpenGLCompositorBackingStore::rhiFlush(), QCALayerBackingStore::rhiFlush(), QXcbBackingStore::rhiFlush(), QRasterBackingStore::scroll(), QQnxRasterBackingStore::scroll(), QAndroidPlatformBackingStore::setBackingStore(), QWindowsDirect2DBackingStore::toImage(), QWasmBackingStore::updateTexture(), and QtWaylandClient::QWaylandShmBackingStore::waylandWindow().
|
friend |
Definition at line 184 of file qplatformbackingstore.h.