Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qcocoabackingstore.h
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QBACKINGSTORE_COCOA_H
6
#
define
QBACKINGSTORE_COCOA_H
7
8
#
include
<
QtGui
/
private
/
qrasterbackingstore_p
.
h
>
9
10
#
include
<
private
/
qcore_mac_p
.
h
>
11
12
#
include
<
QScopedPointer
>
13
#
include
"qiosurfacegraphicsbuffer.h"
14
15
#
include
<
unordered_map
>
16
17
QT_BEGIN_NAMESPACE
18
19
class
QCocoaBackingStore :
public
QPlatformBackingStore
20
{
21
protected
:
22
QCocoaBackingStore(QWindow *window);
23
QCFType<CGColorSpaceRef> colorSpace()
const
;
24
};
25
26
class
QCALayerBackingStore
:
public
QObject
,
public
QCocoaBackingStore
27
{
28
Q_OBJECT
29
public
:
30
QCALayerBackingStore
(
QWindow
*
window
);
31
~
QCALayerBackingStore
();
32
33
void
resize
(
const
QSize &size,
const
QRegion &staticContents)
override
;
34
35
void
beginPaint
(
const
QRegion ®ion)
override
;
36
QPaintDevice
*
paintDevice
()
override
;
37
void
endPaint
()
override
;
38
39
bool
scroll
(
const
QRegion ®ion,
int
dx,
int
dy)
override
;
40
41
void
flush
(QWindow *,
const
QRegion &,
const
QPoint &)
override
;
42
43
FlushResult
rhiFlush
(QWindow *window,
44
qreal sourceDevicePixelRatio,
45
const
QRegion ®ion,
46
const
QPoint &offset,
47
QPlatformTextureList *textures,
48
bool
translucentBackground,
49
qreal sourceTransformFactor)
override
;
50
51
QImage
toImage
()
const
override
;
52
QPlatformGraphicsBuffer
*
graphicsBuffer
()
const
override
;
53
54
private
:
55
void
observeBackingPropertiesChanges();
56
bool
eventFilter
(QObject *watched, QEvent *event)
override
;
57
58
QSize m_requestedSize;
59
QRegion m_staticContents;
60
61
class
GraphicsBuffer :
public
QIOSurfaceGraphicsBuffer
62
{
63
public
:
64
GraphicsBuffer(
const
QSize &size, qreal devicePixelRatio,
65
const
QPixelFormat &format, QCFType<CGColorSpaceRef> colorSpace);
66
67
QRegion dirtyRegion;
// In unscaled coordinates
68
QImage *asImage();
69
qreal devicePixelRatio()
const
{
return
m_devicePixelRatio; }
70
bool
isDirty()
const
{
return
!dirtyRegion.isEmpty(); }
71
QRegion validRegion()
const
;
72
73
private
:
74
qreal m_devicePixelRatio;
75
QImage m_image;
76
};
77
78
void
updateDirtyStates(
const
QRegion &paintedRegion);
79
80
void
ensureBackBuffer();
81
bool
recreateBackBufferIfNeeded();
82
void
finalizeBackBuffer();
83
84
void
blitBuffer(GraphicsBuffer *sourceBuffer,
const
QRegion &sourceRegion,
85
GraphicsBuffer *destinationBuffer,
const
QPoint &destinationOffset = QPoint());
86
87
void
backingPropertiesChanged();
88
QMacNotificationObserver m_backingPropertiesObserver;
89
90
std
::
list
<
std
::
unique_ptr
<
GraphicsBuffer
>>
m_buffers
;
91
92
void
flushSubWindow(QWindow *window);
93
std
::
unordered_map
<
QWindow
*,
std
::
unique_ptr
<
QCALayerBackingStore
>>
m_subWindowBackingstores
;
94
void
windowDestroyed(QObject *object);
95
bool
m_clearSurfaceOnPaint =
true
;
96
};
97
98
QT_END_NAMESPACE
99
100
#
endif
QCALayerBackingStore
Definition
qcocoabackingstore.h:27
QCALayerBackingStore::paintDevice
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
Definition
qcocoabackingstore.mm:251
QCALayerBackingStore::toImage
QImage toImage() const override
Implemented in subclasses to return the content of the backingstore as a QImage.
Definition
qcocoabackingstore.mm:489
QCALayerBackingStore::scroll
bool scroll(const QRegion ®ion, int dx, int dy) override
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative.
Definition
qcocoabackingstore.mm:273
QCALayerBackingStore::endPaint
void endPaint() override
This function is called after painting onto the surface has ended.
Definition
qcocoabackingstore.mm:261
QCALayerBackingStore::flush
void flush(QWindow *, const QRegion &, const QPoint &) override
Flushes the given region from the specified window.
Definition
qcocoabackingstore.mm:330
QCALayerBackingStore::beginPaint
void beginPaint(const QRegion ®ion) override
This function is called before painting onto the surface begins, with the region in which the paintin...
Definition
qcocoabackingstore.mm:84
QCALayerBackingStore::rhiFlush
FlushResult rhiFlush(QWindow *window, qreal sourceDevicePixelRatio, const QRegion ®ion, const QPoint &offset, QPlatformTextureList *textures, bool translucentBackground, qreal sourceTransformFactor) override
Flushes the given region from the specified window, and compositing it with the specified textures li...
Definition
qcocoabackingstore.mm:470
QCALayerBackingStore::graphicsBuffer
QPlatformGraphicsBuffer * graphicsBuffer() const override
Accessor for a backingstores graphics buffer abstraction.
Definition
qcocoabackingstore.mm:525
QCALayerBackingStore::eventFilter
bool eventFilter(QObject *watched, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
Definition
qcocoabackingstore.mm:60
QCALayerBackingStore::~QCALayerBackingStore
~QCALayerBackingStore()
Definition
qcocoabackingstore.mm:46
QCALayerBackingStore::resize
void resize(const QSize &size, const QRegion &staticContents) override
Definition
qcocoabackingstore.mm:75
QCocoaWindow
Definition
qcocoawindow.h:74
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
USE_LAZY_BUFFER_ALLOCATION_DURING_LIVE_WINDOW_RESIZE
#define USE_LAZY_BUFFER_ALLOCATION_DURING_LIVE_WINDOW_RESIZE
Definition
qcocoabackingstore.mm:169
qt_scrollRectInImage
QT_BEGIN_NAMESPACE void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &)
Definition
qbackingstore.cpp:305
qtbase
src
plugins
platforms
cocoa
qcocoabackingstore.h
Generated on
for Qt by
1.18.0