![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
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, qreal sourceTransformFactor=0) |
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 | createRhi (QWindow *window, QPlatformBackingStoreRhiConfig config) |
QRhi * | rhi (QWindow *window) const |
void | surfaceAboutToBeDestroyed () |
void | graphicsDeviceReportedLost (QWindow *window) |
Friends | |
class | QBackingStore |
The QPlatformBackingStore class provides the drawing area for top-level windows.
\preliminary
Definition at line 130 of file qplatformbackingstore.h.
Enumerator | |
---|---|
FlushSuccess | |
FlushFailed | |
FlushFailedDueToLostDevice |
Definition at line 133 of file qplatformbackingstore.h.
Enumerator | |
---|---|
TextureSwizzle | |
TextureFlip | |
TexturePremultiplied |
Definition at line 159 of file qplatformbackingstore.h.
|
explicit |
Constructs an empty surface for the given top-level window.
Definition at line 289 of file qplatformbackingstore.cpp.
|
virtual |
Destroys this surface.
Definition at line 297 of file qplatformbackingstore.cpp.
QBackingStore * QPlatformBackingStore::backingStore | ( | ) | const |
Returns a pointer to the backing store associated with this surface.
Definition at line 323 of file qplatformbackingstore.cpp.
This function is called before painting onto the surface begins, with the region in which the painting will occur.
Reimplemented in QCALayerBackingStore, QFbBackingStore, QMinimalEglBackingStore, QOffscreenBackingStore, QOpenGLCompositorBackingStore, QQnxRasterBackingStore, QRasterBackingStore, QtWaylandClient::QWaylandShmBackingStore, QWasmBackingStore, QWindowsBackingStore, QWindowsDirect2DBackingStore, QXcbBackingStore, QXcbNativeBackingStore, and QXcbSystemTrayBackingStore.
Definition at line 335 of file qplatformbackingstore.cpp.
void QPlatformBackingStore::createRhi | ( | QWindow * | window, |
QPlatformBackingStoreRhiConfig | config ) |
Definition at line 372 of file qplatformbackingstore.cpp.
|
virtual |
This function is called after painting onto the surface has ended.
Reimplemented in QCALayerBackingStore, QFbBackingStore, QMinimalEglBackingStore, QQnxRasterBackingStore, QtWaylandClient::QWaylandShmBackingStore, QWindowsDirect2DBackingStore, and QXcbBackingStore.
Definition at line 345 of file qplatformbackingstore.cpp.
|
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, QDirectFbBackingStore, QFbBackingStore, QHaikuRasterBackingStore, QMinimalBackingStore, QMinimalEglBackingStore, QOffscreenBackingStore, QOpenGLCompositorBackingStore, QQnxRasterBackingStore, QRhiBackingStore, QtWaylandClient::QWaylandShmBackingStore, QVkKhrDisplayBackingStore, QVkKhrDisplayBackingStore, QWasmBackingStore, QWindowsBackingStore, QWindowsDirect2DBackingStore, QXcbBackingStore, and QXcbNativeBackingStore.
Definition at line 190 of file qplatformbackingstore.cpp.
Referenced by testing.tools.encode_pdf_filter._SinkPdfStream::close().
|
virtual |
Accessor for a backingstores graphics buffer abstraction.
Reimplemented in QCALayerBackingStore, and QXcbBackingStore.
Definition at line 352 of file qplatformbackingstore.cpp.
Definition at line 399 of file qplatformbackingstore.cpp.
|
pure virtual |
Implement this function to return the appropriate paint device.
Implemented in QCALayerBackingStore, QDirectFbBackingStore, QFbBackingStore, QHaikuRasterBackingStore, QMinimalBackingStore, QMinimalEglBackingStore, QOffscreenBackingStore, QOpenGLCompositorBackingStore, QQnxRasterBackingStore, QRasterBackingStore, QtWaylandClient::QWaylandShmBackingStore, QVkKhrDisplayBackingStore, QVkKhrDisplayBackingStore, QWasmBackingStore, QWindowsBackingStore, QWindowsDirect2DBackingStore, QXcbBackingStore, and QXcbNativeBackingStore.
|
pure virtual |
Implemented in QCALayerBackingStore, QDirectFbBackingStore, QFbBackingStore, QHaikuRasterBackingStore, QMinimalBackingStore, QMinimalEglBackingStore, QOffscreenBackingStore, QOpenGLCompositorBackingStore, QQnxRasterBackingStore, QRasterBackingStore, QtWaylandClient::QWaylandShmBackingStore, QVkKhrDisplayBackingStore, QVkKhrDisplayBackingStore, QWasmBackingStore, QWindowsBackingStore, QWindowsDirect2DBackingStore, QXcbBackingStore, and QXcbNativeBackingStore.
Definition at line 393 of file qplatformbackingstore.cpp.
|
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 QCALayerBackingStore, QOpenGLCompositorBackingStore, and QXcbBackingStore.
Definition at line 211 of file qplatformbackingstore.cpp.
|
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 QCALayerBackingStore, QDirectFbBackingStore, QOffscreenBackingStore, QQnxRasterBackingStore, QRasterBackingStore, QtWaylandClient::QWaylandShmBackingStore, QWindowsBackingStore, QXcbBackingStore, and QXcbNativeBackingStore.
Definition at line 363 of file qplatformbackingstore.cpp.
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 QCALayerBackingStore, QDirectFbBackingStore, QFbBackingStore, QOffscreenBackingStore, QOpenGLCompositorBackingStore, QRasterBackingStore, QWasmBackingStore, QWindowsBackingStore, QWindowsDirect2DBackingStore, QXcbBackingStore, and QXcbNativeBackingStore.
Definition at line 239 of file qplatformbackingstore.cpp.
|
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 270 of file qplatformbackingstore.cpp.
QWindow * QPlatformBackingStore::window | ( | ) | const |
Returns a pointer to the top-level window associated with this surface.
Definition at line 306 of file qplatformbackingstore.cpp.
|
friend |
Definition at line 187 of file qplatformbackingstore.h.