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
QOffscreenBackingStore Class Reference

#include <qoffscreencommon.h>

+ Inheritance diagram for QOffscreenBackingStore:
+ Collaboration diagram for QOffscreenBackingStore:

Public Member Functions

 QOffscreenBackingStore (QWindow *window)
 
 ~QOffscreenBackingStore ()
 
QPaintDevicepaintDevice () override
 Implement this function to return the appropriate paint device.
 
void flush (QWindow *window, const QRegion &region, const QPoint &offset) override
 Flushes the given region from the specified window.
 
void resize (const QSize &size, const QRegion &staticContents) override
 
bool scroll (const QRegion &area, int dx, int dy) override
 Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative.
 
QPixmap grabWindow (WId window, const QRect &rect) const
 
QImage toImage () const override
 Implemented in subclasses to return the content of the backingstore as a QImage.
 
- Public Member Functions inherited from QPlatformBackingStore
 QPlatformBackingStore (QWindow *window)
 Constructs an empty surface for the given top-level window.
 
virtual ~QPlatformBackingStore ()
 Destroys this surface.
 
QWindowwindow () const
 Returns a pointer to the top-level window associated with this surface.
 
QBackingStorebackingStore () const
 Returns a pointer to the backing store 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 list.
 
virtual QRhiTexturetoTexture (QRhiResourceUpdateBatch *resourceUpdates, const QRegion &dirtyRegion, TextureFlags *flags) const
 May be reimplemented in subclasses to return the content of the backingstore as an QRhiTexture.
 
virtual QPlatformGraphicsBuffergraphicsBuffer () const
 Accessor for a backingstores graphics buffer abstraction.
 
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)
 
QRhirhi () const
 
void surfaceAboutToBeDestroyed ()
 
void graphicsDeviceReportedLost ()
 

Static Public Member Functions

static QOffscreenBackingStorebackingStoreForWinId (WId id)
 

Additional Inherited Members

- Public Types inherited from QPlatformBackingStore
enum  FlushResult { FlushSuccess , FlushFailed , FlushFailedDueToLostDevice }
 
enum  TextureFlag { TextureSwizzle = 0x01 , TextureFlip = 0x02 , TexturePremultiplied = 0x04 }
 

Detailed Description

Definition at line 61 of file qoffscreencommon.h.

Constructor & Destructor Documentation

◆ QOffscreenBackingStore()

QOffscreenBackingStore::QOffscreenBackingStore ( QWindow * window)

Definition at line 111 of file qoffscreencommon.cpp.

◆ ~QOffscreenBackingStore()

QOffscreenBackingStore::~QOffscreenBackingStore ( )

Definition at line 116 of file qoffscreencommon.cpp.

Member Function Documentation

◆ backingStoreForWinId()

QOffscreenBackingStore * QOffscreenBackingStore::backingStoreForWinId ( WId id)
static

Definition at line 190 of file qoffscreencommon.cpp.

Referenced by QOffscreenScreen::grabWindow().

+ Here is the caller graph for this function:

◆ flush()

void QOffscreenBackingStore::flush ( QWindow * window,
const QRegion & region,
const QPoint & offset )
overridevirtual

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()

Reimplemented from QPlatformBackingStore.

Definition at line 126 of file qoffscreencommon.cpp.

References QWindow::height, QSize::isEmpty(), QRect::isNull(), Q_UNUSED, QImage::size(), QRect::translated(), QWindow::width, and QPlatformBackingStore::window().

+ Here is the call graph for this function:

◆ grabWindow()

QPixmap QOffscreenBackingStore::grabWindow ( WId window,
const QRect & rect ) const

Definition at line 170 of file qoffscreencommon.cpp.

References area(), QImage::copy(), QPixmap::fromImage(), QRect::height(), QRect::isEmpty(), rect, QRect::setHeight(), QRect::setWidth(), QRect::translated(), QHash< Key, T >::value(), QRect::width(), and QPlatformBackingStore::window().

Referenced by QOffscreenScreen::grabWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ paintDevice()

QPaintDevice * QOffscreenBackingStore::paintDevice ( )
overridevirtual

Implement this function to return the appropriate paint device.

Implements QPlatformBackingStore.

Definition at line 121 of file qoffscreencommon.cpp.

◆ resize()

void QOffscreenBackingStore::resize ( const QSize & size,
const QRegion & staticContents )
overridevirtual

Implements QPlatformBackingStore.

Definition at line 149 of file qoffscreencommon.cpp.

References QPlatformScreen::format(), QScreen::handle(), QGuiApplication::primaryScreen, and QImage::size().

+ Here is the call graph for this function:

◆ scroll()

bool QOffscreenBackingStore::scroll ( const QRegion & area,
int dx,
int dy )
overridevirtual

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 from QPlatformBackingStore.

Definition at line 159 of file qoffscreencommon.cpp.

References area(), QImage::isNull(), qt_scrollRectInImage(), and rect.

+ Here is the call graph for this function:

◆ toImage()

QImage QOffscreenBackingStore::toImage ( ) const
inlineoverridevirtual

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()

Reimplemented from QPlatformBackingStore.

Definition at line 73 of file qoffscreencommon.h.

Referenced by QOffscreenScreen::grabWindow().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: