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
qpixmap_blitter_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 QPIXMAP_BLITTER_P_H
6#define QPIXMAP_BLITTER_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 purely as an
13// implementation detail. 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 <qpa/qplatformpixmap.h>
21#include <private/qpaintengine_blitter_p.h>
22
23#ifndef QT_NO_BLITTABLE
25
26class Q_GUI_EXPORT QBlittablePlatformPixmap : public QPlatformPixmap
27{
28// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap)
29public:
30 QBlittablePlatformPixmap();
31 ~QBlittablePlatformPixmap();
32
33 virtual QBlittable *createBlittable(const QSize &size, bool alpha) const = 0;
34 QBlittable *blittable() const;
35 void setBlittable(QBlittable *blittable);
36
37 void resize(int width, int height) override;
38 int metric(QPaintDevice::PaintDeviceMetric metric) const override;
39 void fill(const QColor &color) override;
40 QImage *buffer() override;
41 QImage toImage() const override;
42 bool hasAlphaChannel() const override;
43 void fromImage(const QImage &image, Qt::ImageConversionFlags flags) override;
44 qreal devicePixelRatio() const override;
45 void setDevicePixelRatio(qreal scaleFactor) override;
46
47 QPaintEngine *paintEngine() const override;
48
49 void markRasterOverlay(const QRectF &);
50 void markRasterOverlay(const QPointF &, const QTextItem &);
51 void markRasterOverlay(const QVectorPath &);
52 void markRasterOverlay(const QPainterPath &);
53 void markRasterOverlay(const QRect *rects, int rectCount);
54 void markRasterOverlay(const QRectF *rects, int rectCount);
55 void markRasterOverlay(const QPointF *points, int pointCount);
56 void markRasterOverlay(const QPoint *points, int pointCount);
57 void unmarkRasterOverlay(const QRectF &);
58
59#ifdef QT_BLITTER_RASTEROVERLAY
60 void mergeOverlay();
61 void unmergeOverlay();
62 QImage *overlay();
63
64#endif //QT_BLITTER_RASTEROVERLAY
65protected:
66 QScopedPointer<QBlitterPaintEngine> m_engine;
67 QScopedPointer<QBlittable> m_blittable;
68 bool m_alpha;
69 qreal m_devicePixelRatio;
70
71#ifdef QT_BLITTER_RASTEROVERLAY
72 QImage *m_rasterOverlay;
73 QImage *m_unmergedCopy;
74 QColor m_overlayColor;
75
76 void markRasterOverlayImpl(const QRectF &);
77 void unmarkRasterOverlayImpl(const QRectF &);
78 QRectF clipAndTransformRect(const QRectF &) const;
79#endif //QT_BLITTER_RASTEROVERLAY
80
81};
82
83inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF &rect)
84{
85#ifdef QT_BLITTER_RASTEROVERLAY
86 markRasterOverlayImpl(rect);
87#else
88 Q_UNUSED(rect);
89#endif
90}
91
92inline void QBlittablePlatformPixmap::markRasterOverlay(const QVectorPath &path)
93{
94#ifdef QT_BLITTER_RASTEROVERLAY
95 markRasterOverlayImpl(path.convertToPainterPath().boundingRect());
96#else
97 Q_UNUSED(path);
98#endif
99}
100
101inline void QBlittablePlatformPixmap::markRasterOverlay(const QPointF &pos, const QTextItem &ti)
102{
103#ifdef QT_BLITTER_RASTEROVERLAY
104 QFontMetricsF fm(ti.font());
105 QRectF rect = fm.tightBoundingRect(ti.text());
106 rect.moveBottomLeft(pos);
107 markRasterOverlay(rect);
108#else
109 Q_UNUSED(pos);
110 Q_UNUSED(ti);
111#endif
112}
113
114inline void QBlittablePlatformPixmap::markRasterOverlay(const QRect *rects, int rectCount)
115{
116#ifdef QT_BLITTER_RASTEROVERLAY
117 for (int i = 0; i < rectCount; i++) {
118 markRasterOverlay(rects[i]);
119 }
120#else
121 Q_UNUSED(rects);
122 Q_UNUSED(rectCount);
123#endif
124}
125inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF *rects, int rectCount)
126{
127#ifdef QT_BLITTER_RASTEROVERLAY
128 for (int i = 0; i < rectCount; i++) {
129 markRasterOverlay(rects[i]);
130 }
131#else
132 Q_UNUSED(rects);
133 Q_UNUSED(rectCount);
134#endif
135}
136
137inline void QBlittablePlatformPixmap::markRasterOverlay(const QPointF *points, int pointCount)
138{
139#ifdef QT_BLITTER_RASTEROVERLAY
140#error "not ported yet"
141#else
142 Q_UNUSED(points);
143 Q_UNUSED(pointCount);
144#endif
145}
146
147inline void QBlittablePlatformPixmap::markRasterOverlay(const QPoint *points, int pointCount)
148{
149#ifdef QT_BLITTER_RASTEROVERLAY
150#error "not ported yet"
151#else
152 Q_UNUSED(points);
153 Q_UNUSED(pointCount);
154#endif
155}
156
157inline void QBlittablePlatformPixmap::markRasterOverlay(const QPainterPath& path)
158{
159#ifdef QT_BLITTER_RASTEROVERLAY
160#error "not ported yet"
161#else
162 Q_UNUSED(path);
163#endif
164}
165
166inline void QBlittablePlatformPixmap::unmarkRasterOverlay(const QRectF &rect)
167{
168#ifdef QT_BLITTER_RASTEROVERLAY
169 unmarkRasterOverlayImpl(rect);
170#else
171 Q_UNUSED(rect);
172#endif
173}
174
175QT_END_NAMESPACE
176#endif // QT_NO_BLITTABLE
177#endif // QPIXMAP_BLITTER_P_H
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE int global_ser_no