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

The QBackingStore class provides a drawing area for QWindow. More...

#include <qbackingstore.h>

+ Collaboration diagram for QBackingStore:

Public Member Functions

 QBackingStore (QWindow *window)
 Constructs an empty surface for the given top-level window.
 
 ~QBackingStore ()
 Destroys this surface.
 
QWindowwindow () const
 Returns a pointer to the top-level window associated with this surface.
 
QPaintDevicepaintDevice ()
 Returns the paint device for this surface.
 
void flush (const QRegion &region, QWindow *window=nullptr, const QPoint &offset=QPoint())
 Flushes the given region from the specified window onto the screen.
 
void resize (const QSize &size)
 Sets the size of the window surface to size.
 
QSize size () const
 Returns the current size of the window surface.
 
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.
 
void beginPaint (const QRegion &)
 Begins painting on the backing store surface in the given region.
 
void endPaint ()
 Ends painting.
 
void setStaticContents (const QRegion &region)
 Set region as the static contents of this window.
 
QRegion staticContents () const
 Returns a QRegion representing the area of the window that has static contents.
 
bool hasStaticContents () const
 Returns a boolean indicating if this window has static contents or not.
 
QPlatformBackingStorehandle () const
 Returns a pointer to the QPlatformBackingStore implementation.
 

Detailed Description

The QBackingStore class provides a drawing area for QWindow.

Since
5.0 \inmodule QtGui

QBackingStore enables the use of QPainter to paint on a QWindow with type RasterSurface. The other way of rendering to a QWindow is through the use of OpenGL with QOpenGLContext.

A QBackingStore contains a buffered representation of the window contents, and thus supports partial updates by using QPainter to only update a sub region of the window contents.

QBackingStore might be used by an application that wants to use QPainter without OpenGL acceleration and without the extra overhead of using the QWidget or QGraphicsView UI stacks. For an example of how to use QBackingStore see the \l{Raster Window Example}.

Definition at line 23 of file qbackingstore.h.

Constructor & Destructor Documentation

◆ QBackingStore()

QBackingStore::QBackingStore ( QWindow * window)
explicit

Constructs an empty surface for the given top-level window.

Definition at line 80 of file qbackingstore.cpp.

References handle(), and window().

+ Here is the call graph for this function:

◆ ~QBackingStore()

QBackingStore::~QBackingStore ( )

Destroys this surface.

Definition at line 93 of file qbackingstore.cpp.

References QBackingStorePrivate::platformBackingStore.

Member Function Documentation

◆ beginPaint()

void QBackingStore::beginPaint ( const QRegion & region)

Begins painting on the backing store surface in the given region.

You should call this function before using the paintDevice() to paint.

See also
endPaint(), paintDevice()

Definition at line 116 of file qbackingstore.cpp.

References QBackingStorePrivate::backingStoreDevicePixelRatio(), QPlatformBackingStore::beginPaint(), QImage::data_ptr(), device, QBackingStorePrivate::deviceIndependentToNativeFactor(), QImage::devicePixelRatio(), dpr(), handle(), QBackingStorePrivate::highDpiBackingstore, QInternal::Image, QHighDpiScaling::isActive(), QScopedPointer< T, Cleanup >::isNull(), QPlatformBackingStore::paintDevice(), QScopedPointer< T, Cleanup >::reset(), resize(), QHighDpi::scale(), QImage::setDevicePixelRatio(), QImage::size(), and size().

Referenced by QRasterWindowPrivate::beginPaint(), QVideoWindowPrivate::render(), and QSGSoftwareRenderer::render().

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

◆ endPaint()

void QBackingStore::endPaint ( )

Ends painting.

You should call this function after painting with the paintDevice() has ended.

See also
beginPaint(), paintDevice()

Definition at line 173 of file qbackingstore.cpp.

References QPlatformBackingStore::endPaint(), handle(), paintDevice(), and qWarning.

Referenced by QRasterWindowPrivate::endPaint(), QVideoWindowPrivate::render(), and QSGSoftwareRenderer::render().

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

◆ flush()

void QBackingStore::flush ( const QRegion & region,
QWindow * window = nullptr,
const QPoint & offset = QPoint() )

Flushes the given region from the specified window onto the screen.

The window must either be the top level window represented by this backingstore, or a non-transient child of that window. Passing \nullptr falls back to using the backingstore's top level window.

If the window is a child window, the region should be in child window coordinates, and the offset should be the child window's offset in relation to the backingstore's top level window.

