Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qpaintengine_blitter.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||||||||
2 | ** | - | ||||||||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||
5 | ** | - | ||||||||||||||||||
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||||||||
7 | ** | - | ||||||||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||
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 http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
15 | ** information use the contact form at http://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 2.1 or version 3 as published by the Free | - | ||||||||||||||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||
25 | ** | - | ||||||||||||||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||
29 | ** | - | ||||||||||||||||||
30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
31 | ** | - | ||||||||||||||||||
32 | ****************************************************************************/ | - | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | #include "private/qpaintengine_blitter_p.h" | - | ||||||||||||||||||
35 | - | |||||||||||||||||||
36 | #include "private/qblittable_p.h" | - | ||||||||||||||||||
37 | #include "private/qpaintengine_raster_p.h" | - | ||||||||||||||||||
38 | #include "private/qpainter_p.h" | - | ||||||||||||||||||
39 | #include "private/qpixmap_blitter_p.h" | - | ||||||||||||||||||
40 | - | |||||||||||||||||||
41 | #ifndef QT_NO_BLITTABLE | - | ||||||||||||||||||
42 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | #define STATE_XFORM_SCALE 0x00000001 | - | ||||||||||||||||||
45 | #define STATE_XFORM_COMPLEX 0x00000002 | - | ||||||||||||||||||
46 | - | |||||||||||||||||||
47 | #define STATE_BRUSH_PATTERN 0x00000010 | - | ||||||||||||||||||
48 | #define STATE_BRUSH_ALPHA 0x00000020 | - | ||||||||||||||||||
49 | - | |||||||||||||||||||
50 | #define STATE_PEN_ENABLED 0x00000100 | - | ||||||||||||||||||
51 | - | |||||||||||||||||||
52 | #define STATE_ANTIALIASING 0x00001000 | - | ||||||||||||||||||
53 | #define STATE_ALPHA 0x00002000 | - | ||||||||||||||||||
54 | #define STATE_BLENDING_COMPLEX 0x00004000 | - | ||||||||||||||||||
55 | - | |||||||||||||||||||
56 | #define STATE_CLIPSYS_COMPLEX 0x00010000 | - | ||||||||||||||||||
57 | #define STATE_CLIP_COMPLEX 0x00020000 | - | ||||||||||||||||||
58 | - | |||||||||||||||||||
59 | - | |||||||||||||||||||
60 | class CapabilitiesToStateMask | - | ||||||||||||||||||
61 | { | - | ||||||||||||||||||
62 | public: | - | ||||||||||||||||||
63 | CapabilitiesToStateMask(QBlittable::Capabilities capabilities) | - | ||||||||||||||||||
64 | : m_capabilities(capabilities) | - | ||||||||||||||||||
65 | , fillRectMask(0) | - | ||||||||||||||||||
66 | , drawRectMask(0) | - | ||||||||||||||||||
67 | , drawPixmapMask(0) | - | ||||||||||||||||||
68 | , alphaFillRectMask(0) | - | ||||||||||||||||||
69 | , opacityPixmapMask(0) | - | ||||||||||||||||||
70 | , capabillitiesState(0) | - | ||||||||||||||||||
71 | { | - | ||||||||||||||||||
72 | if (capabilities & QBlittable::SolidRectCapability)
| 0 | ||||||||||||||||||
73 | setFillRectMask(); never executed: setFillRectMask(); | 0 | ||||||||||||||||||
74 | if (capabilities & QBlittable::SourcePixmapCapability)
| 0 | ||||||||||||||||||
75 | setSourcePixmapMask(); never executed: setSourcePixmapMask(); | 0 | ||||||||||||||||||
76 | if (capabilities & QBlittable::SourceOverPixmapCapability)
| 0 | ||||||||||||||||||
77 | setSourceOverPixmapMask(); never executed: setSourceOverPixmapMask(); | 0 | ||||||||||||||||||
78 | if (capabilities & QBlittable::SourceOverScaledPixmapCapability)
| 0 | ||||||||||||||||||
79 | setSourceOverScaledPixmapMask(); never executed: setSourceOverScaledPixmapMask(); | 0 | ||||||||||||||||||
80 | if (capabilities & QBlittable::AlphaFillRectCapability)
| 0 | ||||||||||||||||||
81 | setAlphaFillRectMask(); never executed: setAlphaFillRectMask(); | 0 | ||||||||||||||||||
82 | if (capabilities & QBlittable::OpacityPixmapCapability)
| 0 | ||||||||||||||||||
83 | setOpacityPixmapMask(); never executed: setOpacityPixmapMask(); | 0 | ||||||||||||||||||
84 | } never executed: end of block | 0 | ||||||||||||||||||
85 | - | |||||||||||||||||||
86 | inline bool canBlitterFillRect() const | - | ||||||||||||||||||
87 | { | - | ||||||||||||||||||
88 | return checkStateAgainstMask(capabillitiesState, fillRectMask); never executed: return checkStateAgainstMask(capabillitiesState, fillRectMask); | 0 | ||||||||||||||||||
89 | } | - | ||||||||||||||||||
90 | - | |||||||||||||||||||
91 | inline bool canBlitterAlphaFillRect() const | - | ||||||||||||||||||
92 | { | - | ||||||||||||||||||
93 | return checkStateAgainstMask(capabillitiesState, alphaFillRectMask); never executed: return checkStateAgainstMask(capabillitiesState, alphaFillRectMask); | 0 | ||||||||||||||||||
94 | } | - | ||||||||||||||||||
95 | - | |||||||||||||||||||
96 | inline bool canBlitterDrawRectMask() const | - | ||||||||||||||||||
97 | { | - | ||||||||||||||||||
98 | return checkStateAgainstMask(capabillitiesState, drawRectMask); never executed: return checkStateAgainstMask(capabillitiesState, drawRectMask); | 0 | ||||||||||||||||||
99 | } | - | ||||||||||||||||||
100 | - | |||||||||||||||||||
101 | bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const | - | ||||||||||||||||||
102 | { | - | ||||||||||||||||||
103 | if (pm.handle()->classId() != QPlatformPixmap::BlitterClass)
| 0 | ||||||||||||||||||
104 | return false; never executed: return false; | 0 | ||||||||||||||||||
105 | if (checkStateAgainstMask(capabillitiesState, drawPixmapMask)) {
| 0 | ||||||||||||||||||
106 | if (m_capabilities & (QBlittable::SourceOverPixmapCapability
| 0 | ||||||||||||||||||
107 | | QBlittable::SourceOverScaledPixmapCapability)) {
| 0 | ||||||||||||||||||
108 | if (r.size() != sr.size())
| 0 | ||||||||||||||||||
109 | return m_capabilities & QBlittable::SourceOverScaledPixmapCapability; never executed: return m_capabilities & QBlittable::SourceOverScaledPixmapCapability; | 0 | ||||||||||||||||||
110 | else | - | ||||||||||||||||||
111 | return m_capabilities & QBlittable::SourceOverPixmapCapability; never executed: return m_capabilities & QBlittable::SourceOverPixmapCapability; | 0 | ||||||||||||||||||
112 | } | - | ||||||||||||||||||
113 | if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel())
| 0 | ||||||||||||||||||
114 | return m_capabilities & QBlittable::SourcePixmapCapability; never executed: return m_capabilities & QBlittable::SourcePixmapCapability; | 0 | ||||||||||||||||||
115 | } never executed: end of block | 0 | ||||||||||||||||||
116 | return false; never executed: return false; | 0 | ||||||||||||||||||
117 | } | - | ||||||||||||||||||
118 | - | |||||||||||||||||||
119 | bool canBlitterDrawPixmapOpacity(const QPixmap &pm) const | - | ||||||||||||||||||
120 | { | - | ||||||||||||||||||
121 | if (pm.handle()->classId() != QPlatformPixmap::BlitterClass)
| 0 | ||||||||||||||||||
122 | return false; never executed: return false; | 0 | ||||||||||||||||||
123 | - | |||||||||||||||||||
124 | return checkStateAgainstMask(capabillitiesState, opacityPixmapMask); never executed: return checkStateAgainstMask(capabillitiesState, opacityPixmapMask); | 0 | ||||||||||||||||||
125 | } | - | ||||||||||||||||||
126 | - | |||||||||||||||||||
127 | bool canBlitterDrawCachedGlyphs(const QTransform &transform, QFontEngine::GlyphFormat requestedGlyphFormat, bool complexClip) const | - | ||||||||||||||||||
128 | { | - | ||||||||||||||||||
129 | if (transform.type() > QTransform::TxScale)
| 0 | ||||||||||||||||||
130 | return false; never executed: return false; | 0 | ||||||||||||||||||
131 | if (!(m_capabilities & QBlittable::DrawScaledCachedGlyphsCapability))
| 0 | ||||||||||||||||||
132 | return false; never executed: return false; | 0 | ||||||||||||||||||
133 | if (requestedGlyphFormat == QFontEngine::Format_ARGB && !(m_capabilities & QBlittable::SubPixelGlyphsCapability))
| 0 | ||||||||||||||||||
134 | return false; never executed: return false; | 0 | ||||||||||||||||||
135 | if (complexClip && !(m_capabilities & QBlittable::ComplexClipCapability))
| 0 | ||||||||||||||||||
136 | return false; never executed: return false; | 0 | ||||||||||||||||||
137 | return true; never executed: return true; | 0 | ||||||||||||||||||
138 | } | - | ||||||||||||||||||
139 | - | |||||||||||||||||||
140 | inline void updateState(uint mask, bool on) { | - | ||||||||||||||||||
141 | updateStateBits(&capabillitiesState, mask, on); | - | ||||||||||||||||||
142 | } never executed: end of block | 0 | ||||||||||||||||||
143 | - | |||||||||||||||||||
144 | private: | - | ||||||||||||||||||
145 | - | |||||||||||||||||||
146 | static inline void updateStateBits(uint *state, uint mask, bool on) | - | ||||||||||||||||||
147 | { | - | ||||||||||||||||||
148 | *state = on ? (*state | mask) : (*state & ~mask);
| 0 | ||||||||||||||||||
149 | } never executed: end of block | 0 | ||||||||||||||||||
150 | - | |||||||||||||||||||
151 | static inline bool checkStateAgainstMask(uint state, uint mask) | - | ||||||||||||||||||
152 | { | - | ||||||||||||||||||
153 | return !state || (state & mask && !(state & ~mask)); never executed: return !state || (state & mask && !(state & ~mask));
| 0 | ||||||||||||||||||
154 | } | - | ||||||||||||||||||
155 | - | |||||||||||||||||||
156 | void setFillRectMask() { | - | ||||||||||||||||||
157 | updateStateBits(&fillRectMask, STATE_XFORM_SCALE, false); | - | ||||||||||||||||||
158 | updateStateBits(&fillRectMask, STATE_XFORM_COMPLEX, false); | - | ||||||||||||||||||
159 | - | |||||||||||||||||||
160 | updateStateBits(&fillRectMask, STATE_BRUSH_PATTERN, false); | - | ||||||||||||||||||
161 | updateStateBits(&fillRectMask, STATE_BRUSH_ALPHA, false); | - | ||||||||||||||||||
162 | - | |||||||||||||||||||
163 | updateStateBits(&fillRectMask, STATE_PEN_ENABLED, true); | - | ||||||||||||||||||
164 | - | |||||||||||||||||||
165 | //Sub-pixel aliasing should not be sent to the blitter | - | ||||||||||||||||||
166 | updateStateBits(&fillRectMask, STATE_ANTIALIASING, true); | - | ||||||||||||||||||
167 | updateStateBits(&fillRectMask, STATE_ALPHA, false); | - | ||||||||||||||||||
168 | updateStateBits(&fillRectMask, STATE_BLENDING_COMPLEX, false); | - | ||||||||||||||||||
169 | - | |||||||||||||||||||
170 | updateStateBits(&fillRectMask, STATE_CLIPSYS_COMPLEX, false); | - | ||||||||||||||||||
171 | updateStateBits(&fillRectMask, STATE_CLIP_COMPLEX, false); | - | ||||||||||||||||||
172 | } never executed: end of block | 0 | ||||||||||||||||||
173 | - | |||||||||||||||||||
174 | void setAlphaFillRectMask() { | - | ||||||||||||||||||
175 | updateStateBits(&alphaFillRectMask, STATE_XFORM_SCALE, false); | - | ||||||||||||||||||
176 | updateStateBits(&alphaFillRectMask, STATE_XFORM_COMPLEX, false); | - | ||||||||||||||||||
177 | - | |||||||||||||||||||
178 | updateStateBits(&alphaFillRectMask, STATE_BRUSH_PATTERN, false); | - | ||||||||||||||||||
179 | updateStateBits(&alphaFillRectMask, STATE_BRUSH_ALPHA, true); | - | ||||||||||||||||||
180 | - | |||||||||||||||||||
181 | updateStateBits(&alphaFillRectMask, STATE_PEN_ENABLED, true); | - | ||||||||||||||||||
182 | - | |||||||||||||||||||
183 | //Sub-pixel aliasing should not be sent to the blitter | - | ||||||||||||||||||
184 | updateStateBits(&alphaFillRectMask, STATE_ANTIALIASING, true); | - | ||||||||||||||||||
185 | updateStateBits(&alphaFillRectMask, STATE_ALPHA, false); | - | ||||||||||||||||||
186 | updateStateBits(&alphaFillRectMask, STATE_BLENDING_COMPLEX, false); | - | ||||||||||||||||||
187 | - | |||||||||||||||||||
188 | updateStateBits(&alphaFillRectMask, STATE_CLIPSYS_COMPLEX, false); | - | ||||||||||||||||||
189 | updateStateBits(&alphaFillRectMask, STATE_CLIP_COMPLEX, false); | - | ||||||||||||||||||
190 | } never executed: end of block | 0 | ||||||||||||||||||
191 | - | |||||||||||||||||||
192 | void setSourcePixmapMask() { | - | ||||||||||||||||||
193 | updateStateBits(&drawPixmapMask, STATE_XFORM_SCALE, true); | - | ||||||||||||||||||
194 | updateStateBits(&drawPixmapMask, STATE_XFORM_COMPLEX, false); | - | ||||||||||||||||||
195 | - | |||||||||||||||||||
196 | updateStateBits(&drawPixmapMask, STATE_BRUSH_PATTERN, true); | - | ||||||||||||||||||
197 | updateStateBits(&drawPixmapMask, STATE_BRUSH_ALPHA, false); | - | ||||||||||||||||||
198 | - | |||||||||||||||||||
199 | updateStateBits(&drawPixmapMask, STATE_PEN_ENABLED, true); | - | ||||||||||||||||||
200 | - | |||||||||||||||||||
201 | updateStateBits(&drawPixmapMask, STATE_ANTIALIASING, true); | - | ||||||||||||||||||
202 | updateStateBits(&drawPixmapMask, STATE_ALPHA, false); | - | ||||||||||||||||||
203 | updateStateBits(&drawPixmapMask, STATE_BLENDING_COMPLEX, false); | - | ||||||||||||||||||
204 | - | |||||||||||||||||||
205 | updateStateBits(&drawPixmapMask, STATE_CLIPSYS_COMPLEX, false); | - | ||||||||||||||||||
206 | updateStateBits(&drawPixmapMask, STATE_CLIP_COMPLEX, false); | - | ||||||||||||||||||
207 | } never executed: end of block | 0 | ||||||||||||||||||
208 | - | |||||||||||||||||||
209 | void setSourceOverPixmapMask() { | - | ||||||||||||||||||
210 | setSourcePixmapMask(); | - | ||||||||||||||||||
211 | } never executed: end of block | 0 | ||||||||||||||||||
212 | - | |||||||||||||||||||
213 | void setSourceOverScaledPixmapMask() { | - | ||||||||||||||||||
214 | setSourceOverPixmapMask(); | - | ||||||||||||||||||
215 | updateStateBits(&drawRectMask, STATE_XFORM_SCALE, true); | - | ||||||||||||||||||
216 | } never executed: end of block | 0 | ||||||||||||||||||
217 | - | |||||||||||||||||||
218 | void setOpacityPixmapMask() { | - | ||||||||||||||||||
219 | updateStateBits(&opacityPixmapMask, STATE_XFORM_SCALE, true); | - | ||||||||||||||||||
220 | updateStateBits(&opacityPixmapMask, STATE_XFORM_COMPLEX, false); | - | ||||||||||||||||||
221 | - | |||||||||||||||||||
222 | updateStateBits(&opacityPixmapMask, STATE_BRUSH_PATTERN, true); | - | ||||||||||||||||||
223 | updateStateBits(&opacityPixmapMask, STATE_BRUSH_ALPHA, true); | - | ||||||||||||||||||
224 | - | |||||||||||||||||||
225 | updateStateBits(&opacityPixmapMask, STATE_PEN_ENABLED, true); | - | ||||||||||||||||||
226 | - | |||||||||||||||||||
227 | updateStateBits(&opacityPixmapMask, STATE_ANTIALIASING, true); | - | ||||||||||||||||||
228 | updateStateBits(&opacityPixmapMask, STATE_ALPHA, true); | - | ||||||||||||||||||
229 | updateStateBits(&opacityPixmapMask, STATE_BLENDING_COMPLEX, false); | - | ||||||||||||||||||
230 | - | |||||||||||||||||||
231 | updateStateBits(&opacityPixmapMask, STATE_CLIPSYS_COMPLEX, false); | - | ||||||||||||||||||
232 | updateStateBits(&opacityPixmapMask, STATE_CLIP_COMPLEX, false); | - | ||||||||||||||||||
233 | } never executed: end of block | 0 | ||||||||||||||||||
234 | - | |||||||||||||||||||
235 | QBlittable::Capabilities m_capabilities; | - | ||||||||||||||||||
236 | uint fillRectMask; | - | ||||||||||||||||||
237 | uint drawRectMask; | - | ||||||||||||||||||
238 | uint drawPixmapMask; | - | ||||||||||||||||||
239 | uint alphaFillRectMask; | - | ||||||||||||||||||
240 | uint opacityPixmapMask; | - | ||||||||||||||||||
241 | uint capabillitiesState; | - | ||||||||||||||||||
242 | }; | - | ||||||||||||||||||
243 | - | |||||||||||||||||||
244 | class QBlitterPaintEnginePrivate : public QRasterPaintEnginePrivate | - | ||||||||||||||||||
245 | { | - | ||||||||||||||||||
246 | Q_DECLARE_PUBLIC(QBlitterPaintEngine) | - | ||||||||||||||||||
247 | public: | - | ||||||||||||||||||
248 | QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p) | - | ||||||||||||||||||
249 | : QRasterPaintEnginePrivate() | - | ||||||||||||||||||
250 | , pmData(p) | - | ||||||||||||||||||
251 | , caps(pmData->blittable()->capabilities()) | - | ||||||||||||||||||
252 | , hasXForm(false) | - | ||||||||||||||||||
253 | - | |||||||||||||||||||
254 | {} never executed: end of block | 0 | ||||||||||||||||||
255 | - | |||||||||||||||||||
256 | void lock(); | - | ||||||||||||||||||
257 | void unlock(); | - | ||||||||||||||||||
258 | void fillRect(const QRectF &rect, const QColor &color, bool alpha); | - | ||||||||||||||||||
259 | void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity); | - | ||||||||||||||||||
260 | - | |||||||||||||||||||
261 | - | |||||||||||||||||||
262 | void updateCompleteState(QPainterState *s); | - | ||||||||||||||||||
263 | void updatePenState(QPainterState *s); | - | ||||||||||||||||||
264 | void updateBrushState(QPainterState *s); | - | ||||||||||||||||||
265 | void updateOpacityState(QPainterState *s); | - | ||||||||||||||||||
266 | void updateCompositionModeState(QPainterState *s); | - | ||||||||||||||||||
267 | void updateRenderHintsState(QPainterState *s); | - | ||||||||||||||||||
268 | void updateTransformState(QPainterState *s); | - | ||||||||||||||||||
269 | void updateClipState(QPainterState *s); | - | ||||||||||||||||||
270 | - | |||||||||||||||||||
271 | QBlittablePlatformPixmap *pmData; | - | ||||||||||||||||||
272 | CapabilitiesToStateMask caps; | - | ||||||||||||||||||
273 | uint hasXForm; | - | ||||||||||||||||||
274 | }; | - | ||||||||||||||||||
275 | - | |||||||||||||||||||
276 | - | |||||||||||||||||||
277 | inline void QBlitterPaintEnginePrivate::lock() | - | ||||||||||||||||||
278 | { | - | ||||||||||||||||||
279 | if (!pmData->blittable()->isLocked())
| 0 | ||||||||||||||||||
280 | rasterBuffer->prepare(pmData->buffer()); never executed: rasterBuffer->prepare(pmData->buffer()); | 0 | ||||||||||||||||||
281 | } never executed: end of block | 0 | ||||||||||||||||||
282 | - | |||||||||||||||||||
283 | inline void QBlitterPaintEnginePrivate::unlock() | - | ||||||||||||||||||
284 | { | - | ||||||||||||||||||
285 | pmData->blittable()->unlock(); | - | ||||||||||||||||||
286 | } never executed: end of block | 0 | ||||||||||||||||||
287 | - | |||||||||||||||||||
288 | // State tracking to make decisions | - | ||||||||||||||||||
289 | void QBlitterPaintEnginePrivate::updateCompleteState(QPainterState *s) | - | ||||||||||||||||||
290 | { | - | ||||||||||||||||||
291 | updatePenState(s); | - | ||||||||||||||||||
292 | updateBrushState(s); | - | ||||||||||||||||||
293 | updateOpacityState(s); | - | ||||||||||||||||||
294 | updateCompositionModeState(s); | - | ||||||||||||||||||
295 | updateRenderHintsState(s); | - | ||||||||||||||||||
296 | updateTransformState(s); | - | ||||||||||||||||||
297 | updateClipState(s); | - | ||||||||||||||||||
298 | } never executed: end of block | 0 | ||||||||||||||||||
299 | - | |||||||||||||||||||
300 | void QBlitterPaintEnginePrivate::updatePenState(QPainterState *s) | - | ||||||||||||||||||
301 | { | - | ||||||||||||||||||
302 | caps.updateState(STATE_PEN_ENABLED, qpen_style(s->pen) != Qt::NoPen); | - | ||||||||||||||||||
303 | } never executed: end of block | 0 | ||||||||||||||||||
304 | - | |||||||||||||||||||
305 | void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s) | - | ||||||||||||||||||
306 | { | - | ||||||||||||||||||
307 | Qt::BrushStyle style = qbrush_style(s->brush); | - | ||||||||||||||||||
308 | - | |||||||||||||||||||
309 | caps.updateState(STATE_BRUSH_PATTERN, style > Qt::SolidPattern); | - | ||||||||||||||||||
310 | caps.updateState(STATE_BRUSH_ALPHA, | - | ||||||||||||||||||
311 | qbrush_color(s->brush).alpha() < 255); | - | ||||||||||||||||||
312 | } never executed: end of block | 0 | ||||||||||||||||||
313 | - | |||||||||||||||||||
314 | void QBlitterPaintEnginePrivate::updateOpacityState(QPainterState *s) | - | ||||||||||||||||||
315 | { | - | ||||||||||||||||||
316 | bool translucent = s->opacity < 1; | - | ||||||||||||||||||
317 | caps.updateState(STATE_ALPHA, translucent); | - | ||||||||||||||||||
318 | } never executed: end of block | 0 | ||||||||||||||||||
319 | - | |||||||||||||||||||
320 | void QBlitterPaintEnginePrivate::updateCompositionModeState(QPainterState *s) | - | ||||||||||||||||||
321 | { | - | ||||||||||||||||||
322 | bool nonTrivial = s->composition_mode != QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||
323 | && s->composition_mode != QPainter::CompositionMode_Source;
| 0 | ||||||||||||||||||
324 | - | |||||||||||||||||||
325 | caps.updateState(STATE_BLENDING_COMPLEX, nonTrivial); | - | ||||||||||||||||||
326 | } never executed: end of block | 0 | ||||||||||||||||||
327 | - | |||||||||||||||||||
328 | void QBlitterPaintEnginePrivate::updateRenderHintsState(QPainterState *s) | - | ||||||||||||||||||
329 | { | - | ||||||||||||||||||
330 | bool aa = s->renderHints & QPainter::Antialiasing; | - | ||||||||||||||||||
331 | caps.updateState(STATE_ANTIALIASING, aa); | - | ||||||||||||||||||
332 | } never executed: end of block | 0 | ||||||||||||||||||
333 | - | |||||||||||||||||||
334 | void QBlitterPaintEnginePrivate::updateTransformState(QPainterState *s) | - | ||||||||||||||||||
335 | { | - | ||||||||||||||||||
336 | QTransform::TransformationType type = s->matrix.type(); | - | ||||||||||||||||||
337 | - | |||||||||||||||||||
338 | // consider scaling operations with a negative factor as "complex" for now. | - | ||||||||||||||||||
339 | // as some blitters could handle axisymmetrical operations, we should improve blitter | - | ||||||||||||||||||
340 | // paint engine to handle them as a capability | - | ||||||||||||||||||
341 | caps.updateState(STATE_XFORM_COMPLEX, (type > QTransform::TxScale) || | - | ||||||||||||||||||
342 | ((type == QTransform::TxScale) && ((s->matrix.m11() < 0.0) || (s->matrix.m22() < 0.0)))); | - | ||||||||||||||||||
343 | caps.updateState(STATE_XFORM_SCALE, type > QTransform::TxTranslate); | - | ||||||||||||||||||
344 | - | |||||||||||||||||||
345 | hasXForm = type >= QTransform::TxTranslate; | - | ||||||||||||||||||
346 | } never executed: end of block | 0 | ||||||||||||||||||
347 | - | |||||||||||||||||||
348 | void QBlitterPaintEnginePrivate::updateClipState(QPainterState *) | - | ||||||||||||||||||
349 | { | - | ||||||||||||||||||
350 | const QClipData *clipData = clip(); | - | ||||||||||||||||||
351 | bool complexClip = clipData && !(clipData->hasRectClip || clipData->hasRegionClip);
| 0 | ||||||||||||||||||
352 | caps.updateState(STATE_CLIP_COMPLEX, complexClip); | - | ||||||||||||||||||
353 | } never executed: end of block | 0 | ||||||||||||||||||
354 | - | |||||||||||||||||||
355 | void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &color, bool alpha) | - | ||||||||||||||||||
356 | { | - | ||||||||||||||||||
357 | Q_Q(QBlitterPaintEngine); | - | ||||||||||||||||||
358 | pmData->unmarkRasterOverlay(rect); | - | ||||||||||||||||||
359 | QRectF targetRect = rect; | - | ||||||||||||||||||
360 | if (hasXForm)
| 0 | ||||||||||||||||||
361 | targetRect = q->state()->matrix.mapRect(rect); never executed: targetRect = q->state()->matrix.mapRect(rect); | 0 | ||||||||||||||||||
362 | const QClipData *clipData = clip(); | - | ||||||||||||||||||
363 | if (clipData) {
| 0 | ||||||||||||||||||
364 | if (clipData->hasRectClip) {
| 0 | ||||||||||||||||||
365 | unlock(); | - | ||||||||||||||||||
366 | if (alpha)
| 0 | ||||||||||||||||||
367 | pmData->blittable()->alphaFillRect(targetRect & clipData->clipRect, color, q->state()->compositionMode()); never executed: pmData->blittable()->alphaFillRect(targetRect & clipData->clipRect, color, q->state()->compositionMode()); | 0 | ||||||||||||||||||
368 | else | - | ||||||||||||||||||
369 | pmData->blittable()->fillRect(targetRect & clipData->clipRect, color); never executed: pmData->blittable()->fillRect(targetRect & clipData->clipRect, color); | 0 | ||||||||||||||||||
370 | } else if (clipData->hasRegionClip) {
| 0 | ||||||||||||||||||
371 | QVector<QRect> rects = clipData->clipRegion.rects(); | - | ||||||||||||||||||
372 | for (int i = 0; i < rects.size(); ++i) {
| 0 | ||||||||||||||||||
373 | QRect intersectRect = rects.at(i).intersected(targetRect.toRect()); | - | ||||||||||||||||||
374 | if (!intersectRect.isEmpty()) {
| 0 | ||||||||||||||||||
375 | unlock(); | - | ||||||||||||||||||
376 | if (alpha)
| 0 | ||||||||||||||||||
377 | pmData->blittable()->alphaFillRect(intersectRect, color, q->state()->compositionMode()); never executed: pmData->blittable()->alphaFillRect(intersectRect, color, q->state()->compositionMode()); | 0 | ||||||||||||||||||
378 | else | - | ||||||||||||||||||
379 | pmData->blittable()->fillRect(intersectRect, color); never executed: pmData->blittable()->fillRect(intersectRect, color); | 0 | ||||||||||||||||||
380 | } | - | ||||||||||||||||||
381 | } never executed: end of block | 0 | ||||||||||||||||||
382 | } never executed: end of block | 0 | ||||||||||||||||||
383 | } else { never executed: end of block | 0 | ||||||||||||||||||
384 | if (targetRect.x() >= 0 && targetRect.y() >= 0
| 0 | ||||||||||||||||||
385 | && targetRect.width() <= q->paintDevice()->width()
| 0 | ||||||||||||||||||
386 | && targetRect.height() <= q->paintDevice()->height()) {
| 0 | ||||||||||||||||||
387 | unlock(); | - | ||||||||||||||||||
388 | if (alpha)
| 0 | ||||||||||||||||||
389 | pmData->blittable()->alphaFillRect(targetRect, color, q->state()->compositionMode()); never executed: pmData->blittable()->alphaFillRect(targetRect, color, q->state()->compositionMode()); | 0 | ||||||||||||||||||
390 | else | - | ||||||||||||||||||
391 | pmData->blittable()->fillRect(targetRect, color); never executed: pmData->blittable()->fillRect(targetRect, color); | 0 | ||||||||||||||||||
392 | } else { | - | ||||||||||||||||||
393 | QRectF deviceRect(0, 0, q->paintDevice()->width(), q->paintDevice()->height()); | - | ||||||||||||||||||
394 | unlock(); | - | ||||||||||||||||||
395 | if (alpha)
| 0 | ||||||||||||||||||
396 | pmData->blittable()->alphaFillRect(deviceRect & targetRect, color, q->state()->compositionMode()); never executed: pmData->blittable()->alphaFillRect(deviceRect & targetRect, color, q->state()->compositionMode()); | 0 | ||||||||||||||||||
397 | else | - | ||||||||||||||||||
398 | pmData->blittable()->fillRect(deviceRect & targetRect, color); never executed: pmData->blittable()->fillRect(deviceRect & targetRect, color); | 0 | ||||||||||||||||||
399 | } | - | ||||||||||||||||||
400 | } | - | ||||||||||||||||||
401 | } | - | ||||||||||||||||||
402 | - | |||||||||||||||||||
403 | void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip, | - | ||||||||||||||||||
404 | const QRectF &target, | - | ||||||||||||||||||
405 | const QPixmap &pm, | - | ||||||||||||||||||
406 | const QRectF &sr, | - | ||||||||||||||||||
407 | bool opacity) | - | ||||||||||||||||||
408 | { | - | ||||||||||||||||||
409 | Q_Q(QBlitterPaintEngine); | - | ||||||||||||||||||
410 | QRectF intersectedRect = clip.intersected(target); | - | ||||||||||||||||||
411 | if (intersectedRect.isEmpty())
| 0 | ||||||||||||||||||
412 | return; never executed: return; | 0 | ||||||||||||||||||
413 | QRectF source = sr; | - | ||||||||||||||||||
414 | if (intersectedRect.size() != target.size()) {
| 0 | ||||||||||||||||||
415 | if (sr.size() == target.size()) {
| 0 | ||||||||||||||||||
416 | // no resize | - | ||||||||||||||||||
417 | qreal deltaTop = target.top() - intersectedRect.top(); | - | ||||||||||||||||||
418 | qreal deltaLeft = target.left() - intersectedRect.left(); | - | ||||||||||||||||||
419 | qreal deltaBottom = target.bottom() - intersectedRect.bottom(); | - | ||||||||||||||||||
420 | qreal deltaRight = target.right() - intersectedRect.right(); | - | ||||||||||||||||||
421 | source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); | - | ||||||||||||||||||
422 | } else { never executed: end of block | 0 | ||||||||||||||||||
423 | // resize case | - | ||||||||||||||||||
424 | qreal hFactor = sr.size().width() / target.size().width(); | - | ||||||||||||||||||
425 | qreal vFactor = sr.size().height() / target.size().height(); | - | ||||||||||||||||||
426 | qreal deltaTop = (target.top() - intersectedRect.top()) * vFactor; | - | ||||||||||||||||||
427 | qreal deltaLeft = (target.left() - intersectedRect.left()) * hFactor; | - | ||||||||||||||||||
428 | qreal deltaBottom = (target.bottom() - intersectedRect.bottom()) * vFactor; | - | ||||||||||||||||||
429 | qreal deltaRight = (target.right() - intersectedRect.right()) * hFactor; | - | ||||||||||||||||||
430 | source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); | - | ||||||||||||||||||
431 | } never executed: end of block | 0 | ||||||||||||||||||
432 | } | - | ||||||||||||||||||
433 | pmData->unmarkRasterOverlay(intersectedRect); | - | ||||||||||||||||||
434 | if (opacity)
| 0 | ||||||||||||||||||
435 | pmData->blittable()->drawPixmapOpacity(intersectedRect, pm, source, q->state()->compositionMode(), q->state()->opacity); never executed: pmData->blittable()->drawPixmapOpacity(intersectedRect, pm, source, q->state()->compositionMode(), q->state()->opacity); | 0 | ||||||||||||||||||
436 | else | - | ||||||||||||||||||
437 | pmData->blittable()->drawPixmap(intersectedRect, pm, source); never executed: pmData->blittable()->drawPixmap(intersectedRect, pm, source); | 0 | ||||||||||||||||||
438 | } | - | ||||||||||||||||||
439 | - | |||||||||||||||||||
440 | QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p) | - | ||||||||||||||||||
441 | : QRasterPaintEngine(*(new QBlitterPaintEnginePrivate(p)), p->buffer()) | - | ||||||||||||||||||
442 | {} never executed: end of block | 0 | ||||||||||||||||||
443 | - | |||||||||||||||||||
444 | // State tracking | - | ||||||||||||||||||
445 | void QBlitterPaintEngine::penChanged() | - | ||||||||||||||||||
446 | { | - | ||||||||||||||||||
447 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
448 | - | |||||||||||||||||||
449 | QRasterPaintEngine::penChanged(); | - | ||||||||||||||||||
450 | d->updatePenState(state()); | - | ||||||||||||||||||
451 | } never executed: end of block | 0 | ||||||||||||||||||
452 | - | |||||||||||||||||||
453 | void QBlitterPaintEngine::brushChanged() | - | ||||||||||||||||||
454 | { | - | ||||||||||||||||||
455 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
456 | - | |||||||||||||||||||
457 | QRasterPaintEngine::brushChanged(); | - | ||||||||||||||||||
458 | d->updateBrushState(state()); | - | ||||||||||||||||||
459 | } never executed: end of block | 0 | ||||||||||||||||||
460 | - | |||||||||||||||||||
461 | void QBlitterPaintEngine::opacityChanged() | - | ||||||||||||||||||
462 | { | - | ||||||||||||||||||
463 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
464 | - | |||||||||||||||||||
465 | QRasterPaintEngine::opacityChanged(); | - | ||||||||||||||||||
466 | d->updateOpacityState(state()); | - | ||||||||||||||||||
467 | } never executed: end of block | 0 | ||||||||||||||||||
468 | - | |||||||||||||||||||
469 | void QBlitterPaintEngine::compositionModeChanged() | - | ||||||||||||||||||
470 | { | - | ||||||||||||||||||
471 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
472 | - | |||||||||||||||||||
473 | QRasterPaintEngine::compositionModeChanged(); | - | ||||||||||||||||||
474 | d->updateCompositionModeState(state()); | - | ||||||||||||||||||
475 | } never executed: end of block | 0 | ||||||||||||||||||
476 | - | |||||||||||||||||||
477 | void QBlitterPaintEngine::renderHintsChanged() | - | ||||||||||||||||||
478 | { | - | ||||||||||||||||||
479 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
480 | - | |||||||||||||||||||
481 | QRasterPaintEngine::renderHintsChanged(); | - | ||||||||||||||||||
482 | d->updateRenderHintsState(state()); | - | ||||||||||||||||||
483 | } never executed: end of block | 0 | ||||||||||||||||||
484 | - | |||||||||||||||||||
485 | void QBlitterPaintEngine::transformChanged() | - | ||||||||||||||||||
486 | { | - | ||||||||||||||||||
487 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
488 | - | |||||||||||||||||||
489 | QRasterPaintEngine::transformChanged(); | - | ||||||||||||||||||
490 | d->updateTransformState(state()); | - | ||||||||||||||||||
491 | } never executed: end of block | 0 | ||||||||||||||||||
492 | - | |||||||||||||||||||
493 | void QBlitterPaintEngine::clipEnabledChanged() | - | ||||||||||||||||||
494 | { | - | ||||||||||||||||||
495 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
496 | QRasterPaintEngine::clipEnabledChanged(); | - | ||||||||||||||||||
497 | d->updateClipState(state()); | - | ||||||||||||||||||
498 | } never executed: end of block | 0 | ||||||||||||||||||
499 | - | |||||||||||||||||||
500 | bool QBlitterPaintEngine::begin(QPaintDevice *pdev) | - | ||||||||||||||||||
501 | { | - | ||||||||||||||||||
502 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
503 | bool ok = QRasterPaintEngine::begin(pdev); | - | ||||||||||||||||||
504 | #ifdef QT_BLITTER_RASTEROVERLAY | - | ||||||||||||||||||
505 | d->pmData->unmergeOverlay(); | - | ||||||||||||||||||
506 | #endif | - | ||||||||||||||||||
507 | d->pdev = pdev; | - | ||||||||||||||||||
508 | return ok; never executed: return ok; | 0 | ||||||||||||||||||
509 | } | - | ||||||||||||||||||
510 | - | |||||||||||||||||||
511 | bool QBlitterPaintEngine::end() | - | ||||||||||||||||||
512 | { | - | ||||||||||||||||||
513 | #ifdef QT_BLITTER_RASTEROVERLAY | - | ||||||||||||||||||
514 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
515 | d->pmData->mergeOverlay(); | - | ||||||||||||||||||
516 | #endif | - | ||||||||||||||||||
517 | - | |||||||||||||||||||
518 | return QRasterPaintEngine::end(); never executed: return QRasterPaintEngine::end(); | 0 | ||||||||||||||||||
519 | } | - | ||||||||||||||||||
520 | - | |||||||||||||||||||
521 | void QBlitterPaintEngine::setState(QPainterState *s) | - | ||||||||||||||||||
522 | { | - | ||||||||||||||||||
523 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
524 | - | |||||||||||||||||||
525 | QRasterPaintEngine::setState(s); | - | ||||||||||||||||||
526 | d->updateCompleteState(s); | - | ||||||||||||||||||
527 | } never executed: end of block | 0 | ||||||||||||||||||
528 | - | |||||||||||||||||||
529 | // Accelerated paths | - | ||||||||||||||||||
530 | void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) | - | ||||||||||||||||||
531 | { | - | ||||||||||||||||||
532 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
533 | if (path.shape() == QVectorPath::RectangleHint) {
| 0 | ||||||||||||||||||
534 | QRectF rect(((const QPointF *) path.points())[0], ((const QPointF *) path.points())[2]); | - | ||||||||||||||||||
535 | fillRect(rect, brush); | - | ||||||||||||||||||
536 | } else { never executed: end of block | 0 | ||||||||||||||||||
537 | d->lock(); | - | ||||||||||||||||||
538 | d->pmData->markRasterOverlay(path); | - | ||||||||||||||||||
539 | QRasterPaintEngine::fill(path, brush); | - | ||||||||||||||||||
540 | } never executed: end of block | 0 | ||||||||||||||||||
541 | } | - | ||||||||||||||||||
542 | - | |||||||||||||||||||
543 | void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color) | - | ||||||||||||||||||
544 | { | - | ||||||||||||||||||
545 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
546 | if (d->caps.canBlitterAlphaFillRect()) {
| 0 | ||||||||||||||||||
547 | d->fillRect(rect, color, true); | - | ||||||||||||||||||
548 | } else if (d->caps.canBlitterFillRect() && color.alpha() == 0xff) { never executed: end of block
| 0 | ||||||||||||||||||
549 | d->fillRect(rect, color, false); | - | ||||||||||||||||||
550 | } else { never executed: end of block | 0 | ||||||||||||||||||
551 | d->lock(); | - | ||||||||||||||||||
552 | d->pmData->markRasterOverlay(rect); | - | ||||||||||||||||||
553 | QRasterPaintEngine::fillRect(rect, color); | - | ||||||||||||||||||
554 | } never executed: end of block | 0 | ||||||||||||||||||
555 | } | - | ||||||||||||||||||
556 | - | |||||||||||||||||||
557 | void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) | - | ||||||||||||||||||
558 | { | - | ||||||||||||||||||
559 | if (rect.size().isEmpty())
| 0 | ||||||||||||||||||
560 | return; never executed: return; | 0 | ||||||||||||||||||
561 | - | |||||||||||||||||||
562 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
563 | - | |||||||||||||||||||
564 | if (qbrush_style(brush) == Qt::SolidPattern
| 0 | ||||||||||||||||||
565 | && d->caps.canBlitterAlphaFillRect()) {
| 0 | ||||||||||||||||||
566 | d->fillRect(rect, qbrush_color(brush), true); | - | ||||||||||||||||||
567 | } else if (qbrush_style(brush) == Qt::SolidPattern never executed: end of block
| 0 | ||||||||||||||||||
568 | && qbrush_color(brush).alpha() == 0xff
| 0 | ||||||||||||||||||
569 | && d->caps.canBlitterFillRect()) {
| 0 | ||||||||||||||||||
570 | d->fillRect(rect, qbrush_color(brush), false); | - | ||||||||||||||||||
571 | } else if ((brush.style() == Qt::TexturePattern) && never executed: end of block
| 0 | ||||||||||||||||||
572 | (brush.transform().type() <= QTransform::TxTranslate) &&
| 0 | ||||||||||||||||||
573 | ((d->caps.canBlitterDrawPixmapOpacity(brush.texture())) ||
| 0 | ||||||||||||||||||
574 | (d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect)))) {
| 0 | ||||||||||||||||||
575 | bool rectIsFilled = false; | - | ||||||||||||||||||
576 | QRectF transformedRect = state()->matrix.mapRect(rect); | - | ||||||||||||||||||
577 | qreal x = transformedRect.x(); | - | ||||||||||||||||||
578 | qreal y = transformedRect.y(); | - | ||||||||||||||||||
579 | QPixmap pm = brush.texture(); | - | ||||||||||||||||||
580 | d->unlock(); | - | ||||||||||||||||||
581 | int srcX = int(rect.x() - state()->brushOrigin.x() - brush.transform().dx()) % pm.width(); | - | ||||||||||||||||||
582 | if (srcX < 0)
| 0 | ||||||||||||||||||
583 | srcX = pm.width() + srcX; never executed: srcX = pm.width() + srcX; | 0 | ||||||||||||||||||
584 | const int startX = srcX; | - | ||||||||||||||||||
585 | int srcY = int(rect.y() - state()->brushOrigin.y() - brush.transform().dy()) % pm.height(); | - | ||||||||||||||||||
586 | if (srcY < 0)
| 0 | ||||||||||||||||||
587 | srcY = pm.height() + srcY; never executed: srcY = pm.height() + srcY; | 0 | ||||||||||||||||||
588 | while (!rectIsFilled) {
| 0 | ||||||||||||||||||
589 | qreal blitWidth = (pm.width() ) - srcX; | - | ||||||||||||||||||
590 | qreal blitHeight = (pm.height() ) - srcY; | - | ||||||||||||||||||
591 | if (x + blitWidth > transformedRect.right())
| 0 | ||||||||||||||||||
592 | blitWidth = transformedRect.right() -x; never executed: blitWidth = transformedRect.right() -x; | 0 | ||||||||||||||||||
593 | if (y + blitHeight > transformedRect.bottom())
| 0 | ||||||||||||||||||
594 | blitHeight = transformedRect.bottom() - y; never executed: blitHeight = transformedRect.bottom() - y; | 0 | ||||||||||||||||||
595 | const QClipData *clipData = d->clip(); | - | ||||||||||||||||||
596 | if (clipData->hasRectClip) {
| 0 | ||||||||||||||||||
597 | QRect targetRect = QRect(x, y, blitWidth, blitHeight).intersected(clipData->clipRect); | - | ||||||||||||||||||
598 | if (targetRect.isValid()) {
| 0 | ||||||||||||||||||
599 | int tmpSrcX = srcX + (targetRect.x() - x); | - | ||||||||||||||||||
600 | int tmpSrcY = srcY + (targetRect.y() - y); | - | ||||||||||||||||||
601 | QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height()); | - | ||||||||||||||||||
602 | d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect); | - | ||||||||||||||||||
603 | } never executed: end of block | 0 | ||||||||||||||||||
604 | } else if (clipData->hasRegionClip) { never executed: end of block
| 0 | ||||||||||||||||||
605 | QRect unclippedTargetRect(x, y, blitWidth, blitHeight); | - | ||||||||||||||||||
606 | const QVector<QRect> intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect).rects(); | - | ||||||||||||||||||
607 | const int intersectedSize = intersectedRects.size(); | - | ||||||||||||||||||
608 | for (int i = 0; i < intersectedSize; ++i) {
| 0 | ||||||||||||||||||
609 | const QRect &targetRect = intersectedRects.at(i); | - | ||||||||||||||||||
610 | if (!targetRect.isValid() || targetRect.isEmpty())
| 0 | ||||||||||||||||||
611 | continue; never executed: continue; | 0 | ||||||||||||||||||
612 | int tmpSrcX = srcX + (targetRect.x() - x); | - | ||||||||||||||||||
613 | int tmpSrcY = srcY + (targetRect.y() - y); | - | ||||||||||||||||||
614 | QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height()); | - | ||||||||||||||||||
615 | d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect); | - | ||||||||||||||||||
616 | } never executed: end of block | 0 | ||||||||||||||||||
617 | } never executed: end of block | 0 | ||||||||||||||||||
618 | x+=blitWidth; | - | ||||||||||||||||||
619 | if (qFuzzyCompare(x, transformedRect.right())) {
| 0 | ||||||||||||||||||
620 | x = transformedRect.x(); | - | ||||||||||||||||||
621 | srcX = startX; | - | ||||||||||||||||||
622 | srcY = 0; | - | ||||||||||||||||||
623 | y += blitHeight; | - | ||||||||||||||||||
624 | if (qFuzzyCompare(y, transformedRect.bottom()))
| 0 | ||||||||||||||||||
625 | rectIsFilled = true; never executed: rectIsFilled = true; | 0 | ||||||||||||||||||
626 | } else never executed: end of block | 0 | ||||||||||||||||||
627 | srcX = 0; never executed: srcX = 0; | 0 | ||||||||||||||||||
628 | } | - | ||||||||||||||||||
629 | } else { never executed: end of block | 0 | ||||||||||||||||||
630 | d->lock(); | - | ||||||||||||||||||
631 | d->pmData->markRasterOverlay(rect); | - | ||||||||||||||||||
632 | QRasterPaintEngine::fillRect(rect, brush); | - | ||||||||||||||||||
633 | } never executed: end of block | 0 | ||||||||||||||||||
634 | - | |||||||||||||||||||
635 | } | - | ||||||||||||||||||
636 | - | |||||||||||||||||||
637 | void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount) | - | ||||||||||||||||||
638 | { | - | ||||||||||||||||||
639 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
640 | if (d->caps.canBlitterDrawRectMask()) {
| 0 | ||||||||||||||||||
641 | for (int i=0; i<rectCount; ++i)
| 0 | ||||||||||||||||||
642 | d->fillRect(rects[i], qbrush_color(state()->brush), false); never executed: d->fillRect(rects[i], qbrush_color(state()->brush), false); | 0 | ||||||||||||||||||
643 | } else { never executed: end of block | 0 | ||||||||||||||||||
644 | d->pmData->markRasterOverlay(rects, rectCount); | - | ||||||||||||||||||
645 | QRasterPaintEngine::drawRects(rects, rectCount); | - | ||||||||||||||||||
646 | } never executed: end of block | 0 | ||||||||||||||||||
647 | } | - | ||||||||||||||||||
648 | - | |||||||||||||||||||
649 | void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount) | - | ||||||||||||||||||
650 | { | - | ||||||||||||||||||
651 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
652 | if (d->caps.canBlitterDrawRectMask()) {
| 0 | ||||||||||||||||||
653 | for (int i = 0; i < rectCount; ++i)
| 0 | ||||||||||||||||||
654 | d->fillRect(rects[i], qbrush_color(state()->brush), false); never executed: d->fillRect(rects[i], qbrush_color(state()->brush), false); | 0 | ||||||||||||||||||
655 | } else { never executed: end of block | 0 | ||||||||||||||||||
656 | d->pmData->markRasterOverlay(rects, rectCount); | - | ||||||||||||||||||
657 | QRasterPaintEngine::drawRects(rects, rectCount); | - | ||||||||||||||||||
658 | } never executed: end of block | 0 | ||||||||||||||||||
659 | } | - | ||||||||||||||||||
660 | - | |||||||||||||||||||
661 | void QBlitterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) | - | ||||||||||||||||||
662 | { | - | ||||||||||||||||||
663 | drawPixmap(QRectF(pos, pm.size()), pm, pm.rect()); | - | ||||||||||||||||||
664 | } never executed: end of block | 0 | ||||||||||||||||||
665 | - | |||||||||||||||||||
666 | void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) | - | ||||||||||||||||||
667 | { | - | ||||||||||||||||||
668 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
669 | bool canDrawOpacity; | - | ||||||||||||||||||
670 | - | |||||||||||||||||||
671 | canDrawOpacity = d->caps.canBlitterDrawPixmapOpacity(pm); | - | ||||||||||||||||||
672 | if (canDrawOpacity || (d->caps.canBlitterDrawPixmap(r, pm, sr))) {
| 0 | ||||||||||||||||||
673 | - | |||||||||||||||||||
674 | d->unlock(); | - | ||||||||||||||||||
675 | QRectF targetRect = r; | - | ||||||||||||||||||
676 | if (d->hasXForm)
| 0 | ||||||||||||||||||
677 | targetRect = state()->matrix.mapRect(r); never executed: targetRect = state()->matrix.mapRect(r); | 0 | ||||||||||||||||||
678 | const QClipData *clipData = d->clip(); | - | ||||||||||||||||||
679 | if (clipData) {
| 0 | ||||||||||||||||||
680 | if (clipData->hasRectClip) {
| 0 | ||||||||||||||||||
681 | d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity); | - | ||||||||||||||||||
682 | } else if (clipData->hasRegionClip) { never executed: end of block
| 0 | ||||||||||||||||||
683 | QVector<QRect>rects = clipData->clipRegion.rects(); | - | ||||||||||||||||||
684 | for (int i = 0; i<rects.size(); ++i)
| 0 | ||||||||||||||||||
685 | d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity); never executed: d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity); | 0 | ||||||||||||||||||
686 | } never executed: end of block | 0 | ||||||||||||||||||
687 | } else { never executed: end of block | 0 | ||||||||||||||||||
688 | QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height()); | - | ||||||||||||||||||
689 | d->clipAndDrawPixmap(deviceRect, targetRect, pm, sr, canDrawOpacity); | - | ||||||||||||||||||
690 | } never executed: end of block | 0 | ||||||||||||||||||
691 | }else { | - | ||||||||||||||||||
692 | d->lock(); | - | ||||||||||||||||||
693 | d->pmData->markRasterOverlay(r); | - | ||||||||||||||||||
694 | QRasterPaintEngine::drawPixmap(r, pm, sr); | - | ||||||||||||||||||
695 | } never executed: end of block | 0 | ||||||||||||||||||
696 | } | - | ||||||||||||||||||
697 | - | |||||||||||||||||||
698 | // Overridden methods to lock the graphics memory | - | ||||||||||||||||||
699 | void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||||||||
700 | { | - | ||||||||||||||||||
701 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
702 | d->lock(); | - | ||||||||||||||||||
703 | d->pmData->markRasterOverlay(points, pointCount); | - | ||||||||||||||||||
704 | QRasterPaintEngine::drawPolygon(points, pointCount, mode); | - | ||||||||||||||||||
705 | } never executed: end of block | 0 | ||||||||||||||||||
706 | - | |||||||||||||||||||
707 | void QBlitterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||||||||
708 | { | - | ||||||||||||||||||
709 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
710 | d->lock(); | - | ||||||||||||||||||
711 | d->pmData->markRasterOverlay(points, pointCount); | - | ||||||||||||||||||
712 | QRasterPaintEngine::drawPolygon(points, pointCount, mode); | - | ||||||||||||||||||
713 | } never executed: end of block | 0 | ||||||||||||||||||
714 | - | |||||||||||||||||||
715 | void QBlitterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData) | - | ||||||||||||||||||
716 | { | - | ||||||||||||||||||
717 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
718 | d->lock(); | - | ||||||||||||||||||
719 | d->pmData->markRasterOverlay(path); | - | ||||||||||||||||||
720 | QRasterPaintEngine::fillPath(path, fillData); | - | ||||||||||||||||||
721 | } never executed: end of block | 0 | ||||||||||||||||||
722 | - | |||||||||||||||||||
723 | void QBlitterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||||||||
724 | { | - | ||||||||||||||||||
725 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
726 | d->lock(); | - | ||||||||||||||||||
727 | d->pmData->markRasterOverlay(points, pointCount); | - | ||||||||||||||||||
728 | QRasterPaintEngine::fillPolygon(points, pointCount, mode); | - | ||||||||||||||||||
729 | } never executed: end of block | 0 | ||||||||||||||||||
730 | - | |||||||||||||||||||
731 | void QBlitterPaintEngine::drawEllipse(const QRectF &r) | - | ||||||||||||||||||
732 | { | - | ||||||||||||||||||
733 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
734 | d->lock(); | - | ||||||||||||||||||
735 | d->pmData->markRasterOverlay(r); | - | ||||||||||||||||||
736 | QRasterPaintEngine::drawEllipse(r); | - | ||||||||||||||||||
737 | } never executed: end of block | 0 | ||||||||||||||||||
738 | - | |||||||||||||||||||
739 | void QBlitterPaintEngine::drawImage(const QPointF &pos, const QImage &image) | - | ||||||||||||||||||
740 | { | - | ||||||||||||||||||
741 | drawImage(QRectF(pos, image.size()), image, image.rect()); | - | ||||||||||||||||||
742 | } never executed: end of block | 0 | ||||||||||||||||||
743 | - | |||||||||||||||||||
744 | void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, | - | ||||||||||||||||||
745 | Qt::ImageConversionFlags flags) | - | ||||||||||||||||||
746 | { | - | ||||||||||||||||||
747 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
748 | d->lock(); | - | ||||||||||||||||||
749 | d->pmData->markRasterOverlay(r); | - | ||||||||||||||||||
750 | QRasterPaintEngine::drawImage(r, pm, sr, flags); | - | ||||||||||||||||||
751 | } never executed: end of block | 0 | ||||||||||||||||||
752 | - | |||||||||||||||||||
753 | void QBlitterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) | - | ||||||||||||||||||
754 | { | - | ||||||||||||||||||
755 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
756 | d->lock(); | - | ||||||||||||||||||
757 | d->pmData->markRasterOverlay(r); | - | ||||||||||||||||||
758 | QRasterPaintEngine::drawTiledPixmap(r, pm, sr); | - | ||||||||||||||||||
759 | } never executed: end of block | 0 | ||||||||||||||||||
760 | - | |||||||||||||||||||
761 | void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) | - | ||||||||||||||||||
762 | { | - | ||||||||||||||||||
763 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
764 | d->lock(); | - | ||||||||||||||||||
765 | d->pmData->markRasterOverlay(pos, ti); | - | ||||||||||||||||||
766 | QRasterPaintEngine::drawTextItem(pos, ti); | - | ||||||||||||||||||
767 | } never executed: end of block | 0 | ||||||||||||||||||
768 | - | |||||||||||||||||||
769 | void QBlitterPaintEngine::drawPoints(const QPointF *points, int pointCount) | - | ||||||||||||||||||
770 | { | - | ||||||||||||||||||
771 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
772 | d->lock(); | - | ||||||||||||||||||
773 | d->pmData->markRasterOverlay(points, pointCount); | - | ||||||||||||||||||
774 | QRasterPaintEngine::drawPoints(points, pointCount); | - | ||||||||||||||||||
775 | } never executed: end of block | 0 | ||||||||||||||||||
776 | - | |||||||||||||||||||
777 | void QBlitterPaintEngine::drawPoints(const QPoint *points, int pointCount) | - | ||||||||||||||||||
778 | { | - | ||||||||||||||||||
779 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
780 | d->lock(); | - | ||||||||||||||||||
781 | d->pmData->markRasterOverlay(points, pointCount); | - | ||||||||||||||||||
782 | QRasterPaintEngine::drawPoints(points, pointCount); | - | ||||||||||||||||||
783 | } never executed: end of block | 0 | ||||||||||||||||||
784 | - | |||||||||||||||||||
785 | void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) | - | ||||||||||||||||||
786 | { | - | ||||||||||||||||||
787 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
788 | d->lock(); | - | ||||||||||||||||||
789 | d->pmData->markRasterOverlay(path); | - | ||||||||||||||||||
790 | QRasterPaintEngine::stroke(path, pen); | - | ||||||||||||||||||
791 | } never executed: end of block | 0 | ||||||||||||||||||
792 | - | |||||||||||||||||||
793 | void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti) | - | ||||||||||||||||||
794 | { | - | ||||||||||||||||||
795 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
796 | d->lock(); | - | ||||||||||||||||||
797 | QRasterPaintEngine::drawStaticTextItem(sti); | - | ||||||||||||||||||
798 | - | |||||||||||||||||||
799 | #ifdef QT_BLITTER_RASTEROVERLAY | - | ||||||||||||||||||
800 | //#### d->pmData->markRasterOverlay(sti); | - | ||||||||||||||||||
801 | qWarning("not implemented: markRasterOverlay for QStaticTextItem"); | - | ||||||||||||||||||
802 | #endif | - | ||||||||||||||||||
803 | } never executed: end of block | 0 | ||||||||||||||||||
804 | - | |||||||||||||||||||
805 | bool QBlitterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine) | - | ||||||||||||||||||
806 | { | - | ||||||||||||||||||
807 | Q_D(QBlitterPaintEngine); | - | ||||||||||||||||||
808 | QFontEngine::GlyphFormat glyphFormat = d->glyphCacheFormat; | - | ||||||||||||||||||
809 | if (fontEngine->glyphFormat != QFontEngine::Format_None)
| 0 | ||||||||||||||||||
810 | glyphFormat = fontEngine->glyphFormat; never executed: glyphFormat = fontEngine->glyphFormat; | 0 | ||||||||||||||||||
811 | - | |||||||||||||||||||
812 | const QClipData *clipData = d->clip(); | - | ||||||||||||||||||
813 | const bool complexClip = clipData && !clipData->hasRectClip;
| 0 | ||||||||||||||||||
814 | - | |||||||||||||||||||
815 | const QPainterState *s = state(); | - | ||||||||||||||||||
816 | if (d->caps.canBlitterDrawCachedGlyphs(s->transform(), glyphFormat, complexClip)) {
| 0 | ||||||||||||||||||
817 | d->unlock(); | - | ||||||||||||||||||
818 | const bool result = d->pmData->blittable()->drawCachedGlyphs(s, glyphFormat, numGlyphs, glyphs, positions, fontEngine); | - | ||||||||||||||||||
819 | // Lock again as the raster paint engine might draw decorations now. | - | ||||||||||||||||||
820 | d->lock(); | - | ||||||||||||||||||
821 | return result; never executed: return result; | 0 | ||||||||||||||||||
822 | } else { | - | ||||||||||||||||||
823 | return QRasterPaintEngine::drawCachedGlyphs(numGlyphs, glyphs, positions, fontEngine); never executed: return QRasterPaintEngine::drawCachedGlyphs(numGlyphs, glyphs, positions, fontEngine); | 0 | ||||||||||||||||||
824 | } | - | ||||||||||||||||||
825 | } | - | ||||||||||||||||||
826 | - | |||||||||||||||||||
827 | QT_END_NAMESPACE | - | ||||||||||||||||||
828 | #endif //QT_NO_BLITTABLE | - | ||||||||||||||||||
829 | - | |||||||||||||||||||
Source code | Switch to Preprocessed file |