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
qwindowsdirect2dbackingstore.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
12
13#include "qwindowscontext.h"
14
15#include <QtGui/qpainter.h>
16#include <QtGui/qwindow.h>
17#include <QtCore/qdebug.h>
18
20
28{
29 return static_cast<QWindowsDirect2DPlatformPixmap *>(p->handle());
30}
31
33{
34 return platformPixmap(p)->bitmap();
35}
36
38{
39 return static_cast<QWindowsDirect2DWindow *>(window->handle());
40}
41
46
50
52{
53 QPixmap *pixmap = nativeWindow(window())->pixmap();
54 bitmap(pixmap)->deviceContext()->begin();
55
58
60
61 for (const QRect &r : region)
63}
64
66{
67 bitmap(nativeWindow(window())->pixmap())->deviceContext()->end();
68}
69
74
75void QWindowsDirect2DBackingStore::flush(QWindow *targetWindow, const QRegion &region, const QPoint &offset)
76{
77 if (targetWindow != window()) {
78 QSharedPointer<QWindowsDirect2DBitmap> copy(nativeWindow(window())->copyBackBuffer());
79 nativeWindow(targetWindow)->flush(copy.data(), region, offset);
80 }
81
82 nativeWindow(targetWindow)->present(region);
83}
84
86{
87 QPixmap old = nativeWindow(window())->pixmap()->copy();
88
89 nativeWindow(window())->resizeSwapChain(size);
90 QPixmap *newPixmap = nativeWindow(window())->pixmap();
91
92 if (!old.isNull()) {
93 for (const QRect &rect : region)
94 platformPixmap(newPixmap)->copy(old.handle(), rect);
95 }
96}
97
99{
100 return nativeWindow(window())->pixmap()->toImage();
101}
102
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtGui
Definition qimage.h:37
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
@ CompositionMode_Source
Definition qpainter.h:101
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition qpixmap.cpp:456
QPlatformPixmap * handle() const
Definition qpixmap.cpp:1506
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
\inmodule QtCore
Definition qsize.h:25
\inmodule QtGui
Definition qwindow.h:63
void resize(const QSize &size, const QRegion &staticContents) override
void beginPaint(const QRegion &) override
This function is called before painting onto the surface begins, with the region in which the paintin...
void endPaint() override
This function is called after painting onto the surface has ended.
void flush(QWindow *targetWindow, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
QImage toImage() const override
Implemented in subclasses to return the content of the backingstore as a QImage.
b clear()
rect
[4]
Combined button and popup list for selecting options.
@ transparent
Definition qnamespace.h:47
static jboolean copy(JNIEnv *, jobject)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLenum GLuint GLintptr offset
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
GLfloat GLfloat p
[1]
static QWindowsDirect2DPlatformPixmap * platformPixmap(QPixmap *p)
static QWindowsDirect2DWindow * nativeWindow(QWindow *window)
widget render & pixmap
QPainter painter(this)
[7]
aWidget window() -> setWindowTitle("New Window Title")
[2]