You should call this function after ending painting with endPaint().

Definition at line 195 of file qbackingstore.cpp.

References QRegion::boundingRect(), QBackingStorePrivate::deviceIndependentToNativeFactor(), QPlatformBackingStore::flush(), handle(), Q_ASSERT, qAbs(), qMax(), qWarning, QHighDpi::scale(), QRect::topLeft(), window(), QPoint::x(), and QPoint::y().

Referenced by QRasterWindowPrivate::flush(), QVideoWindowPrivate::render(), and QSGSoftwareRenderThread::syncAndRender().

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

◆ handle()

QPlatformBackingStore * QBackingStore::handle ( ) const

Returns a pointer to the QPlatformBackingStore implementation.

Definition at line 349 of file qbackingstore.cpp.

References QBackingStorePrivate::platformBackingStore, QGuiApplicationPrivate::platformIntegration(), and QBackingStorePrivate::window.

Referenced by QBackingStore(), beginPaint(), QWidgetPrivate::create(), endPaint(), QSGSoftwareRenderThread::event(), flush(), paintDevice(), resize(), QWidgetRepaintManager::rhi(), and scroll().

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

◆ hasStaticContents()

bool QBackingStore::hasStaticContents ( ) const

Returns a boolean indicating if this window has static contents or not.

Definition at line 292 of file qbackingstore.cpp.

References QRegion::isEmpty(), and QBackingStorePrivate::staticContents.

+ Here is the call graph for this function:

◆ paintDevice()

QPaintDevice * QBackingStore::paintDevice ( )

Returns the paint device for this surface.

Warning
The device is only valid between calls to beginPaint() and endPaint(). You should not cache the returned value.

Definition at line 155 of file qbackingstore.cpp.

References QScopedPointer< T, Cleanup >::data(), device, handle(), QBackingStorePrivate::highDpiBackingstore, QInternal::Image, QHighDpiScaling::isActive(), and QPlatformBackingStore::paintDevice().

Referenced by endPaint(), QVideoWindowPrivate::render(), and QSGSoftwareRenderer::render().

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

◆ resize()

void QBackingStore::resize ( const QSize & size)

Sets the size of the window surface to size.

See also
size()

Definition at line 230 of file qbackingstore.cpp.

References QBackingStorePrivate::deviceIndependentToNativeFactor(), handle(), QPlatformBackingStore::resize(), QHighDpi::scale(), QBackingStorePrivate::size, size(), and QBackingStorePrivate::staticContents.

Referenced by beginPaint(), QRasterWindowPrivate::beginPaint(), QSGSoftwareRenderThread::event(), and QVideoWindowPrivate::render().

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

◆ scroll()

bool QBackingStore::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.

Definition at line 251 of file qbackingstore.cpp.

References area(), QBackingStorePrivate::deviceIndependentToNativeFactor(), handle(), qFloor(), QHighDpi::scale(), and QPlatformBackingStore::scroll().

Referenced by QWidgetRepaintManager::bltRect().

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

◆ setStaticContents()

void QBackingStore::setStaticContents ( const QRegion & region)

Set region as the static contents of this window.

Definition at line 268 of file qbackingstore.cpp.

References QPlatformIntegration::BackingStoreStaticContents, QGuiApplicationPrivate::platformIntegration(), qWarning, and QBackingStorePrivate::staticContents.

+ Here is the call graph for this function:

◆ size()

QSize QBackingStore::size ( ) const

Returns the current size of the window surface.

Definition at line 240 of file qbackingstore.cpp.

References QBackingStorePrivate::size.

Referenced by beginPaint(), QRasterWindowPrivate::beginPaint(), QSGSoftwareRenderThread::event(), QRasterWindowPrivate::handleResizeEvent(), QVideoWindowPrivate::render(), resize(), QWidgetRepaintManager::staticContents(), and QWidgetRepaintManager::sync().

+ Here is the caller graph for this function:

◆ staticContents()

QRegion QBackingStore::staticContents ( ) const

Returns a QRegion representing the area of the window that has static contents.

Definition at line 284 of file qbackingstore.cpp.

References QBackingStorePrivate::staticContents.

◆ window()

QWindow * QBackingStore::window ( ) const

Returns a pointer to the top-level window associated with this surface.

Definition at line 102 of file qbackingstore.cpp.

References QBackingStorePrivate::window.

Referenced by QBackingStore(), and flush().

+ Here is the caller graph for this function:

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