5#ifndef QBACKINGSTORE_COCOA_H
6#define QBACKINGSTORE_COCOA_H
8#include <QtGui/private/qrasterbackingstore_p.h>
10#include <private/qcore_mac_p.h>
12#include <QScopedPointer>
15#include <unordered_map>
19class QCocoaBackingStore :
public QPlatformBackingStore
22 QCocoaBackingStore(QWindow *window);
23 QCFType<CGColorSpaceRef> colorSpace()
const;
33 void resize(
const QSize &size,
const QRegion &staticContents)
override;
35 void beginPaint(
const QRegion ®ion)
override;
39 bool scroll(
const QRegion ®ion,
int dx,
int dy)
override;
41 void flush(QWindow *,
const QRegion &,
const QPoint &)
override;
44 qreal sourceDevicePixelRatio,
45 const QRegion ®ion,
47 QPlatformTextureList *textures,
48 bool translucentBackground,
49 qreal sourceTransformFactor)
override;
55 void observeBackingPropertiesChanges();
56 bool eventFilter(QObject *watched, QEvent *event)
override;
58 QSize m_requestedSize;
59 QRegion m_staticContents;
61 class GraphicsBuffer :
public QIOSurfaceGraphicsBuffer
64 GraphicsBuffer(
const QSize &size, qreal devicePixelRatio,
65 const QPixelFormat &format, QCFType<CGColorSpaceRef> colorSpace);
69 qreal devicePixelRatio()
const {
return m_devicePixelRatio; }
70 bool isDirty()
const {
return !dirtyRegion.isEmpty(); }
71 QRegion validRegion()
const;
74 qreal m_devicePixelRatio;
78 void updateDirtyStates(
const QRegion &paintedRegion);
80 void ensureBackBuffer();
81 bool recreateBackBufferIfNeeded();
82 void finalizeBackBuffer();
84 void blitBuffer(GraphicsBuffer *sourceBuffer,
const QRegion &sourceRegion,
85 GraphicsBuffer *destinationBuffer,
const QPoint &destinationOffset = QPoint());
87 void backingPropertiesChanged();
88 QMacNotificationObserver m_backingPropertiesObserver;
92 void flushSubWindow(QWindow *window);
94 void windowDestroyed(QObject *object);
95 bool m_clearSurfaceOnPaint =
true;
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.
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.
void endPaint() override
This function is called after painting onto the surface has ended.
void flush(QWindow *, const QRegion &, const QPoint &) override
Flushes the given region from the specified window.
void beginPaint(const QRegion ®ion) override
This function is called before painting onto the surface begins, with the region in which the paintin...
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...
QPlatformGraphicsBuffer * graphicsBuffer() const override
Accessor for a backingstores graphics buffer abstraction.
bool eventFilter(QObject *watched, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void resize(const QSize &size, const QRegion &staticContents) override
#define USE_LAZY_BUFFER_ALLOCATION_DURING_LIVE_WINDOW_RESIZE
QT_BEGIN_NAMESPACE void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &)