Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qpaintengine_p.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 QPAINTENGINE_P_H
6#define QPAINTENGINE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists for the convenience
13// of other Qt classes. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtGui/private/qtguiglobal_p.h>
20#include "QtGui/qpainter.h"
21#include "QtGui/qpaintengine.h"
22#include "QtGui/qregion.h"
23#include "private/qobject_p.h"
24
25QT_BEGIN_NAMESPACE
26
27class QPaintDevice;
28
29class Q_GUI_EXPORT QPaintEnginePrivate
30{
31 Q_DECLARE_PUBLIC(QPaintEngine)
32public:
33 QPaintEnginePrivate() : pdev(nullptr), q_ptr(nullptr), currentClipDevice(nullptr), hasSystemTransform(0),
34 hasSystemViewport(0) {}
35 virtual ~QPaintEnginePrivate();
36
37 QPaintDevice *pdev;
44 QPaintDevice *currentClipDevice;
47
48 inline void updateSystemClip()
49 {
50 systemClip = baseSystemClip;
51 if (systemClip.isEmpty())
52 return;
53
55 if (systemTransform.type() <= QTransform::TxTranslate)
56 systemClip.translate(qRound(systemTransform.dx()), qRound(systemTransform.dy()));
57 else
58 systemClip = systemTransform.map(systemClip);
59 }
60
61 // Make sure we're inside the viewport.
63 systemClip &= systemViewport;
64 if (systemClip.isEmpty()) {
65 // We don't want to paint without system clip, so set it to 1 pixel :)
66 systemClip = QRect(systemViewport.boundingRect().topLeft(), QSize(1, 1));
67 }
68 }
69 }
70
71 inline void setSystemTransform(const QTransform &xform)
72 {
73 systemTransform = xform;
74 hasSystemTransform = !xform.isIdentity();
76 if (q_ptr->state)
77 systemStateChanged();
78 }
79
80 inline void setSystemViewport(const QRegion &region)
81 {
82 systemViewport = region;
83 hasSystemViewport = !systemViewport.isEmpty();
85 if (q_ptr->state)
86 systemStateChanged();
87 }
88
89 inline void setSystemTransformAndViewport(const QTransform &xform, const QRegion &region)
90 {
91 systemTransform = xform;
92 hasSystemTransform = !xform.isIdentity();
93 systemViewport = region;
94 hasSystemViewport = !systemViewport.isEmpty();
96 if (q_ptr->state)
97 systemStateChanged();
98 }
99
100 virtual void systemStateChanged() { }
101
102 void drawBoxTextItem(const QPointF &p, const QTextItemInt &ti);
103
104 static QPaintEnginePrivate *get(QPaintEngine *paintEngine) { return paintEngine->d_func(); }
105
106 virtual QPaintEngine *aggregateEngine() { return nullptr; }
107 virtual Qt::HANDLE nativeHandle() { return nullptr; }
108};
109
110QT_END_NAMESPACE
111
112#endif // QPAINTENGINE_P_H
QObject * q_ptr
Definition qobject.h:73
void setSystemViewport(const QRegion &region)
void setSystemTransform(const QTransform &xform)
QPaintDevice * currentClipDevice
QTransform systemTransform
static QPaintEnginePrivate * get(QPaintEngine *paintEngine)
virtual void systemStateChanged()
void setSystemTransformAndViewport(const QTransform &xform, const QRegion &region)
QPaintDevice * pdev
void drawBoxTextItem(const QPointF &p, const QTextItemInt &ti)
virtual Qt::HANDLE nativeHandle()
virtual QPaintEngine * aggregateEngine()
friend class QPainter
friend class QPaintEngine
Definition qpainter.h:438
\inmodule QtCore\reentrant
Definition qpoint.h:232
Internal QTextItem.
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QT_PointF, Q_PRIMITIVE_TYPE)
Q_GUI_EXPORT void qt_draw_tile(QPaintEngine *gc, qreal x, qreal y, qreal w, qreal h, const QPixmap &pixmap, qreal xOffset, qreal yOffset)
void qt_fill_tile(QPixmap *tile, const QPixmap &pixmap)
Q_DECLARE_TYPEINFO(QT_Point, Q_PRIMITIVE_TYPE)
static QPaintEngine * qt_polygon_recursion