| 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 | #ifndef QQUICKCONTEXT2DTILE_P_H |
| 5 | #define QQUICKCONTEXT2DTILE_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <private/qtquickglobal_p.h> |
| 19 | |
| 20 | QT_REQUIRE_CONFIG(quick_canvas); |
| 21 | |
| 22 | #include "qquickcontext2d_p.h" |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | class QQuickContext2DTexture; |
| 26 | class QQuickContext2DCommandBuffer; |
| 27 | |
| 28 | class QQuickContext2DTile |
| 29 | { |
| 30 | public: |
| 31 | QQuickContext2DTile(); |
| 32 | virtual ~QQuickContext2DTile(); |
| 33 | |
| 34 | bool dirty() const {return m_dirty;} |
| 35 | void markDirty(bool dirty) {m_dirty = dirty;} |
| 36 | |
| 37 | QRect rect() const {return m_rect;} |
| 38 | |
| 39 | virtual void setRect(const QRect& r) = 0; |
| 40 | virtual QPainter* createPainter(bool smooth, bool antialiasing); |
| 41 | virtual void drawFinished() {} |
| 42 | |
| 43 | protected: |
| 44 | virtual void aboutToDraw() {} |
| 45 | uint m_dirty : 1; |
| 46 | QRect m_rect; |
| 47 | QPaintDevice* m_device; |
| 48 | QPainter m_painter; |
| 49 | }; |
| 50 | |
| 51 | class QQuickContext2DImageTile : public QQuickContext2DTile |
| 52 | { |
| 53 | public: |
| 54 | QQuickContext2DImageTile(); |
| 55 | ~QQuickContext2DImageTile(); |
| 56 | void setRect(const QRect& r) override; |
| 57 | const QImage& image() const {return m_image;} |
| 58 | private: |
| 59 | QImage m_image; |
| 60 | }; |
| 61 | QT_END_NAMESPACE |
| 62 | |
| 63 | #endif // QQUICKCONTEXT2DTILE_P_H |
| 64 | |