painting/qpaintengine_blitter.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5class CapabilitiesToStateMask -
6{ -
7public: -
8 CapabilitiesToStateMask(QBlittable::Capabilities capabilities) -
9 : m_capabilities(capabilities) -
10 , fillRectMask(0) -
11 , drawRectMask(0) -
12 , drawPixmapMask(0) -
13 , alphaFillRectMask(0) -
14 , opacityPixmapMask(0) -
15 , capabillitiesState(0) -
16 { -
17 if (capabilities & QBlittable::SolidRectCapability)
never evaluated: capabilities & QBlittable::SolidRectCapability
0
18 setFillRectMask();
never executed: setFillRectMask();
0
19 if (capabilities & QBlittable::SourcePixmapCapability)
never evaluated: capabilities & QBlittable::SourcePixmapCapability
0
20 setSourcePixmapMask();
never executed: setSourcePixmapMask();
0
21 if (capabilities & QBlittable::SourceOverPixmapCapability)
never evaluated: capabilities & QBlittable::SourceOverPixmapCapability
0
22 setSourceOverPixmapMask();
never executed: setSourceOverPixmapMask();
0
23 if (capabilities & QBlittable::SourceOverScaledPixmapCapability)
never evaluated: capabilities & QBlittable::SourceOverScaledPixmapCapability
0
24 setSourceOverScaledPixmapMask();
never executed: setSourceOverScaledPixmapMask();
0
25 if (capabilities & QBlittable::AlphaFillRectCapability)
never evaluated: capabilities & QBlittable::AlphaFillRectCapability
0
26 setAlphaFillRectMask();
never executed: setAlphaFillRectMask();
0
27 if (capabilities & QBlittable::OpacityPixmapCapability)
never evaluated: capabilities & QBlittable::OpacityPixmapCapability
0
28 setOpacityPixmapMask();
never executed: setOpacityPixmapMask();
0
29 }
never executed: }
0
30 -
31 inline bool canBlitterFillRect() const -
32 { -
33 return checkStateAgainstMask(capabillitiesState, fillRectMask);
never executed: return checkStateAgainstMask(capabillitiesState, fillRectMask);
0
34 } -
35 -
36 inline bool canBlitterAlphaFillRect() const -
37 { -
38 return checkStateAgainstMask(capabillitiesState, alphaFillRectMask);
never executed: return checkStateAgainstMask(capabillitiesState, alphaFillRectMask);
0
39 } -
40 -
41 inline bool canBlitterDrawRectMask() const -
42 { -
43 return checkStateAgainstMask(capabillitiesState, drawRectMask);
never executed: return checkStateAgainstMask(capabillitiesState, drawRectMask);
0
44 } -
45 -
46 bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const -
47 { -
48 if (pm.handle()->classId() != QPlatformPixmap::BlitterClass)
never evaluated: pm.handle()->classId() != QPlatformPixmap::BlitterClass
0
49 return false;
never executed: return false;
0
50 if (checkStateAgainstMask(capabillitiesState, drawPixmapMask)) {
never evaluated: checkStateAgainstMask(capabillitiesState, drawPixmapMask)
0
51 if (m_capabilities & (QBlittable::SourceOverPixmapCapability 0
52 | QBlittable::SourceOverScaledPixmapCapability)) {
never evaluated: m_capabilities & (QBlittable::SourceOverPixmapCapability | QBlittable::SourceOverScaledPixmapCapability)
0
53 if (r.size() != sr.size())
never evaluated: r.size() != sr.size()
0
54 return m_capabilities & QBlittable::SourceOverScaledPixmapCapability;
never executed: return m_capabilities & QBlittable::SourceOverScaledPixmapCapability;
0
55 else -
56 return m_capabilities & QBlittable::SourceOverPixmapCapability;
never executed: return m_capabilities & QBlittable::SourceOverPixmapCapability;
0
57 } -
58 if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel())
never evaluated: (m_capabilities & QBlittable::SourcePixmapCapability)
never evaluated: r.size() == sr.size()
never evaluated: !pm.hasAlphaChannel()
0
59 return m_capabilities & QBlittable::SourcePixmapCapability;
never executed: return m_capabilities & QBlittable::SourcePixmapCapability;
0
60 }
never executed: }
0
61 return false;
never executed: return false;
0
62 } -
63 -
64 bool canBlitterDrawPixmapOpacity(const QPixmap &pm) const -
65 { -
66 if (pm.handle()->classId() != QPlatformPixmap::BlitterClass)
never evaluated: pm.handle()->classId() != QPlatformPixmap::BlitterClass
0
67 return false;
never executed: return false;
0
68 -
69 return checkStateAgainstMask(capabillitiesState, opacityPixmapMask);
never executed: return checkStateAgainstMask(capabillitiesState, opacityPixmapMask);
0
70 } -
71 -
72 inline void updateState(uint mask, bool on) { -
73 updateStateBits(&capabillitiesState, mask, on); -
74 }
never executed: }
0
75 -
76private: -
77 -
78 static inline void updateStateBits(uint *state, uint mask, bool on) -
79 { -
80 *state = on ? (*state | mask) : (*state & ~mask);
never evaluated: on
0
81 }
never executed: }
0
82 -
83 static inline bool checkStateAgainstMask(uint state, uint mask) -
84 { -
85 return !state || (state & mask && !(state & ~mask));
never executed: return !state || (state & mask && !(state & ~mask));
0
86 } -
87 -
88 void setFillRectMask() { -
89 updateStateBits(&fillRectMask, 0x00000001, false); -
90 updateStateBits(&fillRectMask, 0x00000002, false); -
91 -
92 updateStateBits(&fillRectMask, 0x00000010, false); -
93 updateStateBits(&fillRectMask, 0x00000020, false); -
94 -
95 updateStateBits(&fillRectMask, 0x00000100, true); -
96 -
97 -
98 updateStateBits(&fillRectMask, 0x00001000, true); -
99 updateStateBits(&fillRectMask, 0x00002000, false); -
100 updateStateBits(&fillRectMask, 0x00004000, false); -
101 -
102 updateStateBits(&fillRectMask, 0x00010000, false); -
103 updateStateBits(&fillRectMask, 0x00020000, false); -
104 }
never executed: }
0
105 -
106 void setAlphaFillRectMask() { -
107 updateStateBits(&alphaFillRectMask, 0x00000001, false); -
108 updateStateBits(&alphaFillRectMask, 0x00000002, false); -
109 -
110 updateStateBits(&alphaFillRectMask, 0x00000010, false); -
111 updateStateBits(&alphaFillRectMask, 0x00000020, true); -
112 -
113 updateStateBits(&alphaFillRectMask, 0x00000100, true); -
114 -
115 -
116 updateStateBits(&alphaFillRectMask, 0x00001000, true); -
117 updateStateBits(&alphaFillRectMask, 0x00002000, false); -
118 updateStateBits(&alphaFillRectMask, 0x00004000, false); -
119 -
120 updateStateBits(&alphaFillRectMask, 0x00010000, false); -
121 updateStateBits(&alphaFillRectMask, 0x00020000, false); -
122 }
never executed: }
0
123 -
124 void setSourcePixmapMask() { -
125 updateStateBits(&drawPixmapMask, 0x00000001, true); -
126 updateStateBits(&drawPixmapMask, 0x00000002, false); -
127 -
128 updateStateBits(&drawPixmapMask, 0x00000010, true); -
129 updateStateBits(&drawPixmapMask, 0x00000020, false); -
130 -
131 updateStateBits(&drawPixmapMask, 0x00000100, true); -
132 -
133 updateStateBits(&drawPixmapMask, 0x00001000, true); -
134 updateStateBits(&drawPixmapMask, 0x00002000, false); -
135 updateStateBits(&drawPixmapMask, 0x00004000, false); -
136 -
137 updateStateBits(&drawPixmapMask, 0x00010000, false); -
138 updateStateBits(&drawPixmapMask, 0x00020000, false); -
139 }
never executed: }
0
140 -
141 void setSourceOverPixmapMask() { -
142 setSourcePixmapMask(); -
143 }
never executed: }
0
144 -
145 void setSourceOverScaledPixmapMask() { -
146 setSourceOverPixmapMask(); -
147 updateStateBits(&drawRectMask, 0x00000001, true); -
148 }
never executed: }
0
149 -
150 void setOpacityPixmapMask() { -
151 updateStateBits(&opacityPixmapMask, 0x00000001, true); -
152 updateStateBits(&opacityPixmapMask, 0x00000002, false); -
153 -
154 updateStateBits(&opacityPixmapMask, 0x00000010, true); -
155 updateStateBits(&opacityPixmapMask, 0x00000020, true); -
156 -
157 updateStateBits(&opacityPixmapMask, 0x00000100, true); -
158 -
159 updateStateBits(&opacityPixmapMask, 0x00001000, true); -
160 updateStateBits(&opacityPixmapMask, 0x00002000, true); -
161 updateStateBits(&opacityPixmapMask, 0x00004000, false); -
162 -
163 updateStateBits(&opacityPixmapMask, 0x00010000, false); -
164 updateStateBits(&opacityPixmapMask, 0x00020000, false); -
165 }
never executed: }
0
166 -
167 QBlittable::Capabilities m_capabilities; -
168 uint fillRectMask; -
169 uint drawRectMask; -
170 uint drawPixmapMask; -
171 uint alphaFillRectMask; -
172 uint opacityPixmapMask; -
173 uint capabillitiesState; -
174}; -
175 -
176class QBlitterPaintEnginePrivate : public QRasterPaintEnginePrivate -
177{ -
178 inline QBlitterPaintEngine* q_func() { return static_cast<QBlitterPaintEngine *>(q_ptr); } inline const QBlitterPaintEngine* q_func() const { return static_cast<const QBlitterPaintEngine *>(q_ptr); } friend class QBlitterPaintEngine;; -
179public: -
180 QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p) -
181 : QRasterPaintEnginePrivate() -
182 , pmData(p) -
183 , caps(pmData->blittable()->capabilities()) -
184 , hasXForm(false) -
185 -
186 {}
never executed: }
0
187 -
188 void lock(); -
189 void unlock(); -
190 void fillRect(const QRectF &rect, const QColor &color, bool alpha); -
191 void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity); -
192 -
193 -
194 void updateCompleteState(QPainterState *s); -
195 void updatePenState(QPainterState *s); -
196 void updateBrushState(QPainterState *s); -
197 void updateOpacityState(QPainterState *s); -
198 void updateCompositionModeState(QPainterState *s); -
199 void updateRenderHintsState(QPainterState *s); -
200 void updateTransformState(QPainterState *s); -
201 void updateClipState(QPainterState *s); -
202 -
203 QBlittablePlatformPixmap *pmData; -
204 CapabilitiesToStateMask caps; -
205 uint hasXForm; -
206}; -
207 -
208 -
209inline void QBlitterPaintEnginePrivate::lock() -
210{ -
211 if (!pmData->blittable()->isLocked())
never evaluated: !pmData->blittable()->isLocked()
0
212 rasterBuffer->prepare(pmData->buffer());
never executed: rasterBuffer->prepare(pmData->buffer());
0
213}
never executed: }
0
214 -
215inline void QBlitterPaintEnginePrivate::unlock() -
216{ -
217 pmData->blittable()->unlock(); -
218}
never executed: }
0
219 -
220 -
221void QBlitterPaintEnginePrivate::updateCompleteState(QPainterState *s) -
222{ -
223 updatePenState(s); -
224 updateBrushState(s); -
225 updateOpacityState(s); -
226 updateCompositionModeState(s); -
227 updateRenderHintsState(s); -
228 updateTransformState(s); -
229 updateClipState(s); -
230}
never executed: }
0
231 -
232void QBlitterPaintEnginePrivate::updatePenState(QPainterState *s) -
233{ -
234 caps.updateState(0x00000100, qpen_style(s->pen) != Qt::NoPen); -
235}
never executed: }
0
236 -
237void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s) -
238{ -
239 Qt::BrushStyle style = qbrush_style(s->brush); -
240 -
241 caps.updateState(0x00000010, style > Qt::SolidPattern); -
242 caps.updateState(0x00000020, -
243 qbrush_color(s->brush).alpha() < 255); -
244}
never executed: }
0
245 -
246void QBlitterPaintEnginePrivate::updateOpacityState(QPainterState *s) -
247{ -
248 bool translucent = s->opacity < 1; -
249 caps.updateState(0x00002000, translucent); -
250}
never executed: }
0
251 -
252void QBlitterPaintEnginePrivate::updateCompositionModeState(QPainterState *s) -
253{ -
254 bool nonTrivial = s->composition_mode != QPainter::CompositionMode_SourceOver
never evaluated: s->composition_mode != QPainter::CompositionMode_SourceOver
0
255 && s->composition_mode != QPainter::CompositionMode_Source;
never evaluated: s->composition_mode != QPainter::CompositionMode_Source
0
256 -
257 caps.updateState(0x00004000, nonTrivial); -
258}
never executed: }
0
259 -
260void QBlitterPaintEnginePrivate::updateRenderHintsState(QPainterState *s) -
261{ -
262 bool aa = s->renderHints & QPainter::Antialiasing; -
263 caps.updateState(0x00001000, aa); -
264}
never executed: }
0
265 -
266void QBlitterPaintEnginePrivate::updateTransformState(QPainterState *s) -
267{ -
268 QTransform::TransformationType type = s->matrix.type(); -
269 -
270 -
271 -
272 -
273 caps.updateState(0x00000002, (type > QTransform::TxScale) || -
274 ((type == QTransform::TxScale) && ((s->matrix.m11() < 0.0) || (s->matrix.m22() < 0.0)))); -
275 caps.updateState(0x00000001, type > QTransform::TxTranslate); -
276 -
277 hasXForm = type >= QTransform::TxTranslate; -
278}
never executed: }
0
279 -
280void QBlitterPaintEnginePrivate::updateClipState(QPainterState *) -
281{ -
282 const QClipData *clipData = clip(); -
283 bool complexClip = clipData && !(clipData->hasRectClip || clipData->hasRegionClip);
never evaluated: clipData
never evaluated: clipData->hasRectClip
never evaluated: clipData->hasRegionClip
0
284 caps.updateState(0x00020000, complexClip); -
285}
never executed: }
0
286 -
287void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &color, bool alpha) -
288{ -
289 QBlitterPaintEngine * const q = q_func(); -
290 pmData->unmarkRasterOverlay(rect); -
291 QRectF targetRect = rect; -
292 if (hasXForm)
never evaluated: hasXForm
0
293 targetRect = q->state()->matrix.mapRect(rect);
never executed: targetRect = q->state()->matrix.mapRect(rect);
0
294 const QClipData *clipData = clip(); -
295 if (clipData) {
never evaluated: clipData
0
296 if (clipData->hasRectClip) {
never evaluated: clipData->hasRectClip
0
297 unlock(); -
298 if (alpha)
never evaluated: alpha
0
299 pmData->blittable()->alphaFillRect(targetRect & clipData->clipRect, color, q->state()->compositionMode());
never executed: pmData->blittable()->alphaFillRect(targetRect & clipData->clipRect, color, q->state()->compositionMode());
0
300 else -
301 pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
never executed: pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
0
302 } else if (clipData->hasRegionClip) {
never evaluated: clipData->hasRegionClip
0
303 QVector<QRect> rects = clipData->clipRegion.rects(); -
304 for (int i = 0; i < rects.size(); ++i) {
never evaluated: i < rects.size()
0
305 QRect intersectRect = rects.at(i).intersected(targetRect.toRect()); -
306 if (!intersectRect.isEmpty()) {
never evaluated: !intersectRect.isEmpty()
0
307 unlock(); -
308 if (alpha)
never evaluated: alpha
0
309 pmData->blittable()->alphaFillRect(intersectRect, color, q->state()->compositionMode());
never executed: pmData->blittable()->alphaFillRect(intersectRect, color, q->state()->compositionMode());
0
310 else -
311 pmData->blittable()->fillRect(intersectRect, color);
never executed: pmData->blittable()->fillRect(intersectRect, color);
0
312 } -
313 }
never executed: }
0
314 }
never executed: }
0
315 } else { -
316 if (targetRect.x() >= 0 && targetRect.y() >= 0
never evaluated: targetRect.x() >= 0
never evaluated: targetRect.y() >= 0
0
317 && targetRect.width() <= q->paintDevice()->width()
never evaluated: targetRect.width() <= q->paintDevice()->width()
0
318 && targetRect.height() <= q->paintDevice()->height()) {
never evaluated: targetRect.height() <= q->paintDevice()->height()
0
319 unlock(); -
320 if (alpha)
never evaluated: alpha
0
321 pmData->blittable()->alphaFillRect(targetRect, color, q->state()->compositionMode());
never executed: pmData->blittable()->alphaFillRect(targetRect, color, q->state()->compositionMode());
0
322 else -
323 pmData->blittable()->fillRect(targetRect, color);
never executed: pmData->blittable()->fillRect(targetRect, color);
0
324 } else { -
325 QRectF deviceRect(0, 0, q->paintDevice()->width(), q->paintDevice()->height()); -
326 unlock(); -
327 if (alpha)
never evaluated: alpha
0
328 pmData->blittable()->alphaFillRect(deviceRect & targetRect, color, q->state()->compositionMode());
never executed: pmData->blittable()->alphaFillRect(deviceRect & targetRect, color, q->state()->compositionMode());
0
329 else -
330 pmData->blittable()->fillRect(deviceRect & targetRect, color);
never executed: pmData->blittable()->fillRect(deviceRect & targetRect, color);
0
331 } -
332 } -
333} -
334 -
335void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip, -
336 const QRectF &target, -
337 const QPixmap &pm, -
338 const QRectF &sr, -
339 bool opacity) -
340{ -
341 QBlitterPaintEngine * const q = q_func(); -
342 QRectF intersectedRect = clip.intersected(target); -
343 if (intersectedRect.isEmpty())
never evaluated: intersectedRect.isEmpty()
0
344 return;
never executed: return;
0
345 QRectF source = sr; -
346 if (intersectedRect.size() != target.size()) {
never evaluated: intersectedRect.size() != target.size()
0
347 if (sr.size() == target.size()) {
never evaluated: sr.size() == target.size()
0
348 -
349 qreal deltaTop = target.top() - intersectedRect.top(); -
350 qreal deltaLeft = target.left() - intersectedRect.left(); -
351 qreal deltaBottom = target.bottom() - intersectedRect.bottom(); -
352 qreal deltaRight = target.right() - intersectedRect.right(); -
353 source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); -
354 } else {
never executed: }
0
355 -
356 qreal hFactor = sr.size().width() / target.size().width(); -
357 qreal vFactor = sr.size().height() / target.size().height(); -
358 qreal deltaTop = (target.top() - intersectedRect.top()) * vFactor; -
359 qreal deltaLeft = (target.left() - intersectedRect.left()) * hFactor; -
360 qreal deltaBottom = (target.bottom() - intersectedRect.bottom()) * vFactor; -
361 qreal deltaRight = (target.right() - intersectedRect.right()) * hFactor; -
362 source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); -
363 }
never executed: }
0
364 } -
365 pmData->unmarkRasterOverlay(intersectedRect); -
366 if (opacity)
never evaluated: opacity
0
367 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
368 else -
369 pmData->blittable()->drawPixmap(intersectedRect, pm, source);
never executed: pmData->blittable()->drawPixmap(intersectedRect, pm, source);
0
370} -
371 -
372QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p) -
373 : QRasterPaintEngine(*(new QBlitterPaintEnginePrivate(p)), p->buffer()) -
374{}
never executed: }
0
375 -
376 -
377void QBlitterPaintEngine::penChanged() -
378{ -
379 QBlitterPaintEnginePrivate * const d = d_func(); -
380 -
381 QRasterPaintEngine::penChanged(); -
382 d->updatePenState(state()); -
383}
never executed: }
0
384 -
385void QBlitterPaintEngine::brushChanged() -
386{ -
387 QBlitterPaintEnginePrivate * const d = d_func(); -
388 -
389 QRasterPaintEngine::brushChanged(); -
390 d->updateBrushState(state()); -
391}
never executed: }
0
392 -
393void QBlitterPaintEngine::opacityChanged() -
394{ -
395 QBlitterPaintEnginePrivate * const d = d_func(); -
396 -
397 QRasterPaintEngine::opacityChanged(); -
398 d->updateOpacityState(state()); -
399}
never executed: }
0
400 -
401void QBlitterPaintEngine::compositionModeChanged() -
402{ -
403 QBlitterPaintEnginePrivate * const d = d_func(); -
404 -
405 QRasterPaintEngine::compositionModeChanged(); -
406 d->updateCompositionModeState(state()); -
407}
never executed: }
0
408 -
409void QBlitterPaintEngine::renderHintsChanged() -
410{ -
411 QBlitterPaintEnginePrivate * const d = d_func(); -
412 -
413 QRasterPaintEngine::renderHintsChanged(); -
414 d->updateRenderHintsState(state()); -
415}
never executed: }
0
416 -
417void QBlitterPaintEngine::transformChanged() -
418{ -
419 QBlitterPaintEnginePrivate * const d = d_func(); -
420 -
421 QRasterPaintEngine::transformChanged(); -
422 d->updateTransformState(state()); -
423}
never executed: }
0
424 -
425void QBlitterPaintEngine::clipEnabledChanged() -
426{ -
427 QBlitterPaintEnginePrivate * const d = d_func(); -
428 QRasterPaintEngine::clipEnabledChanged(); -
429 d->updateClipState(state()); -
430}
never executed: }
0
431 -
432bool QBlitterPaintEngine::begin(QPaintDevice *pdev) -
433{ -
434 bool ok = QRasterPaintEngine::begin(pdev); -
435 -
436 -
437 -
438 -
439 return ok;
never executed: return ok;
0
440} -
441 -
442bool QBlitterPaintEngine::end() -
443{ -
444 -
445 -
446 -
447 -
448 -
449 return QRasterPaintEngine::end();
never executed: return QRasterPaintEngine::end();
0
450} -
451 -
452void QBlitterPaintEngine::setState(QPainterState *s) -
453{ -
454 QBlitterPaintEnginePrivate * const d = d_func(); -
455 -
456 QRasterPaintEngine::setState(s); -
457 d->updateCompleteState(s); -
458}
never executed: }
0
459 -
460 -
461void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) -
462{ -
463 QBlitterPaintEnginePrivate * const d = d_func(); -
464 if (path.shape() == QVectorPath::RectangleHint) {
never evaluated: path.shape() == QVectorPath::RectangleHint
0
465 QRectF rect(((QPointF *) path.points())[0], ((QPointF *) path.points())[2]); -
466 fillRect(rect, brush); -
467 } else {
never executed: }
0
468 d->lock(); -
469 d->pmData->markRasterOverlay(path); -
470 QRasterPaintEngine::fill(path, brush); -
471 }
never executed: }
0
472} -
473 -
474void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color) -
475{ -
476 QBlitterPaintEnginePrivate * const d = d_func(); -
477 if (d->caps.canBlitterAlphaFillRect()) {
never evaluated: d->caps.canBlitterAlphaFillRect()
0
478 d->fillRect(rect, color, true); -
479 } else if (d->caps.canBlitterFillRect() && color.alpha() == 0xff) {
never evaluated: d->caps.canBlitterFillRect()
never evaluated: color.alpha() == 0xff
never executed: }
0
480 d->fillRect(rect, color, false); -
481 } else {
never executed: }
0
482 d->lock(); -
483 d->pmData->markRasterOverlay(rect); -
484 QRasterPaintEngine::fillRect(rect, color); -
485 }
never executed: }
0
486} -
487 -
488void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) -
489{ -
490 if (rect.size().isEmpty())
never evaluated: rect.size().isEmpty()
0
491 return;
never executed: return;
0
492 -
493 QBlitterPaintEnginePrivate * const d = d_func(); -
494 -
495 if (qbrush_style(brush) == Qt::SolidPattern
never evaluated: qbrush_style(brush) == Qt::SolidPattern
0
496 && d->caps.canBlitterAlphaFillRect()) {
never evaluated: d->caps.canBlitterAlphaFillRect()
0
497 d->fillRect(rect, qbrush_color(brush), true); -
498 } else if (qbrush_style(brush) == Qt::SolidPattern
never evaluated: qbrush_style(brush) == Qt::SolidPattern
never executed: }
0
499 && qbrush_color(brush).alpha() == 0xff
never evaluated: qbrush_color(brush).alpha() == 0xff
0
500 && d->caps.canBlitterFillRect()) {
never evaluated: d->caps.canBlitterFillRect()
0
501 d->fillRect(rect, qbrush_color(brush), false); -
502 } else if ((brush.style() == Qt::TexturePattern) &&
never evaluated: (brush.style() == Qt::TexturePattern)
never executed: }
0
503 (brush.transform().type() <= QTransform::TxTranslate) &&
never evaluated: (brush.transform().type() <= QTransform::TxTranslate)
0
504 ((d->caps.canBlitterDrawPixmapOpacity(brush.texture())) ||
never evaluated: (d->caps.canBlitterDrawPixmapOpacity(brush.texture()))
0
505 (d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect)))) {
never evaluated: (d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect))
0
506 bool rectIsFilled = false; -
507 QRectF transformedRect = state()->matrix.mapRect(rect); -
508 qreal x = transformedRect.x(); -
509 qreal y = transformedRect.y(); -
510 QPixmap pm = brush.texture(); -
511 d->unlock(); -
512 int srcX = int(rect.x() - state()->brushOrigin.x() - brush.transform().dx()) % pm.width(); -
513 if (srcX < 0)
never evaluated: srcX < 0
0
514 srcX = pm.width() + srcX;
never executed: srcX = pm.width() + srcX;
0
515 const int startX = srcX; -
516 int srcY = int(rect.y() - state()->brushOrigin.y() - brush.transform().dy()) % pm.height(); -
517 if (srcY < 0)
never evaluated: srcY < 0
0
518 srcY = pm.height() + srcY;
never executed: srcY = pm.height() + srcY;
0
519 while (!rectIsFilled) {
never evaluated: !rectIsFilled
0
520 qreal blitWidth = (pm.width() ) - srcX; -
521 qreal blitHeight = (pm.height() ) - srcY; -
522 if (x + blitWidth > transformedRect.right())
never evaluated: x + blitWidth > transformedRect.right()
0
523 blitWidth = transformedRect.right() -x;
never executed: blitWidth = transformedRect.right() -x;
0
524 if (y + blitHeight > transformedRect.bottom())
never evaluated: y + blitHeight > transformedRect.bottom()
0
525 blitHeight = transformedRect.bottom() - y;
never executed: blitHeight = transformedRect.bottom() - y;
0
526 const QClipData *clipData = d->clip(); -
527 if (clipData->hasRectClip) {
never evaluated: clipData->hasRectClip
0
528 QRect targetRect = QRect(x, y, blitWidth, blitHeight).intersected(clipData->clipRect); -
529 if (targetRect.isValid()) {
never evaluated: targetRect.isValid()
0
530 int tmpSrcX = srcX + (targetRect.x() - x); -
531 int tmpSrcY = srcY + (targetRect.y() - y); -
532 QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height()); -
533 d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect); -
534 }
never executed: }
0
535 } else if (clipData->hasRegionClip) {
never evaluated: clipData->hasRegionClip
never executed: }
0
536 QVector<QRect> clipRects = clipData->clipRegion.rects(); -
537 QRect unclippedTargetRect(x, y, blitWidth, blitHeight); -
538 QRegion intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect); -
539 -
540 for (int i = 0; i < intersectedRects.rects().size(); ++i) {
never evaluated: i < intersectedRects.rects().size()
0
541 QRect targetRect = intersectedRects.rects().at(i); -
542 if (!targetRect.isValid() || targetRect.isEmpty())
never evaluated: !targetRect.isValid()
never evaluated: targetRect.isEmpty()
0
543 continue;
never executed: continue;
0
544 int tmpSrcX = srcX + (targetRect.x() - x); -
545 int tmpSrcY = srcY + (targetRect.y() - y); -
546 QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height()); -
547 d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect); -
548 }
never executed: }
0
549 }
never executed: }
0
550 x+=blitWidth; -
551 if (qFuzzyCompare(x, transformedRect.right())) {
never evaluated: qFuzzyCompare(x, transformedRect.right())
0
552 x = transformedRect.x(); -
553 srcX = startX; -
554 srcY = 0; -
555 y += blitHeight; -
556 if (qFuzzyCompare(y, transformedRect.bottom()))
never evaluated: qFuzzyCompare(y, transformedRect.bottom())
0
557 rectIsFilled = true;
never executed: rectIsFilled = true;
0
558 } else
never executed: }
0
559 srcX = 0;
never executed: srcX = 0;
0
560 } -
561 } else {
never executed: }
0
562 d->lock(); -
563 d->pmData->markRasterOverlay(rect); -
564 QRasterPaintEngine::fillRect(rect, brush); -
565 }
never executed: }
0
566 -
567} -
568 -
569void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount) -
570{ -
571 QBlitterPaintEnginePrivate * const d = d_func(); -
572 if (d->caps.canBlitterDrawRectMask()) {
never evaluated: d->caps.canBlitterDrawRectMask()
0
573 for (int i=0; i<rectCount; ++i)
never evaluated: i<rectCount
0
574 d->fillRect(rects[i], qbrush_color(state()->brush), false);
never executed: d->fillRect(rects[i], qbrush_color(state()->brush), false);
0
575 } else {
never executed: }
0
576 d->pmData->markRasterOverlay(rects, rectCount); -
577 QRasterPaintEngine::drawRects(rects, rectCount); -
578 }
never executed: }
0
579} -
580 -
581void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount) -
582{ -
583 QBlitterPaintEnginePrivate * const d = d_func(); -
584 if (d->caps.canBlitterDrawRectMask()) {
never evaluated: d->caps.canBlitterDrawRectMask()
0
585 for (int i = 0; i < rectCount; ++i)
never evaluated: i < rectCount
0
586 d->fillRect(rects[i], qbrush_color(state()->brush), false);
never executed: d->fillRect(rects[i], qbrush_color(state()->brush), false);
0
587 } else {
never executed: }
0
588 d->pmData->markRasterOverlay(rects, rectCount); -
589 QRasterPaintEngine::drawRects(rects, rectCount); -
590 }
never executed: }
0
591} -
592 -
593void QBlitterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) -
594{ -
595 drawPixmap(QRectF(pos, pm.size()), pm, pm.rect()); -
596}
never executed: }
0
597 -
598void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) -
599{ -
600 QBlitterPaintEnginePrivate * const d = d_func(); -
601 bool canDrawOpacity; -
602 -
603 canDrawOpacity = d->caps.canBlitterDrawPixmapOpacity(pm); -
604 if (canDrawOpacity || (d->caps.canBlitterDrawPixmap(r, pm, sr))) {
never evaluated: canDrawOpacity
never evaluated: (d->caps.canBlitterDrawPixmap(r, pm, sr))
0
605 -
606 d->unlock(); -
607 QRectF targetRect = r; -
608 if (d->hasXForm)
never evaluated: d->hasXForm
0
609 targetRect = state()->matrix.mapRect(r);
never executed: targetRect = state()->matrix.mapRect(r);
0
610 const QClipData *clipData = d->clip(); -
611 if (clipData) {
never evaluated: clipData
0
612 if (clipData->hasRectClip) {
never evaluated: clipData->hasRectClip
0
613 d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity); -
614 } else if (clipData->hasRegionClip) {
never evaluated: clipData->hasRegionClip
never executed: }
0
615 QVector<QRect>rects = clipData->clipRegion.rects(); -
616 for (int i = 0; i<rects.size(); ++i)
never evaluated: i<rects.size()
0
617 d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity);
never executed: d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity);
0
618 }
never executed: }
0
619 } else { -
620 QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height()); -
621 d->clipAndDrawPixmap(deviceRect, targetRect, pm, sr, canDrawOpacity); -
622 }
never executed: }
0
623 }else { -
624 d->lock(); -
625 d->pmData->markRasterOverlay(r); -
626 QRasterPaintEngine::drawPixmap(r, pm, sr); -
627 }
never executed: }
0
628} -
629 -
630 -
631void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) -
632{ -
633 QBlitterPaintEnginePrivate * const d = d_func(); -
634 d->lock(); -
635 d->pmData->markRasterOverlay(points, pointCount); -
636 QRasterPaintEngine::drawPolygon(points, pointCount, mode); -
637}
never executed: }
0
638 -
639void QBlitterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) -
640{ -
641 QBlitterPaintEnginePrivate * const d = d_func(); -
642 d->lock(); -
643 d->pmData->markRasterOverlay(points, pointCount); -
644 QRasterPaintEngine::drawPolygon(points, pointCount, mode); -
645}
never executed: }
0
646 -
647void QBlitterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData) -
648{ -
649 QBlitterPaintEnginePrivate * const d = d_func(); -
650 d->lock(); -
651 d->pmData->markRasterOverlay(path); -
652 QRasterPaintEngine::fillPath(path, fillData); -
653}
never executed: }
0
654 -
655void QBlitterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) -
656{ -
657 QBlitterPaintEnginePrivate * const d = d_func(); -
658 d->lock(); -
659 d->pmData->markRasterOverlay(points, pointCount); -
660 QRasterPaintEngine::fillPolygon(points, pointCount, mode); -
661}
never executed: }
0
662 -
663void QBlitterPaintEngine::drawEllipse(const QRectF &r) -
664{ -
665 QBlitterPaintEnginePrivate * const d = d_func(); -
666 d->lock(); -
667 d->pmData->markRasterOverlay(r); -
668 QRasterPaintEngine::drawEllipse(r); -
669}
never executed: }
0
670 -
671void QBlitterPaintEngine::drawImage(const QPointF &pos, const QImage &image) -
672{ -
673 drawImage(QRectF(pos, image.size()), image, image.rect()); -
674}
never executed: }
0
675 -
676void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, -
677 Qt::ImageConversionFlags flags) -
678{ -
679 QBlitterPaintEnginePrivate * const d = d_func(); -
680 d->lock(); -
681 d->pmData->markRasterOverlay(r); -
682 QRasterPaintEngine::drawImage(r, pm, sr, flags); -
683}
never executed: }
0
684 -
685void QBlitterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) -
686{ -
687 QBlitterPaintEnginePrivate * const d = d_func(); -
688 d->lock(); -
689 d->pmData->markRasterOverlay(r); -
690 QRasterPaintEngine::drawTiledPixmap(r, pm, sr); -
691}
never executed: }
0
692 -
693void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) -
694{ -
695 QBlitterPaintEnginePrivate * const d = d_func(); -
696 d->lock(); -
697 d->pmData->markRasterOverlay(pos, ti); -
698 QRasterPaintEngine::drawTextItem(pos, ti); -
699}
never executed: }
0
700 -
701void QBlitterPaintEngine::drawPoints(const QPointF *points, int pointCount) -
702{ -
703 QBlitterPaintEnginePrivate * const d = d_func(); -
704 d->lock(); -
705 d->pmData->markRasterOverlay(points, pointCount); -
706 QRasterPaintEngine::drawPoints(points, pointCount); -
707}
never executed: }
0
708 -
709void QBlitterPaintEngine::drawPoints(const QPoint *points, int pointCount) -
710{ -
711 QBlitterPaintEnginePrivate * const d = d_func(); -
712 d->lock(); -
713 d->pmData->markRasterOverlay(points, pointCount); -
714 QRasterPaintEngine::drawPoints(points, pointCount); -
715}
never executed: }
0
716 -
717void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) -
718{ -
719 QBlitterPaintEnginePrivate * const d = d_func(); -
720 d->lock(); -
721 d->pmData->markRasterOverlay(path); -
722 QRasterPaintEngine::stroke(path, pen); -
723}
never executed: }
0
724 -
725void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti) -
726{ -
727 QBlitterPaintEnginePrivate * const d = d_func(); -
728 d->lock(); -
729 QRasterPaintEngine::drawStaticTextItem(sti); -
730 -
731 -
732 -
733 -
734 -
735}
never executed: }
0
736 -
737 -
738 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial