QPlatformBackingStore Class
The QPlatformBackingStore class provides the drawing area for top-level windows. More...
Header: | #include <QPlatformBackingStore> |
Inherited By: |
Public Types
flags | TextureFlags |
Public Functions
QPlatformBackingStore(QWindow *window) | |
virtual | ~QPlatformBackingStore() |
QBackingStore * | backingStore() const |
virtual void | beginPaint(const QRegion &) |
virtual void | endPaint() |
virtual void | flush(QWindow *window, const QRegion ®ion, const QPoint &offset) |
virtual QPlatformGraphicsBuffer * | graphicsBuffer() const |
virtual FlushResult | rhiFlush(QWindow *window, qreal sourceDevicePixelRatio, const QRegion ®ion, const QPoint &offset, QPlatformTextureList *textures, bool translucentBackground) |
virtual bool | scroll(const QRegion &area, int dx, int dy) |
virtual QImage | toImage() const |
virtual QRhiTexture * | toTexture(QRhiResourceUpdateBatch *resourceUpdates, const QRegion &dirtyRegion, TextureFlags *flags) const |
QWindow * | window() const |
Detailed Description
\since
5.0 \internal
\preliminary
\ingroup
qpa
Member Function Documentation
[explicit]
QPlatformBackingStore::QPlatformBackingStore(QWindow *window)
Constructs an empty surface for the given top-level window.
[virtual noexcept]
QPlatformBackingStore::~QPlatformBackingStore()
Destroys this surface.
QBackingStore *QPlatformBackingStore::backingStore() const
Returns a pointer to the backing store associated with this surface.
[virtual]
void QPlatformBackingStore::beginPaint(const QRegion &)
This function is called before painting onto the surface begins, with the region in which the painting will occur.
See also endPaint() and paintDevice().
[virtual]
void QPlatformBackingStore::endPaint()
This function is called after painting onto the surface has ended.
See also beginPaint() and paintDevice().
[virtual]
void QPlatformBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset)
Flushes the given region from the specified window.
Note: region is relative to the window which may not be top-level in case window corresponds to a native child widget. offset is the position of the native child relative to the top-level 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.
See also rhiFlush().
[virtual]
QPlatformGraphicsBuffer *QPlatformBackingStore::graphicsBuffer() const
Accessor for a backingstores graphics buffer abstraction
[virtual]
FlushResult QPlatformBackingStore::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.
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.
Note: region is relative to the window which may not be top-level in case window corresponds to a native child widget. offset is the position of the native child relative to the top-level window.
See also flush().
[virtual]
bool QPlatformBackingStore::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.
Returns true
if the area was scrolled successfully; false otherwise.
[virtual]
QImage QPlatformBackingStore::toImage() const
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.
See also toTexture().
[virtual]
QRhiTexture *QPlatformBackingStore::toTexture(QRhiResourceUpdateBatch *resourceUpdates, const QRegion &dirtyRegion, TextureFlags *flags) const
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
.
Note: dirtyRegion is relative to the backingstore so no adjustment is needed.
QWindow *QPlatformBackingStore::window() const
Returns a pointer to the top-level window associated with this surface.