| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | 
|---|
| 4 | ** Contact: https://www.qt.io/licensing/ | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | 
|---|
| 7 | ** | 
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 9 | ** Commercial License Usage | 
|---|
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | 
|---|
| 11 | ** accordance with the commercial license agreement provided with the | 
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | 
|---|
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | 
|---|
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | 
|---|
| 16 | ** | 
|---|
| 17 | ** GNU Lesser General Public License Usage | 
|---|
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 19 | ** General Public License version 3 as published by the Free Software | 
|---|
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | 
|---|
| 21 | ** packaging of this file. Please review the following information to | 
|---|
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | 
|---|
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | 
|---|
| 24 | ** | 
|---|
| 25 | ** GNU General Public License Usage | 
|---|
| 26 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | 
|---|
| 28 | ** Public license version 3 or any later version approved by the KDE Free | 
|---|
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | 
|---|
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | 
|---|
| 31 | ** included in the packaging of this file. Please review the following | 
|---|
| 32 | ** information to ensure the GNU General Public License requirements will | 
|---|
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | 
|---|
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** $QT_END_LICENSE$ | 
|---|
| 37 | ** | 
|---|
| 38 | ****************************************************************************/ | 
|---|
| 39 |  | 
|---|
| 40 | #ifndef QPAINTENGINEEX_P_H | 
|---|
| 41 | #define QPAINTENGINEEX_P_H | 
|---|
| 42 |  | 
|---|
| 43 | // | 
|---|
| 44 | //  W A R N I N G | 
|---|
| 45 | //  ------------- | 
|---|
| 46 | // | 
|---|
| 47 | // This file is not part of the Qt API.  It exists purely as an | 
|---|
| 48 | // implementation detail.  This header file may change from version to | 
|---|
| 49 | // version without notice, or even be removed. | 
|---|
| 50 | // | 
|---|
| 51 | // We mean it. | 
|---|
| 52 | // | 
|---|
| 53 |  | 
|---|
| 54 | #include <QtGui/private/qtguiglobal_p.h> | 
|---|
| 55 | #include <QtGui/qpaintengine.h> | 
|---|
| 56 |  | 
|---|
| 57 | #include <private/qpaintengine_p.h> | 
|---|
| 58 | #include <private/qstroker_p.h> | 
|---|
| 59 | #include <private/qpainter_p.h> | 
|---|
| 60 | #include <private/qvectorpath_p.h> | 
|---|
| 61 |  | 
|---|
| 62 |  | 
|---|
| 63 | QT_BEGIN_NAMESPACE | 
|---|
| 64 |  | 
|---|
| 65 |  | 
|---|
| 66 | class QPainterState; | 
|---|
| 67 | class QPaintEngineExPrivate; | 
|---|
| 68 | class QStaticTextItem; | 
|---|
| 69 | struct StrokeHandler; | 
|---|
| 70 |  | 
|---|
| 71 | #ifndef QT_NO_DEBUG_STREAM | 
|---|
| 72 | QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path); | 
|---|
| 73 | #endif | 
|---|
| 74 |  | 
|---|
| 75 | class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine | 
|---|
| 76 | { | 
|---|
| 77 | Q_DECLARE_PRIVATE(QPaintEngineEx) | 
|---|
| 78 | public: | 
|---|
| 79 | QPaintEngineEx(); | 
|---|
| 80 |  | 
|---|
| 81 | virtual QPainterState *createState(QPainterState *orig) const; | 
|---|
| 82 |  | 
|---|
| 83 | virtual void draw(const QVectorPath &path); | 
|---|
| 84 | virtual void fill(const QVectorPath &path, const QBrush &brush) = 0; | 
|---|
| 85 | virtual void stroke(const QVectorPath &path, const QPen &pen); | 
|---|
| 86 |  | 
|---|
| 87 | virtual void clip(const QVectorPath &path, Qt::ClipOperation op) = 0; | 
|---|
| 88 | virtual void clip(const QRect &rect, Qt::ClipOperation op); | 
|---|
| 89 | virtual void clip(const QRegion ®ion, Qt::ClipOperation op); | 
|---|
| 90 | virtual void clip(const QPainterPath &path, Qt::ClipOperation op); | 
|---|
| 91 |  | 
|---|
| 92 | virtual void clipEnabledChanged() = 0; | 
|---|
| 93 | virtual void penChanged() = 0; | 
|---|
| 94 | virtual void brushChanged() = 0; | 
|---|
| 95 | virtual void brushOriginChanged() = 0; | 
|---|
| 96 | virtual void opacityChanged() = 0; | 
|---|
| 97 | virtual void compositionModeChanged() = 0; | 
|---|
| 98 | virtual void renderHintsChanged() = 0; | 
|---|
| 99 | virtual void transformChanged() = 0; | 
|---|
| 100 |  | 
|---|
| 101 | virtual void fillRect(const QRectF &rect, const QBrush &brush); | 
|---|
| 102 | virtual void fillRect(const QRectF &rect, const QColor &color); | 
|---|
| 103 |  | 
|---|
| 104 | virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode); | 
|---|
| 105 |  | 
|---|
| 106 | virtual void drawRects(const QRect *rects, int rectCount) override; | 
|---|
| 107 | virtual void drawRects(const QRectF *rects, int rectCount) override; | 
|---|
| 108 |  | 
|---|
| 109 | virtual void drawLines(const QLine *lines, int lineCount) override; | 
|---|
| 110 | virtual void drawLines(const QLineF *lines, int lineCount) override; | 
|---|
| 111 |  | 
|---|
| 112 | virtual void drawEllipse(const QRectF &r) override; | 
|---|
| 113 | virtual void drawEllipse(const QRect &r) override; | 
|---|
| 114 |  | 
|---|
| 115 | virtual void drawPath(const QPainterPath &path) override; | 
|---|
| 116 |  | 
|---|
| 117 | virtual void drawPoints(const QPointF *points, int pointCount) override; | 
|---|
| 118 | virtual void drawPoints(const QPoint *points, int pointCount) override; | 
|---|
| 119 |  | 
|---|
| 120 | virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; | 
|---|
| 121 | virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override; | 
|---|
| 122 |  | 
|---|
| 123 | virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override = 0; | 
|---|
| 124 | virtual void drawPixmap(const QPointF &pos, const QPixmap &pm); | 
|---|
| 125 |  | 
|---|
| 126 | virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, | 
|---|
| 127 | Qt::ImageConversionFlags flags = Qt::AutoColor) override = 0; | 
|---|
| 128 | virtual void drawImage(const QPointF &pos, const QImage &image); | 
|---|
| 129 |  | 
|---|
| 130 | virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override; | 
|---|
| 131 |  | 
|---|
| 132 | virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, | 
|---|
| 133 | QFlags<QPainter::PixmapFragmentHint> hints); | 
|---|
| 134 |  | 
|---|
| 135 | virtual void updateState(const QPaintEngineState &state) override; | 
|---|
| 136 |  | 
|---|
| 137 | virtual void drawStaticTextItem(QStaticTextItem *); | 
|---|
| 138 |  | 
|---|
| 139 | virtual void setState(QPainterState *s); | 
|---|
| 140 | inline QPainterState *state() { return static_cast<QPainterState *>(QPaintEngine::state); } | 
|---|
| 141 | inline const QPainterState *state() const { return static_cast<const QPainterState *>(QPaintEngine::state); } | 
|---|
| 142 |  | 
|---|
| 143 | virtual void sync() {} | 
|---|
| 144 |  | 
|---|
| 145 | virtual void beginNativePainting() {} | 
|---|
| 146 | virtual void endNativePainting() {} | 
|---|
| 147 |  | 
|---|
| 148 | // These flags are needed in the implementation of paint buffers. | 
|---|
| 149 | enum Flags | 
|---|
| 150 | { | 
|---|
| 151 | DoNotEmulate = 0x01,        // If set, QPainter will not wrap this engine in an emulation engine. | 
|---|
| 152 | IsEmulationEngine = 0x02    // If set, this object is a QEmulationEngine. | 
|---|
| 153 | }; | 
|---|
| 154 | virtual uint flags() const {return 0;} | 
|---|
| 155 | virtual bool requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const; | 
|---|
| 156 | virtual bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const; | 
|---|
| 157 |  | 
|---|
| 158 | protected: | 
|---|
| 159 | QPaintEngineEx(QPaintEngineExPrivate &data); | 
|---|
| 160 | }; | 
|---|
| 161 |  | 
|---|
| 162 | class Q_GUI_EXPORT QPaintEngineExPrivate : public QPaintEnginePrivate | 
|---|
| 163 | { | 
|---|
| 164 | Q_DECLARE_PUBLIC(QPaintEngineEx) | 
|---|
| 165 | public: | 
|---|
| 166 | QPaintEngineExPrivate(); | 
|---|
| 167 | ~QPaintEngineExPrivate(); | 
|---|
| 168 |  | 
|---|
| 169 | void replayClipOperations(); | 
|---|
| 170 | bool hasClipOperations() const; | 
|---|
| 171 |  | 
|---|
| 172 | QStroker stroker; | 
|---|
| 173 | QDashStroker dasher; | 
|---|
| 174 | StrokeHandler *strokeHandler; | 
|---|
| 175 | QStrokerOps *activeStroker; | 
|---|
| 176 | QPen strokerPen; | 
|---|
| 177 |  | 
|---|
| 178 | QRect exDeviceRect; | 
|---|
| 179 | }; | 
|---|
| 180 |  | 
|---|
| 181 | QT_END_NAMESPACE | 
|---|
| 182 |  | 
|---|
| 183 | #endif | 
|---|
| 184 |  | 
|---|