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
20QT_REQUIRE_CONFIG(quick_canvas);
21
22#include "qquickcontext2d_p.h"
23QT_BEGIN_NAMESPACE
24
25class QQuickContext2DTexture;
26class QQuickContext2DCommandBuffer;
27
28class QQuickContext2DTile
29{
30public:
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
43protected:
44 virtual void aboutToDraw() {}
45 uint m_dirty : 1;
46 QRect m_rect;
47 QPaintDevice* m_device;
48 QPainter m_painter;
49};
50
51class QQuickContext2DImageTile : public QQuickContext2DTile
52{
53public:
54 QQuickContext2DImageTile();
55 ~QQuickContext2DImageTile();
56 void setRect(const QRect& r) override;
57 const QImage& image() const {return m_image;}
58private:
59 QImage m_image;
60};
61QT_END_NAMESPACE
62
63#endif // QQUICKCONTEXT2DTILE_P_H
64

source code of qtdeclarative/src/quick/items/context2d/qquickcontext2dtile_p.h