Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | class QRectVectorPath : public QVectorPath { | - |
17 | public: | - |
18 | inline void set(const QRect &r) { | - |
19 | qreal left = r.x(); | - |
20 | qreal right = r.x() + r.width(); | - |
21 | qreal top = r.y(); | - |
22 | qreal bottom = r.y() + r.height(); | - |
23 | pts[0] = left; | - |
24 | pts[1] = top; | - |
25 | pts[2] = right; | - |
26 | pts[3] = top; | - |
27 | pts[4] = right; | - |
28 | pts[5] = bottom; | - |
29 | pts[6] = left; | - |
30 | pts[7] = bottom; | - |
31 | } executed: } Execution Count:2397 | 2397 |
32 | | - |
33 | inline void set(const QRectF &r) { | - |
34 | qreal left = r.x(); | - |
35 | qreal right = r.x() + r.width(); | - |
36 | qreal top = r.y(); | - |
37 | qreal bottom = r.y() + r.height(); | - |
38 | pts[0] = left; | - |
39 | pts[1] = top; | - |
40 | pts[2] = right; | - |
41 | pts[3] = top; | - |
42 | pts[4] = right; | - |
43 | pts[5] = bottom; | - |
44 | pts[6] = left; | - |
45 | pts[7] = bottom; | - |
46 | } executed: } Execution Count:361 | 361 |
47 | inline QRectVectorPath(const QRect &r) | - |
48 | : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) | - |
49 | { | - |
50 | set(r); | - |
51 | } | 0 |
52 | inline QRectVectorPath(const QRectF &r) | - |
53 | : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) | - |
54 | { | - |
55 | set(r); | - |
56 | } | 0 |
57 | inline QRectVectorPath() | - |
58 | : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) | - |
59 | { } executed: } Execution Count:2758 | 2758 |
60 | | - |
61 | qreal pts[8]; | - |
62 | }; | - |
63 | | - |
64 | __attribute__((visibility("default"))) extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); | - |
65 | static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; | - |
66 | static void qt_span_fill_clipRect(int count, const QSpan *spans, void *userData); | - |
67 | static void qt_span_fill_clipped(int count, const QSpan *spans, void *userData); | - |
68 | static void qt_span_clip(int count, const QSpan *spans, void *userData); | - |
69 | | - |
70 | struct ClipData | - |
71 | { | - |
72 | QClipData *oldClip; | - |
73 | QClipData *newClip; | - |
74 | Qt::ClipOperation operation; | - |
75 | }; | - |
76 | | - |
77 | enum LineDrawMode { | - |
78 | LineDrawClipped, | - |
79 | LineDrawNormal, | - |
80 | LineDrawIncludeLastPixel | - |
81 | }; | - |
82 | | - |
83 | static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, | - |
84 | ProcessSpans pen_func, ProcessSpans brush_func, | - |
85 | QSpanData *pen_data, QSpanData *brush_data); | - |
86 | | - |
87 | struct QRasterFloatPoint { | - |
88 | qreal x; | - |
89 | qreal y; | - |
90 | }; | - |
91 | template <typename T> static inline bool isRect(const T *pts, int elementCount) { | - |
92 | return (elementCount == 5 | 1671 |
93 | && pts[0] == pts[8] && pts[1] == pts[9] | 1671 |
94 | && pts[0] == pts[6] && pts[2] == pts[4] | 1671 |
95 | && pts[1] == pts[3] && pts[5] == pts[7] | 1671 |
96 | && pts[0] < pts[4] && pts[1] < pts[5] | 1671 |
97 | ) || | 1671 |
98 | (elementCount == 4 | 1671 |
99 | && pts[0] == pts[6] && pts[2] == pts[4] | 1671 |
100 | && pts[1] == pts[3] && pts[5] == pts[7] | 1671 |
101 | && pts[0] < pts[4] && pts[1] < pts[5] | 1671 |
102 | ); executed: return (elementCount == 5 && pts[0] == pts[8] && pts[1] == pts[9] && pts[0] == pts[6] && pts[2] == pts[4] && pts[1] == pts[3] && pts[5] == pts[7] && pts[0] < pts[4] && pts[1] < pts[5] ) || (elementCount == 4 && pts[0] == pts[6] && pts[2] == pts[4] && pts[1] == pts[3] && pts[5] == pts[7] && pts[0] < pts[4] && pts[1] < pts[5] ); Execution Count:1671 | 1671 |
103 | } | - |
104 | | - |
105 | | - |
106 | static void qt_ft_outline_move_to(qfixed x, qfixed y, void *data) | - |
107 | { | - |
108 | ((QOutlineMapper *) data)->moveTo(QPointF(x, y)); | - |
109 | } | 0 |
110 | | - |
111 | static void qt_ft_outline_line_to(qfixed x, qfixed y, void *data) | - |
112 | { | - |
113 | ((QOutlineMapper *) data)->lineTo(QPointF(x, y)); | - |
114 | } | 0 |
115 | | - |
116 | static void qt_ft_outline_cubic_to(qfixed c1x, qfixed c1y, | - |
117 | qfixed c2x, qfixed c2y, | - |
118 | qfixed ex, qfixed ey, | - |
119 | void *data) | - |
120 | { | - |
121 | ((QOutlineMapper *) data)->curveTo(QPointF(c1x, c1y), | - |
122 | QPointF(c2x, c2y), | - |
123 | QPointF(ex, ey)); | - |
124 | } | 0 |
125 | QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() : | - |
126 | QPaintEngineExPrivate(), | - |
127 | cachedLines(0) | - |
128 | { | - |
129 | } executed: } Execution Count:5615 | 5615 |
130 | QRasterPaintEngine::QRasterPaintEngine(QPaintDevice *device) | - |
131 | : QPaintEngineEx(*(new QRasterPaintEnginePrivate)) | - |
132 | { | - |
133 | d_func()->device = device; | - |
134 | init(); | - |
135 | } executed: } Execution Count:5614 | 5614 |
136 | | - |
137 | | - |
138 | | - |
139 | | - |
140 | QRasterPaintEngine::QRasterPaintEngine(QRasterPaintEnginePrivate &dd, QPaintDevice *device) | - |
141 | : QPaintEngineEx(dd) | - |
142 | { | - |
143 | d_func()->device = device; | - |
144 | init(); | - |
145 | } | 0 |
146 | | - |
147 | void QRasterPaintEngine::init() | - |
148 | { | - |
149 | QRasterPaintEnginePrivate * const d = d_func(); | - |
150 | | - |
151 | | - |
152 | | - |
153 | | - |
154 | | - |
155 | | - |
156 | | - |
157 | d->grayRaster.reset(new QT_FT_Raster); | - |
158 | qt_noop(); | - |
159 | if (qt_ft_grays_raster.raster_new(d->grayRaster.data())) partially evaluated: qt_ft_grays_raster.raster_new(d->grayRaster.data()) no Evaluation Count:0 | yes Evaluation Count:5615 |
| 0-5615 |
160 | qt_noop(); never executed: qt_noop(); | 0 |
161 | | - |
162 | | - |
163 | d->rasterizer.reset(new QRasterizer); | - |
164 | d->rasterBuffer.reset(new QRasterBuffer()); | - |
165 | d->outlineMapper.reset(new QOutlineMapper); | - |
166 | d->outlinemapper_xform_dirty = true; | - |
167 | | - |
168 | d->basicStroker.setMoveToHook(qt_ft_outline_move_to); | - |
169 | d->basicStroker.setLineToHook(qt_ft_outline_line_to); | - |
170 | d->basicStroker.setCubicToHook(qt_ft_outline_cubic_to); | - |
171 | | - |
172 | d->baseClip.reset(new QClipData(d->device->height())); | - |
173 | d->baseClip->setClipRect(QRect(0, 0, d->device->width(), d->device->height())); | - |
174 | | - |
175 | d->image_filler.init(d->rasterBuffer.data(), this); | - |
176 | d->image_filler.type = QSpanData::Texture; | - |
177 | | - |
178 | d->image_filler_xform.init(d->rasterBuffer.data(), this); | - |
179 | d->image_filler_xform.type = QSpanData::Texture; | - |
180 | | - |
181 | d->solid_color_filler.init(d->rasterBuffer.data(), this); | - |
182 | d->solid_color_filler.type = QSpanData::Solid; | - |
183 | | - |
184 | d->deviceDepth = d->device->depth(); | - |
185 | | - |
186 | d->mono_surface = false; | - |
187 | gccaps &= ~PorterDuff; | - |
188 | | - |
189 | QImage::Format format = QImage::Format_Invalid; | - |
190 | | - |
191 | switch (d->device->devType()) { | - |
192 | case QInternal::Pixmap: | - |
193 | QMessageLogger("painting/qpaintengine_raster.cpp", 416, __PRETTY_FUNCTION__).warning("QRasterPaintEngine: unsupported for pixmaps..."); | - |
194 | break; | 0 |
195 | case QInternal::Image: | - |
196 | format = d->rasterBuffer->prepare(static_cast<QImage *>(d->device)); | - |
197 | break; executed: break; Execution Count:5614 | 5614 |
198 | default: | - |
199 | QMessageLogger("painting/qpaintengine_raster.cpp", 422, __PRETTY_FUNCTION__).warning("QRasterPaintEngine: unsupported target device %d\n", d->device->devType()); | - |
200 | d->device = 0; | - |
201 | return; | 0 |
202 | } | - |
203 | | - |
204 | switch (format) { | - |
205 | case QImage::Format_MonoLSB: | - |
206 | case QImage::Format_Mono: | - |
207 | d->mono_surface = true; | - |
208 | break; executed: break; Execution Count:143 | 143 |
209 | case QImage::Format_ARGB8565_Premultiplied: | - |
210 | case QImage::Format_ARGB8555_Premultiplied: | - |
211 | case QImage::Format_ARGB6666_Premultiplied: | - |
212 | case QImage::Format_ARGB4444_Premultiplied: | - |
213 | case QImage::Format_ARGB32_Premultiplied: | - |
214 | case QImage::Format_ARGB32: | - |
215 | gccaps |= PorterDuff; | - |
216 | break; executed: break; Execution Count:2570 | 2570 |
217 | case QImage::Format_RGB32: | - |
218 | case QImage::Format_RGB444: | - |
219 | case QImage::Format_RGB555: | - |
220 | case QImage::Format_RGB666: | - |
221 | case QImage::Format_RGB888: | - |
222 | case QImage::Format_RGB16: | - |
223 | break; executed: break; Execution Count:2900 | 2900 |
224 | default: | - |
225 | break; executed: break; Execution Count:1 | 1 |
226 | } | - |
227 | } executed: } Execution Count:5614 | 5614 |
228 | | - |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | | - |
235 | QRasterPaintEngine::~QRasterPaintEngine() | - |
236 | { | - |
237 | QRasterPaintEnginePrivate * const d = d_func(); | - |
238 | | - |
239 | qt_ft_grays_raster.raster_done(*d->grayRaster.data()); | - |
240 | } executed: } Execution Count:5604 | 5604 |
241 | | - |
242 | | - |
243 | | - |
244 | | - |
245 | bool QRasterPaintEngine::begin(QPaintDevice *device) | - |
246 | { | - |
247 | QRasterPaintEnginePrivate * const d = d_func(); | - |
248 | | - |
249 | if (device->devType() == QInternal::Pixmap) { evaluated: device->devType() == QInternal::Pixmap yes Evaluation Count:833 | yes Evaluation Count:27903 |
| 833-27903 |
250 | QPixmap *pixmap = static_cast<QPixmap *>(device); | - |
251 | QPlatformPixmap *pd = pixmap->handle(); | - |
252 | if (pd->classId() == QPlatformPixmap::RasterClass || pd->classId() == QPlatformPixmap::BlitterClass) partially evaluated: pd->classId() == QPlatformPixmap::RasterClass yes Evaluation Count:833 | no Evaluation Count:0 |
never evaluated: pd->classId() == QPlatformPixmap::BlitterClass | 0-833 |
253 | d->device = pd->buffer(); executed: d->device = pd->buffer(); Execution Count:833 | 833 |
254 | } else { executed: } Execution Count:833 | 833 |
255 | d->device = device; | - |
256 | } executed: } Execution Count:27903 | 27903 |
257 | | - |
258 | | - |
259 | d->pdev = d->device; | - |
260 | | - |
261 | qt_noop(); | - |
262 | | - |
263 | | - |
264 | d->systemStateChanged(); | - |
265 | | - |
266 | QRasterPaintEngineState *s = state(); | - |
267 | ensureOutlineMapper(); | - |
268 | d->outlineMapper->m_clip_rect = d->deviceRect; | - |
269 | | - |
270 | if (d->outlineMapper->m_clip_rect.width() > QT_RASTER_COORD_LIMIT) partially evaluated: d->outlineMapper->m_clip_rect.width() > QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:28736 |
| 0-28736 |
271 | d->outlineMapper->m_clip_rect.setWidth(QT_RASTER_COORD_LIMIT); never executed: d->outlineMapper->m_clip_rect.setWidth(QT_RASTER_COORD_LIMIT); | 0 |
272 | if (d->outlineMapper->m_clip_rect.height() > QT_RASTER_COORD_LIMIT) partially evaluated: d->outlineMapper->m_clip_rect.height() > QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:28736 |
| 0-28736 |
273 | d->outlineMapper->m_clip_rect.setHeight(QT_RASTER_COORD_LIMIT); never executed: d->outlineMapper->m_clip_rect.setHeight(QT_RASTER_COORD_LIMIT); | 0 |
274 | | - |
275 | d->rasterizer->setClipRect(d->deviceRect); | - |
276 | | - |
277 | s->penData.init(d->rasterBuffer.data(), this); | - |
278 | s->penData.setup(s->pen.brush(), s->intOpacity, s->composition_mode); | - |
279 | s->stroker = &d->basicStroker; | - |
280 | d->basicStroker.setClipRect(d->deviceRect); | - |
281 | | - |
282 | s->brushData.init(d->rasterBuffer.data(), this); | - |
283 | s->brushData.setup(s->brush, s->intOpacity, s->composition_mode); | - |
284 | | - |
285 | d->rasterBuffer->compositionMode = QPainter::CompositionMode_SourceOver; | - |
286 | | - |
287 | setDirty(DirtyBrushOrigin); | - |
288 | if (d->mono_surface) evaluated: d->mono_surface yes Evaluation Count:167 | yes Evaluation Count:28569 |
| 167-28569 |
289 | d->glyphCacheType = QFontEngineGlyphCache::Raster_Mono; executed: d->glyphCacheType = QFontEngineGlyphCache::Raster_Mono; Execution Count:167 | 167 |
290 | | - |
291 | | - |
292 | | - |
293 | else if (false) partially evaluated: false no Evaluation Count:0 | yes Evaluation Count:28569 |
| 0-28569 |
294 | | - |
295 | { | - |
296 | QImage::Format format = static_cast<QImage *>(d->device)->format(); | - |
297 | if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) never evaluated: format == QImage::Format_ARGB32_Premultiplied never evaluated: format == QImage::Format_RGB32 | 0 |
298 | d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask; never executed: d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask; | 0 |
299 | else | - |
300 | d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; never executed: d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; | 0 |
301 | } else | - |
302 | d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; executed: d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; Execution Count:28569 | 28569 |
303 | | - |
304 | setActive(true); | - |
305 | return true; executed: return true; Execution Count:28736 | 28736 |
306 | } | - |
307 | | - |
308 | | - |
309 | | - |
310 | | - |
311 | bool QRasterPaintEngine::end() | - |
312 | { | - |
313 | return true; executed: return true; Execution Count:28736 | 28736 |
314 | } | - |
315 | | - |
316 | | - |
317 | | - |
318 | | - |
319 | void QRasterPaintEngine::releaseBuffer() | - |
320 | { | - |
321 | QRasterPaintEnginePrivate * const d = d_func(); | - |
322 | d->rasterBuffer.reset(new QRasterBuffer); | - |
323 | } | 0 |
324 | | - |
325 | | - |
326 | | - |
327 | | - |
328 | QSize QRasterPaintEngine::size() const | - |
329 | { | - |
330 | const QRasterPaintEnginePrivate * const d = d_func(); | - |
331 | return QSize(d->rasterBuffer->width(), d->rasterBuffer->height()); never executed: return QSize(d->rasterBuffer->width(), d->rasterBuffer->height()); | 0 |
332 | } | - |
333 | void QRasterPaintEngine::updateMatrix(const QTransform &matrix) | - |
334 | { | - |
335 | QRasterPaintEngineState *s = state(); | - |
336 | | - |
337 | s->matrix = matrix; | - |
338 | QTransform::TransformationType txop = s->matrix.type(); | - |
339 | | - |
340 | switch (txop) { | - |
341 | | - |
342 | case QTransform::TxNone: | - |
343 | s->flags.int_xform = true; | - |
344 | break; executed: break; Execution Count:13 | 13 |
345 | | - |
346 | case QTransform::TxTranslate: | - |
347 | s->flags.int_xform = qreal(int(s->matrix.dx())) == s->matrix.dx() evaluated: qreal(int(s->matrix.dx())) == s->matrix.dx() yes Evaluation Count:23737 | yes Evaluation Count:46 |
| 46-23737 |
348 | && qreal(int(s->matrix.dy())) == s->matrix.dy(); partially evaluated: qreal(int(s->matrix.dy())) == s->matrix.dy() yes Evaluation Count:23737 | no Evaluation Count:0 |
| 0-23737 |
349 | break; executed: break; Execution Count:23783 | 23783 |
350 | | - |
351 | case QTransform::TxScale: | - |
352 | s->flags.int_xform = qreal(int(s->matrix.dx())) == s->matrix.dx() evaluated: qreal(int(s->matrix.dx())) == s->matrix.dx() yes Evaluation Count:73 | yes Evaluation Count:2 |
| 2-73 |
353 | && qreal(int(s->matrix.dy())) == s->matrix.dy() partially evaluated: qreal(int(s->matrix.dy())) == s->matrix.dy() yes Evaluation Count:73 | no Evaluation Count:0 |
| 0-73 |
354 | && qreal(int(s->matrix.m11())) == s->matrix.m11() evaluated: qreal(int(s->matrix.m11())) == s->matrix.m11() yes Evaluation Count:17 | yes Evaluation Count:56 |
| 17-56 |
355 | && qreal(int(s->matrix.m22())) == s->matrix.m22(); evaluated: qreal(int(s->matrix.m22())) == s->matrix.m22() yes Evaluation Count:16 | yes Evaluation Count:1 |
| 1-16 |
356 | break; executed: break; Execution Count:75 | 75 |
357 | | - |
358 | default: | - |
359 | s->flags.int_xform = false; | - |
360 | break; executed: break; Execution Count:1716 | 1716 |
361 | } | - |
362 | | - |
363 | s->flags.tx_noshear = qt_scaleForTransform(s->matrix, &s->txscale); | - |
364 | | - |
365 | ensureOutlineMapper(); | - |
366 | } executed: } Execution Count:25587 | 25587 |
367 | | - |
368 | | - |
369 | | - |
370 | QRasterPaintEngineState::~QRasterPaintEngineState() | - |
371 | { | - |
372 | if (flags.has_clip_ownership) evaluated: flags.has_clip_ownership yes Evaluation Count:22363 | yes Evaluation Count:37152 |
| 22363-37152 |
373 | delete clip; executed: delete clip; Execution Count:22363 | 22363 |
374 | } executed: } Execution Count:59515 | 59515 |
375 | | - |
376 | | - |
377 | QRasterPaintEngineState::QRasterPaintEngineState() | - |
378 | { | - |
379 | stroker = 0; | - |
380 | | - |
381 | fillFlags = 0; | - |
382 | strokeFlags = 0; | - |
383 | pixmapFlags = 0; | - |
384 | | - |
385 | intOpacity = 256; | - |
386 | | - |
387 | txscale = 1.; | - |
388 | | - |
389 | flags.fast_pen = true; | - |
390 | flags.antialiased = false; | - |
391 | flags.bilinear = false; | - |
392 | flags.legacy_rounding = false; | - |
393 | flags.fast_text = true; | - |
394 | flags.int_xform = true; | - |
395 | flags.tx_noshear = true; | - |
396 | flags.fast_images = true; | - |
397 | | - |
398 | clip = 0; | - |
399 | flags.has_clip_ownership = false; | - |
400 | | - |
401 | dirty = 0; | - |
402 | } executed: } Execution Count:28736 | 28736 |
403 | | - |
404 | QRasterPaintEngineState::QRasterPaintEngineState(QRasterPaintEngineState &s) | - |
405 | : QPainterState(s) | - |
406 | , lastPen(s.lastPen) | - |
407 | , penData(s.penData) | - |
408 | , stroker(s.stroker) | - |
409 | , strokeFlags(s.strokeFlags) | - |
410 | , lastBrush(s.lastBrush) | - |
411 | , brushData(s.brushData) | - |
412 | , fillFlags(s.fillFlags) | - |
413 | , pixmapFlags(s.pixmapFlags) | - |
414 | , intOpacity(s.intOpacity) | - |
415 | , txscale(s.txscale) | - |
416 | , clip(s.clip) | - |
417 | , dirty(s.dirty) | - |
418 | , flag_bits(s.flag_bits) | - |
419 | { | - |
420 | brushData.tempImage = 0; | - |
421 | penData.tempImage = 0; | - |
422 | flags.has_clip_ownership = false; | - |
423 | } executed: } Execution Count:30778 | 30778 |
424 | | - |
425 | | - |
426 | | - |
427 | | - |
428 | QPainterState *QRasterPaintEngine::createState(QPainterState *orig) const | - |
429 | { | - |
430 | QRasterPaintEngineState *s; | - |
431 | if (!orig) evaluated: !orig yes Evaluation Count:28737 | yes Evaluation Count:30778 |
| 28737-30778 |
432 | s = new QRasterPaintEngineState(); executed: s = new QRasterPaintEngineState(); Execution Count:28737 | 28737 |
433 | else | - |
434 | s = new QRasterPaintEngineState(*static_cast<QRasterPaintEngineState *>(orig)); executed: s = new QRasterPaintEngineState(*static_cast<QRasterPaintEngineState *>(orig)); Execution Count:30778 | 30778 |
435 | | - |
436 | return s; executed: return s; Execution Count:59514 | 59514 |
437 | } | - |
438 | | - |
439 | | - |
440 | | - |
441 | | - |
442 | void QRasterPaintEngine::setState(QPainterState *s) | - |
443 | { | - |
444 | QRasterPaintEnginePrivate * const d = d_func(); | - |
445 | QPaintEngineEx::setState(s); | - |
446 | d->rasterBuffer->compositionMode = s->composition_mode; | - |
447 | } executed: } Execution Count:93235 | 93235 |
448 | void QRasterPaintEngine::penChanged() | - |
449 | { | - |
450 | | - |
451 | | - |
452 | | - |
453 | QRasterPaintEngineState *s = state(); | - |
454 | s->strokeFlags |= DirtyPen; | - |
455 | s->dirty |= DirtyPen; | - |
456 | } executed: } Execution Count:135958 | 135958 |
457 | | - |
458 | | - |
459 | | - |
460 | | - |
461 | void QRasterPaintEngine::updatePen(const QPen &pen) | - |
462 | { | - |
463 | QRasterPaintEnginePrivate * const d = d_func(); | - |
464 | QRasterPaintEngineState *s = state(); | - |
465 | | - |
466 | | - |
467 | | - |
468 | | - |
469 | Qt::PenStyle pen_style = qpen_style(pen); | - |
470 | | - |
471 | s->lastPen = pen; | - |
472 | s->strokeFlags = 0; | - |
473 | | - |
474 | s->penData.clip = d->clip(); | - |
475 | s->penData.setup(pen_style == Qt::NoPen ? QBrush() : pen.brush(), s->intOpacity, s->composition_mode); | - |
476 | | - |
477 | if (s->strokeFlags & QRasterPaintEngine::DirtyTransform partially evaluated: s->strokeFlags & QRasterPaintEngine::DirtyTransform no Evaluation Count:0 | yes Evaluation Count:96143 |
| 0-96143 |
478 | || pen.brush().transform().type() >= QTransform::TxNone) { partially evaluated: pen.brush().transform().type() >= QTransform::TxNone yes Evaluation Count:96143 | no Evaluation Count:0 |
| 0-96143 |
479 | d->updateMatrixData(&s->penData, pen.brush(), s->matrix); | - |
480 | } executed: } Execution Count:96143 | 96143 |
481 | | - |
482 | | - |
483 | | - |
484 | | - |
485 | if (pen_style == Qt::CustomDashLine && pen.dashPattern().size() == 0) { evaluated: pen_style == Qt::CustomDashLine yes Evaluation Count:1 | yes Evaluation Count:96142 |
partially evaluated: pen.dashPattern().size() == 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-96142 |
486 | pen_style = Qt::SolidLine; | - |
487 | s->lastPen.setStyle(Qt::SolidLine); | - |
488 | } | 0 |
489 | | - |
490 | d->basicStroker.setJoinStyle(qpen_joinStyle(pen)); | - |
491 | d->basicStroker.setCapStyle(qpen_capStyle(pen)); | - |
492 | d->basicStroker.setMiterLimit(pen.miterLimit()); | - |
493 | | - |
494 | qreal penWidth = qpen_widthf(pen); | - |
495 | if (penWidth == 0) evaluated: penWidth == 0 yes Evaluation Count:752 | yes Evaluation Count:95391 |
| 752-95391 |
496 | d->basicStroker.setStrokeWidth(1); executed: d->basicStroker.setStrokeWidth(1); Execution Count:752 | 752 |
497 | else | - |
498 | d->basicStroker.setStrokeWidth(penWidth); executed: d->basicStroker.setStrokeWidth(penWidth); Execution Count:95391 | 95391 |
499 | | - |
500 | if(pen_style == Qt::SolidLine) { evaluated: pen_style == Qt::SolidLine yes Evaluation Count:93825 | yes Evaluation Count:2318 |
| 2318-93825 |
501 | s->stroker = &d->basicStroker; | - |
502 | } else if (pen_style != Qt::NoPen) { executed: } Execution Count:93825 evaluated: pen_style != Qt::NoPen yes Evaluation Count:16 | yes Evaluation Count:2302 |
| 16-93825 |
503 | if (!d->dashStroker) evaluated: !d->dashStroker yes Evaluation Count:9 | yes Evaluation Count:7 |
| 7-9 |
504 | d->dashStroker.reset(new QDashStroker(&d->basicStroker)); executed: d->dashStroker.reset(new QDashStroker(&d->basicStroker)); Execution Count:9 | 9 |
505 | if (qt_pen_is_cosmetic(pen, s->renderHints)) { evaluated: qt_pen_is_cosmetic(pen, s->renderHints) yes Evaluation Count:1 | yes Evaluation Count:15 |
| 1-15 |
506 | d->dashStroker->setClipRect(d->deviceRect); | - |
507 | } else { executed: } Execution Count:1 | 1 |
508 | | - |
509 | QRectF clipRect = s->matrix.inverted().mapRect(QRectF(d->deviceRect)); | - |
510 | d->dashStroker->setClipRect(clipRect); | - |
511 | } executed: } Execution Count:15 | 15 |
512 | d->dashStroker->setDashPattern(pen.dashPattern()); | - |
513 | d->dashStroker->setDashOffset(pen.dashOffset()); | - |
514 | s->stroker = d->dashStroker.data(); | - |
515 | } else { executed: } Execution Count:16 | 16 |
516 | s->stroker = 0; | - |
517 | } executed: } Execution Count:2302 | 2302 |
518 | | - |
519 | ensureRasterState(); | - |
520 | bool cosmetic = qt_pen_is_cosmetic(pen, s->renderHints); | - |
521 | s->flags.fast_pen = pen_style > Qt::NoPen evaluated: pen_style > Qt::NoPen yes Evaluation Count:93841 | yes Evaluation Count:2302 |
| 2302-93841 |
522 | && s->penData.blend evaluated: s->penData.blend yes Evaluation Count:93828 | yes Evaluation Count:13 |
| 13-93828 |
523 | && ((cosmetic && penWidth <= 1) evaluated: cosmetic yes Evaluation Count:1711 | yes Evaluation Count:92117 |
partially evaluated: penWidth <= 1 yes Evaluation Count:1711 | no Evaluation Count:0 |
| 0-92117 |
524 | || (!cosmetic && s->flags.tx_noshear && penWidth * s->txscale <= 1)); partially evaluated: !cosmetic yes Evaluation Count:92117 | no Evaluation Count:0 |
evaluated: s->flags.tx_noshear yes Evaluation Count:91897 | yes Evaluation Count:220 |
evaluated: penWidth * s->txscale <= 1 yes Evaluation Count:90340 | yes Evaluation Count:1557 |
| 0-92117 |
525 | | - |
526 | s->flags.non_complex_pen = qpen_capStyle(s->lastPen) <= Qt::SquareCap && s->flags.tx_noshear; evaluated: qpen_capStyle(s->lastPen) <= Qt::SquareCap yes Evaluation Count:96139 | yes Evaluation Count:4 |
evaluated: s->flags.tx_noshear yes Evaluation Count:95919 | yes Evaluation Count:220 |
| 4-96139 |
527 | | - |
528 | s->strokeFlags = 0; | - |
529 | } executed: } Execution Count:96143 | 96143 |
530 | | - |
531 | | - |
532 | | - |
533 | | - |
534 | | - |
535 | | - |
536 | void QRasterPaintEngine::brushOriginChanged() | - |
537 | { | - |
538 | QRasterPaintEngineState *s = state(); | - |
539 | | - |
540 | | - |
541 | | - |
542 | | - |
543 | s->fillFlags |= DirtyBrushOrigin; | - |
544 | } executed: } Execution Count:21057 | 21057 |
545 | | - |
546 | | - |
547 | | - |
548 | | - |
549 | | - |
550 | void QRasterPaintEngine::brushChanged() | - |
551 | { | - |
552 | QRasterPaintEngineState *s = state(); | - |
553 | | - |
554 | | - |
555 | | - |
556 | s->fillFlags |= DirtyBrush; | - |
557 | } executed: } Execution Count:10963 | 10963 |
558 | | - |
559 | | - |
560 | | - |
561 | | - |
562 | | - |
563 | | - |
564 | | - |
565 | void QRasterPaintEngine::updateBrush(const QBrush &brush) | - |
566 | { | - |
567 | | - |
568 | | - |
569 | | - |
570 | QRasterPaintEnginePrivate * const d = d_func(); | - |
571 | QRasterPaintEngineState *s = state(); | - |
572 | | - |
573 | s->brushData.clip = d->clip(); | - |
574 | s->brushData.setup(brush, s->intOpacity, s->composition_mode); | - |
575 | if (s->fillFlags & DirtyTransform evaluated: s->fillFlags & DirtyTransform yes Evaluation Count:52202 | yes Evaluation Count:142481 |
| 52202-142481 |
576 | || brush.transform().type() >= QTransform::TxNone) partially evaluated: brush.transform().type() >= QTransform::TxNone yes Evaluation Count:142480 | no Evaluation Count:0 |
| 0-142480 |
577 | d_func()->updateMatrixData(&s->brushData, brush, d->brushMatrix()); executed: d_func()->updateMatrixData(&s->brushData, brush, d->brushMatrix()); Execution Count:194683 | 194683 |
578 | s->lastBrush = brush; | - |
579 | s->fillFlags = 0; | - |
580 | } executed: } Execution Count:194682 | 194682 |
581 | | - |
582 | void QRasterPaintEngine::updateOutlineMapper() | - |
583 | { | - |
584 | QRasterPaintEnginePrivate * const d = d_func(); | - |
585 | d->outlineMapper->setMatrix(state()->matrix); | - |
586 | } executed: } Execution Count:191264 | 191264 |
587 | | - |
588 | void QRasterPaintEngine::updateRasterState() | - |
589 | { | - |
590 | QRasterPaintEngineState *s = state(); | - |
591 | | - |
592 | if (s->dirty & DirtyTransform) evaluated: s->dirty & DirtyTransform yes Evaluation Count:25587 | yes Evaluation Count:69325 |
| 25587-69325 |
593 | updateMatrix(s->matrix); executed: updateMatrix(s->matrix); Execution Count:25587 | 25587 |
594 | | - |
595 | if (s->dirty & (DirtyPen|DirtyCompositionMode|DirtyOpacity)) { evaluated: s->dirty & (DirtyPen|DirtyCompositionMode|DirtyOpacity) yes Evaluation Count:94649 | yes Evaluation Count:263 |
| 263-94649 |
596 | const QPainter::CompositionMode mode = s->composition_mode; | - |
597 | s->flags.fast_text = (s->penData.type == QSpanData::Solid) evaluated: (s->penData.type == QSpanData::Solid) yes Evaluation Count:94456 | yes Evaluation Count:193 |
| 193-94456 |
598 | && s->intOpacity == 256 evaluated: s->intOpacity == 256 yes Evaluation Count:94422 | yes Evaluation Count:34 |
| 34-94422 |
599 | && (mode == QPainter::CompositionMode_Source evaluated: mode == QPainter::CompositionMode_Source yes Evaluation Count:2 | yes Evaluation Count:94420 |
| 2-94420 |
600 | || (mode == QPainter::CompositionMode_SourceOver partially evaluated: mode == QPainter::CompositionMode_SourceOver yes Evaluation Count:94420 | no Evaluation Count:0 |
| 0-94420 |
601 | && qAlpha(s->penData.solid.color) == 255)); evaluated: qAlpha(s->penData.solid.color) == 255 yes Evaluation Count:92834 | yes Evaluation Count:1586 |
| 1586-92834 |
602 | } executed: } Execution Count:94649 | 94649 |
603 | | - |
604 | s->dirty = 0; | - |
605 | } executed: } Execution Count:94912 | 94912 |
606 | | - |
607 | | - |
608 | | - |
609 | | - |
610 | | - |
611 | void QRasterPaintEngine::opacityChanged() | - |
612 | { | - |
613 | QRasterPaintEngineState *s = state(); | - |
614 | | - |
615 | | - |
616 | | - |
617 | | - |
618 | | - |
619 | s->fillFlags |= DirtyOpacity; | - |
620 | s->strokeFlags |= DirtyOpacity; | - |
621 | s->pixmapFlags |= DirtyOpacity; | - |
622 | s->dirty |= DirtyOpacity; | - |
623 | s->intOpacity = (int) (s->opacity * 256); | - |
624 | } executed: } Execution Count:438 | 438 |
625 | | - |
626 | | - |
627 | | - |
628 | | - |
629 | void QRasterPaintEngine::compositionModeChanged() | - |
630 | { | - |
631 | QRasterPaintEnginePrivate * const d = d_func(); | - |
632 | QRasterPaintEngineState *s = state(); | - |
633 | | - |
634 | | - |
635 | | - |
636 | | - |
637 | | - |
638 | s->fillFlags |= DirtyCompositionMode; | - |
639 | s->dirty |= DirtyCompositionMode; | - |
640 | | - |
641 | s->strokeFlags |= DirtyCompositionMode; | - |
642 | d->rasterBuffer->compositionMode = s->composition_mode; | - |
643 | | - |
644 | d->recalculateFastImages(); | - |
645 | } executed: } Execution Count:6985 | 6985 |
646 | | - |
647 | | - |
648 | | - |
649 | | - |
650 | void QRasterPaintEngine::renderHintsChanged() | - |
651 | { | - |
652 | QRasterPaintEngineState *s = state(); | - |
653 | | - |
654 | | - |
655 | | - |
656 | | - |
657 | | - |
658 | bool was_aa = s->flags.antialiased; | - |
659 | bool was_bilinear = s->flags.bilinear; | - |
660 | | - |
661 | s->flags.antialiased = bool(s->renderHints & QPainter::Antialiasing); | - |
662 | s->flags.bilinear = bool(s->renderHints & QPainter::SmoothPixmapTransform); | - |
663 | s->flags.legacy_rounding = !bool(s->renderHints & QPainter::Antialiasing) && bool(s->renderHints & QPainter::Qt4CompatiblePainting); evaluated: !bool(s->renderHints & QPainter::Antialiasing) yes Evaluation Count:4681 | yes Evaluation Count:783 |
evaluated: bool(s->renderHints & QPainter::Qt4CompatiblePainting) yes Evaluation Count:899 | yes Evaluation Count:3782 |
| 783-4681 |
664 | | - |
665 | if (was_aa != s->flags.antialiased) evaluated: was_aa != s->flags.antialiased yes Evaluation Count:855 | yes Evaluation Count:4609 |
| 855-4609 |
666 | s->strokeFlags |= DirtyHints; executed: s->strokeFlags |= DirtyHints; Execution Count:855 | 855 |
667 | | - |
668 | if (was_bilinear != s->flags.bilinear) { evaluated: was_bilinear != s->flags.bilinear yes Evaluation Count:32 | yes Evaluation Count:5432 |
| 32-5432 |
669 | s->strokeFlags |= DirtyPen; | - |
670 | s->fillFlags |= DirtyBrush; | - |
671 | } executed: } Execution Count:32 | 32 |
672 | | - |
673 | QRasterPaintEnginePrivate * const d = d_func(); | - |
674 | d->recalculateFastImages(); | - |
675 | } executed: } Execution Count:5464 | 5464 |
676 | | - |
677 | | - |
678 | | - |
679 | | - |
680 | void QRasterPaintEngine::transformChanged() | - |
681 | { | - |
682 | QRasterPaintEngineState *s = state(); | - |
683 | | - |
684 | | - |
685 | | - |
686 | | - |
687 | | - |
688 | s->fillFlags |= DirtyTransform; | - |
689 | s->strokeFlags |= DirtyTransform; | - |
690 | | - |
691 | s->dirty |= DirtyTransform; | - |
692 | | - |
693 | QRasterPaintEnginePrivate * const d = d_func(); | - |
694 | d->recalculateFastImages(); | - |
695 | } executed: } Execution Count:57734 | 57734 |
696 | | - |
697 | | - |
698 | | - |
699 | | - |
700 | void QRasterPaintEngine::clipEnabledChanged() | - |
701 | { | - |
702 | QRasterPaintEngineState *s = state(); | - |
703 | | - |
704 | | - |
705 | | - |
706 | | - |
707 | | - |
708 | if (s->clip) { partially evaluated: s->clip yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
709 | s->clip->enabled = s->clipEnabled; | - |
710 | s->fillFlags |= DirtyClipEnabled; | - |
711 | s->strokeFlags |= DirtyClipEnabled; | - |
712 | s->pixmapFlags |= DirtyClipEnabled; | - |
713 | } executed: } Execution Count:4 | 4 |
714 | } executed: } Execution Count:4 | 4 |
715 | | - |
716 | void QRasterPaintEnginePrivate::drawImage(const QPointF &pt, | - |
717 | const QImage &img, | - |
718 | SrcOverBlendFunc func, | - |
719 | const QRect &clip, | - |
720 | int alpha, | - |
721 | const QRect &sr) | - |
722 | { | - |
723 | if (alpha == 0 || !clip.isValid()) evaluated: alpha == 0 yes Evaluation Count:5 | yes Evaluation Count:10009 |
partially evaluated: !clip.isValid() no Evaluation Count:0 | yes Evaluation Count:10009 |
| 0-10009 |
724 | return; executed: return; Execution Count:5 | 5 |
725 | | - |
726 | qt_noop(); | - |
727 | | - |
728 | int srcBPL = img.bytesPerLine(); | - |
729 | const uchar *srcBits = img.bits(); | - |
730 | int srcSize = img.depth() >> 3; | - |
731 | int iw = img.width(); | - |
732 | int ih = img.height(); | - |
733 | | - |
734 | if (!sr.isEmpty()) { evaluated: !sr.isEmpty() yes Evaluation Count:3771 | yes Evaluation Count:6238 |
| 3771-6238 |
735 | iw = sr.width(); | - |
736 | ih = sr.height(); | - |
737 | | - |
738 | srcBits += ((sr.y() * srcBPL) + sr.x() * srcSize); | - |
739 | } executed: } Execution Count:3771 | 3771 |
740 | | - |
741 | | - |
742 | int x = qRound(pt.x()); | - |
743 | int cx1 = clip.x(); | - |
744 | int cx2 = clip.x() + clip.width(); | - |
745 | if (x < cx1) { evaluated: x < cx1 yes Evaluation Count:16 | yes Evaluation Count:9993 |
| 16-9993 |
746 | int d = cx1 - x; | - |
747 | srcBits += srcSize * d; | - |
748 | iw -= d; | - |
749 | x = cx1; | - |
750 | } executed: } Execution Count:16 | 16 |
751 | if (x + iw > cx2) { evaluated: x + iw > cx2 yes Evaluation Count:197 | yes Evaluation Count:9812 |
| 197-9812 |
752 | int d = x + iw - cx2; | - |
753 | iw -= d; | - |
754 | } executed: } Execution Count:197 | 197 |
755 | if (iw <= 0) evaluated: iw <= 0 yes Evaluation Count:23 | yes Evaluation Count:9986 |
| 23-9986 |
756 | return; executed: return; Execution Count:23 | 23 |
757 | | - |
758 | | - |
759 | int cy1 = clip.y(); | - |
760 | int cy2 = clip.y() + clip.height(); | - |
761 | int y = qRound(pt.y()); | - |
762 | if (y < cy1) { evaluated: y < cy1 yes Evaluation Count:58 | yes Evaluation Count:9928 |
| 58-9928 |
763 | int d = cy1 - y; | - |
764 | srcBits += srcBPL * d; | - |
765 | ih -= d; | - |
766 | y = cy1; | - |
767 | } executed: } Execution Count:58 | 58 |
768 | if (y + ih > cy2) { evaluated: y + ih > cy2 yes Evaluation Count:115 | yes Evaluation Count:9871 |
| 115-9871 |
769 | int d = y + ih - cy2; | - |
770 | ih -= d; | - |
771 | } executed: } Execution Count:115 | 115 |
772 | if (ih <= 0) evaluated: ih <= 0 yes Evaluation Count:112 | yes Evaluation Count:9874 |
| 112-9874 |
773 | return; executed: return; Execution Count:112 | 112 |
774 | | - |
775 | | - |
776 | int dstSize = rasterBuffer->bytesPerPixel(); | - |
777 | int dstBPL = rasterBuffer->bytesPerLine(); | - |
778 | func(rasterBuffer->buffer() + x * dstSize + y * dstBPL, dstBPL, | - |
779 | srcBits, srcBPL, | - |
780 | iw, ih, | - |
781 | alpha); | - |
782 | } executed: } Execution Count:9874 | 9874 |
783 | | - |
784 | | - |
785 | void QRasterPaintEnginePrivate::systemStateChanged() | - |
786 | { | - |
787 | deviceRectUnclipped = QRect(0, 0, | - |
788 | qMin(QT_RASTER_COORD_LIMIT, device->width()), | - |
789 | qMin(QT_RASTER_COORD_LIMIT, device->height())); | - |
790 | | - |
791 | if (!systemClip.isEmpty()) { evaluated: !systemClip.isEmpty() yes Evaluation Count:14829 | yes Evaluation Count:13971 |
| 13971-14829 |
792 | QRegion clippedDeviceRgn = systemClip & deviceRectUnclipped; | - |
793 | deviceRect = clippedDeviceRgn.boundingRect(); | - |
794 | baseClip->setClipRegion(clippedDeviceRgn); | - |
795 | } else { executed: } Execution Count:14829 | 14829 |
796 | deviceRect = deviceRectUnclipped; | - |
797 | baseClip->setClipRect(deviceRect); | - |
798 | } executed: } Execution Count:13971 | 13971 |
799 | | - |
800 | | - |
801 | | - |
802 | | - |
803 | exDeviceRect = deviceRect; | - |
804 | | - |
805 | QRasterPaintEngine * const q = q_func(); | - |
806 | if (q->state()) { partially evaluated: q->state() yes Evaluation Count:28800 | no Evaluation Count:0 |
| 0-28800 |
807 | q->state()->strokeFlags |= QPaintEngine::DirtyClipRegion; | - |
808 | q->state()->fillFlags |= QPaintEngine::DirtyClipRegion; | - |
809 | q->state()->pixmapFlags |= QPaintEngine::DirtyClipRegion; | - |
810 | } executed: } Execution Count:28800 | 28800 |
811 | } executed: } Execution Count:28800 | 28800 |
812 | | - |
813 | void QRasterPaintEnginePrivate::updateMatrixData(QSpanData *spanData, const QBrush &b, const QTransform &m) | - |
814 | { | - |
815 | if (b.d->style == Qt::NoBrush || b.d->style == Qt::SolidPattern) evaluated: b.d->style == Qt::NoBrush yes Evaluation Count:1154 | yes Evaluation Count:289669 |
evaluated: b.d->style == Qt::SolidPattern yes Evaluation Count:262713 | yes Evaluation Count:26960 |
| 1154-289669 |
816 | return; executed: return; Execution Count:263867 | 263867 |
817 | | - |
818 | QRasterPaintEngine * const q = q_func(); | - |
819 | bool bilinear = q->state()->flags.bilinear; | - |
820 | | - |
821 | if (b.d->transform.type() > QTransform::TxNone) { evaluated: b.d->transform.type() > QTransform::TxNone yes Evaluation Count:3 | yes Evaluation Count:26956 |
| 3-26956 |
822 | spanData->setupMatrix(b.transform() * m, bilinear); | - |
823 | } else { executed: } Execution Count:3 | 3 |
824 | if (m.type() <= QTransform::TxTranslate) { evaluated: m.type() <= QTransform::TxTranslate yes Evaluation Count:26946 | yes Evaluation Count:4 |
| 4-26946 |
825 | | - |
826 | | - |
827 | spanData->m11 = 1; | - |
828 | spanData->m12 = 0; | - |
829 | spanData->m13 = 0; | - |
830 | spanData->m21 = 0; | - |
831 | spanData->m22 = 1; | - |
832 | spanData->m23 = 0; | - |
833 | spanData->m33 = 1; | - |
834 | spanData->dx = -m.dx(); | - |
835 | spanData->dy = -m.dy(); | - |
836 | spanData->txop = m.type(); | - |
837 | spanData->bilinear = bilinear; | - |
838 | spanData->fast_matrix = qAbs(m.dx()) < 1e4 && qAbs(m.dy()) < 1e4; partially evaluated: qAbs(m.dx()) < 1e4 yes Evaluation Count:26947 | no Evaluation Count:0 |
partially evaluated: qAbs(m.dy()) < 1e4 yes Evaluation Count:26948 | no Evaluation Count:0 |
| 0-26948 |
839 | spanData->adjustSpanMethods(); | - |
840 | } else { executed: } Execution Count:26937 | 26937 |
841 | spanData->setupMatrix(m, bilinear); | - |
842 | } executed: } Execution Count:4 | 4 |
843 | } | - |
844 | } | - |
845 | static void qrasterpaintengine_state_setNoClip(QRasterPaintEngineState *s) | - |
846 | { | - |
847 | if (s->flags.has_clip_ownership) never evaluated: s->flags.has_clip_ownership | 0 |
848 | delete s->clip; never executed: delete s->clip; | 0 |
849 | s->clip = 0; | - |
850 | s->flags.has_clip_ownership = false; | - |
851 | } | 0 |
852 | | - |
853 | static void qrasterpaintengine_dirty_clip(QRasterPaintEnginePrivate *d, QRasterPaintEngineState *s) | - |
854 | { | - |
855 | s->fillFlags |= QPaintEngine::DirtyClipPath; | - |
856 | s->strokeFlags |= QPaintEngine::DirtyClipPath; | - |
857 | s->pixmapFlags |= QPaintEngine::DirtyClipPath; | - |
858 | | - |
859 | d->solid_color_filler.clip = d->clip(); | - |
860 | d->solid_color_filler.adjustSpanMethods(); | - |
861 | | - |
862 | | - |
863 | | - |
864 | | - |
865 | | - |
866 | } executed: } Execution Count:25052 | 25052 |
867 | | - |
868 | | - |
869 | | - |
870 | | - |
871 | | - |
872 | void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) | - |
873 | { | - |
874 | QRasterPaintEnginePrivate * const d = d_func(); | - |
875 | QRasterPaintEngineState *s = state(); | - |
876 | | - |
877 | const qreal *points = path.points(); | - |
878 | const QPainterPath::ElementType *types = path.elements(); | - |
879 | | - |
880 | | - |
881 | if (op != Qt::IntersectClip || !s->clip || s->clip->hasRectClip || s->clip->hasRegionClip) { evaluated: op != Qt::IntersectClip yes Evaluation Count:244 | yes Evaluation Count:810 |
evaluated: !s->clip yes Evaluation Count:306 | yes Evaluation Count:504 |
evaluated: s->clip->hasRectClip yes Evaluation Count:119 | yes Evaluation Count:385 |
evaluated: s->clip->hasRegionClip yes Evaluation Count:8 | yes Evaluation Count:377 |
| 8-810 |
882 | if (s->matrix.type() <= QTransform::TxScale evaluated: s->matrix.type() <= QTransform::TxScale yes Evaluation Count:561 | yes Evaluation Count:116 |
| 116-561 |
883 | && ((path.shape() == QVectorPath::RectangleHint) evaluated: (path.shape() == QVectorPath::RectangleHint) yes Evaluation Count:243 | yes Evaluation Count:318 |
| 243-318 |
884 | || (isRect(points, path.elementCount()) evaluated: isRect(points, path.elementCount()) yes Evaluation Count:225 | yes Evaluation Count:93 |
| 93-225 |
885 | && (!types || (types[0] == QPainterPath::MoveToElement partially evaluated: !types no Evaluation Count:0 | yes Evaluation Count:225 |
partially evaluated: types[0] == QPainterPath::MoveToElement yes Evaluation Count:225 | no Evaluation Count:0 |
| 0-225 |
886 | && types[1] == QPainterPath::LineToElement partially evaluated: types[1] == QPainterPath::LineToElement yes Evaluation Count:225 | no Evaluation Count:0 |
| 0-225 |
887 | && types[2] == QPainterPath::LineToElement partially evaluated: types[2] == QPainterPath::LineToElement yes Evaluation Count:225 | no Evaluation Count:0 |
| 0-225 |
888 | && types[3] == QPainterPath::LineToElement))))) { partially evaluated: types[3] == QPainterPath::LineToElement yes Evaluation Count:225 | no Evaluation Count:0 |
| 0-225 |
889 | | - |
890 | | - |
891 | | - |
892 | | - |
893 | QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]); | - |
894 | if (setClipRectInDeviceCoords(s->matrix.mapRect(r).toRect(), op)) partially evaluated: setClipRectInDeviceCoords(s->matrix.mapRect(r).toRect(), op) yes Evaluation Count:468 | no Evaluation Count:0 |
| 0-468 |
895 | return; executed: return; Execution Count:468 | 468 |
896 | } | 0 |
897 | } executed: } Execution Count:209 | 209 |
898 | | - |
899 | if (op == Qt::NoClip) { partially evaluated: op == Qt::NoClip no Evaluation Count:0 | yes Evaluation Count:586 |
| 0-586 |
900 | qrasterpaintengine_state_setNoClip(s); | - |
901 | | - |
902 | } else { | 0 |
903 | QClipData *base = d->baseClip.data(); | - |
904 | | - |
905 | | - |
906 | if (op == Qt::IntersectClip && s->clip) evaluated: op == Qt::IntersectClip yes Evaluation Count:543 | yes Evaluation Count:43 |
evaluated: s->clip yes Evaluation Count:437 | yes Evaluation Count:106 |
| 43-543 |
907 | base = s->clip; executed: base = s->clip; Execution Count:437 | 437 |
908 | | - |
909 | | - |
910 | | - |
911 | | - |
912 | Qt::ClipOperation isectOp = Qt::IntersectClip; | - |
913 | if (base == 0) partially evaluated: base == 0 no Evaluation Count:0 | yes Evaluation Count:586 |
| 0-586 |
914 | isectOp = Qt::ReplaceClip; never executed: isectOp = Qt::ReplaceClip; | 0 |
915 | | - |
916 | QClipData *newClip = new QClipData(d->rasterBuffer->height()); | - |
917 | newClip->initialize(); | - |
918 | ClipData clipData = { base, newClip, isectOp }; | - |
919 | ensureOutlineMapper(); | - |
920 | d->rasterize(d->outlineMapper->convertPath(path), qt_span_clip, &clipData, 0); | - |
921 | | - |
922 | newClip->fixup(); | - |
923 | | - |
924 | if (s->flags.has_clip_ownership) evaluated: s->flags.has_clip_ownership yes Evaluation Count:384 | yes Evaluation Count:202 |
| 202-384 |
925 | delete s->clip; executed: delete s->clip; Execution Count:384 | 384 |
926 | | - |
927 | s->clip = newClip; | - |
928 | s->flags.has_clip_ownership = true; | - |
929 | } executed: } Execution Count:586 | 586 |
930 | qrasterpaintengine_dirty_clip(d, s); | - |
931 | } executed: } Execution Count:586 | 586 |
932 | | - |
933 | | - |
934 | | - |
935 | | - |
936 | | - |
937 | | - |
938 | void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) | - |
939 | { | - |
940 | | - |
941 | | - |
942 | | - |
943 | | - |
944 | QRasterPaintEngineState *s = state(); | - |
945 | | - |
946 | if (op == Qt::NoClip) { partially evaluated: op == Qt::NoClip no Evaluation Count:0 | yes Evaluation Count:22084 |
| 0-22084 |
947 | qrasterpaintengine_state_setNoClip(s); | - |
948 | | - |
949 | } else if (s->matrix.type() > QTransform::TxScale) { evaluated: s->matrix.type() > QTransform::TxScale yes Evaluation Count:359 | yes Evaluation Count:21725 |
| 0-21725 |
950 | QPaintEngineEx::clip(rect, op); | - |
951 | return; executed: return; Execution Count:359 | 359 |
952 | | - |
953 | } else if (!setClipRectInDeviceCoords(s->matrix.mapRect(rect), op)) { evaluated: !setClipRectInDeviceCoords(s->matrix.mapRect(rect), op) yes Evaluation Count:2 | yes Evaluation Count:21723 |
| 2-21723 |
954 | QPaintEngineEx::clip(rect, op); | - |
955 | return; executed: return; Execution Count:2 | 2 |
956 | } | - |
957 | } | - |
958 | | - |
959 | | - |
960 | bool QRasterPaintEngine::setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op) | - |
961 | { | - |
962 | QRasterPaintEnginePrivate * const d = d_func(); | - |
963 | QRect clipRect = r & d->deviceRect; | - |
964 | QRasterPaintEngineState *s = state(); | - |
965 | | - |
966 | if (op == Qt::ReplaceClip || s->clip == 0) { evaluated: op == Qt::ReplaceClip yes Evaluation Count:21918 | yes Evaluation Count:275 |
evaluated: s->clip == 0 yes Evaluation Count:201 | yes Evaluation Count:74 |
| 74-21918 |
967 | | - |
968 | | - |
969 | | - |
970 | QRegion clipRegion = systemClip(); | - |
971 | QClipData *clip = new QClipData(d->rasterBuffer->height()); | - |
972 | | - |
973 | if (clipRegion.isEmpty()) evaluated: clipRegion.isEmpty() yes Evaluation Count:1338 | yes Evaluation Count:20781 |
| 1338-20781 |
974 | clip->setClipRect(clipRect); executed: clip->setClipRect(clipRect); Execution Count:1338 | 1338 |
975 | else | - |
976 | clip->setClipRegion(clipRegion & clipRect); executed: clip->setClipRegion(clipRegion & clipRect); Execution Count:20781 | 20781 |
977 | | - |
978 | if (s->flags.has_clip_ownership) evaluated: s->flags.has_clip_ownership yes Evaluation Count:92 | yes Evaluation Count:22027 |
| 92-22027 |
979 | delete s->clip; executed: delete s->clip; Execution Count:92 | 92 |
980 | | - |
981 | s->clip = clip; | - |
982 | s->clip->enabled = true; | - |
983 | s->flags.has_clip_ownership = true; | - |
984 | | - |
985 | } else if (op == Qt::IntersectClip){ executed: } Execution Count:22119 partially evaluated: op == Qt::IntersectClip yes Evaluation Count:74 | no Evaluation Count:0 |
| 0-22119 |
986 | QClipData *base = s->clip; | - |
987 | | - |
988 | qt_noop(); | - |
989 | if (base->hasRectClip || base->hasRegionClip) { evaluated: base->hasRectClip yes Evaluation Count:72 | yes Evaluation Count:2 |
partially evaluated: base->hasRegionClip no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-72 |
990 | if (!s->flags.has_clip_ownership) { evaluated: !s->flags.has_clip_ownership yes Evaluation Count:62 | yes Evaluation Count:10 |
| 10-62 |
991 | s->clip = new QClipData(d->rasterBuffer->height()); | - |
992 | s->flags.has_clip_ownership = true; | - |
993 | } executed: } Execution Count:62 | 62 |
994 | if (base->hasRectClip) partially evaluated: base->hasRectClip yes Evaluation Count:72 | no Evaluation Count:0 |
| 0-72 |
995 | s->clip->setClipRect(base->clipRect & clipRect); executed: s->clip->setClipRect(base->clipRect & clipRect); Execution Count:72 | 72 |
996 | else | - |
997 | s->clip->setClipRegion(base->clipRegion & clipRect); never executed: s->clip->setClipRegion(base->clipRegion & clipRect); | 0 |
998 | s->clip->enabled = true; | - |
999 | } else { executed: } Execution Count:72 | 72 |
1000 | return false; executed: return false; Execution Count:2 | 2 |
1001 | } | - |
1002 | } else { | - |
1003 | return false; never executed: return false; | 0 |
1004 | } | - |
1005 | | - |
1006 | qrasterpaintengine_dirty_clip(d, s); | - |
1007 | return true; executed: return true; Execution Count:22191 | 22191 |
1008 | } | - |
1009 | | - |
1010 | | - |
1011 | | - |
1012 | | - |
1013 | | - |
1014 | void QRasterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) | - |
1015 | { | - |
1016 | | - |
1017 | | - |
1018 | | - |
1019 | | - |
1020 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1021 | | - |
1022 | if (region.rectCount() == 1) { evaluated: region.rectCount() == 1 yes Evaluation Count:154 | yes Evaluation Count:2291 |
| 154-2291 |
1023 | clip(region.boundingRect(), op); | - |
1024 | return; executed: return; Execution Count:154 | 154 |
1025 | } | - |
1026 | | - |
1027 | QRasterPaintEngineState *s = state(); | - |
1028 | const QClipData *clip = d->clip(); | - |
1029 | const QClipData *baseClip = d->baseClip.data(); | - |
1030 | | - |
1031 | if (op == Qt::NoClip) { partially evaluated: op == Qt::NoClip no Evaluation Count:0 | yes Evaluation Count:2291 |
| 0-2291 |
1032 | qrasterpaintengine_state_setNoClip(s); | - |
1033 | } else if (s->matrix.type() > QTransform::TxScale evaluated: s->matrix.type() > QTransform::TxScale yes Evaluation Count:8 | yes Evaluation Count:2283 |
| 0-2283 |
1034 | || (op == Qt::IntersectClip && !clip->hasRectClip && !clip->hasRegionClip) evaluated: op == Qt::IntersectClip yes Evaluation Count:18 | yes Evaluation Count:2265 |
evaluated: !clip->hasRectClip yes Evaluation Count:17 | yes Evaluation Count:1 |
evaluated: !clip->hasRegionClip yes Evaluation Count:8 | yes Evaluation Count:9 |
| 1-2265 |
1035 | || (op == Qt::ReplaceClip && !baseClip->hasRectClip && !baseClip->hasRegionClip)) { evaluated: op == Qt::ReplaceClip yes Evaluation Count:2265 | yes Evaluation Count:10 |
evaluated: !baseClip->hasRectClip yes Evaluation Count:261 | yes Evaluation Count:2004 |
partially evaluated: !baseClip->hasRegionClip no Evaluation Count:0 | yes Evaluation Count:261 |
| 0-2265 |
1036 | QPaintEngineEx::clip(region, op); | - |
1037 | } else { executed: } Execution Count:16 | 16 |
1038 | const QClipData *curClip; | - |
1039 | QClipData *newClip; | - |
1040 | | - |
1041 | if (op == Qt::IntersectClip) evaluated: op == Qt::IntersectClip yes Evaluation Count:10 | yes Evaluation Count:2265 |
| 10-2265 |
1042 | curClip = clip; executed: curClip = clip; Execution Count:10 | 10 |
1043 | else | - |
1044 | curClip = baseClip; executed: curClip = baseClip; Execution Count:2265 | 2265 |
1045 | | - |
1046 | if (s->flags.has_clip_ownership) { evaluated: s->flags.has_clip_ownership yes Evaluation Count:2203 | yes Evaluation Count:72 |
| 72-2203 |
1047 | newClip = s->clip; | - |
1048 | qt_noop(); | - |
1049 | } else { executed: } Execution Count:2203 | 2203 |
1050 | newClip = new QClipData(d->rasterBuffer->height()); | - |
1051 | s->clip = newClip; | - |
1052 | s->flags.has_clip_ownership = true; | - |
1053 | } executed: } Execution Count:72 | 72 |
1054 | | - |
1055 | QRegion r = s->matrix.map(region); | - |
1056 | if (curClip->hasRectClip) evaluated: curClip->hasRectClip yes Evaluation Count:2005 | yes Evaluation Count:270 |
| 270-2005 |
1057 | newClip->setClipRegion(r & curClip->clipRect); executed: newClip->setClipRegion(r & curClip->clipRect); Execution Count:2005 | 2005 |
1058 | else if (curClip->hasRegionClip) partially evaluated: curClip->hasRegionClip yes Evaluation Count:270 | no Evaluation Count:0 |
| 0-270 |
1059 | newClip->setClipRegion(r & curClip->clipRegion); executed: newClip->setClipRegion(r & curClip->clipRegion); Execution Count:270 | 270 |
1060 | | - |
1061 | qrasterpaintengine_dirty_clip(d, s); | - |
1062 | } executed: } Execution Count:2275 | 2275 |
1063 | } | - |
1064 | void QRasterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData) | - |
1065 | { | - |
1066 | | - |
1067 | | - |
1068 | | - |
1069 | | - |
1070 | if (!fillData->blend) partially evaluated: !fillData->blend no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1071 | return; | 0 |
1072 | | - |
1073 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1074 | | - |
1075 | const QRectF controlPointRect = path.controlPointRect(); | - |
1076 | | - |
1077 | QRasterPaintEngineState *s = state(); | - |
1078 | const QRect deviceRect = s->matrix.mapRect(controlPointRect).toRect(); | - |
1079 | ProcessSpans blend = d->getBrushFunc(deviceRect, fillData); | - |
1080 | const bool do_clip = (deviceRect.left() < -QT_RASTER_COORD_LIMIT partially evaluated: deviceRect.left() < -QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1081 | || deviceRect.right() > QT_RASTER_COORD_LIMIT partially evaluated: deviceRect.right() > QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1082 | || deviceRect.top() < -QT_RASTER_COORD_LIMIT partially evaluated: deviceRect.top() < -QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1083 | || deviceRect.bottom() > QT_RASTER_COORD_LIMIT); partially evaluated: deviceRect.bottom() > QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1084 | | - |
1085 | if (!s->flags.antialiased && !do_clip) { evaluated: !s->flags.antialiased yes Evaluation Count:1 | yes Evaluation Count:4 |
partially evaluated: !do_clip yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-4 |
1086 | d->initializeRasterizer(fillData); | - |
1087 | d->rasterizer->rasterize(path * s->matrix, path.fillRule()); | - |
1088 | return; executed: return; Execution Count:1 | 1 |
1089 | } | - |
1090 | | - |
1091 | ensureOutlineMapper(); | - |
1092 | d->rasterize(d->outlineMapper->convertPath(path), blend, fillData, d->rasterBuffer.data()); | - |
1093 | } executed: } Execution Count:4 | 4 |
1094 | | - |
1095 | static void fillRect_normalized(const QRect &r, QSpanData *data, | - |
1096 | QRasterPaintEnginePrivate *pe) | - |
1097 | { | - |
1098 | int x1, x2, y1, y2; | - |
1099 | | - |
1100 | bool rectClipped = true; | - |
1101 | | - |
1102 | if (data->clip) { partially evaluated: data->clip yes Evaluation Count:80581 | no Evaluation Count:0 |
| 0-80581 |
1103 | x1 = qMax(r.x(), data->clip->xmin); | - |
1104 | x2 = qMin(r.x() + r.width(), data->clip->xmax); | - |
1105 | y1 = qMax(r.y(), data->clip->ymin); | - |
1106 | y2 = qMin(r.y() + r.height(), data->clip->ymax); | - |
1107 | rectClipped = data->clip->hasRectClip; | - |
1108 | | - |
1109 | } else if (pe) { executed: } Execution Count:80581 | 0-80581 |
1110 | x1 = qMax(r.x(), pe->deviceRect.x()); | - |
1111 | x2 = qMin(r.x() + r.width(), pe->deviceRect.x() + pe->deviceRect.width()); | - |
1112 | y1 = qMax(r.y(), pe->deviceRect.y()); | - |
1113 | y2 = qMin(r.y() + r.height(), pe->deviceRect.y() + pe->deviceRect.height()); | - |
1114 | } else { | 0 |
1115 | x1 = qMax(r.x(), 0); | - |
1116 | x2 = qMin(r.x() + r.width(), data->rasterBuffer->width()); | - |
1117 | y1 = qMax(r.y(), 0); | - |
1118 | y2 = qMin(r.y() + r.height(), data->rasterBuffer->height()); | - |
1119 | } | 0 |
1120 | | - |
1121 | if (x2 <= x1 || y2 <= y1) evaluated: x2 <= x1 yes Evaluation Count:525 | yes Evaluation Count:80056 |
evaluated: y2 <= y1 yes Evaluation Count:355 | yes Evaluation Count:79703 |
| 355-80056 |
1122 | return; executed: return; Execution Count:880 | 880 |
1123 | | - |
1124 | const int width = x2 - x1; | - |
1125 | const int height = y2 - y1; | - |
1126 | | - |
1127 | bool isUnclipped = rectClipped evaluated: rectClipped yes Evaluation Count:78035 | yes Evaluation Count:1669 |
| 1669-78035 |
1128 | || (pe && pe->isUnclipped_normalized(QRect(x1, y1, width, height))); partially evaluated: pe yes Evaluation Count:1669 | no Evaluation Count:0 |
evaluated: pe->isUnclipped_normalized(QRect(x1, y1, width, height)) yes Evaluation Count:442 | yes Evaluation Count:1227 |
| 0-1669 |
1129 | | - |
1130 | if (pe && isUnclipped) { partially evaluated: pe yes Evaluation Count:79704 | no Evaluation Count:0 |
evaluated: isUnclipped yes Evaluation Count:78476 | yes Evaluation Count:1227 |
| 0-79704 |
1131 | const QPainter::CompositionMode mode = pe->rasterBuffer->compositionMode; | - |
1132 | | - |
1133 | if (data->fillRect && (mode == QPainter::CompositionMode_Source evaluated: data->fillRect yes Evaluation Count:41168 | yes Evaluation Count:37309 |
evaluated: mode == QPainter::CompositionMode_Source yes Evaluation Count:9021 | yes Evaluation Count:32147 |
| 9021-41168 |
1134 | || (mode == QPainter::CompositionMode_SourceOver evaluated: mode == QPainter::CompositionMode_SourceOver yes Evaluation Count:32034 | yes Evaluation Count:113 |
| 113-32034 |
1135 | && qAlpha(data->solid.color) == 255))) evaluated: qAlpha(data->solid.color) == 255 yes Evaluation Count:32008 | yes Evaluation Count:26 |
| 26-32008 |
1136 | { | - |
1137 | data->fillRect(data->rasterBuffer, x1, y1, width, height, | - |
1138 | data->solid.color); | - |
1139 | return; executed: return; Execution Count:41029 | 41029 |
1140 | } | - |
1141 | } executed: } Execution Count:37444 | 37444 |
1142 | | - |
1143 | ProcessSpans blend = isUnclipped ? data->unclipped_blend : data->blend; evaluated: isUnclipped yes Evaluation Count:37444 | yes Evaluation Count:1227 |
| 1227-37444 |
1144 | | - |
1145 | const int nspans = 256; | - |
1146 | QT_FT_Span spans[nspans]; | - |
1147 | | - |
1148 | qt_noop(); | - |
1149 | int y = y1; | - |
1150 | while (y < y2) { evaluated: y < y2 yes Evaluation Count:38708 | yes Evaluation Count:38665 |
| 38665-38708 |
1151 | int n = qMin(nspans, y2 - y); | - |
1152 | int i = 0; | - |
1153 | while (i < n) { evaluated: i < n yes Evaluation Count:632253 | yes Evaluation Count:38709 |
| 38709-632253 |
1154 | spans[i].x = x1; | - |
1155 | spans[i].len = width; | - |
1156 | spans[i].y = y + i; | - |
1157 | spans[i].coverage = 255; | - |
1158 | ++i; | - |
1159 | } executed: } Execution Count:632255 | 632255 |
1160 | | - |
1161 | blend(n, spans, data); | - |
1162 | y += n; | - |
1163 | } executed: } Execution Count:38703 | 38703 |
1164 | } executed: } Execution Count:38666 | 38666 |
1165 | | - |
1166 | | - |
1167 | | - |
1168 | | - |
1169 | void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount) | - |
1170 | { | - |
1171 | | - |
1172 | | - |
1173 | | - |
1174 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1175 | ensureRasterState(); | - |
1176 | QRasterPaintEngineState *s = state(); | - |
1177 | | - |
1178 | | - |
1179 | ensureBrush(); | - |
1180 | if (s->brushData.blend) { evaluated: s->brushData.blend yes Evaluation Count:6418 | yes Evaluation Count:2013 |
| 2013-6418 |
1181 | if (!s->flags.antialiased && s->matrix.type() <= QTransform::TxTranslate) { evaluated: !s->flags.antialiased yes Evaluation Count:6408 | yes Evaluation Count:10 |
evaluated: s->matrix.type() <= QTransform::TxTranslate yes Evaluation Count:6405 | yes Evaluation Count:3 |
| 3-6408 |
1182 | const QRect *r = rects; | - |
1183 | const QRect *lastRect = rects + rectCount; | - |
1184 | | - |
1185 | int offset_x = int(s->matrix.dx()); | - |
1186 | int offset_y = int(s->matrix.dy()); | - |
1187 | while (r < lastRect) { evaluated: r < lastRect yes Evaluation Count:6405 | yes Evaluation Count:6405 |
| 6405 |
1188 | QRect rect = r->normalized(); | - |
1189 | QRect rr = rect.translated(offset_x, offset_y); | - |
1190 | fillRect_normalized(rr, &s->brushData, d); | - |
1191 | ++r; | - |
1192 | } executed: } Execution Count:6405 | 6405 |
1193 | } else { executed: } Execution Count:6405 | 6405 |
1194 | QRectVectorPath path; | - |
1195 | for (int i=0; i<rectCount; ++i) { evaluated: i<rectCount yes Evaluation Count:13 | yes Evaluation Count:13 |
| 13 |
1196 | path.set(rects[i]); | - |
1197 | fill(path, s->brush); | - |
1198 | } executed: } Execution Count:13 | 13 |
1199 | } executed: } Execution Count:13 | 13 |
1200 | } | - |
1201 | | - |
1202 | ensurePen(); | - |
1203 | if (s->penData.blend) { evaluated: s->penData.blend yes Evaluation Count:2384 | yes Evaluation Count:6047 |
| 2384-6047 |
1204 | QRectVectorPath path; | - |
1205 | if (s->flags.fast_pen) { evaluated: s->flags.fast_pen yes Evaluation Count:2378 | yes Evaluation Count:6 |
| 6-2378 |
1206 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - |
1207 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
1208 | for (int i = 0; i < rectCount; ++i) { evaluated: i < rectCount yes Evaluation Count:2378 | yes Evaluation Count:2378 |
| 2378 |
1209 | path.set(rects[i]); | - |
1210 | stroker.drawPath(path); | - |
1211 | } executed: } Execution Count:2378 | 2378 |
1212 | } else { executed: } Execution Count:2378 | 2378 |
1213 | for (int i = 0; i < rectCount; ++i) { evaluated: i < rectCount yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
1214 | path.set(rects[i]); | - |
1215 | stroke(path, s->pen); | - |
1216 | } executed: } Execution Count:6 | 6 |
1217 | } executed: } Execution Count:6 | 6 |
1218 | } | - |
1219 | } executed: } Execution Count:8431 | 8431 |
1220 | | - |
1221 | | - |
1222 | | - |
1223 | | - |
1224 | void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount) | - |
1225 | { | - |
1226 | | - |
1227 | | - |
1228 | | - |
1229 | | - |
1230 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1231 | ensureRasterState(); | - |
1232 | QRasterPaintEngineState *s = state(); | - |
1233 | | - |
1234 | | - |
1235 | if (s->flags.tx_noshear) { evaluated: s->flags.tx_noshear yes Evaluation Count:616 | yes Evaluation Count:8 |
| 8-616 |
1236 | ensureBrush(); | - |
1237 | if (s->brushData.blend) { evaluated: s->brushData.blend yes Evaluation Count:313 | yes Evaluation Count:303 |
| 303-313 |
1238 | d->initializeRasterizer(&s->brushData); | - |
1239 | for (int i = 0; i < rectCount; ++i) { evaluated: i < rectCount yes Evaluation Count:313 | yes Evaluation Count:313 |
| 313 |
1240 | const QRectF &rect = rects[i].normalized(); | - |
1241 | if (rect.isEmpty()) evaluated: rect.isEmpty() yes Evaluation Count:2 | yes Evaluation Count:311 |
| 2-311 |
1242 | continue; executed: continue; Execution Count:2 | 2 |
1243 | const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f); | - |
1244 | const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f); | - |
1245 | d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); | - |
1246 | } executed: } Execution Count:311 | 311 |
1247 | } executed: } Execution Count:313 | 313 |
1248 | | - |
1249 | ensurePen(); | - |
1250 | if (s->penData.blend) { evaluated: s->penData.blend yes Evaluation Count:361 | yes Evaluation Count:255 |
| 255-361 |
1251 | QRectVectorPath path; | - |
1252 | if (s->flags.fast_pen) { evaluated: s->flags.fast_pen yes Evaluation Count:337 | yes Evaluation Count:24 |
| 24-337 |
1253 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - |
1254 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
1255 | for (int i = 0; i < rectCount; ++i) { evaluated: i < rectCount yes Evaluation Count:337 | yes Evaluation Count:337 |
| 337 |
1256 | path.set(rects[i]); | - |
1257 | stroker.drawPath(path); | - |
1258 | } executed: } Execution Count:337 | 337 |
1259 | } else { executed: } Execution Count:337 | 337 |
1260 | for (int i = 0; i < rectCount; ++i) { evaluated: i < rectCount yes Evaluation Count:24 | yes Evaluation Count:24 |
| 24 |
1261 | path.set(rects[i]); | - |
1262 | QPaintEngineEx::stroke(path, s->lastPen); | - |
1263 | } executed: } Execution Count:24 | 24 |
1264 | } executed: } Execution Count:24 | 24 |
1265 | } | - |
1266 | | - |
1267 | return; executed: return; Execution Count:616 | 616 |
1268 | } | - |
1269 | | - |
1270 | QPaintEngineEx::drawRects(rects, rectCount); | - |
1271 | } executed: } Execution Count:8 | 8 |
1272 | | - |
1273 | | - |
1274 | | - |
1275 | | - |
1276 | | - |
1277 | void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) | - |
1278 | { | - |
1279 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1280 | QRasterPaintEngineState *s = state(); | - |
1281 | | - |
1282 | ensurePen(pen); | - |
1283 | if (!s->penData.blend) evaluated: !s->penData.blend yes Evaluation Count:13 | yes Evaluation Count:13272 |
| 13-13272 |
1284 | return; executed: return; Execution Count:13 | 13 |
1285 | | - |
1286 | if (s->flags.fast_pen) { evaluated: s->flags.fast_pen yes Evaluation Count:11507 | yes Evaluation Count:1765 |
| 1765-11507 |
1287 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - |
1288 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
1289 | stroker.drawPath(path); | - |
1290 | } else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) { evaluated: s->flags.non_complex_pen yes Evaluation Count:1545 | yes Evaluation Count:220 |
evaluated: path.shape() == QVectorPath::LinesHint yes Evaluation Count:875 | yes Evaluation Count:670 |
executed: } Execution Count:11507 | 220-11507 |
1291 | qreal width = qt_pen_is_cosmetic(s->lastPen, s->renderHints) partially evaluated: qt_pen_is_cosmetic(s->lastPen, s->renderHints) no Evaluation Count:0 | yes Evaluation Count:875 |
| 0-875 |
1292 | ? (qpen_widthf(s->lastPen) == 0 ? 1 : qpen_widthf(s->lastPen)) | - |
1293 | : qpen_widthf(s->lastPen) * s->txscale; | - |
1294 | int dashIndex = 0; | - |
1295 | qreal dashOffset = s->lastPen.dashOffset(); | - |
1296 | bool inDash = true; | - |
1297 | qreal patternLength = 0; | - |
1298 | const QVector<qreal> pattern = s->lastPen.dashPattern(); | - |
1299 | for (int i = 0; i < pattern.size(); ++i) evaluated: i < pattern.size() yes Evaluation Count:6 | yes Evaluation Count:875 |
| 6-875 |
1300 | patternLength += pattern.at(i); executed: patternLength += pattern.at(i); Execution Count:6 | 6 |
1301 | | - |
1302 | if (patternLength > 0) { evaluated: patternLength > 0 yes Evaluation Count:1 | yes Evaluation Count:874 |
| 1-874 |
1303 | int n = qFloor(dashOffset / patternLength); | - |
1304 | dashOffset -= n * patternLength; | - |
1305 | while (dashOffset >= pattern.at(dashIndex)) { partially evaluated: dashOffset >= pattern.at(dashIndex) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1306 | dashOffset -= pattern.at(dashIndex); | - |
1307 | if (++dashIndex >= pattern.size()) never evaluated: ++dashIndex >= pattern.size() | 0 |
1308 | dashIndex = 0; never executed: dashIndex = 0; | 0 |
1309 | inDash = !inDash; | - |
1310 | } | 0 |
1311 | } executed: } Execution Count:1 | 1 |
1312 | | - |
1313 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1314 | d->initializeRasterizer(&s->penData); | - |
1315 | int lineCount = path.elementCount() / 2; | - |
1316 | const QLineF *lines = reinterpret_cast<const QLineF *>(path.points()); | - |
1317 | | - |
1318 | for (int i = 0; i < lineCount; ++i) { evaluated: i < lineCount yes Evaluation Count:876 | yes Evaluation Count:875 |
| 875-876 |
1319 | if (lines[i].p1() == lines[i].p2()) { evaluated: lines[i].p1() == lines[i].p2() yes Evaluation Count:1 | yes Evaluation Count:875 |
| 1-875 |
1320 | if (s->lastPen.capStyle() != Qt::FlatCap) { partially evaluated: s->lastPen.capStyle() != Qt::FlatCap yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1321 | QPointF p = lines[i].p1(); | - |
1322 | QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*0.5, p.y()), | - |
1323 | QPointF(p.x() + width*0.5, p.y()))); | - |
1324 | d->rasterizer->rasterizeLine(line.p1(), line.p2(), 1); | - |
1325 | } executed: } Execution Count:1 | 1 |
1326 | continue; executed: continue; Execution Count:1 | 1 |
1327 | } | - |
1328 | | - |
1329 | const QLineF line = s->matrix.map(lines[i]); | - |
1330 | if (qpen_style(s->lastPen) == Qt::SolidLine) { evaluated: qpen_style(s->lastPen) == Qt::SolidLine yes Evaluation Count:872 | yes Evaluation Count:3 |
| 3-872 |
1331 | d->rasterizer->rasterizeLine(line.p1(), line.p2(), | - |
1332 | width / line.length(), | - |
1333 | s->lastPen.capStyle() == Qt::SquareCap); | - |
1334 | } else { executed: } Execution Count:872 | 872 |
1335 | d->rasterizeLine_dashed(line, width, | - |
1336 | &dashIndex, &dashOffset, &inDash); | - |
1337 | } executed: } Execution Count:3 | 3 |
1338 | } | - |
1339 | } executed: } Execution Count:875 | 875 |
1340 | else | - |
1341 | QPaintEngineEx::stroke(path, pen); executed: QPaintEngineEx::stroke(path, pen); Execution Count:890 | 890 |
1342 | } | - |
1343 | | - |
1344 | QRect QRasterPaintEngine::toNormalizedFillRect(const QRectF &rect) | - |
1345 | { | - |
1346 | QRasterPaintEngineState *s = state(); | - |
1347 | | - |
1348 | qreal delta = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0); evaluated: s->flags.legacy_rounding yes Evaluation Count:1 | yes Evaluation Count:72909 |
| 1-72909 |
1349 | | - |
1350 | int x1 = qRound(rect.x() + delta); | - |
1351 | int y1 = qRound(rect.y() + delta); | - |
1352 | int x2 = qRound(rect.right() + delta); | - |
1353 | int y2 = qRound(rect.bottom() + delta); | - |
1354 | | - |
1355 | if (x2 < x1) partially evaluated: x2 < x1 no Evaluation Count:0 | yes Evaluation Count:72904 |
| 0-72904 |
1356 | qSwap(x1, x2); never executed: qSwap(x1, x2); | 0 |
1357 | if (y2 < y1) partially evaluated: y2 < y1 no Evaluation Count:0 | yes Evaluation Count:72909 |
| 0-72909 |
1358 | qSwap(y1, y2); never executed: qSwap(y1, y2); | 0 |
1359 | | - |
1360 | return QRect(x1, y1, x2 - x1, y2 - y1); executed: return QRect(x1, y1, x2 - x1, y2 - y1); Execution Count:72909 | 72909 |
1361 | } | - |
1362 | | - |
1363 | | - |
1364 | | - |
1365 | | - |
1366 | void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) | - |
1367 | { | - |
1368 | if (path.isEmpty()) partially evaluated: path.isEmpty() no Evaluation Count:0 | yes Evaluation Count:148247 |
| 0-148247 |
1369 | return; | 0 |
1370 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1371 | QRasterPaintEngineState *s = state(); | - |
1372 | | - |
1373 | ensureBrush(brush); | - |
1374 | if (!s->brushData.blend) evaluated: !s->brushData.blend yes Evaluation Count:1 | yes Evaluation Count:148246 |
| 1-148246 |
1375 | return; executed: return; Execution Count:1 | 1 |
1376 | | - |
1377 | if (path.shape() == QVectorPath::RectangleHint) { evaluated: path.shape() == QVectorPath::RectangleHint yes Evaluation Count:13137 | yes Evaluation Count:135109 |
| 13137-135109 |
1378 | if (!s->flags.antialiased && s->matrix.type() <= QTransform::TxScale) { evaluated: !s->flags.antialiased yes Evaluation Count:13127 | yes Evaluation Count:10 |
partially evaluated: s->matrix.type() <= QTransform::TxScale yes Evaluation Count:13127 | no Evaluation Count:0 |
| 0-13127 |
1379 | const qreal *p = path.points(); | - |
1380 | QPointF tl = QPointF(p[0], p[1]) * s->matrix; | - |
1381 | QPointF br = QPointF(p[4], p[5]) * s->matrix; | - |
1382 | fillRect_normalized(toNormalizedFillRect(QRectF(tl, br)), &s->brushData, d); | - |
1383 | return; executed: return; Execution Count:13127 | 13127 |
1384 | } | - |
1385 | ensureRasterState(); | - |
1386 | if (s->flags.tx_noshear) { partially evaluated: s->flags.tx_noshear yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1387 | d->initializeRasterizer(&s->brushData); | - |
1388 | | - |
1389 | const qreal *p = path.points(); | - |
1390 | QRectF r = QRectF(p[0], p[1], p[2] - p[0], p[7] - p[1]).normalized(); | - |
1391 | if (!r.isEmpty()) { partially evaluated: !r.isEmpty() yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1392 | const QPointF a = s->matrix.map((r.topLeft() + r.bottomLeft()) * 0.5f); | - |
1393 | const QPointF b = s->matrix.map((r.topRight() + r.bottomRight()) * 0.5f); | - |
1394 | d->rasterizer->rasterizeLine(a, b, r.height() / r.width()); | - |
1395 | } executed: } Execution Count:10 | 10 |
1396 | return; executed: return; Execution Count:10 | 10 |
1397 | } | - |
1398 | } | 0 |
1399 | | - |
1400 | | - |
1401 | QRectF cpRect = path.controlPointRect(); | - |
1402 | const QRect deviceRect = s->matrix.mapRect(cpRect).toRect(); | - |
1403 | ProcessSpans blend = d->getBrushFunc(deviceRect, &s->brushData); | - |
1404 | ensureOutlineMapper(); | - |
1405 | d->rasterize(d->outlineMapper->convertPath(path), blend, &s->brushData, d->rasterBuffer.data()); | - |
1406 | } executed: } Execution Count:135109 | 135109 |
1407 | | - |
1408 | void QRasterPaintEngine::fillRect(const QRectF &r, QSpanData *data) | - |
1409 | { | - |
1410 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1411 | QRasterPaintEngineState *s = state(); | - |
1412 | | - |
1413 | if (!s->flags.antialiased) { evaluated: !s->flags.antialiased yes Evaluation Count:59814 | yes Evaluation Count:30 |
| 30-59814 |
1414 | uint txop = s->matrix.type(); | - |
1415 | if (txop == QTransform::TxNone) { evaluated: txop == QTransform::TxNone yes Evaluation Count:31267 | yes Evaluation Count:28544 |
| 28544-31267 |
1416 | fillRect_normalized(toNormalizedFillRect(r), data, d); | - |
1417 | return; executed: return; Execution Count:31263 | 31263 |
1418 | } else if (txop == QTransform::TxTranslate) { evaluated: txop == QTransform::TxTranslate yes Evaluation Count:28480 | yes Evaluation Count:64 |
| 64-28480 |
1419 | const QRect rr = toNormalizedFillRect(r.translated(s->matrix.dx(), s->matrix.dy())); | - |
1420 | fillRect_normalized(rr, data, d); | - |
1421 | return; executed: return; Execution Count:28480 | 28480 |
1422 | } else if (txop == QTransform::TxScale) { evaluated: txop == QTransform::TxScale yes Evaluation Count:37 | yes Evaluation Count:27 |
| 27-37 |
1423 | const QRect rr = toNormalizedFillRect(s->matrix.mapRect(r)); | - |
1424 | fillRect_normalized(rr, data, d); | - |
1425 | return; executed: return; Execution Count:37 | 37 |
1426 | } | - |
1427 | } | - |
1428 | ensureRasterState(); | - |
1429 | if (s->flags.tx_noshear) { evaluated: s->flags.tx_noshear yes Evaluation Count:56 | yes Evaluation Count:1 |
| 1-56 |
1430 | d->initializeRasterizer(data); | - |
1431 | QRectF nr = r.normalized(); | - |
1432 | if (!nr.isEmpty()) { evaluated: !nr.isEmpty() yes Evaluation Count:52 | yes Evaluation Count:4 |
| 4-52 |
1433 | const QPointF a = s->matrix.map((nr.topLeft() + nr.bottomLeft()) * 0.5f); | - |
1434 | const QPointF b = s->matrix.map((nr.topRight() + nr.bottomRight()) * 0.5f); | - |
1435 | d->rasterizer->rasterizeLine(a, b, nr.height() / nr.width()); | - |
1436 | } executed: } Execution Count:52 | 52 |
1437 | return; executed: return; Execution Count:56 | 56 |
1438 | } | - |
1439 | | - |
1440 | QPainterPath path; | - |
1441 | path.addRect(r); | - |
1442 | ensureOutlineMapper(); | - |
1443 | fillPath(path, data); | - |
1444 | } executed: } Execution Count:1 | 1 |
1445 | | - |
1446 | | - |
1447 | | - |
1448 | | - |
1449 | void QRasterPaintEngine::fillRect(const QRectF &r, const QBrush &brush) | - |
1450 | { | - |
1451 | | - |
1452 | | - |
1453 | | - |
1454 | QRasterPaintEngineState *s = state(); | - |
1455 | | - |
1456 | ensureBrush(brush); | - |
1457 | if (!s->brushData.blend) evaluated: !s->brushData.blend yes Evaluation Count:4 | yes Evaluation Count:56817 |
| 4-56817 |
1458 | return; executed: return; Execution Count:4 | 4 |
1459 | | - |
1460 | fillRect(r, &s->brushData); | - |
1461 | } executed: } Execution Count:56813 | 56813 |
1462 | | - |
1463 | | - |
1464 | | - |
1465 | | - |
1466 | void QRasterPaintEngine::fillRect(const QRectF &r, const QColor &color) | - |
1467 | { | - |
1468 | | - |
1469 | | - |
1470 | | - |
1471 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1472 | QRasterPaintEngineState *s = state(); | - |
1473 | | - |
1474 | d->solid_color_filler.solid.color = PREMUL(((((color.rgba() >> 24) * s->intOpacity) >> 8) << 24) | (color.rgba() & 0x00ffffff)); | - |
1475 | if ((d->solid_color_filler.solid.color & 0xff000000) == 0 evaluated: (d->solid_color_filler.solid.color & 0xff000000) == 0 yes Evaluation Count:3 | yes Evaluation Count:3020 |
| 3-3020 |
1476 | && s->composition_mode == QPainter::CompositionMode_SourceOver) { partially evaluated: s->composition_mode == QPainter::CompositionMode_SourceOver no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1477 | return; | 0 |
1478 | } | - |
1479 | d->solid_color_filler.clip = d->clip(); | - |
1480 | d->solid_color_filler.adjustSpanMethods(); | - |
1481 | fillRect(r, &d->solid_color_filler); | - |
1482 | } executed: } Execution Count:3023 | 3023 |
1483 | | - |
1484 | static inline bool isAbove(const QPointF *a, const QPointF *b) | - |
1485 | { | - |
1486 | return a->y() < b->y(); never executed: return a->y() < b->y(); | 0 |
1487 | } | - |
1488 | | - |
1489 | static bool splitPolygon(const QPointF *points, int pointCount, QVector<QPointF> *upper, QVector<QPointF> *lower) | - |
1490 | { | - |
1491 | qt_noop(); | - |
1492 | qt_noop(); | - |
1493 | | - |
1494 | qt_noop(); | - |
1495 | | - |
1496 | QVector<const QPointF *> sorted; | - |
1497 | sorted.reserve(pointCount); | - |
1498 | | - |
1499 | upper->reserve(pointCount * 3 / 4); | - |
1500 | lower->reserve(pointCount * 3 / 4); | - |
1501 | | - |
1502 | for (int i = 0; i < pointCount; ++i) never evaluated: i < pointCount | 0 |
1503 | sorted << points + i; never executed: sorted << points + i; | 0 |
1504 | | - |
1505 | qSort(sorted.begin(), sorted.end(), isAbove); | - |
1506 | | - |
1507 | qreal splitY = sorted.at(sorted.size() / 2)->y(); | - |
1508 | | - |
1509 | const QPointF *end = points + pointCount; | - |
1510 | const QPointF *last = end - 1; | - |
1511 | | - |
1512 | QVector<QPointF> *bin[2] = { upper, lower }; | - |
1513 | | - |
1514 | for (const QPointF *p = points; p < end; ++p) { | 0 |
1515 | int side = p->y() < splitY; | - |
1516 | int lastSide = last->y() < splitY; | - |
1517 | | - |
1518 | if (side != lastSide) { never evaluated: side != lastSide | 0 |
1519 | if (qFuzzyCompare(p->y(), splitY)) { never evaluated: qFuzzyCompare(p->y(), splitY) | 0 |
1520 | bin[!side]->append(*p); | - |
1521 | } else if (qFuzzyCompare(last->y(), splitY)) { never evaluated: qFuzzyCompare(last->y(), splitY) | 0 |
1522 | bin[side]->append(*last); | - |
1523 | } else { | 0 |
1524 | QPointF delta = *p - *last; | - |
1525 | QPointF intersection(p->x() + delta.x() * (splitY - p->y()) / delta.y(), splitY); | - |
1526 | | - |
1527 | bin[0]->append(intersection); | - |
1528 | bin[1]->append(intersection); | - |
1529 | } | 0 |
1530 | } | - |
1531 | | - |
1532 | bin[side]->append(*p); | - |
1533 | | - |
1534 | last = p; | - |
1535 | } | 0 |
1536 | | - |
1537 | | - |
1538 | return upper->size() < pointCount && lower->size() < pointCount; never executed: return upper->size() < pointCount && lower->size() < pointCount; | 0 |
1539 | } | - |
1540 | | - |
1541 | | - |
1542 | | - |
1543 | | - |
1544 | void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - |
1545 | { | - |
1546 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1547 | QRasterPaintEngineState *s = state(); | - |
1548 | | - |
1549 | const int maxPoints = 0xffff; | - |
1550 | | - |
1551 | | - |
1552 | if (pointCount > maxPoints) { partially evaluated: pointCount > maxPoints no Evaluation Count:0 | yes Evaluation Count:391 |
| 0-391 |
1553 | QVector<QPointF> upper, lower; | - |
1554 | | - |
1555 | if (splitPolygon(points, pointCount, &upper, &lower)) { never evaluated: splitPolygon(points, pointCount, &upper, &lower) | 0 |
1556 | fillPolygon(upper.constData(), upper.size(), mode); | - |
1557 | fillPolygon(lower.constData(), lower.size(), mode); | - |
1558 | } else | 0 |
1559 | QMessageLogger("painting/qpaintengine_raster.cpp", 1907, __PRETTY_FUNCTION__).warning("Polygon too complex for filling."); never executed: QMessageLogger("painting/qpaintengine_raster.cpp", 1907, __PRETTY_FUNCTION__).warning("Polygon too complex for filling."); | 0 |
1560 | | - |
1561 | return; | 0 |
1562 | } | - |
1563 | | - |
1564 | | - |
1565 | QVectorPath vp((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); | - |
1566 | ensureOutlineMapper(); | - |
1567 | QT_FT_Outline *outline = d->outlineMapper->convertPath(vp); | - |
1568 | | - |
1569 | | - |
1570 | ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, | - |
1571 | &s->brushData); | - |
1572 | d->rasterize(outline, brushBlend, &s->brushData, d->rasterBuffer.data()); | - |
1573 | } executed: } Execution Count:391 | 391 |
1574 | | - |
1575 | | - |
1576 | | - |
1577 | | - |
1578 | void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - |
1579 | { | - |
1580 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1581 | QRasterPaintEngineState *s = state(); | - |
1582 | | - |
1583 | | - |
1584 | | - |
1585 | | - |
1586 | | - |
1587 | | - |
1588 | qt_noop(); | - |
1589 | | - |
1590 | if (mode != PolylineMode && isRect((qreal *) points, pointCount)) { partially evaluated: mode != PolylineMode yes Evaluation Count:447 | no Evaluation Count:0 |
evaluated: isRect((qreal *) points, pointCount) yes Evaluation Count:20 | yes Evaluation Count:427 |
| 0-447 |
1591 | QRectF r(points[0], points[2]); | - |
1592 | drawRects(&r, 1); | - |
1593 | return; executed: return; Execution Count:20 | 20 |
1594 | } | - |
1595 | | - |
1596 | ensurePen(); | - |
1597 | if (mode != PolylineMode) { partially evaluated: mode != PolylineMode yes Evaluation Count:427 | no Evaluation Count:0 |
| 0-427 |
1598 | | - |
1599 | ensureBrush(); | - |
1600 | if (s->brushData.blend) evaluated: s->brushData.blend yes Evaluation Count:391 | yes Evaluation Count:36 |
| 36-391 |
1601 | fillPolygon(points, pointCount, mode); executed: fillPolygon(points, pointCount, mode); Execution Count:391 | 391 |
1602 | } executed: } Execution Count:427 | 427 |
1603 | | - |
1604 | | - |
1605 | if (s->penData.blend) { evaluated: s->penData.blend yes Evaluation Count:408 | yes Evaluation Count:19 |
| 19-408 |
1606 | QVectorPath vp((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); | - |
1607 | if (s->flags.fast_pen) { evaluated: s->flags.fast_pen yes Evaluation Count:396 | yes Evaluation Count:12 |
| 12-396 |
1608 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - |
1609 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
1610 | stroker.drawPath(vp); | - |
1611 | } else { executed: } Execution Count:396 | 396 |
1612 | QPaintEngineEx::stroke(vp, s->lastPen); | - |
1613 | } executed: } Execution Count:12 | 12 |
1614 | } | - |
1615 | } executed: } Execution Count:427 | 427 |
1616 | | - |
1617 | | - |
1618 | | - |
1619 | | - |
1620 | void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) | - |
1621 | { | - |
1622 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1623 | QRasterPaintEngineState *s = state(); | - |
1624 | | - |
1625 | | - |
1626 | | - |
1627 | | - |
1628 | | - |
1629 | | - |
1630 | qt_noop(); | - |
1631 | if (mode != PolylineMode && isRect((int *) points, pointCount)) { evaluated: mode != PolylineMode yes Evaluation Count:906 | yes Evaluation Count:50052 |
evaluated: isRect((int *) points, pointCount) yes Evaluation Count:20 | yes Evaluation Count:886 |
| 20-50052 |
1632 | QRect r(points[0].x(), | - |
1633 | points[0].y(), | - |
1634 | points[2].x() - points[0].x(), | - |
1635 | points[2].y() - points[0].y()); | - |
1636 | drawRects(&r, 1); | - |
1637 | return; executed: return; Execution Count:20 | 20 |
1638 | } | - |
1639 | | - |
1640 | ensurePen(); | - |
1641 | | - |
1642 | | - |
1643 | if (mode != PolylineMode) { evaluated: mode != PolylineMode yes Evaluation Count:886 | yes Evaluation Count:50052 |
| 886-50052 |
1644 | ensureBrush(); | - |
1645 | if (s->brushData.blend) { evaluated: s->brushData.blend yes Evaluation Count:850 | yes Evaluation Count:36 |
| 36-850 |
1646 | | - |
1647 | ensureOutlineMapper(); | - |
1648 | d->outlineMapper->beginOutline(mode == WindingMode ? Qt::WindingFill : Qt::OddEvenFill); | - |
1649 | d->outlineMapper->moveTo(*points); | - |
1650 | const QPoint *p = points; | - |
1651 | const QPoint *ep = points + pointCount - 1; | - |
1652 | do { | - |
1653 | d->outlineMapper->lineTo(*(++p)); | - |
1654 | } while (p < ep); executed: } Execution Count:2317 evaluated: p < ep yes Evaluation Count:1467 | yes Evaluation Count:850 |
| 850-2317 |
1655 | d->outlineMapper->endOutline(); | - |
1656 | | - |
1657 | | - |
1658 | ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, | - |
1659 | &s->brushData); | - |
1660 | d->rasterize(d->outlineMapper->outline(), brushBlend, &s->brushData, d->rasterBuffer.data()); | - |
1661 | } executed: } Execution Count:850 | 850 |
1662 | } executed: } Execution Count:886 | 886 |
1663 | | - |
1664 | | - |
1665 | if (s->penData.blend) { evaluated: s->penData.blend yes Evaluation Count:50920 | yes Evaluation Count:18 |
| 18-50920 |
1666 | int count = pointCount * 2; | - |
1667 | QVarLengthArray<qreal> fpoints(count); | - |
1668 | for (int i=0; i<count; ++i) evaluated: i<count yes Evaluation Count:309350 | yes Evaluation Count:50920 |
| 50920-309350 |
1669 | fpoints[i] = ((int *) points)[i]; executed: fpoints[i] = ((int *) points)[i]; Execution Count:309350 | 309350 |
1670 | QVectorPath vp((qreal *) fpoints.data(), pointCount, 0, QVectorPath::polygonFlags(mode)); | - |
1671 | | - |
1672 | if (s->flags.fast_pen) { evaluated: s->flags.fast_pen yes Evaluation Count:50908 | yes Evaluation Count:12 |
| 12-50908 |
1673 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - |
1674 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
1675 | stroker.drawPath(vp); | - |
1676 | } else { executed: } Execution Count:50908 | 50908 |
1677 | QPaintEngineEx::stroke(vp, s->lastPen); | - |
1678 | } executed: } Execution Count:12 | 12 |
1679 | } | - |
1680 | } executed: } Execution Count:50938 | 50938 |
1681 | | - |
1682 | | - |
1683 | | - |
1684 | | - |
1685 | void QRasterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pixmap) | - |
1686 | { | - |
1687 | | - |
1688 | | - |
1689 | | - |
1690 | | - |
1691 | QPlatformPixmap *pd = pixmap.handle(); | - |
1692 | if (pd->classId() == QPlatformPixmap::RasterClass) { partially evaluated: pd->classId() == QPlatformPixmap::RasterClass yes Evaluation Count:6209 | no Evaluation Count:0 |
| 0-6209 |
1693 | const QImage &image = static_cast<QRasterPlatformPixmap *>(pd)->image; | - |
1694 | if (image.depth() == 1) { partially evaluated: image.depth() == 1 no Evaluation Count:0 | yes Evaluation Count:6209 |
| 0-6209 |
1695 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1696 | QRasterPaintEngineState *s = state(); | - |
1697 | if (s->matrix.type() <= QTransform::TxTranslate) { never evaluated: s->matrix.type() <= QTransform::TxTranslate | 0 |
1698 | ensurePen(); | - |
1699 | drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - |
1700 | } else { | 0 |
1701 | drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); | - |
1702 | } | 0 |
1703 | } else { | - |
1704 | QRasterPaintEngine::drawImage(pos, image); | - |
1705 | } executed: } Execution Count:6209 | 6209 |
1706 | } else { | - |
1707 | const QImage image = pixmap.toImage(); | - |
1708 | if (pixmap.depth() == 1) { never evaluated: pixmap.depth() == 1 | 0 |
1709 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1710 | QRasterPaintEngineState *s = state(); | - |
1711 | if (s->matrix.type() <= QTransform::TxTranslate) { never evaluated: s->matrix.type() <= QTransform::TxTranslate | 0 |
1712 | ensurePen(); | - |
1713 | drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - |
1714 | } else { | 0 |
1715 | drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); | - |
1716 | } | 0 |
1717 | } else { | - |
1718 | QRasterPaintEngine::drawImage(pos, image); | - |
1719 | } | 0 |
1720 | } | - |
1721 | } | - |
1722 | | - |
1723 | | - |
1724 | | - |
1725 | | - |
1726 | void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, const QRectF &sr) | - |
1727 | { | - |
1728 | | - |
1729 | | - |
1730 | | - |
1731 | | - |
1732 | QPlatformPixmap* pd = pixmap.handle(); | - |
1733 | if (pd->classId() == QPlatformPixmap::RasterClass) { partially evaluated: pd->classId() == QPlatformPixmap::RasterClass yes Evaluation Count:4195 | no Evaluation Count:0 |
| 0-4195 |
1734 | const QImage &image = static_cast<QRasterPlatformPixmap *>(pd)->image; | - |
1735 | if (image.depth() == 1) { evaluated: image.depth() == 1 yes Evaluation Count:1 | yes Evaluation Count:4194 |
| 1-4194 |
1736 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1737 | QRasterPaintEngineState *s = state(); | - |
1738 | if (s->matrix.type() <= QTransform::TxTranslate partially evaluated: s->matrix.type() <= QTransform::TxTranslate yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1739 | && r.size() == sr.size() partially evaluated: r.size() == sr.size() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1740 | && r.size() == pixmap.size()) { partially evaluated: r.size() == pixmap.size() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1741 | ensurePen(); | - |
1742 | drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - |
1743 | return; executed: return; Execution Count:1 | 1 |
1744 | } else { | - |
1745 | drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), sr); | - |
1746 | } | 0 |
1747 | } else { | - |
1748 | drawImage(r, image, sr); | - |
1749 | } executed: } Execution Count:4194 | 4194 |
1750 | } else { | - |
1751 | QRect clippedSource = sr.toAlignedRect().intersected(pixmap.rect()); | - |
1752 | const QImage image = pd->toImage(clippedSource); | - |
1753 | QRectF translatedSource = sr.translated(-clippedSource.topLeft()); | - |
1754 | if (image.depth() == 1) { never evaluated: image.depth() == 1 | 0 |
1755 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1756 | QRasterPaintEngineState *s = state(); | - |
1757 | if (s->matrix.type() <= QTransform::TxTranslate never evaluated: s->matrix.type() <= QTransform::TxTranslate | 0 |
1758 | && r.size() == sr.size() never evaluated: r.size() == sr.size() | 0 |
1759 | && r.size() == pixmap.size()) { never evaluated: r.size() == pixmap.size() | 0 |
1760 | ensurePen(); | - |
1761 | drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - |
1762 | return; | 0 |
1763 | } else { | - |
1764 | drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), translatedSource); | - |
1765 | } | 0 |
1766 | } else { | - |
1767 | drawImage(r, image, translatedSource); | - |
1768 | } | 0 |
1769 | } | - |
1770 | } | - |
1771 | | - |
1772 | static inline int fast_ceil_positive(const qreal &v) | - |
1773 | { | - |
1774 | const int iv = int(v); | - |
1775 | if (v - iv == 0) partially evaluated: v - iv == 0 yes Evaluation Count:710 | no Evaluation Count:0 |
| 0-710 |
1776 | return iv; executed: return iv; Execution Count:710 | 710 |
1777 | else | - |
1778 | return iv + 1; never executed: return iv + 1; | 0 |
1779 | } | - |
1780 | | - |
1781 | static inline const QRect toAlignedRect_positive(const QRectF &rect) | - |
1782 | { | - |
1783 | const int xmin = int(rect.x()); | - |
1784 | const int xmax = int(fast_ceil_positive(rect.right())); | - |
1785 | const int ymin = int(rect.y()); | - |
1786 | const int ymax = int(fast_ceil_positive(rect.bottom())); | - |
1787 | return QRect(xmin, ymin, xmax - xmin, ymax - ymin); executed: return QRect(xmin, ymin, xmax - xmin, ymax - ymin); Execution Count:355 | 355 |
1788 | } | - |
1789 | | - |
1790 | | - |
1791 | | - |
1792 | | - |
1793 | void QRasterPaintEngine::drawImage(const QPointF &p, const QImage &img) | - |
1794 | { | - |
1795 | | - |
1796 | | - |
1797 | | - |
1798 | | - |
1799 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1800 | QRasterPaintEngineState *s = state(); | - |
1801 | qreal scale = img.devicePixelRatio(); | - |
1802 | | - |
1803 | if (scale > 1.0 || s->matrix.type() > QTransform::TxTranslate) { partially evaluated: scale > 1.0 no Evaluation Count:0 | yes Evaluation Count:8528 |
evaluated: s->matrix.type() > QTransform::TxTranslate yes Evaluation Count:1367 | yes Evaluation Count:7161 |
| 0-8528 |
1804 | drawImage(QRectF(p.x(), p.y(), img.width() / scale, img.height() / scale), | - |
1805 | img, | - |
1806 | QRectF(0, 0, img.width(), img.height())); | - |
1807 | } else { executed: } Execution Count:1367 | 1367 |
1808 | | - |
1809 | const QClipData *clip = d->clip(); | - |
1810 | QPointF pt(p.x() + s->matrix.dx(), p.y() + s->matrix.dy()); | - |
1811 | | - |
1812 | if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) { evaluated: d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img) yes Evaluation Count:7143 | yes Evaluation Count:18 |
| 18-7143 |
1813 | SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; | - |
1814 | if (func) { evaluated: func yes Evaluation Count:6239 | yes Evaluation Count:904 |
| 904-6239 |
1815 | if (!clip) { partially evaluated: !clip no Evaluation Count:0 | yes Evaluation Count:6239 |
| 0-6239 |
1816 | d->drawImage(pt, img, func, d->deviceRect, s->intOpacity); | - |
1817 | return; | 0 |
1818 | } else if (clip->hasRectClip) { partially evaluated: clip->hasRectClip yes Evaluation Count:6239 | no Evaluation Count:0 |
| 0-6239 |
1819 | d->drawImage(pt, img, func, clip->clipRect, s->intOpacity); | - |
1820 | return; executed: return; Execution Count:6239 | 6239 |
1821 | } | - |
1822 | } | - |
1823 | } executed: } Execution Count:904 | 904 |
1824 | | - |
1825 | | - |
1826 | | - |
1827 | d->image_filler.clip = clip; | - |
1828 | d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, img.rect()); | - |
1829 | if (!d->image_filler.blend) evaluated: !d->image_filler.blend yes Evaluation Count:1 | yes Evaluation Count:921 |
| 1-921 |
1830 | return; executed: return; Execution Count:1 | 1 |
1831 | d->image_filler.dx = -pt.x(); | - |
1832 | d->image_filler.dy = -pt.y(); | - |
1833 | QRect rr = img.rect().translated(qRound(pt.x()), qRound(pt.y())); | - |
1834 | | - |
1835 | fillRect_normalized(rr, &d->image_filler, d); | - |
1836 | } executed: } Execution Count:921 | 921 |
1837 | | - |
1838 | } | - |
1839 | | - |
1840 | QRectF qt_mapRect_non_normalizing(const QRectF &r, const QTransform &t) | - |
1841 | { | - |
1842 | return QRectF(r.topLeft() * t, r.bottomRight() * t); executed: return QRectF(r.topLeft() * t, r.bottomRight() * t); Execution Count:1652 | 1652 |
1843 | } | - |
1844 | | - |
1845 | namespace { | - |
1846 | enum RotationType { | - |
1847 | Rotation90, | - |
1848 | Rotation180, | - |
1849 | Rotation270, | - |
1850 | NoRotation | - |
1851 | }; | - |
1852 | | - |
1853 | inline RotationType qRotationType(const QTransform &transform) | - |
1854 | { | - |
1855 | QTransform::TransformationType type = transform.type(); | - |
1856 | | - |
1857 | if (type > QTransform::TxRotate) partially evaluated: type > QTransform::TxRotate no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1858 | return NoRotation; never executed: return NoRotation; | 0 |
1859 | | - |
1860 | if (type == QTransform::TxRotate && qFuzzyIsNull(transform.m11()) && qFuzzyCompare(transform.m12(), qreal(-1)) evaluated: type == QTransform::TxRotate yes Evaluation Count:2 | yes Evaluation Count:6 |
partially evaluated: qFuzzyIsNull(transform.m11()) yes Evaluation Count:2 | no Evaluation Count:0 |
evaluated: qFuzzyCompare(transform.m12(), qreal(-1)) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 0-6 |
1861 | && qFuzzyCompare(transform.m21(), qreal(1)) && qFuzzyIsNull(transform.m22())) partially evaluated: qFuzzyCompare(transform.m21(), qreal(1)) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: qFuzzyIsNull(transform.m22()) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1862 | return Rotation90; executed: return Rotation90; Execution Count:1 | 1 |
1863 | | - |
1864 | if (type == QTransform::TxScale && qFuzzyCompare(transform.m11(), qreal(-1)) && qFuzzyIsNull(transform.m12()) evaluated: type == QTransform::TxScale yes Evaluation Count:6 | yes Evaluation Count:1 |
evaluated: qFuzzyCompare(transform.m11(), qreal(-1)) yes Evaluation Count:2 | yes Evaluation Count:4 |
partially evaluated: qFuzzyIsNull(transform.m12()) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-6 |
1865 | && qFuzzyIsNull(transform.m21()) && qFuzzyCompare(transform.m22(), qreal(-1))) partially evaluated: qFuzzyIsNull(transform.m21()) yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: qFuzzyCompare(transform.m22(), qreal(-1)) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1866 | return Rotation180; executed: return Rotation180; Execution Count:2 | 2 |
1867 | | - |
1868 | if (type == QTransform::TxRotate && qFuzzyIsNull(transform.m11()) && qFuzzyCompare(transform.m12(), qreal(1)) evaluated: type == QTransform::TxRotate yes Evaluation Count:1 | yes Evaluation Count:4 |
partially evaluated: qFuzzyIsNull(transform.m11()) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: qFuzzyCompare(transform.m12(), qreal(1)) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-4 |
1869 | && qFuzzyCompare(transform.m21(), qreal(-1)) && qFuzzyIsNull(transform.m22())) partially evaluated: qFuzzyCompare(transform.m21(), qreal(-1)) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: qFuzzyIsNull(transform.m22()) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1870 | return Rotation270; executed: return Rotation270; Execution Count:1 | 1 |
1871 | | - |
1872 | return NoRotation; executed: return NoRotation; Execution Count:4 | 4 |
1873 | } | - |
1874 | | - |
1875 | inline bool isPixelAligned(const QRectF &rect) { | - |
1876 | return QRectF(rect.toRect()) == rect; never executed: return QRectF(rect.toRect()) == rect; | 0 |
1877 | } | - |
1878 | } | - |
1879 | | - |
1880 | | - |
1881 | | - |
1882 | | - |
1883 | void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRectF &sr, | - |
1884 | Qt::ImageConversionFlags) | - |
1885 | { | - |
1886 | | - |
1887 | | - |
1888 | | - |
1889 | | - |
1890 | if (r.isEmpty()) partially evaluated: r.isEmpty() no Evaluation Count:0 | yes Evaluation Count:5788 |
| 0-5788 |
1891 | return; | 0 |
1892 | | - |
1893 | QRasterPaintEnginePrivate * const d = d_func(); | - |
1894 | QRasterPaintEngineState *s = state(); | - |
1895 | int sr_l = qFloor(sr.left()); | - |
1896 | int sr_r = qCeil(sr.right()) - 1; | - |
1897 | int sr_t = qFloor(sr.top()); | - |
1898 | int sr_b = qCeil(sr.bottom()) - 1; | - |
1899 | | - |
1900 | if (s->matrix.type() <= QTransform::TxScale && !s->flags.antialiased && sr_l == sr_r && sr_t == sr_b) { evaluated: s->matrix.type() <= QTransform::TxScale yes Evaluation Count:5776 | yes Evaluation Count:12 |
evaluated: !s->flags.antialiased yes Evaluation Count:5774 | yes Evaluation Count:2 |
evaluated: sr_l == sr_r yes Evaluation Count:1 | yes Evaluation Count:5773 |
partially evaluated: sr_t == sr_b yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-5776 |
1901 | | - |
1902 | | - |
1903 | QTransform old = s->matrix; | - |
1904 | | - |
1905 | if (s->flags.legacy_rounding) partially evaluated: s->flags.legacy_rounding no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1906 | s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); never executed: s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); | 0 |
1907 | | - |
1908 | | - |
1909 | QRgb color = img.pixel(sr_l, sr_t); | - |
1910 | switch (img.format()) { | - |
1911 | case QImage::Format_ARGB32_Premultiplied: | - |
1912 | case QImage::Format_ARGB8565_Premultiplied: | - |
1913 | case QImage::Format_ARGB6666_Premultiplied: | - |
1914 | case QImage::Format_ARGB8555_Premultiplied: | - |
1915 | case QImage::Format_ARGB4444_Premultiplied: | - |
1916 | | - |
1917 | d->solid_color_filler.solid.color = | - |
1918 | ((((color & 0x00ff00ff) * s->intOpacity) >> 8) & 0x00ff00ff) | - |
1919 | | ((((color & 0xff00ff00) >> 8) * s->intOpacity) & 0xff00ff00); | - |
1920 | break; executed: break; Execution Count:1 | 1 |
1921 | default: | - |
1922 | d->solid_color_filler.solid.color = PREMUL(((((color >> 24) * s->intOpacity) >> 8) << 24) | (color & 0x00ffffff)); | - |
1923 | break; | 0 |
1924 | } | - |
1925 | | - |
1926 | if ((d->solid_color_filler.solid.color & 0xff000000) == 0 partially evaluated: (d->solid_color_filler.solid.color & 0xff000000) == 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1927 | && s->composition_mode == QPainter::CompositionMode_SourceOver) { never evaluated: s->composition_mode == QPainter::CompositionMode_SourceOver | 0 |
1928 | return; | 0 |
1929 | } | - |
1930 | | - |
1931 | d->solid_color_filler.clip = d->clip(); | - |
1932 | d->solid_color_filler.adjustSpanMethods(); | - |
1933 | fillRect(r, &d->solid_color_filler); | - |
1934 | | - |
1935 | s->matrix = old; | - |
1936 | return; executed: return; Execution Count:1 | 1 |
1937 | } | - |
1938 | | - |
1939 | bool stretch_sr = r.width() != sr.width() || r.height() != sr.height(); evaluated: r.width() != sr.width() yes Evaluation Count:305 | yes Evaluation Count:5482 |
evaluated: r.height() != sr.height() yes Evaluation Count:4 | yes Evaluation Count:5478 |
| 4-5482 |
1940 | | - |
1941 | const QClipData *clip = d->clip(); | - |
1942 | | - |
1943 | if (s->matrix.type() > QTransform::TxTranslate evaluated: s->matrix.type() > QTransform::TxTranslate yes Evaluation Count:1374 | yes Evaluation Count:4413 |
| 1374-4413 |
1944 | && !stretch_sr evaluated: !stretch_sr yes Evaluation Count:1372 | yes Evaluation Count:2 |
| 2-1372 |
1945 | && (!clip || clip->hasRectClip) partially evaluated: !clip no Evaluation Count:0 | yes Evaluation Count:1372 |
partially evaluated: clip->hasRectClip yes Evaluation Count:1372 | no Evaluation Count:0 |
| 0-1372 |
1946 | && s->intOpacity == 256 partially evaluated: s->intOpacity == 256 yes Evaluation Count:1372 | no Evaluation Count:0 |
| 0-1372 |
1947 | && (d->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver evaluated: d->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver yes Evaluation Count:1371 | yes Evaluation Count:1 |
| 1-1371 |
1948 | || d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source) partially evaluated: d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1949 | && d->rasterBuffer->format == img.format() evaluated: d->rasterBuffer->format == img.format() yes Evaluation Count:1362 | yes Evaluation Count:10 |
| 10-1362 |
1950 | && (d->rasterBuffer->format == QImage::Format_RGB16 partially evaluated: d->rasterBuffer->format == QImage::Format_RGB16 no Evaluation Count:0 | yes Evaluation Count:1362 |
| 0-1362 |
1951 | || d->rasterBuffer->format == QImage::Format_RGB32 evaluated: d->rasterBuffer->format == QImage::Format_RGB32 yes Evaluation Count:8 | yes Evaluation Count:1354 |
| 8-1354 |
1952 | || (d->rasterBuffer->format == QImage::Format_ARGB32_Premultiplied partially evaluated: d->rasterBuffer->format == QImage::Format_ARGB32_Premultiplied yes Evaluation Count:1354 | no Evaluation Count:0 |
| 0-1354 |
1953 | && d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source))) partially evaluated: d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source no Evaluation Count:0 | yes Evaluation Count:1354 |
| 0-1354 |
1954 | { | - |
1955 | RotationType rotationType = qRotationType(s->matrix); | - |
1956 | | - |
1957 | if (rotationType != NoRotation && qMemRotateFunctions[d->rasterBuffer->format][rotationType] && img.rect().contains(sr.toAlignedRect())) { evaluated: rotationType != NoRotation yes Evaluation Count:4 | yes Evaluation Count:4 |
partially evaluated: qMemRotateFunctions[d->rasterBuffer->format][rotationType] yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: img.rect().contains(sr.toAlignedRect()) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1958 | QRectF transformedTargetRect = s->matrix.mapRect(r); | - |
1959 | | - |
1960 | if ((!(s->renderHints & QPainter::SmoothPixmapTransform) && !(s->renderHints & QPainter::Antialiasing)) partially evaluated: !(s->renderHints & QPainter::SmoothPixmapTransform) yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: !(s->renderHints & QPainter::Antialiasing) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1961 | || (isPixelAligned(transformedTargetRect) && isPixelAligned(sr))) never evaluated: isPixelAligned(transformedTargetRect) never evaluated: isPixelAligned(sr) | 0 |
1962 | { | - |
1963 | QRect clippedTransformedTargetRect = transformedTargetRect.toRect().intersected(clip ? clip->clipRect : d->deviceRect); | - |
1964 | if (clippedTransformedTargetRect.isNull()) partially evaluated: clippedTransformedTargetRect.isNull() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
1965 | return; | 0 |
1966 | | - |
1967 | QRectF clippedTargetRect = s->matrix.inverted().mapRect(QRectF(clippedTransformedTargetRect)); | - |
1968 | | - |
1969 | QRect clippedSourceRect | - |
1970 | = QRectF(sr.x() + clippedTargetRect.x() - r.x(), sr.y() + clippedTargetRect.y() - r.y(), | - |
1971 | clippedTargetRect.width(), clippedTargetRect.height()).toRect(); | - |
1972 | | - |
1973 | uint dbpl = d->rasterBuffer->bytesPerLine(); | - |
1974 | uint sbpl = img.bytesPerLine(); | - |
1975 | | - |
1976 | uchar *dst = d->rasterBuffer->buffer(); | - |
1977 | uint bpp = img.depth() >> 3; | - |
1978 | | - |
1979 | const uchar *srcBase = img.bits() + clippedSourceRect.y() * sbpl + clippedSourceRect.x() * bpp; | - |
1980 | uchar *dstBase = dst + clippedTransformedTargetRect.y() * dbpl + clippedTransformedTargetRect.x() * bpp; | - |
1981 | | - |
1982 | uint cw = clippedSourceRect.width(); | - |
1983 | uint ch = clippedSourceRect.height(); | - |
1984 | | - |
1985 | qMemRotateFunctions[d->rasterBuffer->format][rotationType](srcBase, cw, ch, sbpl, dstBase, dbpl); | - |
1986 | | - |
1987 | return; executed: return; Execution Count:4 | 4 |
1988 | } | - |
1989 | } | 0 |
1990 | } executed: } Execution Count:4 | 4 |
1991 | | - |
1992 | if (s->matrix.type() > QTransform::TxTranslate || stretch_sr) { evaluated: s->matrix.type() > QTransform::TxTranslate yes Evaluation Count:1370 | yes Evaluation Count:4413 |
evaluated: stretch_sr yes Evaluation Count:307 | yes Evaluation Count:4106 |
| 307-4413 |
1993 | | - |
1994 | QRectF targetBounds = s->matrix.mapRect(r); | - |
1995 | bool exceedsPrecision = targetBounds.width() > 0xffff partially evaluated: targetBounds.width() > 0xffff no Evaluation Count:0 | yes Evaluation Count:1677 |
| 0-1677 |
1996 | || targetBounds.height() > 0xffff; partially evaluated: targetBounds.height() > 0xffff no Evaluation Count:0 | yes Evaluation Count:1677 |
| 0-1677 |
1997 | | - |
1998 | if (!exceedsPrecision && d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) { partially evaluated: !exceedsPrecision yes Evaluation Count:1677 | no Evaluation Count:0 |
evaluated: d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img) yes Evaluation Count:1656 | yes Evaluation Count:21 |
| 0-1677 |
1999 | if (s->matrix.type() > QTransform::TxScale) { evaluated: s->matrix.type() > QTransform::TxScale yes Evaluation Count:2 | yes Evaluation Count:1654 |
| 2-1654 |
2000 | SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()]; | - |
2001 | if (func && (!clip || clip->hasRectClip)) { evaluated: func yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: !clip no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: clip->hasRectClip yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2002 | func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), img.bits(), | - |
2003 | img.bytesPerLine(), r, sr, !clip ? d->deviceRect : clip->clipRect, | - |
2004 | s->matrix, s->intOpacity); | - |
2005 | return; executed: return; Execution Count:1 | 1 |
2006 | } | - |
2007 | } else { executed: } Execution Count:1 | 1 |
2008 | | - |
2009 | bool sourceRect2x = r.width() * 2 == sr.width() && r.height() * 2 == sr.height(); evaluated: r.width() * 2 == sr.width() yes Evaluation Count:296 | yes Evaluation Count:1358 |
partially evaluated: r.height() * 2 == sr.height() yes Evaluation Count:296 | no Evaluation Count:0 |
| 0-1358 |
2010 | bool scale2x = (s->matrix.m11() == qreal(2)) && (s->matrix.m22() == qreal(2)); evaluated: (s->matrix.m11() == qreal(2)) yes Evaluation Count:3 | yes Evaluation Count:1651 |
partially evaluated: (s->matrix.m22() == qreal(2)) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-1651 |
2011 | if (s->matrix.type() == QTransform::TxScale && sourceRect2x && scale2x) { evaluated: s->matrix.type() == QTransform::TxScale yes Evaluation Count:1356 | yes Evaluation Count:298 |
partially evaluated: sourceRect2x no Evaluation Count:0 | yes Evaluation Count:1356 |
| 0-1356 |
2012 | SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; | - |
2013 | if (func) { | 0 |
2014 | QPointF pt(r.x() * 2 + s->matrix.dx(), r.y() * 2 + s->matrix.dy()); | - |
2015 | if (!clip) { | 0 |
2016 | d->drawImage(pt, img, func, d->deviceRect, s->intOpacity, sr.toRect()); | - |
2017 | return; | 0 |
2018 | } else if (clip->hasRectClip) { never evaluated: clip->hasRectClip | 0 |
2019 | d->drawImage(pt, img, func, clip->clipRect, s->intOpacity, sr.toRect()); | - |
2020 | return; | 0 |
2021 | } | - |
2022 | } | - |
2023 | } | 0 |
2024 | SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()]; | - |
2025 | if (func && (!clip || clip->hasRectClip)) { evaluated: func yes Evaluation Count:1652 | yes Evaluation Count:2 |
partially evaluated: !clip no Evaluation Count:0 | yes Evaluation Count:1652 |
partially evaluated: clip->hasRectClip yes Evaluation Count:1652 | no Evaluation Count:0 |
| 0-1652 |
2026 | func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), | - |
2027 | img.bits(), img.bytesPerLine(), | - |
2028 | qt_mapRect_non_normalizing(r, s->matrix), sr, | - |
2029 | !clip ? d->deviceRect : clip->clipRect, | - |
2030 | s->intOpacity); | - |
2031 | return; executed: return; Execution Count:1652 | 1652 |
2032 | } | - |
2033 | } executed: } Execution Count:2 | 2 |
2034 | } | - |
2035 | | - |
2036 | QTransform copy = s->matrix; | - |
2037 | copy.translate(r.x(), r.y()); | - |
2038 | if (stretch_sr) evaluated: stretch_sr yes Evaluation Count:11 | yes Evaluation Count:13 |
| 11-13 |
2039 | copy.scale(r.width() / sr.width(), r.height() / sr.height()); executed: copy.scale(r.width() / sr.width(), r.height() / sr.height()); Execution Count:11 | 11 |
2040 | copy.translate(-sr.x(), -sr.y()); | - |
2041 | | - |
2042 | d->image_filler_xform.clip = clip; | - |
2043 | d->image_filler_xform.initTexture(&img, s->intOpacity, QTextureData::Plain, toAlignedRect_positive(sr)); | - |
2044 | if (!d->image_filler_xform.blend) partially evaluated: !d->image_filler_xform.blend no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
2045 | return; | 0 |
2046 | d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); | - |
2047 | | - |
2048 | if (!s->flags.antialiased && s->matrix.type() == QTransform::TxScale) { evaluated: !s->flags.antialiased yes Evaluation Count:14 | yes Evaluation Count:10 |
evaluated: s->matrix.type() == QTransform::TxScale yes Evaluation Count:2 | yes Evaluation Count:12 |
| 2-14 |
2049 | QRectF rr = s->matrix.mapRect(r); | - |
2050 | | - |
2051 | const int x1 = qRound(rr.x()); | - |
2052 | const int y1 = qRound(rr.y()); | - |
2053 | const int x2 = qRound(rr.right()); | - |
2054 | const int y2 = qRound(rr.bottom()); | - |
2055 | | - |
2056 | fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d); | - |
2057 | return; executed: return; Execution Count:2 | 2 |
2058 | } | - |
2059 | | - |
2060 | | - |
2061 | ensureRasterState(); | - |
2062 | if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) { evaluated: s->flags.tx_noshear yes Evaluation Count:18 | yes Evaluation Count:4 |
partially evaluated: s->matrix.type() == QTransform::TxScale no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-18 |
2063 | d->initializeRasterizer(&d->image_filler_xform); | - |
2064 | d->rasterizer->setAntialiased(s->flags.antialiased); | - |
2065 | d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
2066 | | - |
2067 | const QPointF offs = s->flags.legacy_rounding ? QPointF(aliasedCoordinateDelta, aliasedCoordinateDelta) : QPointF(); partially evaluated: s->flags.legacy_rounding no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
2068 | | - |
2069 | const QRectF &rect = r.normalized(); | - |
2070 | const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f) - offs; | - |
2071 | const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f) - offs; | - |
2072 | | - |
2073 | if (s->flags.tx_noshear) partially evaluated: s->flags.tx_noshear yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
2074 | d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); executed: d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); Execution Count:18 | 18 |
2075 | else | - |
2076 | d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width()))); never executed: d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width()))); | 0 |
2077 | return; executed: return; Execution Count:18 | 18 |
2078 | } | - |
2079 | | - |
2080 | const qreal offs = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0); partially evaluated: s->flags.legacy_rounding no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2081 | QPainterPath path; | - |
2082 | path.addRect(r); | - |
2083 | QTransform m = s->matrix; | - |
2084 | s->matrix = QTransform(m.m11(), m.m12(), m.m13(), | - |
2085 | m.m21(), m.m22(), m.m23(), | - |
2086 | m.m31() - offs, m.m32() - offs, m.m33()); | - |
2087 | fillPath(path, &d->image_filler_xform); | - |
2088 | s->matrix = m; | - |
2089 | } else { executed: } Execution Count:4 | 4 |
2090 | if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) { evaluated: d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img) yes Evaluation Count:4095 | yes Evaluation Count:11 |
| 11-4095 |
2091 | SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; | - |
2092 | if (func) { evaluated: func yes Evaluation Count:3915 | yes Evaluation Count:180 |
| 180-3915 |
2093 | QPointF pt(r.x() + s->matrix.dx(), r.y() + s->matrix.dy()); | - |
2094 | if (!clip) { partially evaluated: !clip no Evaluation Count:0 | yes Evaluation Count:3915 |
| 0-3915 |
2095 | d->drawImage(pt, img, func, d->deviceRect, s->intOpacity, sr.toRect()); | - |
2096 | return; | 0 |
2097 | } else if (clip->hasRectClip) { evaluated: clip->hasRectClip yes Evaluation Count:3775 | yes Evaluation Count:140 |
| 140-3775 |
2098 | d->drawImage(pt, img, func, clip->clipRect, s->intOpacity, sr.toRect()); | - |
2099 | return; executed: return; Execution Count:3775 | 3775 |
2100 | } | - |
2101 | } | - |
2102 | } executed: } Execution Count:320 | 320 |
2103 | | - |
2104 | d->image_filler.clip = clip; | - |
2105 | d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, toAlignedRect_positive(sr)); | - |
2106 | if (!d->image_filler.blend) partially evaluated: !d->image_filler.blend no Evaluation Count:0 | yes Evaluation Count:331 |
| 0-331 |
2107 | return; | 0 |
2108 | d->image_filler.dx = -(r.x() + s->matrix.dx()) + sr.x(); | - |
2109 | d->image_filler.dy = -(r.y() + s->matrix.dy()) + sr.y(); | - |
2110 | | - |
2111 | QRectF rr = r; | - |
2112 | rr.translate(s->matrix.dx(), s->matrix.dy()); | - |
2113 | | - |
2114 | const int x1 = qRound(rr.x()); | - |
2115 | const int y1 = qRound(rr.y()); | - |
2116 | const int x2 = qRound(rr.right()); | - |
2117 | const int y2 = qRound(rr.bottom()); | - |
2118 | | - |
2119 | fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler, d); | - |
2120 | } executed: } Execution Count:331 | 331 |
2121 | } | - |
2122 | | - |
2123 | | - |
2124 | | - |
2125 | | - |
2126 | void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &sr) | - |
2127 | { | - |
2128 | | - |
2129 | | - |
2130 | | - |
2131 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2132 | QRasterPaintEngineState *s = state(); | - |
2133 | | - |
2134 | QImage image; | - |
2135 | | - |
2136 | QPlatformPixmap *pd = pixmap.handle(); | - |
2137 | if (pd->classId() == QPlatformPixmap::RasterClass) { partially evaluated: pd->classId() == QPlatformPixmap::RasterClass yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
2138 | image = static_cast<QRasterPlatformPixmap *>(pd)->image; | - |
2139 | } else { executed: } Execution Count:9 | 9 |
2140 | image = pixmap.toImage(); | - |
2141 | } | 0 |
2142 | | - |
2143 | if (image.depth() == 1) partially evaluated: image.depth() == 1 no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
2144 | image = d->rasterBuffer->colorizeBitmap(image, s->pen.color()); never executed: image = d->rasterBuffer->colorizeBitmap(image, s->pen.color()); | 0 |
2145 | | - |
2146 | if (s->matrix.type() > QTransform::TxTranslate) { partially evaluated: s->matrix.type() > QTransform::TxTranslate no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
2147 | QTransform copy = s->matrix; | - |
2148 | copy.translate(r.x(), r.y()); | - |
2149 | copy.translate(-sr.x(), -sr.y()); | - |
2150 | d->image_filler_xform.clip = d->clip(); | - |
2151 | d->image_filler_xform.initTexture(&image, s->intOpacity, QTextureData::Tiled); | - |
2152 | if (!d->image_filler_xform.blend) never evaluated: !d->image_filler_xform.blend | 0 |
2153 | return; | 0 |
2154 | d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); | - |
2155 | | - |
2156 | | - |
2157 | ensureRasterState(); | - |
2158 | if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) { never evaluated: s->flags.tx_noshear never evaluated: s->matrix.type() == QTransform::TxScale | 0 |
2159 | d->initializeRasterizer(&d->image_filler_xform); | - |
2160 | d->rasterizer->setAntialiased(s->flags.antialiased); | - |
2161 | d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
2162 | | - |
2163 | const QRectF &rect = r.normalized(); | - |
2164 | const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f); | - |
2165 | const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f); | - |
2166 | if (s->flags.tx_noshear) never evaluated: s->flags.tx_noshear | 0 |
2167 | d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); never executed: d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); | 0 |
2168 | else | - |
2169 | d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width()))); never executed: d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width()))); | 0 |
2170 | return; | 0 |
2171 | } | - |
2172 | | - |
2173 | QPainterPath path; | - |
2174 | path.addRect(r); | - |
2175 | fillPath(path, &d->image_filler_xform); | - |
2176 | } else { | 0 |
2177 | d->image_filler.clip = d->clip(); | - |
2178 | | - |
2179 | d->image_filler.initTexture(&image, s->intOpacity, QTextureData::Tiled); | - |
2180 | if (!d->image_filler.blend) partially evaluated: !d->image_filler.blend no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
2181 | return; | 0 |
2182 | d->image_filler.dx = -(r.x() + s->matrix.dx()) + sr.x(); | - |
2183 | d->image_filler.dy = -(r.y() + s->matrix.dy()) + sr.y(); | - |
2184 | | - |
2185 | QRectF rr = r; | - |
2186 | rr.translate(s->matrix.dx(), s->matrix.dy()); | - |
2187 | fillRect_normalized(rr.toRect().normalized(), &d->image_filler, d); | - |
2188 | } executed: } Execution Count:9 | 9 |
2189 | } | - |
2190 | | - |
2191 | | - |
2192 | | - |
2193 | static inline bool monoVal(const uchar* s, int x) | - |
2194 | { | - |
2195 | return (s[x>>3] << (x&7)) & 0x80; executed: return (s[x>>3] << (x&7)) & 0x80; Execution Count:392 | 392 |
2196 | } | - |
2197 | | - |
2198 | | - |
2199 | | - |
2200 | | - |
2201 | QRasterBuffer *QRasterPaintEngine::rasterBuffer() | - |
2202 | { | - |
2203 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2204 | return d->rasterBuffer.data(); never executed: return d->rasterBuffer.data(); | 0 |
2205 | } | - |
2206 | | - |
2207 | | - |
2208 | | - |
2209 | | - |
2210 | void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx,int ry,int w,int h) | - |
2211 | { | - |
2212 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2213 | QRasterPaintEngineState *s = state(); | - |
2214 | | - |
2215 | if (!s->penData.blend) partially evaluated: !s->penData.blend no Evaluation Count:0 | yes Evaluation Count:133733 |
| 0-133733 |
2216 | return; | 0 |
2217 | | - |
2218 | QRasterBuffer *rb = d->rasterBuffer.data(); | - |
2219 | | - |
2220 | const QRect rect(rx, ry, w, h); | - |
2221 | const QClipData *clip = d->clip(); | - |
2222 | bool unclipped = false; | - |
2223 | if (clip) { partially evaluated: clip yes Evaluation Count:133733 | no Evaluation Count:0 |
| 0-133733 |
2224 | | - |
2225 | const bool intersects = qMax(clip->xmin, rect.left()) <= qMin(clip->xmax - 1, rect.right()) evaluated: qMax(clip->xmin, rect.left()) <= qMin(clip->xmax - 1, rect.right()) yes Evaluation Count:119001 | yes Evaluation Count:14732 |
| 14732-119001 |
2226 | && qMax(clip->ymin, rect.top()) <= qMin(clip->ymax - 1, rect.bottom()); evaluated: qMax(clip->ymin, rect.top()) <= qMin(clip->ymax - 1, rect.bottom()) yes Evaluation Count:110045 | yes Evaluation Count:8956 |
| 8956-110045 |
2227 | | - |
2228 | if (clip->hasRectClip) { evaluated: clip->hasRectClip yes Evaluation Count:127092 | yes Evaluation Count:6641 |
| 6641-127092 |
2229 | unclipped = rx > clip->xmin evaluated: rx > clip->xmin yes Evaluation Count:126097 | yes Evaluation Count:995 |
| 995-126097 |
2230 | && rx + w < clip->xmax evaluated: rx + w < clip->xmax yes Evaluation Count:114514 | yes Evaluation Count:11583 |
| 11583-114514 |
2231 | && ry > clip->ymin evaluated: ry > clip->ymin yes Evaluation Count:114122 | yes Evaluation Count:392 |
| 392-114122 |
2232 | && ry + h < clip->ymax; evaluated: ry + h < clip->ymax yes Evaluation Count:101491 | yes Evaluation Count:12631 |
| 12631-101491 |
2233 | } executed: } Execution Count:127092 | 127092 |
2234 | | - |
2235 | if (!intersects) evaluated: !intersects yes Evaluation Count:23688 | yes Evaluation Count:110045 |
| 23688-110045 |
2236 | return; executed: return; Execution Count:23688 | 23688 |
2237 | } else { executed: } Execution Count:110045 | 110045 |
2238 | | - |
2239 | const bool intersects = qMax(0, rect.left()) <= qMin(rb->width() - 1, rect.right()) never evaluated: qMax(0, rect.left()) <= qMin(rb->width() - 1, rect.right()) | 0 |
2240 | && qMax(0, rect.top()) <= qMin(rb->height() - 1, rect.bottom()); never evaluated: qMax(0, rect.top()) <= qMin(rb->height() - 1, rect.bottom()) | 0 |
2241 | if (!intersects) never evaluated: !intersects | 0 |
2242 | return; | 0 |
2243 | | - |
2244 | | - |
2245 | const bool contains = rect.left() >= 0 && rect.right() < rb->width() never evaluated: rect.left() >= 0 never evaluated: rect.right() < rb->width() | 0 |
2246 | && rect.top() >= 0 && rect.bottom() < rb->height(); never evaluated: rect.top() >= 0 never evaluated: rect.bottom() < rb->height() | 0 |
2247 | | - |
2248 | unclipped = contains && d->isUnclipped_normalized(rect); never evaluated: contains never evaluated: d->isUnclipped_normalized(rect) | 0 |
2249 | } | 0 |
2250 | | - |
2251 | ProcessSpans blend = unclipped ? s->penData.unclipped_blend : s->penData.blend; evaluated: unclipped yes Evaluation Count:101491 | yes Evaluation Count:8554 |
| 8554-101491 |
2252 | const uchar * scanline = static_cast<const uchar *>(src); | - |
2253 | | - |
2254 | if (s->flags.fast_text) { evaluated: s->flags.fast_text yes Evaluation Count:110040 | yes Evaluation Count:5 |
| 5-110040 |
2255 | if (unclipped) { evaluated: unclipped yes Evaluation Count:101488 | yes Evaluation Count:8552 |
| 8552-101488 |
2256 | if (depth == 1) { evaluated: depth == 1 yes Evaluation Count:370 | yes Evaluation Count:101118 |
| 370-101118 |
2257 | if (s->penData.bitmapBlit) { partially evaluated: s->penData.bitmapBlit yes Evaluation Count:370 | no Evaluation Count:0 |
| 0-370 |
2258 | s->penData.bitmapBlit(rb, rx, ry, s->penData.solid.color, | - |
2259 | scanline, w, h, bpl); | - |
2260 | return; executed: return; Execution Count:370 | 370 |
2261 | } | - |
2262 | } else if (depth == 8) { partially evaluated: depth == 8 yes Evaluation Count:101118 | no Evaluation Count:0 |
| 0-101118 |
2263 | if (s->penData.alphamapBlit) { partially evaluated: s->penData.alphamapBlit yes Evaluation Count:101118 | no Evaluation Count:0 |
| 0-101118 |
2264 | s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, | - |
2265 | scanline, w, h, bpl, 0); | - |
2266 | return; executed: return; Execution Count:101118 | 101118 |
2267 | } | - |
2268 | } else if (depth == 32) { never evaluated: depth == 32 | 0 |
2269 | | - |
2270 | if (s->penData.alphaRGBBlit) { never evaluated: s->penData.alphaRGBBlit | 0 |
2271 | s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color, | - |
2272 | (const uint *) scanline, w, h, bpl / 4, 0); | - |
2273 | return; | 0 |
2274 | } | - |
2275 | } | 0 |
2276 | } else if (d->deviceDepth == 32 && (depth == 8 || depth == 32)) { evaluated: d->deviceDepth == 32 yes Evaluation Count:517 | yes Evaluation Count:8035 |
evaluated: depth == 8 yes Evaluation Count:513 | yes Evaluation Count:4 |
partially evaluated: depth == 32 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-8035 |
2277 | | - |
2278 | if (!clip) { partially evaluated: !clip no Evaluation Count:0 | yes Evaluation Count:513 |
| 0-513 |
2279 | int nx = qMax(0, rx); | - |
2280 | int ny = qMax(0, ry); | - |
2281 | | - |
2282 | | - |
2283 | int xdiff = nx - rx; | - |
2284 | int ydiff = ny - ry; | - |
2285 | scanline += ydiff * bpl; | - |
2286 | scanline += xdiff * (depth == 32 ? 4 : 1); | - |
2287 | | - |
2288 | w -= xdiff; | - |
2289 | h -= ydiff; | - |
2290 | | - |
2291 | if (nx + w > d->rasterBuffer->width()) never evaluated: nx + w > d->rasterBuffer->width() | 0 |
2292 | w = d->rasterBuffer->width() - nx; never executed: w = d->rasterBuffer->width() - nx; | 0 |
2293 | if (ny + h > d->rasterBuffer->height()) never evaluated: ny + h > d->rasterBuffer->height() | 0 |
2294 | h = d->rasterBuffer->height() - ny; never executed: h = d->rasterBuffer->height() - ny; | 0 |
2295 | | - |
2296 | rx = nx; | - |
2297 | ry = ny; | - |
2298 | } | 0 |
2299 | if (depth == 8 && s->penData.alphamapBlit) { partially evaluated: depth == 8 yes Evaluation Count:513 | no Evaluation Count:0 |
partially evaluated: s->penData.alphamapBlit yes Evaluation Count:513 | no Evaluation Count:0 |
| 0-513 |
2300 | s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, | - |
2301 | scanline, w, h, bpl, clip); | - |
2302 | } else if (depth == 32 && s->penData.alphaRGBBlit) { never evaluated: depth == 32 never evaluated: s->penData.alphaRGBBlit executed: } Execution Count:513 | 0-513 |
2303 | s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color, | - |
2304 | (const uint *) scanline, w, h, bpl / 4, clip); | - |
2305 | } | 0 |
2306 | return; executed: return; Execution Count:513 | 513 |
2307 | } | - |
2308 | } | - |
2309 | | - |
2310 | int x0 = 0; | - |
2311 | if (rx < 0) { evaluated: rx < 0 yes Evaluation Count:9 | yes Evaluation Count:8035 |
| 9-8035 |
2312 | x0 = -rx; | - |
2313 | w -= x0; | - |
2314 | } executed: } Execution Count:9 | 9 |
2315 | | - |
2316 | int y0 = 0; | - |
2317 | if (ry < 0) { evaluated: ry < 0 yes Evaluation Count:102 | yes Evaluation Count:7942 |
| 102-7942 |
2318 | y0 = -ry; | - |
2319 | scanline += bpl * y0; | - |
2320 | h -= y0; | - |
2321 | } executed: } Execution Count:102 | 102 |
2322 | | - |
2323 | w = qMin(w, rb->width() - qMax(0, rx)); | - |
2324 | h = qMin(h, rb->height() - qMax(0, ry)); | - |
2325 | | - |
2326 | if (w <= 0 || h <= 0) partially evaluated: w <= 0 no Evaluation Count:0 | yes Evaluation Count:8044 |
partially evaluated: h <= 0 no Evaluation Count:0 | yes Evaluation Count:8044 |
| 0-8044 |
2327 | return; | 0 |
2328 | | - |
2329 | const int NSPANS = 256; | - |
2330 | QSpan spans[NSPANS]; | - |
2331 | int current = 0; | - |
2332 | | - |
2333 | const int x1 = x0 + w; | - |
2334 | const int y1 = y0 + h; | - |
2335 | | - |
2336 | if (depth == 1) { evaluated: depth == 1 yes Evaluation Count:4 | yes Evaluation Count:8040 |
| 4-8040 |
2337 | for (int y = y0; y < y1; ++y) { evaluated: y < y1 yes Evaluation Count:44 | yes Evaluation Count:4 |
| 4-44 |
2338 | for (int x = x0; x < x1; ) { evaluated: x < x1 yes Evaluation Count:316 | yes Evaluation Count:44 |
| 44-316 |
2339 | if (!monoVal(scanline, x)) { evaluated: !monoVal(scanline, x) yes Evaluation Count:264 | yes Evaluation Count:52 |
| 52-264 |
2340 | ++x; | - |
2341 | continue; executed: continue; Execution Count:264 | 264 |
2342 | } | - |
2343 | | - |
2344 | if (current == NSPANS) { partially evaluated: current == NSPANS no Evaluation Count:0 | yes Evaluation Count:52 |
| 0-52 |
2345 | blend(current, spans, &s->penData); | - |
2346 | current = 0; | - |
2347 | } | 0 |
2348 | spans[current].x = x + rx; | - |
2349 | spans[current].y = y + ry; | - |
2350 | spans[current].coverage = 255; | - |
2351 | int len = 1; | - |
2352 | ++x; | - |
2353 | | - |
2354 | while (x < x1 && monoVal(scanline, x)) { evaluated: x < x1 yes Evaluation Count:76 | yes Evaluation Count:12 |
evaluated: monoVal(scanline, x) yes Evaluation Count:36 | yes Evaluation Count:40 |
| 12-76 |
2355 | ++x; | - |
2356 | ++len; | - |
2357 | } executed: } Execution Count:36 | 36 |
2358 | spans[current].len = len; | - |
2359 | ++current; | - |
2360 | } executed: } Execution Count:52 | 52 |
2361 | scanline += bpl; | - |
2362 | } executed: } Execution Count:44 | 44 |
2363 | } else if (depth == 8) { executed: } Execution Count:4 partially evaluated: depth == 8 yes Evaluation Count:8040 | no Evaluation Count:0 |
| 0-8040 |
2364 | for (int y = y0; y < y1; ++y) { evaluated: y < y1 yes Evaluation Count:49031 | yes Evaluation Count:8040 |
| 8040-49031 |
2365 | for (int x = x0; x < x1; ) { evaluated: x < x1 yes Evaluation Count:349673 | yes Evaluation Count:49031 |
| 49031-349673 |
2366 | | - |
2367 | if (scanline[x] == 0) { evaluated: scanline[x] == 0 yes Evaluation Count:164618 | yes Evaluation Count:185055 |
| 164618-185055 |
2368 | ++x; | - |
2369 | continue; executed: continue; Execution Count:164618 | 164618 |
2370 | } | - |
2371 | | - |
2372 | if (current == NSPANS) { partially evaluated: current == NSPANS no Evaluation Count:0 | yes Evaluation Count:185055 |
| 0-185055 |
2373 | blend(current, spans, &s->penData); | - |
2374 | current = 0; | - |
2375 | } | 0 |
2376 | int coverage = scanline[x]; | - |
2377 | spans[current].x = x + rx; | - |
2378 | spans[current].y = y + ry; | - |
2379 | spans[current].coverage = coverage; | - |
2380 | int len = 1; | - |
2381 | ++x; | - |
2382 | | - |
2383 | | - |
2384 | while (x < x1 && scanline[x] == coverage) { evaluated: x < x1 yes Evaluation Count:192142 | yes Evaluation Count:22104 |
evaluated: scanline[x] == coverage yes Evaluation Count:29191 | yes Evaluation Count:162951 |
| 22104-192142 |
2385 | ++x; | - |
2386 | ++len; | - |
2387 | } executed: } Execution Count:29191 | 29191 |
2388 | spans[current].len = len; | - |
2389 | ++current; | - |
2390 | } executed: } Execution Count:185055 | 185055 |
2391 | scanline += bpl; | - |
2392 | } executed: } Execution Count:49031 | 49031 |
2393 | } else { executed: } Execution Count:8040 | 8040 |
2394 | uint *sl = (uint *) src; | - |
2395 | for (int y = y0; y < y1; ++y) { | 0 |
2396 | for (int x = x0; x < x1; ) { | 0 |
2397 | | - |
2398 | if ((sl[x] & 0x00ffffff) == 0) { never evaluated: (sl[x] & 0x00ffffff) == 0 | 0 |
2399 | ++x; | - |
2400 | continue; never executed: continue; | 0 |
2401 | } | - |
2402 | | - |
2403 | if (current == NSPANS) { never evaluated: current == NSPANS | 0 |
2404 | blend(current, spans, &s->penData); | - |
2405 | current = 0; | - |
2406 | } | 0 |
2407 | uint rgbCoverage = sl[x]; | - |
2408 | int coverage = qGreen(rgbCoverage); | - |
2409 | spans[current].x = x + rx; | - |
2410 | spans[current].y = y + ry; | - |
2411 | spans[current].coverage = coverage; | - |
2412 | int len = 1; | - |
2413 | ++x; | - |
2414 | | - |
2415 | | - |
2416 | while (x < x1 && sl[x] == rgbCoverage) { never evaluated: sl[x] == rgbCoverage | 0 |
2417 | ++x; | - |
2418 | ++len; | - |
2419 | } | 0 |
2420 | spans[current].len = len; | - |
2421 | ++current; | - |
2422 | } | 0 |
2423 | sl += bpl / sizeof(uint); | - |
2424 | } | 0 |
2425 | } | 0 |
2426 | | - |
2427 | | - |
2428 | | - |
2429 | if (current != 0) partially evaluated: current != 0 yes Evaluation Count:8044 | no Evaluation Count:0 |
| 0-8044 |
2430 | blend(current, spans, &s->penData); executed: blend(current, spans, &s->penData); Execution Count:8044 | 8044 |
2431 | } executed: } Execution Count:8044 | 8044 |
2432 | | - |
2433 | | - |
2434 | | - |
2435 | | - |
2436 | bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, | - |
2437 | const QFixedPoint *positions, QFontEngine *fontEngine) | - |
2438 | { | - |
2439 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2440 | QRasterPaintEngineState *s = state(); | - |
2441 | | - |
2442 | if (fontEngine->hasInternalCaching()) { evaluated: fontEngine->hasInternalCaching() yes Evaluation Count:23002 | yes Evaluation Count:8 |
| 8-23002 |
2443 | QFontEngine::GlyphFormat neededFormat = | - |
2444 | painter()->device()->devType() == QInternal::Widget evaluated: painter()->device()->devType() == QInternal::Widget yes Evaluation Count:22054 | yes Evaluation Count:948 |
| 948-22054 |
2445 | ? QFontEngine::Format_None | - |
2446 | : QFontEngine::Format_A8; | - |
2447 | | - |
2448 | if (d_func()->mono_surface) evaluated: d_func()->mono_surface yes Evaluation Count:1 | yes Evaluation Count:23001 |
| 1-23001 |
2449 | neededFormat = QFontEngine::Format_Mono; executed: neededFormat = QFontEngine::Format_Mono; Execution Count:1 | 1 |
2450 | | - |
2451 | for (int i = 0; i < numGlyphs; i++) { evaluated: i < numGlyphs yes Evaluation Count:145074 | yes Evaluation Count:23002 |
| 23002-145074 |
2452 | QFixed spp = fontEngine->subPixelPositionForX(positions[i].x); | - |
2453 | | - |
2454 | QPoint offset; | - |
2455 | QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix, | - |
2456 | &offset); | - |
2457 | if (alphaMap == 0 || alphaMap->isNull()) evaluated: alphaMap == 0 yes Evaluation Count:11364 | yes Evaluation Count:133710 |
evaluated: alphaMap->isNull() yes Evaluation Count:1 | yes Evaluation Count:133709 |
| 1-133710 |
2458 | continue; executed: continue; Execution Count:11365 | 11365 |
2459 | | - |
2460 | alphaPenBlt(alphaMap->bits(), alphaMap->bytesPerLine(), alphaMap->depth(), | - |
2461 | qFloor(positions[i].x) + offset.x(), | - |
2462 | qRound(positions[i].y) + offset.y(), | - |
2463 | alphaMap->width(), alphaMap->height()); | - |
2464 | | - |
2465 | fontEngine->unlockAlphaMapForGlyph(); | - |
2466 | } executed: } Execution Count:133709 | 133709 |
2467 | | - |
2468 | } else { executed: } Execution Count:23002 | 23002 |
2469 | QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(fontEngine->glyphFormat) : d->glyphCacheType; partially evaluated: fontEngine->glyphFormat >= 0 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
2470 | | - |
2471 | QImageTextureGlyphCache *cache = | - |
2472 | static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphType, s->matrix)); | - |
2473 | if (!cache) { evaluated: !cache yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
2474 | cache = new QImageTextureGlyphCache(glyphType, s->matrix); | - |
2475 | fontEngine->setGlyphCache(0, cache); | - |
2476 | } executed: } Execution Count:1 | 1 |
2477 | | - |
2478 | cache->populate(fontEngine, numGlyphs, glyphs, positions); | - |
2479 | cache->fillInPendingGlyphs(); | - |
2480 | | - |
2481 | const QImage &image = cache->image(); | - |
2482 | int bpl = image.bytesPerLine(); | - |
2483 | | - |
2484 | int depth = image.depth(); | - |
2485 | int rightShift = 0; | - |
2486 | int leftShift = 0; | - |
2487 | if (depth == 32) partially evaluated: depth == 32 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
2488 | leftShift = 2; never executed: leftShift = 2; | 0 |
2489 | else if (depth == 1) partially evaluated: depth == 1 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
2490 | rightShift = 3; never executed: rightShift = 3; | 0 |
2491 | | - |
2492 | int margin = fontEngine->glyphMargin(glyphType); | - |
2493 | const uchar *bits = image.bits(); | - |
2494 | for (int i=0; i<numGlyphs; ++i) { evaluated: i<numGlyphs yes Evaluation Count:24 | yes Evaluation Count:8 |
| 8-24 |
2495 | | - |
2496 | QFixed subPixelPosition = fontEngine->subPixelPositionForX(positions[i].x); | - |
2497 | QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition); | - |
2498 | const QTextureGlyphCache::Coord &c = cache->coords[glyph]; | - |
2499 | if (c.isNull()) partially evaluated: c.isNull() no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
2500 | continue; never executed: continue; | 0 |
2501 | | - |
2502 | int x = qFloor(positions[i].x) + c.baseLineX - margin; | - |
2503 | int y = qRound(positions[i].y) - c.baseLineY - margin; | - |
2504 | alphaPenBlt(bits + ((c.x << leftShift) >> rightShift) + c.y * bpl, bpl, depth, x, y, c.w, c.h); | - |
2505 | } executed: } Execution Count:24 | 24 |
2506 | } executed: } Execution Count:8 | 8 |
2507 | return true; executed: return true; Execution Count:23010 | 23010 |
2508 | } | - |
2509 | | - |
2510 | | - |
2511 | | - |
2512 | | - |
2513 | | - |
2514 | | - |
2515 | bool QRasterPaintEnginePrivate::isUnclipped_normalized(const QRect &r) const | - |
2516 | { | - |
2517 | const QClipData *cl = clip(); | - |
2518 | if (!cl) { partially evaluated: !cl no Evaluation Count:0 | yes Evaluation Count:1669 |
| 0-1669 |
2519 | | - |
2520 | const QRect &r1 = deviceRect; | - |
2521 | return (r.left() >= r1.left() && r.right() <= r1.right() | 0 |
2522 | && r.top() >= r1.top() && r.bottom() <= r1.bottom()); never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 |
2523 | } | - |
2524 | | - |
2525 | | - |
2526 | if (cl->hasRectClip) { partially evaluated: cl->hasRectClip no Evaluation Count:0 | yes Evaluation Count:1669 |
| 0-1669 |
2527 | | - |
2528 | if (cl->clipRect == deviceRect) never evaluated: cl->clipRect == deviceRect | 0 |
2529 | return true; never executed: return true; | 0 |
2530 | | - |
2531 | | - |
2532 | const QRect &r1 = cl->clipRect; | - |
2533 | return (r.left() >= r1.left() && r.right() <= r1.right() | 0 |
2534 | && r.top() >= r1.top() && r.bottom() <= r1.bottom()); never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 |
2535 | } else { | - |
2536 | return qt_region_strictContains(cl->clipRegion, r); executed: return qt_region_strictContains(cl->clipRegion, r); Execution Count:1669 | 1669 |
2537 | } | - |
2538 | } | - |
2539 | | - |
2540 | bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect, | - |
2541 | int penWidth) const | - |
2542 | { | - |
2543 | const QRasterPaintEngine * const q = q_func(); | - |
2544 | const QRasterPaintEngineState *s = q->state(); | - |
2545 | const QClipData *cl = clip(); | - |
2546 | if (!cl) { partially evaluated: !cl no Evaluation Count:0 | yes Evaluation Count:138665 |
| 0-138665 |
2547 | QRect r = rect.normalized(); | - |
2548 | | - |
2549 | const QRect &r1 = deviceRect; | - |
2550 | return (r.left() >= r1.left() && r.right() <= r1.right() | 0 |
2551 | && r.top() >= r1.top() && r.bottom() <= r1.bottom()); never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 |
2552 | } | - |
2553 | | - |
2554 | | - |
2555 | | - |
2556 | if (cl->hasRectClip && cl->clipRect == deviceRect) evaluated: cl->hasRectClip yes Evaluation Count:137688 | yes Evaluation Count:977 |
evaluated: cl->clipRect == deviceRect yes Evaluation Count:137530 | yes Evaluation Count:158 |
| 158-137688 |
2557 | return true; executed: return true; Execution Count:137530 | 137530 |
2558 | | - |
2559 | if (s->flags.antialiased) evaluated: s->flags.antialiased yes Evaluation Count:78 | yes Evaluation Count:1057 |
| 78-1057 |
2560 | ++penWidth; executed: ++penWidth; Execution Count:78 | 78 |
2561 | | - |
2562 | QRect r = rect.normalized(); | - |
2563 | if (penWidth > 0) { evaluated: penWidth > 0 yes Evaluation Count:149 | yes Evaluation Count:986 |
| 149-986 |
2564 | r.setX(r.x() - penWidth); | - |
2565 | r.setY(r.y() - penWidth); | - |
2566 | r.setWidth(r.width() + 2 * penWidth); | - |
2567 | r.setHeight(r.height() + 2 * penWidth); | - |
2568 | } executed: } Execution Count:149 | 149 |
2569 | | - |
2570 | if (cl->hasRectClip) { evaluated: cl->hasRectClip yes Evaluation Count:158 | yes Evaluation Count:977 |
| 158-977 |
2571 | | - |
2572 | const QRect &r1 = cl->clipRect; | - |
2573 | return (r.left() >= r1.left() && r.right() <= r1.right() | 158 |
2574 | && r.top() >= r1.top() && r.bottom() <= r1.bottom()); executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); Execution Count:158 | 158 |
2575 | } else { | - |
2576 | return qt_region_strictContains(cl->clipRegion, r); executed: return qt_region_strictContains(cl->clipRegion, r); Execution Count:977 | 977 |
2577 | } | - |
2578 | } | - |
2579 | | - |
2580 | inline bool QRasterPaintEnginePrivate::isUnclipped(const QRectF &rect, | - |
2581 | int penWidth) const | - |
2582 | { | - |
2583 | return isUnclipped(rect.normalized().toAlignedRect(), penWidth); executed: return isUnclipped(rect.normalized().toAlignedRect(), penWidth); Execution Count:3551 | 3551 |
2584 | } | - |
2585 | | - |
2586 | inline ProcessSpans | - |
2587 | QRasterPaintEnginePrivate::getBrushFunc(const QRect &rect, | - |
2588 | const QSpanData *data) const | - |
2589 | { | - |
2590 | return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; executed: return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; Execution Count:135114 | 135114 |
2591 | } | - |
2592 | | - |
2593 | inline ProcessSpans | - |
2594 | QRasterPaintEnginePrivate::getBrushFunc(const QRectF &rect, | - |
2595 | const QSpanData *data) const | - |
2596 | { | - |
2597 | return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; executed: return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; Execution Count:2396 | 2396 |
2598 | } | - |
2599 | | - |
2600 | inline ProcessSpans | - |
2601 | QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect, | - |
2602 | const QSpanData *data) const | - |
2603 | { | - |
2604 | const QRasterPaintEngine * const q = q_func(); | - |
2605 | const QRasterPaintEngineState *s = q->state(); | - |
2606 | | - |
2607 | if (!s->flags.fast_pen && s->matrix.type() > QTransform::TxTranslate) evaluated: !s->flags.fast_pen yes Evaluation Count:97 | yes Evaluation Count:1058 |
partially evaluated: s->matrix.type() > QTransform::TxTranslate no Evaluation Count:0 | yes Evaluation Count:97 |
| 0-1058 |
2608 | return data->blend; never executed: return data->blend; | 0 |
2609 | const int penWidth = s->flags.fast_pen ? 1 : qCeil(s->lastPen.widthF()); evaluated: s->flags.fast_pen yes Evaluation Count:1058 | yes Evaluation Count:97 |
| 97-1058 |
2610 | return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend; executed: return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend; Execution Count:1155 | 1155 |
2611 | } | - |
2612 | | - |
2613 | static QPair<int, int> visibleGlyphRange(const QRectF &clip, QFontEngine *fontEngine, | - |
2614 | glyph_t *glyphs, QFixedPoint *positions, int numGlyphs) | - |
2615 | { | - |
2616 | QFixed clipLeft = QFixed::fromReal(clip.left()); | - |
2617 | QFixed clipRight = QFixed::fromReal(clip.right()); | - |
2618 | QFixed clipTop = QFixed::fromReal(clip.top()); | - |
2619 | QFixed clipBottom = QFixed::fromReal(clip.bottom()); | - |
2620 | | - |
2621 | int first = 0; | - |
2622 | while (first < numGlyphs) { partially evaluated: first < numGlyphs yes Evaluation Count:217 | no Evaluation Count:0 |
| 0-217 |
2623 | glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[first]); | - |
2624 | QFixed left = metrics.x + positions[first].x; | - |
2625 | QFixed top = metrics.y + positions[first].y; | - |
2626 | QFixed right = left + metrics.width; | - |
2627 | QFixed bottom = top + metrics.height; | - |
2628 | if (left < clipRight && right > clipLeft && top < clipBottom && bottom > clipTop) partially evaluated: left < clipRight yes Evaluation Count:217 | no Evaluation Count:0 |
evaluated: right > clipLeft yes Evaluation Count:19 | yes Evaluation Count:198 |
partially evaluated: top < clipBottom yes Evaluation Count:19 | no Evaluation Count:0 |
partially evaluated: bottom > clipTop yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-217 |
2629 | break; executed: break; Execution Count:19 | 19 |
2630 | ++first; | - |
2631 | } executed: } Execution Count:198 | 198 |
2632 | int last = numGlyphs - 1; | - |
2633 | while (last > first) { partially evaluated: last > first yes Evaluation Count:254 | no Evaluation Count:0 |
| 0-254 |
2634 | glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[last]); | - |
2635 | QFixed left = metrics.x + positions[last].x; | - |
2636 | QFixed top = metrics.y + positions[last].y; | - |
2637 | QFixed right = left + metrics.width; | - |
2638 | QFixed bottom = top + metrics.height; | - |
2639 | if (left < clipRight && right > clipLeft && top < clipBottom && bottom > clipTop) evaluated: left < clipRight yes Evaluation Count:19 | yes Evaluation Count:235 |
partially evaluated: right > clipLeft yes Evaluation Count:19 | no Evaluation Count:0 |
partially evaluated: top < clipBottom yes Evaluation Count:19 | no Evaluation Count:0 |
partially evaluated: bottom > clipTop yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-235 |
2640 | break; executed: break; Execution Count:19 | 19 |
2641 | --last; | - |
2642 | } executed: } Execution Count:235 | 235 |
2643 | return QPair<int, int>(first, last + 1); executed: return QPair<int, int>(first, last + 1); Execution Count:19 | 19 |
2644 | } | - |
2645 | | - |
2646 | | - |
2647 | | - |
2648 | | - |
2649 | void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) | - |
2650 | { | - |
2651 | if (textItem->numGlyphs == 0) partially evaluated: textItem->numGlyphs == 0 no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
2652 | return; | 0 |
2653 | | - |
2654 | ensurePen(); | - |
2655 | ensureRasterState(); | - |
2656 | | - |
2657 | QFontEngine *fontEngine = textItem->fontEngine(); | - |
2658 | if (!supportsTransformations(fontEngine)) { partially evaluated: !supportsTransformations(fontEngine) yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
2659 | drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions, | - |
2660 | fontEngine); | - |
2661 | } else if (state()->matrix.type() < QTransform::TxProject) { executed: } Execution Count:12 never evaluated: state()->matrix.type() < QTransform::TxProject | 0-12 |
2662 | bool invertible; | - |
2663 | QTransform invMat = state()->matrix.inverted(&invertible); | - |
2664 | if (!invertible) never evaluated: !invertible | 0 |
2665 | return; | 0 |
2666 | | - |
2667 | QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()), | - |
2668 | textItem->fontEngine(), textItem->glyphs, | - |
2669 | textItem->glyphPositions, textItem->numGlyphs); | - |
2670 | QStaticTextItem copy = *textItem; | - |
2671 | copy.glyphs += range.first; | - |
2672 | copy.glyphPositions += range.first; | - |
2673 | copy.numGlyphs = range.second - range.first; | - |
2674 | QPaintEngineEx::drawStaticTextItem(©); | - |
2675 | } else { | 0 |
2676 | QPaintEngineEx::drawStaticTextItem(textItem); | - |
2677 | } | 0 |
2678 | } | - |
2679 | | - |
2680 | | - |
2681 | | - |
2682 | | - |
2683 | void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) | - |
2684 | { | - |
2685 | const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); | - |
2686 | if (ti.glyphs.numGlyphs == 0) partially evaluated: ti.glyphs.numGlyphs == 0 no Evaluation Count:0 | yes Evaluation Count:23017 |
| 0-23017 |
2687 | return; | 0 |
2688 | ensurePen(); | - |
2689 | ensureRasterState(); | - |
2690 | | - |
2691 | QRasterPaintEngineState *s = state(); | - |
2692 | QTransform matrix = s->matrix; | - |
2693 | | - |
2694 | if (!supportsTransformations(ti.fontEngine)) { evaluated: !supportsTransformations(ti.fontEngine) yes Evaluation Count:22998 | yes Evaluation Count:19 |
| 19-22998 |
2695 | QVarLengthArray<QFixedPoint> positions; | - |
2696 | QVarLengthArray<glyph_t> glyphs; | - |
2697 | | - |
2698 | matrix.translate(p.x(), p.y()); | - |
2699 | ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); | - |
2700 | | - |
2701 | drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), ti.fontEngine); | - |
2702 | } else if (matrix.type() < QTransform::TxProject) { executed: } Execution Count:22998 partially evaluated: matrix.type() < QTransform::TxProject yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-22998 |
2703 | bool invertible; | - |
2704 | QTransform invMat = matrix.inverted(&invertible); | - |
2705 | if (!invertible) partially evaluated: !invertible no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
2706 | return; | 0 |
2707 | | - |
2708 | QVarLengthArray<QFixedPoint> positions; | - |
2709 | QVarLengthArray<glyph_t> glyphs; | - |
2710 | | - |
2711 | ti.fontEngine->getGlyphPositions(ti.glyphs, QTransform::fromTranslate(p.x(), p.y()), | - |
2712 | ti.flags, glyphs, positions); | - |
2713 | QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()), | - |
2714 | ti.fontEngine, glyphs.data(), positions.data(), | - |
2715 | glyphs.size()); | - |
2716 | | - |
2717 | if (range.first >= range.second) partially evaluated: range.first >= range.second no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
2718 | return; | 0 |
2719 | | - |
2720 | QStaticTextItem staticTextItem; | - |
2721 | staticTextItem.color = s->pen.color(); | - |
2722 | staticTextItem.font = s->font; | - |
2723 | staticTextItem.setFontEngine(ti.fontEngine); | - |
2724 | staticTextItem.numGlyphs = range.second - range.first; | - |
2725 | staticTextItem.glyphs = glyphs.data() + range.first; | - |
2726 | staticTextItem.glyphPositions = positions.data() + range.first; | - |
2727 | QPaintEngineEx::drawStaticTextItem(&staticTextItem); | - |
2728 | } else { executed: } Execution Count:19 | 19 |
2729 | QPaintEngineEx::drawTextItem(p, ti); | - |
2730 | } | 0 |
2731 | } | - |
2732 | | - |
2733 | | - |
2734 | | - |
2735 | | - |
2736 | void QRasterPaintEngine::drawPoints(const QPointF *points, int pointCount) | - |
2737 | { | - |
2738 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2739 | QRasterPaintEngineState *s = state(); | - |
2740 | | - |
2741 | ensurePen(); | - |
2742 | if (!s->penData.blend) never evaluated: !s->penData.blend | 0 |
2743 | return; | 0 |
2744 | | - |
2745 | if (!s->flags.fast_pen) { never evaluated: !s->flags.fast_pen | 0 |
2746 | QPaintEngineEx::drawPoints(points, pointCount); | - |
2747 | return; | 0 |
2748 | } | - |
2749 | | - |
2750 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - |
2751 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
2752 | stroker.drawPoints(points, pointCount); | - |
2753 | } | 0 |
2754 | | - |
2755 | | - |
2756 | void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount) | - |
2757 | { | - |
2758 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2759 | QRasterPaintEngineState *s = state(); | - |
2760 | | - |
2761 | ensurePen(); | - |
2762 | if (!s->penData.blend) partially evaluated: !s->penData.blend no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
2763 | return; | 0 |
2764 | | - |
2765 | if (!s->flags.fast_pen) { evaluated: !s->flags.fast_pen yes Evaluation Count:1 | yes Evaluation Count:135 |
| 1-135 |
2766 | QPaintEngineEx::drawPoints(points, pointCount); | - |
2767 | return; executed: return; Execution Count:1 | 1 |
2768 | } | - |
2769 | | - |
2770 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - |
2771 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
2772 | stroker.drawPoints(points, pointCount); | - |
2773 | } executed: } Execution Count:135 | 135 |
2774 | | - |
2775 | | - |
2776 | | - |
2777 | | - |
2778 | void QRasterPaintEngine::drawLines(const QLine *lines, int lineCount) | - |
2779 | { | - |
2780 | | - |
2781 | | - |
2782 | | - |
2783 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2784 | QRasterPaintEngineState *s = state(); | - |
2785 | | - |
2786 | ensurePen(); | - |
2787 | if (!s->penData.blend) evaluated: !s->penData.blend yes Evaluation Count:48 | yes Evaluation Count:4988 |
| 48-4988 |
2788 | return; executed: return; Execution Count:48 | 48 |
2789 | | - |
2790 | if (s->flags.fast_pen) { evaluated: s->flags.fast_pen yes Evaluation Count:4933 | yes Evaluation Count:55 |
| 55-4933 |
2791 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - |
2792 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
2793 | for (int i=0; i<lineCount; ++i) { evaluated: i<lineCount yes Evaluation Count:4933 | yes Evaluation Count:4933 |
| 4933 |
2794 | const QLine &l = lines[i]; | - |
2795 | stroker.drawLine(l.p1(), l.p2()); | - |
2796 | } executed: } Execution Count:4933 | 4933 |
2797 | } else { executed: } Execution Count:4933 | 4933 |
2798 | QPaintEngineEx::drawLines(lines, lineCount); | - |
2799 | } executed: } Execution Count:55 | 55 |
2800 | } | - |
2801 | | - |
2802 | void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line, | - |
2803 | qreal width, | - |
2804 | int *dashIndex, | - |
2805 | qreal *dashOffset, | - |
2806 | bool *inDash) | - |
2807 | { | - |
2808 | QRasterPaintEngine * const q = q_func(); | - |
2809 | QRasterPaintEngineState *s = q->state(); | - |
2810 | | - |
2811 | const QPen &pen = s->lastPen; | - |
2812 | const bool squareCap = (pen.capStyle() == Qt::SquareCap); | - |
2813 | const QVector<qreal> pattern = pen.dashPattern(); | - |
2814 | | - |
2815 | qreal patternLength = 0; | - |
2816 | for (int i = 0; i < pattern.size(); ++i) evaluated: i < pattern.size() yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
2817 | patternLength += pattern.at(i); executed: patternLength += pattern.at(i); Execution Count:10 | 10 |
2818 | | - |
2819 | if (patternLength <= 0) evaluated: patternLength <= 0 yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
2820 | return; executed: return; Execution Count:1 | 1 |
2821 | | - |
2822 | qreal length = line.length(); | - |
2823 | qt_noop(); | - |
2824 | while (length > 0) { evaluated: length > 0 yes Evaluation Count:130 | yes Evaluation Count:2 |
| 2-130 |
2825 | const bool rasterize = *inDash; | - |
2826 | qreal dash = (pattern.at(*dashIndex) - *dashOffset) * width; | - |
2827 | QLineF l = line; | - |
2828 | | - |
2829 | if (dash >= length) { evaluated: dash >= length yes Evaluation Count:2 | yes Evaluation Count:128 |
| 2-128 |
2830 | dash = length; | - |
2831 | *dashOffset += dash / width; | - |
2832 | length = 0; | - |
2833 | } else { executed: } Execution Count:2 | 2 |
2834 | *dashOffset = 0; | - |
2835 | *inDash = !(*inDash); | - |
2836 | if (++*dashIndex >= pattern.size()) evaluated: ++*dashIndex >= pattern.size() yes Evaluation Count:32 | yes Evaluation Count:96 |
| 32-96 |
2837 | *dashIndex = 0; executed: *dashIndex = 0; Execution Count:32 | 32 |
2838 | length -= dash; | - |
2839 | l.setLength(dash); | - |
2840 | line.setP1(l.p2()); | - |
2841 | } executed: } Execution Count:128 | 128 |
2842 | | - |
2843 | if (rasterize && dash > 0) evaluated: rasterize yes Evaluation Count:66 | yes Evaluation Count:64 |
partially evaluated: dash > 0 yes Evaluation Count:66 | no Evaluation Count:0 |
| 0-66 |
2844 | rasterizer->rasterizeLine(l.p1(), l.p2(), width / dash, squareCap); executed: rasterizer->rasterizeLine(l.p1(), l.p2(), width / dash, squareCap); Execution Count:66 | 66 |
2845 | } executed: } Execution Count:130 | 130 |
2846 | } executed: } Execution Count:2 | 2 |
2847 | | - |
2848 | | - |
2849 | | - |
2850 | | - |
2851 | void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount) | - |
2852 | { | - |
2853 | | - |
2854 | | - |
2855 | | - |
2856 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2857 | QRasterPaintEngineState *s = state(); | - |
2858 | | - |
2859 | ensurePen(); | - |
2860 | if (!s->penData.blend) evaluated: !s->penData.blend yes Evaluation Count:48 | yes Evaluation Count:1925 |
| 48-1925 |
2861 | return; executed: return; Execution Count:48 | 48 |
2862 | if (s->flags.fast_pen) { evaluated: s->flags.fast_pen yes Evaluation Count:1106 | yes Evaluation Count:819 |
| 819-1106 |
2863 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - |
2864 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
2865 | for (int i=0; i<lineCount; ++i) { evaluated: i<lineCount yes Evaluation Count:1595 | yes Evaluation Count:1106 |
| 1106-1595 |
2866 | QLineF line = lines[i]; | - |
2867 | stroker.drawLine(line.p1(), line.p2()); | - |
2868 | } executed: } Execution Count:1595 | 1595 |
2869 | } else { executed: } Execution Count:1106 | 1106 |
2870 | QPaintEngineEx::drawLines(lines, lineCount); | - |
2871 | } executed: } Execution Count:819 | 819 |
2872 | } | - |
2873 | | - |
2874 | | - |
2875 | | - |
2876 | | - |
2877 | | - |
2878 | void QRasterPaintEngine::drawEllipse(const QRectF &rect) | - |
2879 | { | - |
2880 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2881 | QRasterPaintEngineState *s = state(); | - |
2882 | | - |
2883 | ensurePen(); | - |
2884 | if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen) evaluated: qpen_style(s->lastPen) == Qt::SolidLine yes Evaluation Count:1922 | yes Evaluation Count:102 |
evaluated: s->flags.fast_pen yes Evaluation Count:1062 | yes Evaluation Count:860 |
| 102-1922 |
2885 | || (qpen_style(s->lastPen) == Qt::NoPen)) evaluated: (qpen_style(s->lastPen) == Qt::NoPen) yes Evaluation Count:102 | yes Evaluation Count:860 |
| 102-860 |
2886 | && !s->flags.antialiased evaluated: !s->flags.antialiased yes Evaluation Count:1155 | yes Evaluation Count:9 |
| 9-1155 |
2887 | && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT partially evaluated: qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT yes Evaluation Count:1155 | no Evaluation Count:0 |
| 0-1155 |
2888 | && !rect.isEmpty() partially evaluated: !rect.isEmpty() yes Evaluation Count:1155 | no Evaluation Count:0 |
| 0-1155 |
2889 | && s->matrix.type() <= QTransform::TxScale) partially evaluated: s->matrix.type() <= QTransform::TxScale yes Evaluation Count:1155 | no Evaluation Count:0 |
| 0-1155 |
2890 | { | - |
2891 | ensureBrush(); | - |
2892 | const QRectF r = s->matrix.mapRect(rect); | - |
2893 | ProcessSpans penBlend = d->getPenFunc(r, &s->penData); | - |
2894 | ProcessSpans brushBlend = d->getBrushFunc(r, &s->brushData); | - |
2895 | const QRect brect = QRect(int(r.x()), int(r.y()), | - |
2896 | (int(r.x()+r.width()) - int(r.x())), | - |
2897 | (int(r.y()+r.height()) - int(r.y()))); | - |
2898 | if (brect == r) { partially evaluated: brect == r yes Evaluation Count:1155 | no Evaluation Count:0 |
| 0-1155 |
2899 | drawEllipse_midpoint_i(brect, d->deviceRect, penBlend, brushBlend, | - |
2900 | &s->penData, &s->brushData); | - |
2901 | return; executed: return; Execution Count:1155 | 1155 |
2902 | } | - |
2903 | } | 0 |
2904 | QPaintEngineEx::drawEllipse(rect); | - |
2905 | } executed: } Execution Count:869 | 869 |
2906 | bool QRasterPaintEngine::supportsTransformations(QFontEngine *fontEngine) const | - |
2907 | { | - |
2908 | const QTransform &m = state()->matrix; | - |
2909 | return supportsTransformations(fontEngine, m); executed: return supportsTransformations(fontEngine, m); Execution Count:23029 | 23029 |
2910 | } | - |
2911 | | - |
2912 | | - |
2913 | | - |
2914 | | - |
2915 | bool QRasterPaintEngine::supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const | - |
2916 | { | - |
2917 | if (fontEngine->supportsTransformations(m)) partially evaluated: fontEngine->supportsTransformations(m) no Evaluation Count:0 | yes Evaluation Count:23041 |
| 0-23041 |
2918 | return true; never executed: return true; | 0 |
2919 | | - |
2920 | return !shouldDrawCachedGlyphs(fontEngine, m); executed: return !shouldDrawCachedGlyphs(fontEngine, m); Execution Count:23041 | 23041 |
2921 | } | - |
2922 | | - |
2923 | | - |
2924 | | - |
2925 | | - |
2926 | QPoint QRasterPaintEngine::coordinateOffset() const | - |
2927 | { | - |
2928 | return QPoint(0, 0); executed: return QPoint(0, 0); Execution Count:28776 | 28776 |
2929 | } | - |
2930 | | - |
2931 | void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fg) | - |
2932 | { | - |
2933 | qt_noop(); | - |
2934 | if (!fg->blend) partially evaluated: !fg->blend no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2935 | return; | 0 |
2936 | QRasterPaintEnginePrivate * const d = d_func(); | - |
2937 | | - |
2938 | qt_noop(); | - |
2939 | | - |
2940 | const int spanCount = 256; | - |
2941 | QT_FT_Span spans[spanCount]; | - |
2942 | int n = 0; | - |
2943 | | - |
2944 | | - |
2945 | int w = image.width(); | - |
2946 | int h = image.height(); | - |
2947 | int ymax = qMin(qRound(pos.y() + h), d->rasterBuffer->height()); | - |
2948 | int ymin = qMax(qRound(pos.y()), 0); | - |
2949 | int xmax = qMin(qRound(pos.x() + w), d->rasterBuffer->width()); | - |
2950 | int xmin = qMax(qRound(pos.x()), 0); | - |
2951 | | - |
2952 | int x_offset = xmin - qRound(pos.x()); | - |
2953 | | - |
2954 | QImage::Format format = image.format(); | - |
2955 | for (int y = ymin; y < ymax; ++y) { evaluated: y < ymax yes Evaluation Count:10 | yes Evaluation Count:1 |
| 1-10 |
2956 | const uchar *src = image.scanLine(y - qRound(pos.y())); | - |
2957 | if (format == QImage::Format_MonoLSB) { partially evaluated: format == QImage::Format_MonoLSB yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
2958 | for (int x = 0; x < xmax - xmin; ++x) { evaluated: x < xmax - xmin yes Evaluation Count:10 | yes Evaluation Count:10 |
| 10 |
2959 | int src_x = x + x_offset; | - |
2960 | uchar pixel = src[src_x >> 3]; | - |
2961 | if (!pixel) { partially evaluated: !pixel no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
2962 | x += 7 - (src_x%8); | - |
2963 | continue; never executed: continue; | 0 |
2964 | } | - |
2965 | if (pixel & (0x1 << (src_x & 7))) { partially evaluated: pixel & (0x1 << (src_x & 7)) yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
2966 | spans[n].x = xmin + x; | - |
2967 | spans[n].y = y; | - |
2968 | spans[n].coverage = 255; | - |
2969 | int len = 1; | - |
2970 | while (src_x+1 < w && src[(src_x+1) >> 3] & (0x1 << ((src_x+1) & 7))) { evaluated: src_x+1 < w yes Evaluation Count:90 | yes Evaluation Count:10 |
partially evaluated: src[(src_x+1) >> 3] & (0x1 << ((src_x+1) & 7)) yes Evaluation Count:90 | no Evaluation Count:0 |
| 0-90 |
2971 | ++src_x; | - |
2972 | ++len; | - |
2973 | } executed: } Execution Count:90 | 90 |
2974 | spans[n].len = ((len + spans[n].x) > xmax) ? (xmax - spans[n].x) : len; partially evaluated: ((len + spans[n].x) > xmax) no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
2975 | x += len; | - |
2976 | ++n; | - |
2977 | if (n == spanCount) { partially evaluated: n == spanCount no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
2978 | fg->blend(n, spans, fg); | - |
2979 | n = 0; | - |
2980 | } | 0 |
2981 | } executed: } Execution Count:10 | 10 |
2982 | } executed: } Execution Count:10 | 10 |
2983 | } else { executed: } Execution Count:10 | 10 |
2984 | for (int x = 0; x < xmax - xmin; ++x) { never evaluated: x < xmax - xmin | 0 |
2985 | int src_x = x + x_offset; | - |
2986 | uchar pixel = src[src_x >> 3]; | - |
2987 | if (!pixel) { | 0 |
2988 | x += 7 - (src_x%8); | - |
2989 | continue; never executed: continue; | 0 |
2990 | } | - |
2991 | if (pixel & (0x80 >> (x & 7))) { never evaluated: pixel & (0x80 >> (x & 7)) | 0 |
2992 | spans[n].x = xmin + x; | - |
2993 | spans[n].y = y; | - |
2994 | spans[n].coverage = 255; | - |
2995 | int len = 1; | - |
2996 | while (src_x+1 < w && src[(src_x+1) >> 3] & (0x80 >> ((src_x+1) & 7))) { never evaluated: src_x+1 < w never evaluated: src[(src_x+1) >> 3] & (0x80 >> ((src_x+1) & 7)) | 0 |
2997 | ++src_x; | - |
2998 | ++len; | - |
2999 | } | 0 |
3000 | spans[n].len = ((len + spans[n].x) > xmax) ? (xmax - spans[n].x) : len; never evaluated: ((len + spans[n].x) > xmax) | 0 |
3001 | x += len; | - |
3002 | ++n; | - |
3003 | if (n == spanCount) { never evaluated: n == spanCount | 0 |
3004 | fg->blend(n, spans, fg); | - |
3005 | n = 0; | - |
3006 | } | 0 |
3007 | } | 0 |
3008 | } | 0 |
3009 | } | 0 |
3010 | } | - |
3011 | if (n) { partially evaluated: n yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3012 | fg->blend(n, spans, fg); | - |
3013 | n = 0; | - |
3014 | } executed: } Execution Count:1 | 1 |
3015 | } executed: } Execution Count:1 | 1 |
3016 | QRasterPaintEngine::ClipType QRasterPaintEngine::clipType() const | - |
3017 | { | - |
3018 | const QRasterPaintEnginePrivate * const d = d_func(); | - |
3019 | | - |
3020 | const QClipData *clip = d->clip(); | - |
3021 | if (!clip || clip->hasRectClip) partially evaluated: !clip no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: clip->hasRectClip yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
3022 | return RectClip; executed: return RectClip; Execution Count:2 | 2 |
3023 | else | - |
3024 | return ComplexClip; never executed: return ComplexClip; | 0 |
3025 | } | - |
3026 | | - |
3027 | | - |
3028 | | - |
3029 | | - |
3030 | | - |
3031 | QRect QRasterPaintEngine::clipBoundingRect() const | - |
3032 | { | - |
3033 | const QRasterPaintEnginePrivate * const d = d_func(); | - |
3034 | | - |
3035 | const QClipData *clip = d->clip(); | - |
3036 | | - |
3037 | if (!clip) partially evaluated: !clip no Evaluation Count:0 | yes Evaluation Count:21 |
| 0-21 |
3038 | return d->deviceRect; never executed: return d->deviceRect; | 0 |
3039 | | - |
3040 | if (clip->hasRectClip) partially evaluated: clip->hasRectClip yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-21 |
3041 | return clip->clipRect; executed: return clip->clipRect; Execution Count:21 | 21 |
3042 | | - |
3043 | return QRect(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin); never executed: return QRect(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin); | 0 |
3044 | } | - |
3045 | | - |
3046 | void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data) | - |
3047 | { | - |
3048 | QRasterPaintEngine * const q = q_func(); | - |
3049 | QRasterPaintEngineState *s = q->state(); | - |
3050 | | - |
3051 | rasterizer->setAntialiased(s->flags.antialiased); | - |
3052 | rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
3053 | | - |
3054 | QRect clipRect(deviceRect); | - |
3055 | ProcessSpans blend; | - |
3056 | | - |
3057 | | - |
3058 | const QClipData *c = clip(); | - |
3059 | if (c) { partially evaluated: c yes Evaluation Count:121082 | no Evaluation Count:0 |
| 0-121082 |
3060 | const QRect r(QPoint(c->xmin, c->ymin), | - |
3061 | QSize(c->xmax - c->xmin, c->ymax - c->ymin)); | - |
3062 | clipRect = clipRect.intersected(r); | - |
3063 | blend = data->blend; | - |
3064 | } else { executed: } Execution Count:121082 | 121082 |
3065 | blend = data->unclipped_blend; | - |
3066 | } | 0 |
3067 | | - |
3068 | rasterizer->setClipRect(clipRect); | - |
3069 | rasterizer->initialize(blend, data); | - |
3070 | } executed: } Execution Count:121082 | 121082 |
3071 | | - |
3072 | void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, | - |
3073 | ProcessSpans callback, | - |
3074 | QSpanData *spanData, QRasterBuffer *rasterBuffer) | - |
3075 | { | - |
3076 | if (!callback || !outline) partially evaluated: !callback no Evaluation Count:0 | yes Evaluation Count:136354 |
partially evaluated: !outline no Evaluation Count:0 | yes Evaluation Count:136354 |
| 0-136354 |
3077 | return; | 0 |
3078 | | - |
3079 | QRasterPaintEngine * const q = q_func(); | - |
3080 | QRasterPaintEngineState *s = q->state(); | - |
3081 | | - |
3082 | if (!s->flags.antialiased) { evaluated: !s->flags.antialiased yes Evaluation Count:119809 | yes Evaluation Count:16545 |
| 16545-119809 |
3083 | initializeRasterizer(spanData); | - |
3084 | | - |
3085 | const Qt::FillRule fillRule = outline->flags == 0x0 evaluated: outline->flags == 0x0 yes Evaluation Count:957 | yes Evaluation Count:118852 |
| 957-118852 |
3086 | ? Qt::WindingFill | - |
3087 | : Qt::OddEvenFill; | - |
3088 | | - |
3089 | rasterizer->rasterize(outline, fillRule); | - |
3090 | return; executed: return; Execution Count:119809 | 119809 |
3091 | } | - |
3092 | | - |
3093 | rasterize(outline, callback, (void *)spanData, rasterBuffer); | - |
3094 | } executed: } Execution Count:16545 | 16545 |
3095 | | - |
3096 | extern "C" { | - |
3097 | int q_gray_rendered_spans(QT_FT_Raster raster); | - |
3098 | } | - |
3099 | | - |
3100 | static inline uchar *alignAddress(uchar *address, quintptr alignmentMask) | - |
3101 | { | - |
3102 | return (uchar *)(((quintptr)address + alignmentMask) & ~alignmentMask); executed: return (uchar *)(((quintptr)address + alignmentMask) & ~alignmentMask); Execution Count:16545 | 16545 |
3103 | } | - |
3104 | | - |
3105 | void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, | - |
3106 | ProcessSpans callback, | - |
3107 | void *userData, QRasterBuffer *) | - |
3108 | { | - |
3109 | if (!callback || !outline) partially evaluated: !callback no Evaluation Count:0 | yes Evaluation Count:17131 |
partially evaluated: !outline no Evaluation Count:0 | yes Evaluation Count:17131 |
| 0-17131 |
3110 | return; | 0 |
3111 | | - |
3112 | QRasterPaintEngine * const q = q_func(); | - |
3113 | QRasterPaintEngineState *s = q->state(); | - |
3114 | | - |
3115 | if (!s->flags.antialiased) { evaluated: !s->flags.antialiased yes Evaluation Count:586 | yes Evaluation Count:16545 |
| 586-16545 |
3116 | rasterizer->setAntialiased(s->flags.antialiased); | - |
3117 | rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - |
3118 | rasterizer->setClipRect(deviceRect); | - |
3119 | rasterizer->initialize(callback, userData); | - |
3120 | | - |
3121 | const Qt::FillRule fillRule = outline->flags == 0x0 evaluated: outline->flags == 0x0 yes Evaluation Count:21 | yes Evaluation Count:565 |
| 21-565 |
3122 | ? Qt::WindingFill | - |
3123 | : Qt::OddEvenFill; | - |
3124 | | - |
3125 | rasterizer->rasterize(outline, fillRule); | - |
3126 | return; executed: return; Execution Count:586 | 586 |
3127 | } | - |
3128 | | - |
3129 | | - |
3130 | | - |
3131 | | - |
3132 | | - |
3133 | int rasterPoolSize = 8192; | - |
3134 | uchar rasterPoolOnStack[8192 + 0xf]; | - |
3135 | uchar *rasterPoolBase = alignAddress(rasterPoolOnStack, 0xf); | - |
3136 | uchar *rasterPoolOnHeap = 0; | - |
3137 | | - |
3138 | qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); | - |
3139 | | - |
3140 | void *data = userData; | - |
3141 | | - |
3142 | QT_FT_BBox clip_box = { deviceRect.x(), | - |
3143 | deviceRect.y(), | - |
3144 | deviceRect.x() + deviceRect.width(), | - |
3145 | deviceRect.y() + deviceRect.height() }; | - |
3146 | | - |
3147 | QT_FT_Raster_Params rasterParams; | - |
3148 | rasterParams.target = 0; | - |
3149 | rasterParams.source = outline; | - |
3150 | rasterParams.flags = 0x4; | - |
3151 | rasterParams.gray_spans = 0; | - |
3152 | rasterParams.black_spans = 0; | - |
3153 | rasterParams.bit_test = 0; | - |
3154 | rasterParams.bit_set = 0; | - |
3155 | rasterParams.user = data; | - |
3156 | rasterParams.clip_box = clip_box; | - |
3157 | | - |
3158 | bool done = false; | - |
3159 | int error; | - |
3160 | | - |
3161 | int rendered_spans = 0; | - |
3162 | | - |
3163 | while (!done) { evaluated: !done yes Evaluation Count:16545 | yes Evaluation Count:16545 |
| 16545 |
3164 | | - |
3165 | rasterParams.flags |= (0x1 | 0x2); | - |
3166 | rasterParams.gray_spans = callback; | - |
3167 | rasterParams.skip_spans = rendered_spans; | - |
3168 | error = qt_ft_grays_raster.raster_render(*grayRaster.data(), &rasterParams); | - |
3169 | | - |
3170 | | - |
3171 | if (error == -6) { partially evaluated: error == -6 no Evaluation Count:0 | yes Evaluation Count:16545 |
| 0-16545 |
3172 | rasterPoolSize *= 2; | - |
3173 | if (rasterPoolSize > 1024 * 1024) { never evaluated: rasterPoolSize > 1024 * 1024 | 0 |
3174 | QMessageLogger("painting/qpaintengine_raster.cpp", 3584, __PRETTY_FUNCTION__).warning("QPainter: Rasterization of primitive failed"); | - |
3175 | break; | 0 |
3176 | } | - |
3177 | | - |
3178 | rendered_spans += q_gray_rendered_spans(*grayRaster.data()); | - |
3179 | | - |
3180 | free(rasterPoolOnHeap); | - |
3181 | rasterPoolOnHeap = (uchar *)malloc(rasterPoolSize + 0xf); | - |
3182 | | - |
3183 | qt_noop(); | - |
3184 | | - |
3185 | rasterPoolBase = alignAddress(rasterPoolOnHeap, 0xf); | - |
3186 | | - |
3187 | qt_ft_grays_raster.raster_done(*grayRaster.data()); | - |
3188 | qt_ft_grays_raster.raster_new(grayRaster.data()); | - |
3189 | qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); | - |
3190 | } else { | 0 |
3191 | done = true; | - |
3192 | } executed: } Execution Count:16545 | 16545 |
3193 | } | - |
3194 | | - |
3195 | free(rasterPoolOnHeap); | - |
3196 | } executed: } Execution Count:16545 | 16545 |
3197 | | - |
3198 | void QRasterPaintEnginePrivate::recalculateFastImages() | - |
3199 | { | - |
3200 | QRasterPaintEngine * const q = q_func(); | - |
3201 | QRasterPaintEngineState *s = q->state(); | - |
3202 | | - |
3203 | s->flags.fast_images = !(s->renderHints & QPainter::SmoothPixmapTransform) evaluated: !(s->renderHints & QPainter::SmoothPixmapTransform) yes Evaluation Count:70111 | yes Evaluation Count:72 |
| 72-70111 |
3204 | && s->matrix.type() <= QTransform::TxShear; partially evaluated: s->matrix.type() <= QTransform::TxShear yes Evaluation Count:70111 | no Evaluation Count:0 |
| 0-70111 |
3205 | } executed: } Execution Count:70183 | 70183 |
3206 | | - |
3207 | bool QRasterPaintEnginePrivate::canUseFastImageBlending(QPainter::CompositionMode mode, const QImage &image) const | - |
3208 | { | - |
3209 | const QRasterPaintEngine * const q = q_func(); | - |
3210 | const QRasterPaintEngineState *s = q->state(); | - |
3211 | | - |
3212 | return s->flags.fast_images | 12944 |
3213 | && (mode == QPainter::CompositionMode_SourceOver | 12944 |
3214 | || (mode == QPainter::CompositionMode_Source | 12944 |
3215 | && !image.hasAlphaChannel())); executed: return s->flags.fast_images && (mode == QPainter::CompositionMode_SourceOver || (mode == QPainter::CompositionMode_Source && !image.hasAlphaChannel())); Execution Count:12944 | 12944 |
3216 | } | - |
3217 | | - |
3218 | QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color) | - |
3219 | { | - |
3220 | qt_noop(); | - |
3221 | | - |
3222 | QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB); | - |
3223 | QImage dest = QImage(sourceImage.size(), QImage::Format_ARGB32_Premultiplied); | - |
3224 | | - |
3225 | QRgb fg = PREMUL(color.rgba()); | - |
3226 | QRgb bg = 0; | - |
3227 | | - |
3228 | int height = sourceImage.height(); | - |
3229 | int width = sourceImage.width(); | - |
3230 | for (int y=0; y<height; ++y) { evaluated: y<height yes Evaluation Count:76432 | yes Evaluation Count:9554 |
| 9554-76432 |
3231 | uchar *source = sourceImage.scanLine(y); | - |
3232 | QRgb *target = reinterpret_cast<QRgb *>(dest.scanLine(y)); | - |
3233 | if (!source || !target) partially evaluated: !source no Evaluation Count:0 | yes Evaluation Count:76432 |
partially evaluated: !target no Evaluation Count:0 | yes Evaluation Count:76432 |
| 0-76432 |
3234 | qt_noop(); never executed: qt_noop(); | 0 |
3235 | for (int x=0; x < width; ++x) evaluated: x < width yes Evaluation Count:611456 | yes Evaluation Count:76432 |
| 76432-611456 |
3236 | target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg; evaluated: (source[x>>3] >> (x&7)) & 1 yes Evaluation Count:305584 | yes Evaluation Count:305872 |
executed: target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg; Execution Count:611456 | 305584-611456 |
3237 | } executed: } Execution Count:76432 | 76432 |
3238 | return dest; executed: return dest; Execution Count:9554 | 9554 |
3239 | } | - |
3240 | | - |
3241 | QRasterBuffer::~QRasterBuffer() | - |
3242 | { | - |
3243 | } | - |
3244 | | - |
3245 | void QRasterBuffer::init() | - |
3246 | { | - |
3247 | compositionMode = QPainter::CompositionMode_SourceOver; | - |
3248 | monoDestinationWithClut = false; | - |
3249 | destColor0 = 0; | - |
3250 | destColor1 = 0; | - |
3251 | } executed: } Execution Count:5615 | 5615 |
3252 | | - |
3253 | QImage::Format QRasterBuffer::prepare(QImage *image) | - |
3254 | { | - |
3255 | m_buffer = (uchar *)image->bits(); | - |
3256 | m_width = qMin(QT_RASTER_COORD_LIMIT, image->width()); | - |
3257 | m_height = qMin(QT_RASTER_COORD_LIMIT, image->height()); | - |
3258 | bytes_per_pixel = image->depth()/8; | - |
3259 | bytes_per_line = image->bytesPerLine(); | - |
3260 | | - |
3261 | format = image->format(); | - |
3262 | drawHelper = qDrawHelper + format; | - |
3263 | if (image->depth() == 1 && image->colorTable().size() == 2) { evaluated: image->depth() == 1 yes Evaluation Count:143 | yes Evaluation Count:5472 |
partially evaluated: image->colorTable().size() == 2 yes Evaluation Count:143 | no Evaluation Count:0 |
| 0-5472 |
3264 | monoDestinationWithClut = true; | - |
3265 | destColor0 = PREMUL(image->colorTable()[0]); | - |
3266 | destColor1 = PREMUL(image->colorTable()[1]); | - |
3267 | } executed: } Execution Count:143 | 143 |
3268 | | - |
3269 | return format; executed: return format; Execution Count:5614 | 5614 |
3270 | } | - |
3271 | | - |
3272 | void QRasterBuffer::resetBuffer(int val) | - |
3273 | { | - |
3274 | memset(m_buffer, val, m_height*bytes_per_line); | - |
3275 | } | 0 |
3276 | | - |
3277 | QClipData::QClipData(int height) | - |
3278 | { | - |
3279 | clipSpanHeight = height; | - |
3280 | m_clipLines = 0; | - |
3281 | | - |
3282 | allocated = 0; | - |
3283 | m_spans = 0; | - |
3284 | xmin = xmax = ymin = ymax = 0; | - |
3285 | count = 0; | - |
3286 | | - |
3287 | enabled = true; | - |
3288 | hasRectClip = hasRegionClip = false; | - |
3289 | } executed: } Execution Count:28454 | 28454 |
3290 | | - |
3291 | QClipData::~QClipData() | - |
3292 | { | - |
3293 | if (m_clipLines) evaluated: m_clipLines yes Evaluation Count:1964 | yes Evaluation Count:26479 |
| 1964-26479 |
3294 | free(m_clipLines); executed: free(m_clipLines); Execution Count:1964 | 1964 |
3295 | if (m_spans) evaluated: m_spans yes Evaluation Count:1445 | yes Evaluation Count:26998 |
| 1445-26998 |
3296 | free(m_spans); executed: free(m_spans); Execution Count:1445 | 1445 |
3297 | } executed: } Execution Count:28443 | 28443 |
3298 | | - |
3299 | void QClipData::initialize() | - |
3300 | { | - |
3301 | if (m_spans) evaluated: m_spans yes Evaluation Count:23341 | yes Evaluation Count:4167 |
| 4167-23341 |
3302 | return; executed: return; Execution Count:23341 | 23341 |
3303 | | - |
3304 | if (!m_clipLines) evaluated: !m_clipLines yes Evaluation Count:1964 | yes Evaluation Count:2203 |
| 1964-2203 |
3305 | m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight); executed: m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight); Execution Count:1964 | 1964 |
3306 | | - |
3307 | qt_noop(); | - |
3308 | if (true) { partially evaluated: true yes Evaluation Count:4167 | no Evaluation Count:0 |
| 0-4167 |
3309 | m_spans = (QSpan *)malloc(clipSpanHeight*sizeof(QSpan)); | - |
3310 | allocated = clipSpanHeight; | - |
3311 | qt_noop(); | - |
3312 | | - |
3313 | if (true) { partially evaluated: true yes Evaluation Count:4167 | no Evaluation Count:0 |
| 0-4167 |
3314 | if (hasRectClip) { evaluated: hasRectClip yes Evaluation Count:512 | yes Evaluation Count:3655 |
| 512-3655 |
3315 | int y = 0; | - |
3316 | while (y < ymin) { evaluated: y < ymin yes Evaluation Count:31823 | yes Evaluation Count:512 |
| 512-31823 |
3317 | m_clipLines[y].spans = 0; | - |
3318 | m_clipLines[y].count = 0; | - |
3319 | ++y; | - |
3320 | } executed: } Execution Count:31823 | 31823 |
3321 | | - |
3322 | const int len = clipRect.width(); | - |
3323 | count = 0; | - |
3324 | while (y < ymax) { evaluated: y < ymax yes Evaluation Count:19594 | yes Evaluation Count:512 |
| 512-19594 |
3325 | QSpan *span = m_spans + count; | - |
3326 | span->x = xmin; | - |
3327 | span->len = len; | - |
3328 | span->y = y; | - |
3329 | span->coverage = 255; | - |
3330 | ++count; | - |
3331 | | - |
3332 | m_clipLines[y].spans = span; | - |
3333 | m_clipLines[y].count = 1; | - |
3334 | ++y; | - |
3335 | } executed: } Execution Count:19594 | 19594 |
3336 | | - |
3337 | while (y < clipSpanHeight) { evaluated: y < clipSpanHeight yes Evaluation Count:27750 | yes Evaluation Count:512 |
| 512-27750 |
3338 | m_clipLines[y].spans = 0; | - |
3339 | m_clipLines[y].count = 0; | - |
3340 | ++y; | - |
3341 | } executed: } Execution Count:27750 | 27750 |
3342 | } else if (hasRegionClip) { executed: } Execution Count:512 evaluated: hasRegionClip yes Evaluation Count:3069 | yes Evaluation Count:586 |
| 512-3069 |
3343 | | - |
3344 | const QVector<QRect> rects = clipRegion.rects(); | - |
3345 | const int numRects = rects.size(); | - |
3346 | | - |
3347 | { | - |
3348 | const int maxSpans = (ymax - ymin) * numRects; | - |
3349 | if (maxSpans > allocated) { evaluated: maxSpans > allocated yes Evaluation Count:2839 | yes Evaluation Count:230 |
| 230-2839 |
3350 | m_spans = q_check_ptr((QSpan *)realloc(m_spans, maxSpans * sizeof(QSpan))); | - |
3351 | allocated = maxSpans; | - |
3352 | } executed: } Execution Count:2839 | 2839 |
3353 | } | - |
3354 | | - |
3355 | int y = 0; | - |
3356 | int firstInBand = 0; | - |
3357 | count = 0; | - |
3358 | while (firstInBand < numRects) { evaluated: firstInBand < numRects yes Evaluation Count:10491 | yes Evaluation Count:3069 |
| 3069-10491 |
3359 | const int currMinY = rects.at(firstInBand).y(); | - |
3360 | const int currMaxY = currMinY + rects.at(firstInBand).height(); | - |
3361 | | - |
3362 | while (y < currMinY) { evaluated: y < currMinY yes Evaluation Count:33412 | yes Evaluation Count:10491 |
| 10491-33412 |
3363 | m_clipLines[y].spans = 0; | - |
3364 | m_clipLines[y].count = 0; | - |
3365 | ++y; | - |
3366 | } executed: } Execution Count:33412 | 33412 |
3367 | | - |
3368 | int lastInBand = firstInBand; | - |
3369 | while (lastInBand + 1 < numRects && rects.at(lastInBand+1).top() == y) evaluated: lastInBand + 1 < numRects yes Evaluation Count:10592 | yes Evaluation Count:2972 |
evaluated: rects.at(lastInBand+1).top() == y yes Evaluation Count:3073 | yes Evaluation Count:7519 |
| 2972-10592 |
3370 | ++lastInBand; executed: ++lastInBand; Execution Count:3073 | 3073 |
3371 | | - |
3372 | while (y < currMaxY) { evaluated: y < currMaxY yes Evaluation Count:520210 | yes Evaluation Count:10491 |
| 10491-520210 |
3373 | | - |
3374 | m_clipLines[y].spans = m_spans + count; | - |
3375 | m_clipLines[y].count = lastInBand - firstInBand + 1; | - |
3376 | | - |
3377 | for (int r = firstInBand; r <= lastInBand; ++r) { evaluated: r <= lastInBand yes Evaluation Count:898183 | yes Evaluation Count:520210 |
| 520210-898183 |
3378 | const QRect &currRect = rects.at(r); | - |
3379 | QSpan *span = m_spans + count; | - |
3380 | span->x = currRect.x(); | - |
3381 | span->len = currRect.width(); | - |
3382 | span->y = y; | - |
3383 | span->coverage = 255; | - |
3384 | ++count; | - |
3385 | } executed: } Execution Count:898183 | 898183 |
3386 | ++y; | - |
3387 | } executed: } Execution Count:520210 | 520210 |
3388 | | - |
3389 | firstInBand = lastInBand + 1; | - |
3390 | } executed: } Execution Count:10491 | 10491 |
3391 | | - |
3392 | qt_noop(); | - |
3393 | | - |
3394 | while (y < clipSpanHeight) { evaluated: y < clipSpanHeight yes Evaluation Count:67012 | yes Evaluation Count:3069 |
| 3069-67012 |
3395 | m_clipLines[y].spans = 0; | - |
3396 | m_clipLines[y].count = 0; | - |
3397 | ++y; | - |
3398 | } executed: } Execution Count:67012 | 67012 |
3399 | | - |
3400 | } executed: } Execution Count:3069 | 3069 |
3401 | } else { | - |
3402 | free(m_spans); | - |
3403 | m_spans = 0; | - |
3404 | qt_noop(); | - |
3405 | } | 0 |
3406 | } else { | - |
3407 | free(m_clipLines); | - |
3408 | m_clipLines = 0; | - |
3409 | qt_noop(); | - |
3410 | } | 0 |
3411 | } | - |
3412 | | - |
3413 | void QClipData::fixup() | - |
3414 | { | - |
3415 | qt_noop(); | - |
3416 | | - |
3417 | if (count == 0) { evaluated: count == 0 yes Evaluation Count:12 | yes Evaluation Count:574 |
| 12-574 |
3418 | ymin = ymax = xmin = xmax = 0; | - |
3419 | return; executed: return; Execution Count:12 | 12 |
3420 | } | - |
3421 | | - |
3422 | int y = -1; | - |
3423 | ymin = m_spans[0].y; | - |
3424 | ymax = m_spans[count-1].y + 1; | - |
3425 | xmin = 2147483647; | - |
3426 | xmax = 0; | - |
3427 | | - |
3428 | const int firstLeft = m_spans[0].x; | - |
3429 | const int firstRight = m_spans[0].x + m_spans[0].len; | - |
3430 | bool isRect = true; | - |
3431 | | - |
3432 | for (int i = 0; i < count; ++i) { evaluated: i < count yes Evaluation Count:111874 | yes Evaluation Count:574 |
| 574-111874 |
3433 | QT_FT_Span_& span = m_spans[i]; | - |
3434 | | - |
3435 | if (span.y != y) { evaluated: span.y != y yes Evaluation Count:87947 | yes Evaluation Count:23927 |
| 23927-87947 |
3436 | if (span.y != y + 1 && y != -1) evaluated: span.y != y + 1 yes Evaluation Count:556 | yes Evaluation Count:87391 |
evaluated: y != -1 yes Evaluation Count:8 | yes Evaluation Count:548 |
| 8-87391 |
3437 | isRect = false; executed: isRect = false; Execution Count:8 | 8 |
3438 | y = span.y; | - |
3439 | m_clipLines[y].spans = &span; | - |
3440 | m_clipLines[y].count = 1; | - |
3441 | } else executed: } Execution Count:87947 | 87947 |
3442 | ++m_clipLines[y].count; executed: ++m_clipLines[y].count; Execution Count:23927 | 23927 |
3443 | | - |
3444 | const int spanLeft = span.x; | - |
3445 | const int spanRight = spanLeft + span.len; | - |
3446 | | - |
3447 | if (spanLeft < xmin) evaluated: spanLeft < xmin yes Evaluation Count:24015 | yes Evaluation Count:87859 |
| 24015-87859 |
3448 | xmin = spanLeft; executed: xmin = spanLeft; Execution Count:24015 | 24015 |
3449 | | - |
3450 | if (spanRight > xmax) evaluated: spanRight > xmax yes Evaluation Count:24058 | yes Evaluation Count:87816 |
| 24058-87816 |
3451 | xmax = spanRight; executed: xmax = spanRight; Execution Count:24058 | 24058 |
3452 | | - |
3453 | if (spanLeft != firstLeft || spanRight != firstRight) evaluated: spanLeft != firstLeft yes Evaluation Count:106131 | yes Evaluation Count:5743 |
evaluated: spanRight != firstRight yes Evaluation Count:542 | yes Evaluation Count:5201 |
| 542-106131 |
3454 | isRect = false; executed: isRect = false; Execution Count:106673 | 106673 |
3455 | } executed: } Execution Count:111874 | 111874 |
3456 | | - |
3457 | if (isRect) { evaluated: isRect yes Evaluation Count:58 | yes Evaluation Count:516 |
| 58-516 |
3458 | hasRectClip = true; | - |
3459 | clipRect.setRect(xmin, ymin, xmax - xmin, ymax - ymin); | - |
3460 | } executed: } Execution Count:58 | 58 |
3461 | } executed: } Execution Count:574 | 574 |
3462 | | - |
3463 | | - |
3464 | | - |
3465 | | - |
3466 | void QClipData::setClipRect(const QRect &rect) | - |
3467 | { | - |
3468 | if (hasRectClip && rect == clipRect) evaluated: hasRectClip yes Evaluation Count:22850 | yes Evaluation Count:28922 |
evaluated: rect == clipRect yes Evaluation Count:8737 | yes Evaluation Count:14113 |
| 8737-28922 |
3469 | return; executed: return; Execution Count:8737 | 8737 |
3470 | | - |
3471 | | - |
3472 | hasRectClip = true; | - |
3473 | hasRegionClip = false; | - |
3474 | clipRect = rect; | - |
3475 | | - |
3476 | xmin = rect.x(); | - |
3477 | xmax = rect.x() + rect.width(); | - |
3478 | ymin = qMin(rect.y(), clipSpanHeight); | - |
3479 | ymax = qMin(rect.y() + rect.height(), clipSpanHeight); | - |
3480 | | - |
3481 | if (m_spans) { evaluated: m_spans yes Evaluation Count:1940 | yes Evaluation Count:41095 |
| 1940-41095 |
3482 | free(m_spans); | - |
3483 | m_spans = 0; | - |
3484 | } executed: } Execution Count:1940 | 1940 |
3485 | | - |
3486 | | - |
3487 | } executed: } Execution Count:43035 | 43035 |
3488 | | - |
3489 | | - |
3490 | | - |
3491 | | - |
3492 | void QClipData::setClipRegion(const QRegion ®ion) | - |
3493 | { | - |
3494 | if (region.rectCount() == 1) { evaluated: region.rectCount() == 1 yes Evaluation Count:30776 | yes Evaluation Count:7109 |
| 7109-30776 |
3495 | setClipRect(region.rects().at(0)); | - |
3496 | return; executed: return; Execution Count:30776 | 30776 |
3497 | } | - |
3498 | | - |
3499 | hasRegionClip = true; | - |
3500 | hasRectClip = false; | - |
3501 | clipRegion = region; | - |
3502 | | - |
3503 | { | - |
3504 | const QRect rect = region.boundingRect(); | - |
3505 | xmin = rect.x(); | - |
3506 | xmax = rect.x() + rect.width(); | - |
3507 | ymin = rect.y(); | - |
3508 | ymax = rect.y() + rect.height(); | - |
3509 | } | - |
3510 | | - |
3511 | if (m_spans) { evaluated: m_spans yes Evaluation Count:782 | yes Evaluation Count:6327 |
| 782-6327 |
3512 | free(m_spans); | - |
3513 | m_spans = 0; | - |
3514 | } executed: } Execution Count:782 | 782 |
3515 | | - |
3516 | } executed: } Execution Count:7109 | 7109 |
3517 | | - |
3518 | | - |
3519 | | - |
3520 | | - |
3521 | | - |
3522 | static const QSpan *qt_intersect_spans(const QClipData *clip, int *currentClip, | - |
3523 | const QSpan *spans, const QSpan *end, | - |
3524 | QSpan **outSpans, int available) | - |
3525 | { | - |
3526 | const_cast<QClipData *>(clip)->initialize(); | - |
3527 | | - |
3528 | QSpan *out = *outSpans; | - |
3529 | | - |
3530 | const QSpan *clipSpans = clip->m_spans + *currentClip; | - |
3531 | const QSpan *clipEnd = clip->m_spans + clip->count; | - |
3532 | | - |
3533 | while (available && spans < end ) { evaluated: available yes Evaluation Count:5209064 | yes Evaluation Count:154 |
evaluated: spans < end yes Evaluation Count:5187081 | yes Evaluation Count:21983 |
| 154-5209064 |
3534 | if (clipSpans >= clipEnd) { evaluated: clipSpans >= clipEnd yes Evaluation Count:3404 | yes Evaluation Count:5183677 |
| 3404-5183677 |
3535 | spans = end; | - |
3536 | break; executed: break; Execution Count:3404 | 3404 |
3537 | } | - |
3538 | if (clipSpans->y > spans->y) { evaluated: clipSpans->y > spans->y yes Evaluation Count:429940 | yes Evaluation Count:4753737 |
| 429940-4753737 |
3539 | ++spans; | - |
3540 | continue; executed: continue; Execution Count:429940 | 429940 |
3541 | } | - |
3542 | if (spans->y != clipSpans->y) { evaluated: spans->y != clipSpans->y yes Evaluation Count:993951 | yes Evaluation Count:3759786 |
| 993951-3759786 |
3543 | if (spans->y < clip->count && clip->m_clipLines[spans->y].spans) evaluated: spans->y < clip->count yes Evaluation Count:880968 | yes Evaluation Count:112983 |
evaluated: clip->m_clipLines[spans->y].spans yes Evaluation Count:872718 | yes Evaluation Count:8250 |
| 8250-880968 |
3544 | clipSpans = clip->m_clipLines[spans->y].spans; executed: clipSpans = clip->m_clipLines[spans->y].spans; Execution Count:872718 | 872718 |
3545 | else | - |
3546 | ++clipSpans; executed: ++clipSpans; Execution Count:121233 | 121233 |
3547 | continue; executed: continue; Execution Count:993951 | 993951 |
3548 | } | - |
3549 | qt_noop(); | - |
3550 | | - |
3551 | int sx1 = spans->x; | - |
3552 | int sx2 = sx1 + spans->len; | - |
3553 | int cx1 = clipSpans->x; | - |
3554 | int cx2 = cx1 + clipSpans->len; | - |
3555 | | - |
3556 | if (cx1 < sx1 && cx2 < sx1) { evaluated: cx1 < sx1 yes Evaluation Count:2811224 | yes Evaluation Count:948562 |
evaluated: cx2 < sx1 yes Evaluation Count:551510 | yes Evaluation Count:2259714 |
| 551510-2811224 |
3557 | ++clipSpans; | - |
3558 | continue; executed: continue; Execution Count:551510 | 551510 |
3559 | } else if (sx1 < cx1 && sx2 < cx1) { evaluated: sx1 < cx1 yes Evaluation Count:389716 | yes Evaluation Count:2818560 |
evaluated: sx2 < cx1 yes Evaluation Count:295779 | yes Evaluation Count:93937 |
| 93937-2818560 |
3560 | ++spans; | - |
3561 | continue; executed: continue; Execution Count:295779 | 295779 |
3562 | } | - |
3563 | int x = qMax(sx1, cx1); | - |
3564 | int len = qMin(sx2, cx2) - x; | - |
3565 | if (len) { evaluated: len yes Evaluation Count:2904043 | yes Evaluation Count:8454 |
| 8454-2904043 |
3566 | out->x = qMax(sx1, cx1); | - |
3567 | out->len = qMin(sx2, cx2) - out->x; | - |
3568 | out->y = spans->y; | - |
3569 | out->coverage = qt_div_255(spans->coverage * clipSpans->coverage); | - |
3570 | ++out; | - |
3571 | --available; | - |
3572 | } executed: } Execution Count:2904043 | 2904043 |
3573 | if (sx2 < cx2) { evaluated: sx2 < cx2 yes Evaluation Count:2259020 | yes Evaluation Count:653477 |
| 653477-2259020 |
3574 | ++spans; | - |
3575 | } else { executed: } Execution Count:2259020 | 2259020 |
3576 | ++clipSpans; | - |
3577 | } executed: } Execution Count:653477 | 653477 |
3578 | } | - |
3579 | | - |
3580 | *outSpans = out; | - |
3581 | *currentClip = clipSpans - clip->m_spans; | - |
3582 | return spans; executed: return spans; Execution Count:25541 | 25541 |
3583 | } | - |
3584 | | - |
3585 | static void qt_span_fill_clipped(int spanCount, const QSpan *spans, void *userData) | - |
3586 | { | - |
3587 | | - |
3588 | QSpanData *fillData = reinterpret_cast<QSpanData *>(userData); | - |
3589 | | - |
3590 | qt_noop(); | - |
3591 | | - |
3592 | const int NSPANS = 256; | - |
3593 | QSpan cspans[NSPANS]; | - |
3594 | int currentClip = 0; | - |
3595 | const QSpan *end = spans + spanCount; | - |
3596 | while (spans < end) { evaluated: spans < end yes Evaluation Count:24623 | yes Evaluation Count:25148 |
| 24623-25148 |
3597 | QSpan *clipped = cspans; | - |
3598 | spans = qt_intersect_spans(fillData->clip, ¤tClip, spans, end, &clipped, NSPANS); | - |
3599 | | - |
3600 | | - |
3601 | | - |
3602 | if (clipped - cspans) evaluated: clipped - cspans yes Evaluation Count:21356 | yes Evaluation Count:3267 |
| 3267-21356 |
3603 | fillData->unclipped_blend(clipped - cspans, cspans, fillData); executed: fillData->unclipped_blend(clipped - cspans, cspans, fillData); Execution Count:21356 | 21356 |
3604 | } executed: } Execution Count:24623 | 24623 |
3605 | } executed: } Execution Count:25148 | 25148 |
3606 | | - |
3607 | | - |
3608 | | - |
3609 | | - |
3610 | | - |
3611 | | - |
3612 | static int qt_intersect_spans(QT_FT_Span *spans, int numSpans, | - |
3613 | const QRect &clip) | - |
3614 | { | - |
3615 | const short minx = clip.left(); | - |
3616 | const short miny = clip.top(); | - |
3617 | const short maxx = clip.right(); | - |
3618 | const short maxy = clip.bottom(); | - |
3619 | | - |
3620 | int n = 0; | - |
3621 | for (int i = 0; i < numSpans; ++i) { evaluated: i < numSpans yes Evaluation Count:6601965 | yes Evaluation Count:307451 |
| 307451-6601965 |
3622 | if (spans[i].y > maxy) evaluated: spans[i].y > maxy yes Evaluation Count:19151 | yes Evaluation Count:6582814 |
| 19151-6582814 |
3623 | break; executed: break; Execution Count:19151 | 19151 |
3624 | if (spans[i].y < miny evaluated: spans[i].y < miny yes Evaluation Count:36058 | yes Evaluation Count:6546756 |
| 36058-6546756 |
3625 | || spans[i].x > maxx evaluated: spans[i].x > maxx yes Evaluation Count:24023 | yes Evaluation Count:6522733 |
| 24023-6522733 |
3626 | || spans[i].x + spans[i].len <= minx) { evaluated: spans[i].x + spans[i].len <= minx yes Evaluation Count:17375 | yes Evaluation Count:6505358 |
| 17375-6505358 |
3627 | continue; executed: continue; Execution Count:77456 | 77456 |
3628 | } | - |
3629 | if (spans[i].x < minx) { evaluated: spans[i].x < minx yes Evaluation Count:1340 | yes Evaluation Count:6504018 |
| 1340-6504018 |
3630 | spans[n].len = qMin(spans[i].len - (minx - spans[i].x), maxx - minx + 1); | - |
3631 | spans[n].x = minx; | - |
3632 | } else { executed: } Execution Count:1340 | 1340 |
3633 | spans[n].x = spans[i].x; | - |
3634 | spans[n].len = qMin(spans[i].len, ushort(maxx - spans[n].x + 1)); | - |
3635 | } executed: } Execution Count:6504018 | 6504018 |
3636 | if (spans[n].len == 0) partially evaluated: spans[n].len == 0 no Evaluation Count:0 | yes Evaluation Count:6505358 |
| 0-6505358 |
3637 | continue; never executed: continue; | 0 |
3638 | spans[n].y = spans[i].y; | - |
3639 | spans[n].coverage = spans[i].coverage; | - |
3640 | ++n; | - |
3641 | } executed: } Execution Count:6505358 | 6505358 |
3642 | return n; executed: return n; Execution Count:326602 | 326602 |
3643 | } | - |
3644 | | - |
3645 | | - |
3646 | static void qt_span_fill_clipRect(int count, const QSpan *spans, | - |
3647 | void *userData) | - |
3648 | { | - |
3649 | QSpanData *fillData = reinterpret_cast<QSpanData *>(userData); | - |
3650 | qt_noop(); | - |
3651 | | - |
3652 | qt_noop(); | - |
3653 | qt_noop(); | - |
3654 | | - |
3655 | | - |
3656 | count = qt_intersect_spans(const_cast<QSpan*>(spans), count, | - |
3657 | fillData->clip->clipRect); | - |
3658 | if (count > 0) evaluated: count > 0 yes Evaluation Count:270144 | yes Evaluation Count:2328 |
| 2328-270144 |
3659 | fillData->unclipped_blend(count, spans, fillData); executed: fillData->unclipped_blend(count, spans, fillData); Execution Count:270144 | 270144 |
3660 | } executed: } Execution Count:272472 | 272472 |
3661 | | - |
3662 | static void qt_span_clip(int count, const QSpan *spans, void *userData) | - |
3663 | { | - |
3664 | ClipData *clipData = reinterpret_cast<ClipData *>(userData); | - |
3665 | | - |
3666 | | - |
3667 | | - |
3668 | | - |
3669 | | - |
3670 | | - |
3671 | switch (clipData->operation) { | - |
3672 | | - |
3673 | case Qt::IntersectClip: | - |
3674 | { | - |
3675 | QClipData *newClip = clipData->newClip; | - |
3676 | newClip->initialize(); | - |
3677 | | - |
3678 | int currentClip = 0; | - |
3679 | const QSpan *end = spans + count; | - |
3680 | while (spans < end) { evaluated: spans < end yes Evaluation Count:918 | yes Evaluation Count:868 |
| 868-918 |
3681 | QSpan *newspans = newClip->m_spans + newClip->count; | - |
3682 | spans = qt_intersect_spans(clipData->oldClip, ¤tClip, spans, end, | - |
3683 | &newspans, newClip->allocated - newClip->count); | - |
3684 | newClip->count = newspans - newClip->m_spans; | - |
3685 | if (spans < end) { evaluated: spans < end yes Evaluation Count:61 | yes Evaluation Count:857 |
| 61-857 |
3686 | newClip->m_spans = q_check_ptr((QSpan *)realloc(newClip->m_spans, newClip->allocated*2*sizeof(QSpan))); | - |
3687 | newClip->allocated *= 2; | - |
3688 | } executed: } Execution Count:61 | 61 |
3689 | } executed: } Execution Count:918 | 918 |
3690 | } | - |
3691 | break; executed: break; Execution Count:868 | 868 |
3692 | | - |
3693 | case Qt::ReplaceClip: | - |
3694 | clipData->newClip->appendSpans(spans, count); | - |
3695 | break; | 0 |
3696 | case Qt::NoClip: | - |
3697 | break; | 0 |
3698 | } | - |
3699 | } executed: } Execution Count:868 | 868 |
3700 | void QRasterBuffer::flushToARGBImage(QImage *target) const | - |
3701 | { | - |
3702 | int w = qMin(m_width, target->width()); | - |
3703 | int h = qMin(m_height, target->height()); | - |
3704 | | - |
3705 | for (int y=0; y<h; ++y) { | 0 |
3706 | uint *sourceLine = (uint *)const_cast<QRasterBuffer *>(this)->scanLine(y); | - |
3707 | QRgb *dest = (QRgb *) target->scanLine(y); | - |
3708 | for (int x=0; x<w; ++x) { | 0 |
3709 | QRgb pixel = sourceLine[x]; | - |
3710 | int alpha = qAlpha(pixel); | - |
3711 | if (!alpha) { | 0 |
3712 | dest[x] = 0; | - |
3713 | } else { | 0 |
3714 | dest[x] = (alpha << 24) | - |
3715 | | ((255*qRed(pixel)/alpha) << 16) | - |
3716 | | ((255*qGreen(pixel)/alpha) << 8) | - |
3717 | | ((255*qBlue(pixel)/alpha) << 0); | - |
3718 | } | 0 |
3719 | } | - |
3720 | } | 0 |
3721 | } | 0 |
3722 | | - |
3723 | | - |
3724 | class QGradientCache | - |
3725 | { | - |
3726 | struct CacheInfo | - |
3727 | { | - |
3728 | inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) : | - |
3729 | stops(s), opacity(op), interpolationMode(mode) {} executed: } Execution Count:12353 | 12353 |
3730 | uint buffer[1024]; | - |
3731 | QGradientStops stops; | - |
3732 | int opacity; | - |
3733 | QGradient::InterpolationMode interpolationMode; | - |
3734 | }; | - |
3735 | | - |
3736 | typedef QMultiHash<quint64, CacheInfo> QGradientColorTableHash; | - |
3737 | | - |
3738 | public: | - |
3739 | inline const uint *getBuffer(const QGradient &gradient, int opacity) { | - |
3740 | quint64 hash_val = 0; | - |
3741 | | - |
3742 | QGradientStops stops = gradient.stops(); | - |
3743 | for (int i = 0; i < stops.size() && i <= 2; i++) evaluated: i < stops.size() yes Evaluation Count:35219 | yes Evaluation Count:17064 |
evaluated: i <= 2 yes Evaluation Count:35073 | yes Evaluation Count:149 |
| 149-35219 |
3744 | hash_val += stops[i].second.rgba(); executed: hash_val += stops[i].second.rgba(); Execution Count:35073 | 35073 |
3745 | | - |
3746 | QMutexLocker lock(&mutex); | - |
3747 | QGradientColorTableHash::const_iterator it = cache.constFind(hash_val); | - |
3748 | | - |
3749 | if (it == cache.constEnd()) evaluated: it == cache.constEnd() yes Evaluation Count:12349 | yes Evaluation Count:4867 |
| 4867-12349 |
3750 | return addCacheElement(hash_val, gradient, opacity); executed: return addCacheElement(hash_val, gradient, opacity); Execution Count:12349 | 12349 |
3751 | else { | - |
3752 | do { | - |
3753 | const CacheInfo &cache_info = it.value(); | - |
3754 | if (cache_info.stops == stops && cache_info.opacity == opacity && cache_info.interpolationMode == gradient.interpolationMode()) evaluated: cache_info.stops == stops yes Evaluation Count:4864 | yes Evaluation Count:6 |
partially evaluated: cache_info.opacity == opacity yes Evaluation Count:4864 | no Evaluation Count:0 |
evaluated: cache_info.interpolationMode == gradient.interpolationMode() yes Evaluation Count:4863 | yes Evaluation Count:1 |
| 0-4864 |
3755 | return cache_info.buffer; executed: return cache_info.buffer; Execution Count:4863 | 4863 |
3756 | ++it; | - |
3757 | } while (it != cache.constEnd() && it.key() == hash_val); partially evaluated: it != cache.constEnd() yes Evaluation Count:7 | no Evaluation Count:0 |
evaluated: it.key() == hash_val yes Evaluation Count:3 | yes Evaluation Count:4 |
executed: } Execution Count:7 | 0-7 |
3758 | | - |
3759 | return addCacheElement(hash_val, gradient, opacity); executed: return addCacheElement(hash_val, gradient, opacity); Execution Count:4 | 4 |
3760 | } | - |
3761 | } | - |
3762 | | - |
3763 | inline int paletteSize() const { return 1024; } executed: return 1024; Execution Count:12353 | 12353 |
3764 | protected: | - |
3765 | inline int maxCacheSize() const { return 60; } executed: return 60; Execution Count:24622 | 24622 |
3766 | inline void generateGradientColorTable(const QGradient& g, | - |
3767 | uint *colorTable, | - |
3768 | int size, int opacity) const; | - |
3769 | uint *addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) { | - |
3770 | if (cache.size() == maxCacheSize()) { evaluated: cache.size() == maxCacheSize() yes Evaluation Count:12269 | yes Evaluation Count:84 |
| 84-12269 |
3771 | | - |
3772 | cache.erase(cache.begin() + (qrand() % maxCacheSize())); | - |
3773 | } executed: } Execution Count:12269 | 12269 |
3774 | CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode()); | - |
3775 | generateGradientColorTable(gradient, cache_entry.buffer, paletteSize(), opacity); | - |
3776 | return cache.insert(hash_val, cache_entry).value().buffer; executed: return cache.insert(hash_val, cache_entry).value().buffer; Execution Count:12353 | 12353 |
3777 | } | - |
3778 | | - |
3779 | QGradientColorTableHash cache; | - |
3780 | QMutex mutex; | - |
3781 | }; | - |
3782 | | - |
3783 | void QGradientCache::generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, int opacity) const | - |
3784 | { | - |
3785 | QGradientStops stops = gradient.stops(); | - |
3786 | int stopCount = stops.count(); | - |
3787 | qt_noop(); | - |
3788 | | - |
3789 | bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation); | - |
3790 | | - |
3791 | if (stopCount == 2) { evaluated: stopCount == 2 yes Evaluation Count:12342 | yes Evaluation Count:11 |
| 11-12342 |
3792 | uint first_color = ((((stops[0].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[0].second.rgba() & 0x00ffffff); | - |
3793 | uint second_color = ((((stops[1].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[1].second.rgba() & 0x00ffffff); | - |
3794 | | - |
3795 | qreal first_stop = stops[0].first; | - |
3796 | qreal second_stop = stops[1].first; | - |
3797 | | - |
3798 | if (second_stop < first_stop) { partially evaluated: second_stop < first_stop no Evaluation Count:0 | yes Evaluation Count:12342 |
| 0-12342 |
3799 | qSwap(first_color, second_color); | - |
3800 | qSwap(first_stop, second_stop); | - |
3801 | } | 0 |
3802 | | - |
3803 | if (colorInterpolation) { evaluated: colorInterpolation yes Evaluation Count:12341 | yes Evaluation Count:1 |
| 1-12341 |
3804 | first_color = PREMUL(first_color); | - |
3805 | second_color = PREMUL(second_color); | - |
3806 | } executed: } Execution Count:12341 | 12341 |
3807 | | - |
3808 | int first_index = qRound(first_stop * (1024 -1)); | - |
3809 | int second_index = qRound(second_stop * (1024 -1)); | - |
3810 | | - |
3811 | uint red_first = qRed(first_color) << 16; | - |
3812 | uint green_first = qGreen(first_color) << 16; | - |
3813 | uint blue_first = qBlue(first_color) << 16; | - |
3814 | uint alpha_first = qAlpha(first_color) << 16; | - |
3815 | | - |
3816 | uint red_second = qRed(second_color) << 16; | - |
3817 | uint green_second = qGreen(second_color) << 16; | - |
3818 | uint blue_second = qBlue(second_color) << 16; | - |
3819 | uint alpha_second = qAlpha(second_color) << 16; | - |
3820 | | - |
3821 | int i = 0; | - |
3822 | for (; i <= qMin(1024, first_index); ++i) { evaluated: i <= qMin(1024, first_index) yes Evaluation Count:13989 | yes Evaluation Count:12342 |
| 12342-13989 |
3823 | if (colorInterpolation) evaluated: colorInterpolation yes Evaluation Count:13988 | yes Evaluation Count:1 |
| 1-13988 |
3824 | colorTable[i] = first_color; executed: colorTable[i] = first_color; Execution Count:13988 | 13988 |
3825 | else | - |
3826 | colorTable[i] = PREMUL(first_color); executed: colorTable[i] = PREMUL(first_color); Execution Count:1 | 1 |
3827 | } | - |
3828 | | - |
3829 | if (i < second_index) { partially evaluated: i < second_index yes Evaluation Count:12342 | no Evaluation Count:0 |
| 0-12342 |
3830 | qreal reciprocal = qreal(1) / (second_index - first_index); | - |
3831 | | - |
3832 | int red_delta = qRound(int(red_second - red_first) * reciprocal); | - |
3833 | int green_delta = qRound(int(green_second - green_first) * reciprocal); | - |
3834 | int blue_delta = qRound(int(blue_second - blue_first) * reciprocal); | - |
3835 | int alpha_delta = qRound(int(alpha_second - alpha_first) * reciprocal); | - |
3836 | | - |
3837 | | - |
3838 | red_first += 1 << 15; | - |
3839 | green_first += 1 << 15; | - |
3840 | blue_first += 1 << 15; | - |
3841 | alpha_first += 1 << 15; | - |
3842 | | - |
3843 | for (; i < qMin(1024, second_index); ++i) { evaluated: i < qMin(1024, second_index) yes Evaluation Count:12611161 | yes Evaluation Count:12342 |
| 12342-12611161 |
3844 | red_first += red_delta; | - |
3845 | green_first += green_delta; | - |
3846 | blue_first += blue_delta; | - |
3847 | alpha_first += alpha_delta; | - |
3848 | | - |
3849 | const uint color = ((alpha_first << 8) & 0xff000000) | (red_first & 0xff0000) | - |
3850 | | ((green_first >> 8) & 0xff00) | (blue_first >> 16); | - |
3851 | | - |
3852 | if (colorInterpolation) evaluated: colorInterpolation yes Evaluation Count:12610139 | yes Evaluation Count:1022 |
| 1022-12610139 |
3853 | colorTable[i] = color; executed: colorTable[i] = color; Execution Count:12610139 | 12610139 |
3854 | else | - |
3855 | colorTable[i] = PREMUL(color); executed: colorTable[i] = PREMUL(color); Execution Count:1022 | 1022 |
3856 | } | - |
3857 | } executed: } Execution Count:12342 | 12342 |
3858 | | - |
3859 | for (; i < 1024; ++i) { evaluated: i < 1024 yes Evaluation Count:13058 | yes Evaluation Count:12342 |
| 12342-13058 |
3860 | if (colorInterpolation) evaluated: colorInterpolation yes Evaluation Count:13057 | yes Evaluation Count:1 |
| 1-13057 |
3861 | colorTable[i] = second_color; executed: colorTable[i] = second_color; Execution Count:13057 | 13057 |
3862 | else | - |
3863 | colorTable[i] = PREMUL(second_color); executed: colorTable[i] = PREMUL(second_color); Execution Count:1 | 1 |
3864 | } | - |
3865 | | - |
3866 | return; executed: return; Execution Count:12342 | 12342 |
3867 | } | - |
3868 | | - |
3869 | uint current_color = ((((stops[0].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[0].second.rgba() & 0x00ffffff); | - |
3870 | if (stopCount == 1) { evaluated: stopCount == 1 yes Evaluation Count:1 | yes Evaluation Count:10 |
| 1-10 |
3871 | current_color = PREMUL(current_color); | - |
3872 | for (int i = 0; i < size; ++i) evaluated: i < size yes Evaluation Count:1024 | yes Evaluation Count:1 |
| 1-1024 |
3873 | colorTable[i] = current_color; executed: colorTable[i] = current_color; Execution Count:1024 | 1024 |
3874 | return; executed: return; Execution Count:1 | 1 |
3875 | } | - |
3876 | | - |
3877 | | - |
3878 | qreal begin_pos = stops[0].first; | - |
3879 | qreal end_pos = stops[stopCount-1].first; | - |
3880 | | - |
3881 | int pos = 0; | - |
3882 | uint next_color; | - |
3883 | | - |
3884 | qreal incr = 1 / qreal(size); | - |
3885 | qreal dpos = 1.5 * incr; | - |
3886 | | - |
3887 | | - |
3888 | colorTable[pos++] = PREMUL(current_color); | - |
3889 | while (dpos <= begin_pos) { partially evaluated: dpos <= begin_pos no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
3890 | colorTable[pos] = colorTable[pos - 1]; | - |
3891 | ++pos; | - |
3892 | dpos += incr; | - |
3893 | } | 0 |
3894 | | - |
3895 | int current_stop = 0; | - |
3896 | | - |
3897 | qreal t; | - |
3898 | qreal t_delta; | - |
3899 | | - |
3900 | if (dpos < end_pos) { partially evaluated: dpos < end_pos yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
3901 | | - |
3902 | while (dpos > stops[current_stop+1].first) partially evaluated: dpos > stops[current_stop+1].first no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
3903 | ++current_stop; never executed: ++current_stop; | 0 |
3904 | | - |
3905 | if (current_stop != 0) partially evaluated: current_stop != 0 no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
3906 | current_color = ((((stops[current_stop].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[current_stop].second.rgba() & 0x00ffffff); never executed: current_color = ((((stops[current_stop].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[current_stop].second.rgba() & 0x00ffffff); | 0 |
3907 | next_color = ((((stops[current_stop+1].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[current_stop+1].second.rgba() & 0x00ffffff); | - |
3908 | | - |
3909 | if (colorInterpolation) { partially evaluated: colorInterpolation yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
3910 | current_color = PREMUL(current_color); | - |
3911 | next_color = PREMUL(next_color); | - |
3912 | } executed: } Execution Count:10 | 10 |
3913 | | - |
3914 | qreal diff = stops[current_stop+1].first - stops[current_stop].first; | - |
3915 | qreal c = (diff == 0) ? qreal(0) : 256 / diff; partially evaluated: (diff == 0) no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
3916 | t = (dpos - stops[current_stop].first) * c; | - |
3917 | t_delta = incr * c; | - |
3918 | | - |
3919 | while (true) { partially evaluated: true yes Evaluation Count:10230 | no Evaluation Count:0 |
| 0-10230 |
3920 | qt_noop(); | - |
3921 | | - |
3922 | int dist = qRound(t); | - |
3923 | int idist = 256 - dist; | - |
3924 | | - |
3925 | if (colorInterpolation) partially evaluated: colorInterpolation yes Evaluation Count:10230 | no Evaluation Count:0 |
| 0-10230 |
3926 | colorTable[pos] = INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist); executed: colorTable[pos] = INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist); Execution Count:10230 | 10230 |
3927 | else | - |
3928 | colorTable[pos] = PREMUL(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)); never executed: colorTable[pos] = PREMUL(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)); | 0 |
3929 | | - |
3930 | ++pos; | - |
3931 | dpos += incr; | - |
3932 | | - |
3933 | if (dpos >= end_pos) evaluated: dpos >= end_pos yes Evaluation Count:10 | yes Evaluation Count:10220 |
| 10-10220 |
3934 | break; executed: break; Execution Count:10 | 10 |
3935 | | - |
3936 | t += t_delta; | - |
3937 | | - |
3938 | int skip = 0; | - |
3939 | while (dpos > stops[current_stop+skip+1].first) evaluated: dpos > stops[current_stop+skip+1].first yes Evaluation Count:18 | yes Evaluation Count:10220 |
| 18-10220 |
3940 | ++skip; executed: ++skip; Execution Count:18 | 18 |
3941 | | - |
3942 | if (skip != 0) { evaluated: skip != 0 yes Evaluation Count:18 | yes Evaluation Count:10202 |
| 18-10202 |
3943 | current_stop += skip; | - |
3944 | if (skip == 1) partially evaluated: skip == 1 yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
3945 | current_color = next_color; executed: current_color = next_color; Execution Count:18 | 18 |
3946 | else | - |
3947 | current_color = ((((stops[current_stop].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[current_stop].second.rgba() & 0x00ffffff); never executed: current_color = ((((stops[current_stop].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[current_stop].second.rgba() & 0x00ffffff); | 0 |
3948 | next_color = ((((stops[current_stop+1].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[current_stop+1].second.rgba() & 0x00ffffff); | - |
3949 | | - |
3950 | if (colorInterpolation) { partially evaluated: colorInterpolation yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
3951 | if (skip != 1) partially evaluated: skip != 1 no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
3952 | current_color = PREMUL(current_color); never executed: current_color = PREMUL(current_color); | 0 |
3953 | next_color = PREMUL(next_color); | - |
3954 | } executed: } Execution Count:18 | 18 |
3955 | | - |
3956 | qreal diff = stops[current_stop+1].first - stops[current_stop].first; | - |
3957 | qreal c = (diff == 0) ? qreal(0) : 256 / diff; partially evaluated: (diff == 0) no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
3958 | t = (dpos - stops[current_stop].first) * c; | - |
3959 | t_delta = incr * c; | - |
3960 | } executed: } Execution Count:18 | 18 |
3961 | } executed: } Execution Count:10220 | 10220 |
3962 | } executed: } Execution Count:10 | 10 |
3963 | | - |
3964 | | - |
3965 | current_color = PREMUL(((((stops[stopCount - 1].second.rgba() >> 24) * opacity) >> 8) << 24) | (stops[stopCount - 1].second.rgba() & 0x00ffffff)); | - |
3966 | while (pos < size - 1) { partially evaluated: pos < size - 1 no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
3967 | colorTable[pos] = current_color; | - |
3968 | ++pos; | - |
3969 | } | 0 |
3970 | | - |
3971 | | - |
3972 | colorTable[size - 1] = current_color; | - |
3973 | } executed: } Execution Count:10 | 10 |
3974 | | - |
3975 | static QGradientCache *qt_gradient_cache() { static QGlobalStatic<QGradientCache > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QGradientCache *x = new QGradientCache; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QGradientCache > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:7 | yes Evaluation Count:17200 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:7 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:17206 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-17206 |
3976 | | - |
3977 | | - |
3978 | void QSpanData::init(QRasterBuffer *rb, const QRasterPaintEngine *pe) | - |
3979 | { | - |
3980 | rasterBuffer = rb; | - |
3981 | type = None; | - |
3982 | txop = 0; | - |
3983 | bilinear = false; | - |
3984 | m11 = m22 = m33 = 1.; | - |
3985 | m12 = m13 = m21 = m23 = dx = dy = 0.0; | - |
3986 | clip = pe ? pe->d_func()->clip() : 0; partially evaluated: pe yes Evaluation Count:74317 | no Evaluation Count:0 |
| 0-74317 |
3987 | } executed: } Execution Count:74317 | 74317 |
3988 | | - |
3989 | __attribute__((visibility("default"))) extern QImage qt_imageForBrush(int brushStyle, bool invert); | - |
3990 | | - |
3991 | void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode) | - |
3992 | { | - |
3993 | Qt::BrushStyle brushStyle = qbrush_style(brush); | - |
3994 | switch (brushStyle) { | - |
3995 | case Qt::SolidPattern: { | - |
3996 | type = Solid; | - |
3997 | QColor c = qbrush_color(brush); | - |
3998 | QRgb rgba = c.rgba(); | - |
3999 | solid.color = PREMUL(((((rgba >> 24) * alpha) >> 8) << 24) | (rgba & 0x00ffffff)); | - |
4000 | if ((solid.color & 0xff000000) == 0 evaluated: (solid.color & 0xff000000) == 0 yes Evaluation Count:17 | yes Evaluation Count:289297 |
| 17-289297 |
4001 | && compositionMode == QPainter::CompositionMode_SourceOver) { partially evaluated: compositionMode == QPainter::CompositionMode_SourceOver yes Evaluation Count:17 | no Evaluation Count:0 |
| 0-17 |
4002 | type = None; | - |
4003 | } executed: } Execution Count:17 | 17 |
4004 | break; executed: break; Execution Count:289314 | 289314 |
4005 | } | - |
4006 | | - |
4007 | case Qt::LinearGradientPattern: | - |
4008 | { | - |
4009 | type = LinearGradient; | - |
4010 | const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient()); | - |
4011 | gradient.alphaColor = !brush.isOpaque() || alpha != 256; evaluated: !brush.isOpaque() yes Evaluation Count:4 | yes Evaluation Count:16702 |
partially evaluated: alpha != 256 no Evaluation Count:0 | yes Evaluation Count:16702 |
| 0-16702 |
4012 | gradient.colorTable = const_cast<uint*>(qt_gradient_cache()->getBuffer(*g, alpha)); | - |
4013 | gradient.spread = g->spread(); | - |
4014 | | - |
4015 | QLinearGradientData &linearData = gradient.linear; | - |
4016 | | - |
4017 | linearData.origin.x = g->start().x(); | - |
4018 | linearData.origin.y = g->start().y(); | - |
4019 | linearData.end.x = g->finalStop().x(); | - |
4020 | linearData.end.y = g->finalStop().y(); | - |
4021 | break; executed: break; Execution Count:16707 | 16707 |
4022 | } | - |
4023 | | - |
4024 | case Qt::RadialGradientPattern: | - |
4025 | { | - |
4026 | type = RadialGradient; | - |
4027 | const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient()); | - |
4028 | gradient.alphaColor = !brush.isOpaque() || alpha != 256; evaluated: !brush.isOpaque() yes Evaluation Count:502 | yes Evaluation Count:4 |
partially evaluated: alpha != 256 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-502 |
4029 | gradient.colorTable = const_cast<uint*>(qt_gradient_cache()->getBuffer(*g, alpha)); | - |
4030 | gradient.spread = g->spread(); | - |
4031 | | - |
4032 | QRadialGradientData &radialData = gradient.radial; | - |
4033 | | - |
4034 | QPointF center = g->center(); | - |
4035 | radialData.center.x = center.x(); | - |
4036 | radialData.center.y = center.y(); | - |
4037 | radialData.center.radius = g->centerRadius(); | - |
4038 | QPointF focal = g->focalPoint(); | - |
4039 | radialData.focal.x = focal.x(); | - |
4040 | radialData.focal.y = focal.y(); | - |
4041 | radialData.focal.radius = g->focalRadius(); | - |
4042 | } | - |
4043 | break; executed: break; Execution Count:506 | 506 |
4044 | | - |
4045 | case Qt::ConicalGradientPattern: | - |
4046 | { | - |
4047 | type = ConicalGradient; | - |
4048 | const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient()); | - |
4049 | gradient.alphaColor = !brush.isOpaque() || alpha != 256; never evaluated: !brush.isOpaque() never evaluated: alpha != 256 | 0 |
4050 | gradient.colorTable = const_cast<uint*>(qt_gradient_cache()->getBuffer(*g, alpha)); | - |
4051 | gradient.spread = QGradient::RepeatSpread; | - |
4052 | | - |
4053 | QConicalGradientData &conicalData = gradient.conical; | - |
4054 | | - |
4055 | QPointF center = g->center(); | - |
4056 | conicalData.center.x = center.x(); | - |
4057 | conicalData.center.y = center.y(); | - |
4058 | conicalData.angle = g->angle() * 2 * Q_PI / 360.0; | - |
4059 | } | - |
4060 | break; | 0 |
4061 | | - |
4062 | case Qt::Dense1Pattern: | - |
4063 | case Qt::Dense2Pattern: | - |
4064 | case Qt::Dense3Pattern: | - |
4065 | case Qt::Dense4Pattern: | - |
4066 | case Qt::Dense5Pattern: | - |
4067 | case Qt::Dense6Pattern: | - |
4068 | case Qt::Dense7Pattern: | - |
4069 | case Qt::HorPattern: | - |
4070 | case Qt::VerPattern: | - |
4071 | case Qt::CrossPattern: | - |
4072 | case Qt::BDiagPattern: | - |
4073 | case Qt::FDiagPattern: | - |
4074 | case Qt::DiagCrossPattern: | - |
4075 | type = Texture; | - |
4076 | if (!tempImage) evaluated: !tempImage yes Evaluation Count:5138 | yes Evaluation Count:4416 |
| 4416-5138 |
4077 | tempImage = new QImage(); executed: tempImage = new QImage(); Execution Count:5138 | 5138 |
4078 | *tempImage = rasterBuffer->colorizeBitmap(qt_imageForBrush(brushStyle, true), brush.color()); | - |
4079 | initTexture(tempImage, alpha, QTextureData::Tiled); | - |
4080 | break; executed: break; Execution Count:9554 | 9554 |
4081 | case Qt::TexturePattern: | - |
4082 | type = Texture; | - |
4083 | if (!tempImage) partially evaluated: !tempImage yes Evaluation Count:195 | no Evaluation Count:0 |
| 0-195 |
4084 | tempImage = new QImage(); executed: tempImage = new QImage(); Execution Count:195 | 195 |
4085 | | - |
4086 | if (qHasPixmapTexture(brush) && brush.texture().isQBitmap()) evaluated: qHasPixmapTexture(brush) yes Evaluation Count:1 | yes Evaluation Count:194 |
partially evaluated: brush.texture().isQBitmap() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-194 |
4087 | *tempImage = rasterBuffer->colorizeBitmap(brush.textureImage(), brush.color()); never executed: *tempImage = rasterBuffer->colorizeBitmap(brush.textureImage(), brush.color()); | 0 |
4088 | else | - |
4089 | *tempImage = brush.textureImage(); executed: *tempImage = brush.textureImage(); Execution Count:195 | 195 |
4090 | initTexture(tempImage, alpha, QTextureData::Tiled, tempImage->rect()); | - |
4091 | break; executed: break; Execution Count:195 | 195 |
4092 | | - |
4093 | case Qt::NoBrush: | - |
4094 | default: | - |
4095 | type = None; | - |
4096 | break; executed: break; Execution Count:32025 | 32025 |
4097 | } | - |
4098 | adjustSpanMethods(); | - |
4099 | } executed: } Execution Count:348299 | 348299 |
4100 | | - |
4101 | void QSpanData::adjustSpanMethods() | - |
4102 | { | - |
4103 | bitmapBlit = 0; | - |
4104 | alphamapBlit = 0; | - |
4105 | alphaRGBBlit = 0; | - |
4106 | | - |
4107 | fillRect = 0; | - |
4108 | | - |
4109 | switch(type) { | - |
4110 | case None: | - |
4111 | unclipped_blend = 0; | - |
4112 | break; executed: break; Execution Count:32042 | 32042 |
4113 | case Solid: | - |
4114 | unclipped_blend = rasterBuffer->drawHelper->blendColor; | - |
4115 | bitmapBlit = rasterBuffer->drawHelper->bitmapBlit; | - |
4116 | alphamapBlit = rasterBuffer->drawHelper->alphamapBlit; | - |
4117 | alphaRGBBlit = rasterBuffer->drawHelper->alphaRGBBlit; | - |
4118 | fillRect = rasterBuffer->drawHelper->fillRect; | - |
4119 | break; executed: break; Execution Count:317373 | 317373 |
4120 | case LinearGradient: | - |
4121 | case RadialGradient: | - |
4122 | case ConicalGradient: | - |
4123 | unclipped_blend = rasterBuffer->drawHelper->blendGradient; | - |
4124 | break; executed: break; Execution Count:34406 | 34406 |
4125 | case Texture: | - |
4126 | unclipped_blend = qBlendTexture; | - |
4127 | if (!texture.imageData) partially evaluated: !texture.imageData no Evaluation Count:0 | yes Evaluation Count:30557 |
| 0-30557 |
4128 | unclipped_blend = 0; never executed: unclipped_blend = 0; | 0 |
4129 | | - |
4130 | break; executed: break; Execution Count:30557 | 30557 |
4131 | } | - |
4132 | | - |
4133 | if (!unclipped_blend) { evaluated: !unclipped_blend yes Evaluation Count:32042 | yes Evaluation Count:382338 |
| 32042-382338 |
4134 | blend = 0; | - |
4135 | } else if (!clip) { executed: } Execution Count:32042 partially evaluated: !clip no Evaluation Count:0 | yes Evaluation Count:382339 |
| 0-382339 |
4136 | blend = unclipped_blend; | - |
4137 | } else if (clip->hasRectClip) { evaluated: clip->hasRectClip yes Evaluation Count:362063 | yes Evaluation Count:20277 |
| 0-362063 |
4138 | blend = clip->clipRect.isEmpty() ? 0 : qt_span_fill_clipRect; evaluated: clip->clipRect.isEmpty() yes Evaluation Count:9 | yes Evaluation Count:362055 |
| 9-362055 |
4139 | } else { executed: } Execution Count:362053 | 362053 |
4140 | blend = qt_span_fill_clipped; | - |
4141 | } executed: } Execution Count:20277 | 20277 |
4142 | } | - |
4143 | | - |
4144 | void QSpanData::setupMatrix(const QTransform &matrix, int bilin) | - |
4145 | { | - |
4146 | QTransform delta; | - |
4147 | | - |
4148 | delta.translate(1.0 / 65536, 1.0 / 65536); | - |
4149 | | - |
4150 | QTransform inv = (delta * matrix).inverted(); | - |
4151 | m11 = inv.m11(); | - |
4152 | m12 = inv.m12(); | - |
4153 | m13 = inv.m13(); | - |
4154 | m21 = inv.m21(); | - |
4155 | m22 = inv.m22(); | - |
4156 | m23 = inv.m23(); | - |
4157 | m33 = inv.m33(); | - |
4158 | dx = inv.dx(); | - |
4159 | dy = inv.dy(); | - |
4160 | txop = inv.type(); | - |
4161 | bilinear = bilin; | - |
4162 | | - |
4163 | const bool affine = inv.isAffine(); | - |
4164 | fast_matrix = affine evaluated: affine yes Evaluation Count:27 | yes Evaluation Count:4 |
| 4-27 |
4165 | && m11 * m11 + m21 * m21 < 1e4 evaluated: m11 * m11 + m21 * m21 < 1e4 yes Evaluation Count:25 | yes Evaluation Count:2 |
| 2-25 |
4166 | && m12 * m12 + m22 * m22 < 1e4 partially evaluated: m12 * m12 + m22 * m22 < 1e4 yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-25 |
4167 | && qAbs(dx) < 1e4 evaluated: qAbs(dx) < 1e4 yes Evaluation Count:23 | yes Evaluation Count:2 |
| 2-23 |
4168 | && qAbs(dy) < 1e4; partially evaluated: qAbs(dy) < 1e4 yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-23 |
4169 | | - |
4170 | adjustSpanMethods(); | - |
4171 | } executed: } Execution Count:31 | 31 |
4172 | | - |
4173 | void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _type, const QRect &sourceRect) | - |
4174 | { | - |
4175 | const QImageData *d = const_cast<QImage *>(image)->data_ptr(); | - |
4176 | if (!d || d->height == 0) { partially evaluated: !d no Evaluation Count:0 | yes Evaluation Count:11035 |
partially evaluated: d->height == 0 no Evaluation Count:0 | yes Evaluation Count:11035 |
| 0-11035 |
4177 | texture.imageData = 0; | - |
4178 | texture.width = 0; | - |
4179 | texture.height = 0; | - |
4180 | texture.x1 = 0; | - |
4181 | texture.y1 = 0; | - |
4182 | texture.x2 = 0; | - |
4183 | texture.y2 = 0; | - |
4184 | texture.bytesPerLine = 0; | - |
4185 | texture.format = QImage::Format_Invalid; | - |
4186 | texture.colorTable = 0; | - |
4187 | texture.hasAlpha = alpha != 256; | - |
4188 | } else { | 0 |
4189 | texture.imageData = d->data; | - |
4190 | texture.width = d->width; | - |
4191 | texture.height = d->height; | - |
4192 | | - |
4193 | if (sourceRect.isNull()) { evaluated: sourceRect.isNull() yes Evaluation Count:9563 | yes Evaluation Count:1472 |
| 1472-9563 |
4194 | texture.x1 = 0; | - |
4195 | texture.y1 = 0; | - |
4196 | texture.x2 = texture.width; | - |
4197 | texture.y2 = texture.height; | - |
4198 | } else { executed: } Execution Count:9563 | 9563 |
4199 | texture.x1 = sourceRect.x(); | - |
4200 | texture.y1 = sourceRect.y(); | - |
4201 | texture.x2 = qMin(texture.x1 + sourceRect.width(), d->width); | - |
4202 | texture.y2 = qMin(texture.y1 + sourceRect.height(), d->height); | - |
4203 | } executed: } Execution Count:1472 | 1472 |
4204 | | - |
4205 | texture.bytesPerLine = d->bytes_per_line; | - |
4206 | | - |
4207 | texture.format = d->format; | - |
4208 | texture.colorTable = (d->format <= QImage::Format_Indexed8 && !d->colortable.isEmpty()) ? &d->colortable : 0; evaluated: d->format <= QImage::Format_Indexed8 yes Evaluation Count:181 | yes Evaluation Count:10854 |
partially evaluated: !d->colortable.isEmpty() yes Evaluation Count:181 | no Evaluation Count:0 |
| 0-10854 |
4209 | texture.hasAlpha = image->hasAlphaChannel() || alpha != 256; evaluated: image->hasAlphaChannel() yes Evaluation Count:10242 | yes Evaluation Count:793 |
evaluated: alpha != 256 yes Evaluation Count:248 | yes Evaluation Count:545 |
| 248-10242 |
4210 | } executed: } Execution Count:11035 | 11035 |
4211 | texture.const_alpha = alpha; | - |
4212 | texture.type = _type; | - |
4213 | | - |
4214 | adjustSpanMethods(); | - |
4215 | } executed: } Execution Count:11035 | 11035 |
4216 | | - |
4217 | | - |
4218 | | - |
4219 | | - |
4220 | | - |
4221 | static inline void drawEllipsePoints(int x, int y, int length, | - |
4222 | const QRect &rect, | - |
4223 | const QRect &clip, | - |
4224 | ProcessSpans pen_func, ProcessSpans brush_func, | - |
4225 | QSpanData *pen_data, QSpanData *brush_data) | - |
4226 | { | - |
4227 | if (length == 0) partially evaluated: length == 0 no Evaluation Count:0 | yes Evaluation Count:44167 |
| 0-44167 |
4228 | return; | 0 |
4229 | | - |
4230 | QT_FT_Span outline[4]; | - |
4231 | const int midx = rect.x() + (rect.width() + 1) / 2; | - |
4232 | const int midy = rect.y() + (rect.height() + 1) / 2; | - |
4233 | | - |
4234 | x = x + midx; | - |
4235 | y = midy - y; | - |
4236 | | - |
4237 | | - |
4238 | outline[0].x = midx + (midx - x) - (length - 1) - (rect.width() & 0x1); | - |
4239 | outline[0].len = qMin(length, x - outline[0].x); | - |
4240 | outline[0].y = y; | - |
4241 | outline[0].coverage = 255; | - |
4242 | | - |
4243 | | - |
4244 | outline[1].x = x; | - |
4245 | outline[1].len = length; | - |
4246 | outline[1].y = y; | - |
4247 | outline[1].coverage = 255; | - |
4248 | | - |
4249 | | - |
4250 | outline[2].x = outline[0].x; | - |
4251 | outline[2].len = outline[0].len; | - |
4252 | outline[2].y = midy + (midy - y) - (rect.height() & 0x1); | - |
4253 | outline[2].coverage = 255; | - |
4254 | | - |
4255 | | - |
4256 | outline[3].x = x; | - |
4257 | outline[3].len = length; | - |
4258 | outline[3].y = outline[2].y; | - |
4259 | outline[3].coverage = 255; | - |
4260 | | - |
4261 | if (brush_func && outline[0].x + outline[0].len < outline[1].x) { evaluated: brush_func yes Evaluation Count:13803 | yes Evaluation Count:30364 |
evaluated: outline[0].x + outline[0].len < outline[1].x yes Evaluation Count:13482 | yes Evaluation Count:321 |
| 321-30364 |
4262 | QT_FT_Span fill[2]; | - |
4263 | | - |
4264 | | - |
4265 | fill[0].x = outline[0].x + outline[0].len - 1; | - |
4266 | fill[0].len = qMax(0, outline[1].x - fill[0].x); | - |
4267 | fill[0].y = outline[1].y; | - |
4268 | fill[0].coverage = 255; | - |
4269 | | - |
4270 | | - |
4271 | fill[1].x = outline[2].x + outline[2].len - 1; | - |
4272 | fill[1].len = qMax(0, outline[3].x - fill[1].x); | - |
4273 | fill[1].y = outline[3].y; | - |
4274 | fill[1].coverage = 255; | - |
4275 | | - |
4276 | int n = (fill[0].y >= fill[1].y ? 1 : 2); evaluated: fill[0].y >= fill[1].y yes Evaluation Count:222 | yes Evaluation Count:13260 |
| 222-13260 |
4277 | n = qt_intersect_spans(fill, n, clip); | - |
4278 | if (n > 0) evaluated: n > 0 yes Evaluation Count:9232 | yes Evaluation Count:4250 |
| 4250-9232 |
4279 | brush_func(n, fill, brush_data); executed: brush_func(n, fill, brush_data); Execution Count:9232 | 9232 |
4280 | } executed: } Execution Count:13482 | 13482 |
4281 | if (pen_func) { evaluated: pen_func yes Evaluation Count:40648 | yes Evaluation Count:3519 |
| 3519-40648 |
4282 | int n = (outline[1].y >= outline[2].y ? 2 : 4); evaluated: outline[1].y >= outline[2].y yes Evaluation Count:624 | yes Evaluation Count:40024 |
| 624-40024 |
4283 | n = qt_intersect_spans(outline, n, clip); | - |
4284 | if (n > 0) evaluated: n > 0 yes Evaluation Count:35673 | yes Evaluation Count:4975 |
| 4975-35673 |
4285 | pen_func(n, outline, pen_data); executed: pen_func(n, outline, pen_data); Execution Count:35673 | 35673 |
4286 | } executed: } Execution Count:40648 | 40648 |
4287 | } executed: } Execution Count:44167 | 44167 |
4288 | | - |
4289 | | - |
4290 | | - |
4291 | | - |
4292 | | - |
4293 | static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, | - |
4294 | ProcessSpans pen_func, ProcessSpans brush_func, | - |
4295 | QSpanData *pen_data, QSpanData *brush_data) | - |
4296 | { | - |
4297 | const qreal a = qreal(rect.width()) / 2; | - |
4298 | const qreal b = qreal(rect.height()) / 2; | - |
4299 | qreal d = b*b - (a*a*b) + 0.25*a*a; | - |
4300 | | - |
4301 | int x = 0; | - |
4302 | int y = (rect.height() + 1) / 2; | - |
4303 | int startx = x; | - |
4304 | | - |
4305 | | - |
4306 | while (a*a*(2*y - 1) > 2*b*b*(x + 1)) { evaluated: a*a*(2*y - 1) > 2*b*b*(x + 1) yes Evaluation Count:32525 | yes Evaluation Count:1155 |
| 1155-32525 |
4307 | if (d < 0) { evaluated: d < 0 yes Evaluation Count:20026 | yes Evaluation Count:12499 |
| 12499-20026 |
4308 | d += b*b*(2*x + 3); | - |
4309 | ++x; | - |
4310 | } else { executed: } Execution Count:20026 | 20026 |
4311 | d += b*b*(2*x + 3) + a*a*(-2*y + 2); | - |
4312 | drawEllipsePoints(startx, y, x - startx + 1, rect, clip, | - |
4313 | pen_func, brush_func, pen_data, brush_data); | - |
4314 | startx = ++x; | - |
4315 | --y; | - |
4316 | } executed: } Execution Count:12499 | 12499 |
4317 | } | - |
4318 | drawEllipsePoints(startx, y, x - startx + 1, rect, clip, | - |
4319 | pen_func, brush_func, pen_data, brush_data); | - |
4320 | | - |
4321 | | - |
4322 | d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b); | - |
4323 | const int miny = rect.height() & 0x1; | - |
4324 | while (y > miny) { evaluated: y > miny yes Evaluation Count:30513 | yes Evaluation Count:1155 |
| 1155-30513 |
4325 | if (d < 0) { evaluated: d < 0 yes Evaluation Count:12095 | yes Evaluation Count:18418 |
| 12095-18418 |
4326 | d += b*b*(2*x + 2) + a*a*(-2*y + 3); | - |
4327 | ++x; | - |
4328 | } else { executed: } Execution Count:12095 | 12095 |
4329 | d += a*a*(-2*y + 3); | - |
4330 | } executed: } Execution Count:18418 | 18418 |
4331 | --y; | - |
4332 | drawEllipsePoints(x, y, 1, rect, clip, | - |
4333 | pen_func, brush_func, pen_data, brush_data); | - |
4334 | } executed: } Execution Count:30513 | 30513 |
4335 | } executed: } Execution Count:1155 | 1155 |
4336 | | - |
4337 | | - |
| | |