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
qfbbackingstore.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qfbbackingstore_p.h"
5#include "qfbwindow_p.h"
6#include "qfbscreen_p.h"
7
8#include <qpa/qplatformwindow.h>
9#include <QtGui/qscreen.h>
10#include <QtGui/qpainter.h>
11
13
16{
17 if (window->handle())
18 (static_cast<QFbWindow *>(window->handle()))->setBackingStore(this);
19 else
20 (static_cast<QFbScreen *>(window->screen()->handle()))->addPendingBackingStore(this);
21}
22
26
28{
31
32 (static_cast<QFbWindow *>(window->handle()))->repaint(region);
33}
34
35void QFbBackingStore::resize(const QSize &size, const QRegion &staticContents)
36{
37 Q_UNUSED(staticContents);
38
39 if (mImage.size() != size)
41}
42
44{
45 return mImage;
46}
47
48
50{
51 return mImage;
52}
53
58
63
65{
66 lock();
67
68 if (mImage.hasAlphaChannel()) {
70 p.setCompositionMode(QPainter::CompositionMode_Source);
71 for (const QRect &r : region)
72 p.fillRect(r, Qt::transparent);
73 }
74}
75
77{
78 unlock();
79}
80
void resize(const QSize &size, const QRegion &region) override
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
QImage toImage() const override
Implemented in subclasses to return the content of the backingstore as a QImage.
void endPaint() override
This function is called after painting onto the surface has ended.
void beginPaint(const QRegion &) override
This function is called before painting onto the surface begins, with the region in which the paintin...
const QImage image()
QFbBackingStore(QWindow *window)
\inmodule QtGui
Definition qimage.h:37
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false.
Definition qimage.cpp:4589
QSize size() const
Returns the size of the image, i.e.
void unlock() noexcept
Unlocks the mutex.
Definition qmutex.h:289
void lock() noexcept
Locks the mutex.
Definition qmutex.h:286
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
@ CompositionMode_Source
Definition qpainter.h:101
The QPlatformBackingStore class provides the drawing area for top-level windows.
QWindow * window() const
Returns a pointer to the top-level window associated with this surface.
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
QPlatformScreen * handle() const
Get the platform screen handle.
Definition qscreen.cpp:83
\inmodule QtCore
Definition qsize.h:25
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
@ transparent
Definition qnamespace.h:47
GLuint64 GLenum void * handle
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat p
[1]
QScreen * screen
[1]
Definition main.cpp:29
#define Q_UNUSED(x)
aWidget window() -> setWindowTitle("New Window Title")
[2]