painting/qrasterizer.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6typedef int Q16Dot16; -
7static inline QT_FT_Vector PointToVector(const QPointF &p) -
8{ -
9 QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) }; -
10 return result;
executed: return result;
Execution Count:6
6
11} -
12 -
13class QSpanBuffer { -
14public: -
15 QSpanBuffer(ProcessSpans blend, void *data, const QRect &clipRect) -
16 : m_spanCount(0) -
17 , m_blend(blend) -
18 , m_data(data) -
19 , m_clipRect(clipRect) -
20 { -
21 }
executed: }
Execution Count:121588
121588
22 -
23 ~QSpanBuffer() -
24 { -
25 flushSpans(); -
26 }
executed: }
Execution Count:121588
121588
27 -
28 void addSpan(int x, unsigned int len, int y, unsigned char coverage) -
29 { -
30 if (!coverage || !len)
evaluated: !coverage
TRUEFALSE
yes
Evaluation Count:646
yes
Evaluation Count:3775787
evaluated: !len
TRUEFALSE
yes
Evaluation Count:666465
yes
Evaluation Count:3109322
646-3775787
31 return;
executed: return;
Execution Count:667111
667111
32 -
33 qt_noop(); -
34 qt_noop(); -
35 qt_noop(); -
36 qt_noop(); -
37 -
38 m_spans[m_spanCount].x = x; -
39 m_spans[m_spanCount].len = len; -
40 m_spans[m_spanCount].y = y; -
41 m_spans[m_spanCount].coverage = coverage; -
42 -
43 if (++m_spanCount == 256)
evaluated: ++m_spanCount == 256
TRUEFALSE
yes
Evaluation Count:881
yes
Evaluation Count:3108441
881-3108441
44 flushSpans();
executed: flushSpans();
Execution Count:881
881
45 }
executed: }
Execution Count:3109322
3109322
46 -
47private: -
48 void flushSpans() -
49 { -
50 m_blend(m_spanCount, m_spans, m_data); -
51 m_spanCount = 0; -
52 }
executed: }
Execution Count:122469
122469
53 -
54 QT_FT_Span m_spans[256]; -
55 int m_spanCount; -
56 -
57 ProcessSpans m_blend; -
58 void *m_data; -
59 -
60 QRect m_clipRect; -
61}; -
62 -
63 -
64class QScanConverter -
65{ -
66public: -
67 QScanConverter(); -
68 ~QScanConverter(); -
69 -
70 void begin(int top, int bottom, int left, int right, -
71 Qt::FillRule fillRule, bool legacyRounding, QSpanBuffer *spanBuffer); -
72 void end(); -
73 -
74 void mergeCurve(const QT_FT_Vector &a, const QT_FT_Vector &b, -
75 const QT_FT_Vector &c, const QT_FT_Vector &d); -
76 void mergeLine(QT_FT_Vector a, QT_FT_Vector b); -
77 -
78 struct Line -
79 { -
80 Q16Dot16 x; -
81 Q16Dot16 delta; -
82 -
83 int top, bottom; -
84 -
85 int winding; -
86 }; -
87 -
88private: -
89 struct Intersection -
90 { -
91 int x; -
92 int winding; -
93 -
94 int left, right; -
95 }; -
96 -
97 inline bool clip(Q16Dot16 &xFP, int &iTop, int &iBottom, Q16Dot16 slopeFP, Q16Dot16 edgeFP, int winding); -
98 inline void mergeIntersection(Intersection *head, const Intersection &isect); -
99 -
100 void prepareChunk(); -
101 -
102 void emitNode(const Intersection *node); -
103 void emitSpans(int chunk); -
104 -
105 inline void allocate(int size); -
106 -
107 QDataBuffer<Line> m_lines; -
108 -
109 int m_alloc; -
110 int m_size; -
111 -
112 int m_top; -
113 int m_bottom; -
114 -
115 Q16Dot16 m_leftFP; -
116 Q16Dot16 m_rightFP; -
117 -
118 int m_fillRuleMask; -
119 bool m_legacyRounding; -
120 -
121 int m_x; -
122 int m_y; -
123 int m_winding; -
124 -
125 Intersection *m_intersections; -
126 -
127 QSpanBuffer *m_spanBuffer; -
128 -
129 QDataBuffer<Line *> m_active; -
130 -
131 template <typename T> -
132 friend void qScanConvert(QScanConverter &d, T allVertical); -
133}; -
134 -
135class QRasterizerPrivate -
136{ -
137public: -
138 bool antialiased; -
139 bool legacyRounding; -
140 ProcessSpans blend; -
141 void *data; -
142 QRect clipRect; -
143 -
144 QScanConverter scanConverter; -
145}; -
146 -
147QScanConverter::QScanConverter() -
148 : m_lines(0) -
149 , m_alloc(0) -
150 , m_size(0) -
151 , m_intersections(0) -
152 , m_active(0) -
153{ -
154}
executed: }
Execution Count:5615
5615
155 -
156QScanConverter::~QScanConverter() -
157{ -
158 if (m_intersections)
evaluated: m_intersections
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:5587
17-5587
159 free(m_intersections);
executed: free(m_intersections);
Execution Count:17
17
160}
executed: }
Execution Count:5604
5604
161 -
162void QScanConverter::begin(int top, int bottom, int left, int right, -
163 Qt::FillRule fillRule, bool legacyRounding, -
164 QSpanBuffer *spanBuffer) -
165{ -
166 m_top = top; -
167 m_bottom = bottom; -
168 m_leftFP = ((left) << 16); -
169 m_rightFP = ((right + 1) << 16); -
170 -
171 m_lines.reset(); -
172 -
173 m_fillRuleMask = fillRule == Qt::WindingFill ? ~0x0 : 0x1;
evaluated: fillRule == Qt::WindingFill
TRUEFALSE
yes
Evaluation Count:907
yes
Evaluation Count:119365
907-119365
174 m_legacyRounding = legacyRounding; -
175 m_spanBuffer = spanBuffer; -
176}
executed: }
Execution Count:120272
120272
177 -
178void QScanConverter::prepareChunk() -
179{ -
180 m_size = 64; -
181 -
182 allocate(64); -
183 memset(m_intersections, 0, 64 * sizeof(Intersection)); -
184}
executed: }
Execution Count:1369
1369
185 -
186void QScanConverter::emitNode(const Intersection *node) -
187{ -
188tail_call: -
189 if (node->left)
evaluated: node->left
TRUEFALSE
yes
Evaluation Count:78279
yes
Evaluation Count:205683
78279-205683
190 emitNode(node + node->left);
executed: emitNode(node + node->left);
Execution Count:78279
78279
191 -
192 if (m_winding & m_fillRuleMask)
evaluated: m_winding & m_fillRuleMask
TRUEFALSE
yes
Evaluation Count:97316
yes
Evaluation Count:186646
97316-186646
193 m_spanBuffer->addSpan(m_x, node->x - m_x, m_y, 0xff);
executed: m_spanBuffer->addSpan(m_x, node->x - m_x, m_y, 0xff);
Execution Count:97316
97316
194 -
195 m_x = node->x; -
196 m_winding += node->winding; -
197 -
198 if (node->right) {
evaluated: node->right
TRUEFALSE
yes
Evaluation Count:118067
yes
Evaluation Count:165895
118067-165895
199 node += node->right; -
200 goto tail_call;
executed: goto tail_call;
Execution Count:118067
118067
201 } -
202}
executed: }
Execution Count:165895
165895
203 -
204void QScanConverter::emitSpans(int chunk) -
205{ -
206 for (int dy = 0; dy < 64; ++dy) {
evaluated: dy < 64
TRUEFALSE
yes
Evaluation Count:87616
yes
Evaluation Count:1369
1369-87616
207 m_x = 0; -
208 m_y = chunk + dy; -
209 m_winding = 0; -
210 -
211 emitNode(&m_intersections[dy]); -
212 }
executed: }
Execution Count:87616
87616
213}
executed: }
Execution Count:1369
1369
214 -
215 -
216 -
217static void split(QT_FT_Vector *b) -
218{ -
219 b[6] = b[3]; -
220 -
221 { -
222 const QT_FT_Pos temp = (b[1].x + b[2].x)/2; -
223 -
224 b[1].x = (b[0].x + b[1].x)/2; -
225 b[5].x = (b[2].x + b[3].x)/2; -
226 b[2].x = (b[1].x + temp)/2; -
227 b[4].x = (b[5].x + temp)/2; -
228 b[3].x = (b[2].x + b[4].x)/2; -
229 } -
230 { -
231 const QT_FT_Pos temp = (b[1].y + b[2].y)/2; -
232 -
233 b[1].y = (b[0].y + b[1].y)/2; -
234 b[5].y = (b[2].y + b[3].y)/2; -
235 b[2].y = (b[1].y + temp)/2; -
236 b[4].y = (b[5].y + temp)/2; -
237 b[3].y = (b[2].y + b[4].y)/2; -
238 } -
239}
never executed: }
0
240 -
241static inline bool topOrder(const QScanConverter::Line &a, const QScanConverter::Line &b) -
242{ -
243 return a.top < b.top;
executed: return a.top < b.top;
Execution Count:1895804
1895804
244} -
245 -
246static inline bool xOrder(const QScanConverter::Line *a, const QScanConverter::Line *b) -
247{ -
248 return a->x < b->x;
executed: return a->x < b->x;
Execution Count:3519283
3519283
249} -
250 -
251template <bool B> -
252struct QBoolToType -
253{ -
254 inline bool operator()() const -
255 { -
256 return B;
executed: return B;
Execution Count:10398045
10398045
257 } -
258}; -
259 -
260 -
261template <typename T> -
262void qScanConvert(QScanConverter &d, T allVertical) -
263{ -
264 if (!d.m_lines.size()) {
partially evaluated: !d.m_lines.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:119241
0-119241
265 d.m_active.reset(); -
266 return;
never executed: return;
0
267 } -
268 qSort(d.m_lines.data(), d.m_lines.data() + d.m_lines.size(), ::topOrder); -
269 int line = 0; -
270 for (int y = d.m_lines.first().top; y <= d.m_bottom; ++y) {
evaluated: y <= d.m_bottom
TRUEFALSE
yes
Evaluation Count:3454699
yes
Evaluation Count:119241
119241-3454699
271 for (; line < d.m_lines.size() && d.m_lines.at(line).top == y; ++line) {
evaluated: line < d.m_lines.size()
TRUEFALSE
yes
Evaluation Count:3512233
yes
Evaluation Count:694944
evaluated: d.m_lines.at(line).top == y
TRUEFALSE
yes
Evaluation Count:752478
yes
Evaluation Count:2759755
694944-3512233
272 -
273 if (allVertical()) {
evaluated: allVertical()
TRUEFALSE
yes
Evaluation Count:83145
yes
Evaluation Count:669333
83145-669333
274 QScanConverter::Line *l = &d.m_lines.at(line); -
275 d.m_active.resize(d.m_active.size() + 1); -
276 int j; -
277 for (j = d.m_active.size() - 2; j >= 0 && ::xOrder(l, d.m_active.at(j)); --j)
evaluated: j >= 0
TRUEFALSE
yes
Evaluation Count:91165
yes
Evaluation Count:57916
evaluated: ::xOrder(l, d.m_active.at(j))
TRUEFALSE
yes
Evaluation Count:65936
yes
Evaluation Count:25229
25229-91165
278 d.m_active.at(j+1) = d.m_active.at(j);
executed: d.m_active.at(j+1) = d.m_active.at(j);
Execution Count:65936
65936
279 d.m_active.at(j+1) = l; -
280 } else {
executed: }
Execution Count:83145
83145
281 d.m_active << &d.m_lines.at(line); -
282 }
executed: }
Execution Count:669333
669333
283 } -
284 -
285 int numActive = d.m_active.size(); -
286 if (!allVertical()) {
evaluated: !allVertical()
TRUEFALSE
yes
Evaluation Count:3415434
yes
Evaluation Count:39265
39265-3415434
287 -
288 -
289 for (int i = 1; i < numActive; ++i) {
evaluated: i < numActive
TRUEFALSE
yes
Evaluation Count:3426668
yes
Evaluation Count:3415434
3415434-3426668
290 QScanConverter::Line *l = d.m_active.at(i); -
291 int j; -
292 for (j = i-1; j >= 0 && ::xOrder(l, d.m_active.at(j)); --j)
evaluated: j >= 0
TRUEFALSE
yes
Evaluation Count:3428118
yes
Evaluation Count:232080
evaluated: ::xOrder(l, d.m_active.at(j))
TRUEFALSE
yes
Evaluation Count:233530
yes
Evaluation Count:3194588
232080-3428118
293 d.m_active.at(j+1) = d.m_active.at(j);
executed: d.m_active.at(j+1) = d.m_active.at(j);
Execution Count:233530
233530
294 d.m_active.at(j+1) = l; -
295 }
executed: }
Execution Count:3426668
3426668
296 }
executed: }
Execution Count:3415434
3415434
297 -
298 int x = 0; -
299 int winding = 0; -
300 for (int i = 0; i < numActive; ++i) {
evaluated: i < numActive
TRUEFALSE
yes
Evaluation Count:6943346
yes
Evaluation Count:3454699
3454699-6943346
301 QScanConverter::Line *node = d.m_active.at(i); -
302 -
303 const int current = ((node->x) >> 16); -
304 if (winding & d.m_fillRuleMask)
evaluated: winding & d.m_fillRuleMask
TRUEFALSE
yes
Evaluation Count:3473534
yes
Evaluation Count:3469812
3469812-3473534
305 d.m_spanBuffer->addSpan(x, current - x, y, 0xff);
executed: d.m_spanBuffer->addSpan(x, current - x, y, 0xff);
Execution Count:3473534
3473534
306 -
307 x = current; -
308 winding += node->winding; -
309 -
310 if (node->bottom == y) {
evaluated: node->bottom == y
TRUEFALSE
yes
Evaluation Count:752478
yes
Evaluation Count:6190868
752478-6190868
311 -
312 for (int j = i; j < numActive - 1; ++j)
evaluated: j < numActive - 1
TRUEFALSE
yes
Evaluation Count:451785
yes
Evaluation Count:752478
451785-752478
313 d.m_active.at(j) = d.m_active.at(j+1);
executed: d.m_active.at(j) = d.m_active.at(j+1);
Execution Count:451785
451785
314 -
315 d.m_active.resize(--numActive); -
316 --i; -
317 } else if (!allVertical())
evaluated: !allVertical()
TRUEFALSE
yes
Evaluation Count:6172755
yes
Evaluation Count:18113
executed: }
Execution Count:752478
18113-6172755
318 node->x += node->delta;
executed: node->x += node->delta;
Execution Count:6172755
6172755
319 } -
320 }
executed: }
Execution Count:3454699
3454699
321 d.m_active.reset(); -
322}
executed: }
Execution Count:119241
119241
323 -
324void QScanConverter::end() -
325{ -
326 if (m_lines.isEmpty())
partially evaluated: m_lines.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120272
0-120272
327 return;
never executed: return;
0
328 -
329 if (m_lines.size() <= 32) {
evaluated: m_lines.size() <= 32
TRUEFALSE
yes
Evaluation Count:119241
yes
Evaluation Count:1031
1031-119241
330 bool allVertical = true; -
331 for (int i = 0; i < m_lines.size(); ++i) {
evaluated: i < m_lines.size()
TRUEFALSE
yes
Evaluation Count:288930
yes
Evaluation Count:16744
16744-288930
332 if (m_lines.at(i).delta) {
evaluated: m_lines.at(i).delta
TRUEFALSE
yes
Evaluation Count:102497
yes
Evaluation Count:186433
102497-186433
333 allVertical = false; -
334 break;
executed: break;
Execution Count:102497
102497
335 } -
336 }
executed: }
Execution Count:186433
186433
337 if (allVertical)
evaluated: allVertical
TRUEFALSE
yes
Evaluation Count:16744
yes
Evaluation Count:102497
16744-102497
338 qScanConvert(*this, QBoolToType<true>());
executed: qScanConvert(*this, QBoolToType<true>());
Execution Count:16744
16744
339 else -
340 qScanConvert(*this, QBoolToType<false>());
executed: qScanConvert(*this, QBoolToType<false>());
Execution Count:102497
102497
341 } else { -
342 for (int chunkTop = m_top; chunkTop <= m_bottom; chunkTop += 64) {
evaluated: chunkTop <= m_bottom
TRUEFALSE
yes
Evaluation Count:1369
yes
Evaluation Count:1031
1031-1369
343 prepareChunk(); -
344 -
345 Intersection isect = { 0, 0, 0, 0 }; -
346 -
347 const int chunkBottom = chunkTop + 64; -
348 for (int i = 0; i < m_lines.size(); ++i) {
evaluated: i < m_lines.size()
TRUEFALSE
yes
Evaluation Count:174964
yes
Evaluation Count:1369
1369-174964
349 Line &line = m_lines.at(i); -
350 -
351 if ((line.bottom < chunkTop) || (line.top > chunkBottom))
evaluated: (line.bottom < chunkTop)
TRUEFALSE
yes
Evaluation Count:50224
yes
Evaluation Count:124740
evaluated: (line.top > chunkBottom)
TRUEFALSE
yes
Evaluation Count:21160
yes
Evaluation Count:103580
21160-124740
352 continue;
executed: continue;
Execution Count:71384
71384
353 -
354 const int top = qMax(0, line.top - chunkTop); -
355 const int bottom = qMin(64, line.bottom + 1 - chunkTop); -
356 allocate(m_size + bottom - top); -
357 -
358 isect.winding = line.winding; -
359 -
360 Intersection *it = m_intersections + top; -
361 Intersection *end = m_intersections + bottom; -
362 -
363 if (line.delta) {
evaluated: line.delta
TRUEFALSE
yes
Evaluation Count:52502
yes
Evaluation Count:51078
51078-52502
364 for (; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:176656
yes
Evaluation Count:52502
52502-176656
365 isect.x = ((line.x) >> 16); -
366 line.x += line.delta; -
367 mergeIntersection(it, isect); -
368 }
executed: }
Execution Count:176656
176656
369 } else {
executed: }
Execution Count:52502
52502
370 isect.x = ((line.x) >> 16); -
371 for (; it != end; ++it)
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:91454
yes
Evaluation Count:51078
51078-91454
372 mergeIntersection(it, isect);
executed: mergeIntersection(it, isect);
Execution Count:91454
91454
373 }
executed: }
Execution Count:51078
51078
374 } -
375 -
376 emitSpans(chunkTop); -
377 }
executed: }
Execution Count:1369
1369
378 }
executed: }
Execution Count:1031
1031
379 -
380 if (m_alloc > 1024) {
evaluated: m_alloc > 1024
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:120265
7-120265
381 free(m_intersections); -
382 m_alloc = 0; -
383 m_size = 0; -
384 m_intersections = 0; -
385 }
executed: }
Execution Count:7
7
386 -
387 if (m_lines.size() > 1024)
evaluated: m_lines.size() > 1024
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:120269
3-120269
388 m_lines.shrink(1024);
executed: m_lines.shrink(1024);
Execution Count:3
3
389}
executed: }
Execution Count:120272
120272
390 -
391inline void QScanConverter::allocate(int size) -
392{ -
393 if (m_alloc < size) {
evaluated: m_alloc < size
TRUEFALSE
yes
Evaluation Count:114
yes
Evaluation Count:104835
114-104835
394 int newAlloc = qMax(size, 2 * m_alloc); -
395 m_intersections = q_check_ptr((Intersection *)realloc(m_intersections, newAlloc * sizeof(Intersection))); -
396 m_alloc = newAlloc; -
397 }
executed: }
Execution Count:114
114
398}
executed: }
Execution Count:104949
104949
399 -
400inline void QScanConverter::mergeIntersection(Intersection *it, const Intersection &isect) -
401{ -
402 Intersection *current = it; -
403 -
404 while (isect.x != current->x) {
evaluated: isect.x != current->x
TRUEFALSE
yes
Evaluation Count:1801602
yes
Evaluation Count:71764
71764-1801602
405 int &next = isect.x < current->x ? current->left : current->right;
evaluated: isect.x < current->x
TRUEFALSE
yes
Evaluation Count:796533
yes
Evaluation Count:1005069
796533-1005069
406 if (next)
evaluated: next
TRUEFALSE
yes
Evaluation Count:1605256
yes
Evaluation Count:196346
196346-1605256
407 current += next;
executed: current += next;
Execution Count:1605256
1605256
408 else { -
409 Intersection *last = m_intersections + m_size; -
410 next = last - current; -
411 *last = isect; -
412 ++m_size; -
413 return;
executed: return;
Execution Count:196346
196346
414 } -
415 } -
416 -
417 current->winding += isect.winding; -
418}
executed: }
Execution Count:71764
71764
419 -
420void QScanConverter::mergeCurve(const QT_FT_Vector &pa, const QT_FT_Vector &pb, -
421 const QT_FT_Vector &pc, const QT_FT_Vector &pd) -
422{ -
423 -
424 QT_FT_Vector beziers[4 + 3 * 32]; -
425 -
426 QT_FT_Vector *b = beziers; -
427 -
428 b[0] = pa; -
429 b[1] = pb; -
430 b[2] = pc; -
431 b[3] = pd; -
432 -
433 const QT_FT_Pos flatness = 16; -
434 -
435 while (b >= beziers) {
never evaluated: b >= beziers
0
436 QT_FT_Vector delta = { b[3].x - b[0].x, b[3].y - b[0].y }; -
437 QT_FT_Pos l = qAbs(delta.x) + qAbs(delta.y); -
438 -
439 bool belowThreshold; -
440 if (l > 64) {
never evaluated: l > 64
0
441 qlonglong d2 = qAbs(qlonglong(b[1].x-b[0].x) * qlonglong(delta.y) - -
442 qlonglong(b[1].y-b[0].y) * qlonglong(delta.x)); -
443 qlonglong d3 = qAbs(qlonglong(b[2].x-b[0].x) * qlonglong(delta.y) - -
444 qlonglong(b[2].y-b[0].y) * qlonglong(delta.x)); -
445 -
446 qlonglong d = d2 + d3; -
447 -
448 belowThreshold = (d <= qlonglong(flatness) * qlonglong(l)); -
449 } else {
never executed: }
0
450 QT_FT_Pos d = qAbs(b[0].x-b[1].x) + qAbs(b[0].y-b[1].y) + -
451 qAbs(b[0].x-b[2].x) + qAbs(b[0].y-b[2].y); -
452 -
453 belowThreshold = (d <= flatness); -
454 }
never executed: }
0
455 -
456 if (belowThreshold || b == beziers + 3 * 32) {
never evaluated: belowThreshold
never evaluated: b == beziers + 3 * 32
0
457 mergeLine(b[0], b[3]); -
458 b -= 3; -
459 continue;
never executed: continue;
0
460 } -
461 -
462 split(b); -
463 b += 3; -
464 }
never executed: }
0
465}
never executed: }
0
466 -
467inline bool QScanConverter::clip(Q16Dot16 &xFP, int &iTop, int &iBottom, Q16Dot16 slopeFP, Q16Dot16 edgeFP, int winding) -
468{ -
469 bool right = edgeFP == m_rightFP; -
470 -
471 if (xFP == edgeFP) {
evaluated: xFP == edgeFP
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:748156
16-748156
472 if ((slopeFP > 0) ^ right)
evaluated: (slopeFP > 0) ^ right
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
1-15
473 return false;
executed: return false;
Execution Count:15
15
474 else { -
475 Line line = { edgeFP, 0, iTop, iBottom, winding }; -
476 m_lines.add(line); -
477 return true;
executed: return true;
Execution Count:1
1
478 } -
479 } -
480 -
481 Q16Dot16 lastFP = xFP + slopeFP * (iBottom - iTop); -
482 -
483 if (lastFP == edgeFP) {
evaluated: lastFP == edgeFP
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:748153
3-748153
484 if ((slopeFP < 0) ^ right)
partially evaluated: (slopeFP < 0) ^ right
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
485 return false;
executed: return false;
Execution Count:3
3
486 else { -
487 Line line = { edgeFP, 0, iTop, iBottom, winding }; -
488 m_lines.add(line); -
489 return true;
never executed: return true;
0
490 } -
491 } -
492 -
493 -
494 if ((lastFP < edgeFP) ^ (xFP < edgeFP)) {
evaluated: (lastFP < edgeFP) ^ (xFP < edgeFP)
TRUEFALSE
yes
Evaluation Count:357970
yes
Evaluation Count:390183
357970-390183
495 Q16Dot16 deltaY = Q16Dot16((edgeFP - xFP) / ((slopeFP)/65536.)); -
496 -
497 if ((xFP < edgeFP) ^ right) {
evaluated: (xFP < edgeFP) ^ right
TRUEFALSE
yes
Evaluation Count:179400
yes
Evaluation Count:178570
178570-179400
498 -
499 int iHeight = ((deltaY + 1) >> 16); -
500 int iMiddle = iTop + iHeight; -
501 -
502 Line line = { edgeFP, 0, iTop, iMiddle, winding }; -
503 m_lines.add(line); -
504 -
505 if (iMiddle != iBottom) {
partially evaluated: iMiddle != iBottom
TRUEFALSE
yes
Evaluation Count:179400
no
Evaluation Count:0
0-179400
506 xFP += slopeFP * (iHeight + 1); -
507 iTop = iMiddle + 1; -
508 } else
executed: }
Execution Count:179400
179400
509 return true;
never executed: return true;
0
510 } else { -
511 -
512 int iHeight = ((deltaY) >> 16); -
513 int iMiddle = iTop + iHeight; -
514 -
515 if (iMiddle != iBottom) {
partially evaluated: iMiddle != iBottom
TRUEFALSE
yes
Evaluation Count:178570
no
Evaluation Count:0
0-178570
516 Line line = { edgeFP, 0, iMiddle + 1, iBottom, winding }; -
517 m_lines.add(line); -
518 -
519 iBottom = iMiddle; -
520 }
executed: }
Execution Count:178570
178570
521 }
executed: }
Execution Count:178570
178570
522 return false;
executed: return false;
Execution Count:357970
357970
523 } else if ((xFP < edgeFP) ^ right) {
evaluated: (xFP < edgeFP) ^ right
TRUEFALSE
yes
Evaluation Count:28541
yes
Evaluation Count:361642
28541-361642
524 Line line = { edgeFP, 0, iTop, iBottom, winding }; -
525 m_lines.add(line); -
526 return true;
executed: return true;
Execution Count:28541
28541
527 } -
528 -
529 return false;
executed: return false;
Execution Count:361642
361642
530} -
531 -
532void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b) -
533{ -
534 int winding = 1; -
535 -
536 if (a.y > b.y) {
evaluated: a.y > b.y
TRUEFALSE
yes
Evaluation Count:285830
yes
Evaluation Count:419999
285830-419999
537 qSwap(a, b); -
538 winding = -1; -
539 }
executed: }
Execution Count:285830
285830
540 -
541 if (m_legacyRounding) {
evaluated: m_legacyRounding
TRUEFALSE
yes
Evaluation Count:4166
yes
Evaluation Count:701663
4166-701663
542 a.x += 32; -
543 a.y += 32; -
544 b.x += 32; -
545 b.y += 32; -
546 }
executed: }
Execution Count:4166
4166
547 -
548 int rounding = m_legacyRounding ? 1 : 0;
evaluated: m_legacyRounding
TRUEFALSE
yes
Evaluation Count:4166
yes
Evaluation Count:701663
4166-701663
549 -
550 int iTop = qMax(m_top, int((a.y + 32 - rounding) >> 6)); -
551 int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6)); -
552 -
553 if (iTop <= iBottom) {
evaluated: iTop <= iBottom
TRUEFALSE
yes
Evaluation Count:496108
yes
Evaluation Count:209721
209721-496108
554 Q16Dot16 aFP = 65536/2 + (a.x << 10) - rounding; -
555 -
556 if (b.x == a.x) {
evaluated: b.x == a.x
TRUEFALSE
yes
Evaluation Count:115369
yes
Evaluation Count:380739
115369-380739
557 Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding }; -
558 m_lines.add(line); -
559 } else {
executed: }
Execution Count:115369
115369
560 const qreal slope = (b.x - a.x) / qreal(b.y - a.y); -
561 -
562 const Q16Dot16 slopeFP = (int)((slope) * 65536.); -
563 -
564 Q16Dot16 xFP = aFP + (int)((qlonglong(slopeFP) * qlonglong(((iTop) << 16) + 65536/2 - (a.y << 10))) >> 16); -
565 -
566 -
567 -
568 if (clip(xFP, iTop, iBottom, slopeFP, m_leftFP, winding))
evaluated: clip(xFP, iTop, iBottom, slopeFP, m_leftFP, winding)
TRUEFALSE
yes
Evaluation Count:13306
yes
Evaluation Count:367433
13306-367433
569 return;
executed: return;
Execution Count:13306
13306
570 -
571 if (clip(xFP, iTop, iBottom, slopeFP, m_rightFP, winding))
evaluated: clip(xFP, iTop, iBottom, slopeFP, m_rightFP, winding)
TRUEFALSE
yes
Evaluation Count:15236
yes
Evaluation Count:352197
15236-352197
572 return;
executed: return;
Execution Count:15236
15236
573 -
574 qt_noop(); -
575 -
576 Line line = { xFP, slopeFP, iTop, iBottom, winding }; -
577 m_lines.add(line); -
578 }
executed: }
Execution Count:352197
352197
579 } -
580}
executed: }
Execution Count:677287
677287
581 -
582QRasterizer::QRasterizer() -
583 : d(new QRasterizerPrivate) -
584{ -
585 d->legacyRounding = false; -
586}
executed: }
Execution Count:5615
5615
587 -
588QRasterizer::~QRasterizer() -
589{ -
590 delete d; -
591}
executed: }
Execution Count:5604
5604
592 -
593void QRasterizer::setAntialiased(bool antialiased) -
594{ -
595 d->antialiased = antialiased; -
596}
executed: }
Execution Count:121686
121686
597 -
598void QRasterizer::initialize(ProcessSpans blend, void *data) -
599{ -
600 d->blend = blend; -
601 d->data = data; -
602}
executed: }
Execution Count:121668
121668
603 -
604void QRasterizer::setClipRect(const QRect &clipRect) -
605{ -
606 d->clipRect = clipRect; -
607}
executed: }
Execution Count:150404
150404
608 -
609void QRasterizer::setLegacyRoundingEnabled(bool legacyRoundingEnabled) -
610{ -
611 d->legacyRounding = legacyRoundingEnabled; -
612}
executed: }
Execution Count:121686
121686
613 -
614static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16 leftIntersectX, Q16Dot16 rightIntersectX, Q16Dot16 slope, Q16Dot16 invSlope) -
615{ -
616 Q16Dot16 leftX = ((x) << 16); -
617 Q16Dot16 rightX = ((x) << 16) + 65536; -
618 -
619 Q16Dot16 leftIntersectY, rightIntersectY; -
620 if (slope > 0) {
evaluated: slope > 0
TRUEFALSE
yes
Evaluation Count:71106
yes
Evaluation Count:768
768-71106
621 leftIntersectY = top + (int)((qlonglong(leftX - leftIntersectX) * qlonglong(invSlope)) >> 16); -
622 rightIntersectY = leftIntersectY + invSlope; -
623 } else {
executed: }
Execution Count:71106
71106
624 leftIntersectY = top + (int)((qlonglong(leftX - rightIntersectX) * qlonglong(invSlope)) >> 16); -
625 rightIntersectY = leftIntersectY + invSlope; -
626 }
executed: }
Execution Count:768
768
627 -
628 if (leftIntersectX >= leftX && rightIntersectX <= rightX) {
evaluated: leftIntersectX >= leftX
TRUEFALSE
yes
Evaluation Count:68669
yes
Evaluation Count:3205
evaluated: rightIntersectX <= rightX
TRUEFALSE
yes
Evaluation Count:65673
yes
Evaluation Count:2996
2996-68669
629 return (int)((qlonglong(bottom - top) * qlonglong(leftIntersectX - leftX + ((rightIntersectX - leftIntersectX) >> 1))) >> 16);
executed: return (int)((qlonglong(bottom - top) * qlonglong(leftIntersectX - leftX + ((rightIntersectX - leftIntersectX) >> 1))) >> 16);
Execution Count:65673
65673
630 } else if (leftIntersectX >= rightX) {
evaluated: leftIntersectX >= rightX
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:6173
28-6173
631 return bottom - top;
executed: return bottom - top;
Execution Count:28
28
632 } else if (leftIntersectX >= leftX) {
evaluated: leftIntersectX >= leftX
TRUEFALSE
yes
Evaluation Count:2968
yes
Evaluation Count:3205
2968-3205
633 if (slope > 0) {
evaluated: slope > 0
TRUEFALSE
yes
Evaluation Count:2697
yes
Evaluation Count:271
271-2697
634 return (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (rightIntersectY - top)) >> 16);
executed: return (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (rightIntersectY - top)) >> 16);
Execution Count:2697
2697
635 } else { -
636 return (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (bottom - rightIntersectY)) >> 16);
executed: return (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (bottom - rightIntersectY)) >> 16);
Execution Count:271
271
637 } -
638 } else if (rightIntersectX <= leftX) {
evaluated: rightIntersectX <= leftX
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:3157
48-3157
639 return 0;
executed: return 0;
Execution Count:48
48
640 } else if (rightIntersectX <= rightX) {
evaluated: rightIntersectX <= rightX
TRUEFALSE
yes
Evaluation Count:2972
yes
Evaluation Count:185
185-2972
641 if (slope > 0) {
evaluated: slope > 0
TRUEFALSE
yes
Evaluation Count:2705
yes
Evaluation Count:267
267-2705
642 return ((((rightIntersectX - leftX) >> 1) * (bottom - leftIntersectY)) >> 16);
executed: return ((((rightIntersectX - leftX) >> 1) * (bottom - leftIntersectY)) >> 16);
Execution Count:2705
2705
643 } else { -
644 return ((((rightIntersectX - leftX) >> 1) * (leftIntersectY - top)) >> 16);
executed: return ((((rightIntersectX - leftX) >> 1) * (leftIntersectY - top)) >> 16);
Execution Count:267
267
645 } -
646 } else { -
647 if (slope > 0) {
evaluated: slope > 0
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:1
1-184
648 return (bottom - rightIntersectY) + ((rightIntersectY - leftIntersectY) >> 1);
executed: return (bottom - rightIntersectY) + ((rightIntersectY - leftIntersectY) >> 1);
Execution Count:184
184
649 } else { -
650 return (rightIntersectY - top) + ((leftIntersectY - rightIntersectY) >> 1);
executed: return (rightIntersectY - top) + ((leftIntersectY - rightIntersectY) >> 1);
Execution Count:1
1
651 } -
652 } -
653} -
654 -
655static inline bool q26Dot6Compare(qreal p1, qreal p2) -
656{ -
657 return int((p2 - p1) * 64.) == 0;
executed: return int((p2 - p1) * 64.) == 0;
Execution Count:3386
3386
658} -
659 -
660static inline qreal qFloorF(qreal v) -
661{ -
662 -
663 if (sizeof(qreal) == sizeof(float))
partially evaluated: sizeof(qreal) == sizeof(float)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5672
0-5672
664 return floorf(v);
never executed: return floorf(v);
0
665 else -
666 -
667 return floor(v);
executed: return floor(v);
Execution Count:5672
5672
668} -
669 -
670static inline QPointF snapTo26Dot6Grid(const QPointF &p) -
671{ -
672 return QPointF(qFloorF(p.x() * 64) * (1 / qreal(64)), 2836
673 qFloorF(p.y() * 64) * (1 / qreal(64)));
executed: return QPointF(qFloorF(p.x() * 64) * (1 / qreal(64)), qFloorF(p.y() * 64) * (1 / qreal(64)));
Execution Count:2836
2836
674} -
675 -
676void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) -
677{ -
678 if (a == b || width == 0 || d->clipRect.isEmpty())
partially evaluated: a == b
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1330
partially evaluated: width == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1330
evaluated: d->clipRect.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1326
0-1330
679 return;
executed: return;
Execution Count:4
4
680 -
681 qt_noop(); -
682 -
683 QPointF pa = a; -
684 QPointF pb = b; -
685 -
686 if (squareCap) {
evaluated: squareCap
TRUEFALSE
yes
Evaluation Count:938
yes
Evaluation Count:388
388-938
687 QPointF delta = pb - pa; -
688 pa -= (0.5f * width) * delta; -
689 pb += (0.5f * width) * delta; -
690 }
executed: }
Execution Count:938
938
691 -
692 QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; -
693 const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs); -
694 -
695 if (!clip.contains(pa) || !clip.contains(pb)) {
evaluated: !clip.contains(pa)
TRUEFALSE
yes
Evaluation Count:588
yes
Evaluation Count:738
evaluated: !clip.contains(pb)
TRUEFALSE
yes
Evaluation Count:330
yes
Evaluation Count:408
330-738
696 qreal t1 = 0; -
697 qreal t2 = 1; -
698 -
699 const qreal o[2] = { pa.x(), pa.y() }; -
700 const qreal d[2] = { pb.x() - pa.x(), pb.y() - pa.y() }; -
701 -
702 const qreal low[2] = { clip.left(), clip.top() }; -
703 const qreal high[2] = { clip.right(), clip.bottom() }; -
704 -
705 for (int i = 0; i < 2; ++i) {
evaluated: i < 2
TRUEFALSE
yes
Evaluation Count:1809
yes
Evaluation Count:793
793-1809
706 if (d[i] == 0) {
evaluated: d[i] == 0
TRUEFALSE
yes
Evaluation Count:164
yes
Evaluation Count:1645
164-1645
707 if (o[i] <= low[i] || o[i] >= high[i])
evaluated: o[i] <= low[i]
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:160
evaluated: o[i] >= high[i]
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:150
4-160
708 return;
executed: return;
Execution Count:14
14
709 continue;
executed: continue;
Execution Count:150
150
710 } -
711 const qreal d_inv = 1 / d[i]; -
712 qreal t_low = (low[i] - o[i]) * d_inv; -
713 qreal t_high = (high[i] - o[i]) * d_inv; -
714 if (t_low > t_high)
evaluated: t_low > t_high
TRUEFALSE
yes
Evaluation Count:400
yes
Evaluation Count:1245
400-1245
715 qSwap(t_low, t_high);
executed: qSwap(t_low, t_high);
Execution Count:400
400
716 if (t1 < t_low)
evaluated: t1 < t_low
TRUEFALSE
yes
Evaluation Count:616
yes
Evaluation Count:1029
616-1029
717 t1 = t_low;
executed: t1 = t_low;
Execution Count:616
616
718 if (t2 > t_high)
evaluated: t2 > t_high
TRUEFALSE
yes
Evaluation Count:602
yes
Evaluation Count:1043
602-1043
719 t2 = t_high;
executed: t2 = t_high;
Execution Count:602
602
720 if (t1 >= t2)
evaluated: t1 >= t2
TRUEFALSE
yes
Evaluation Count:111
yes
Evaluation Count:1534
111-1534
721 return;
executed: return;
Execution Count:111
111
722 }
executed: }
Execution Count:1534
1534
723 -
724 QPointF npa = pa + (pb - pa) * t1; -
725 QPointF npb = pa + (pb - pa) * t2; -
726 -
727 pa = npa; -
728 pb = npb; -
729 }
executed: }
Execution Count:793
793
730 -
731 if (!d->antialiased && d->legacyRounding) {
evaluated: !d->antialiased
TRUEFALSE
yes
Evaluation Count:883
yes
Evaluation Count:318
partially evaluated: d->legacyRounding
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:883
0-883
732 pa.rx() += (32 - 1)/64.; -
733 pa.ry() += (32 - 1)/64.; -
734 pb.rx() += (32 - 1)/64.; -
735 pb.ry() += (32 - 1)/64.; -
736 }
never executed: }
0
737 -
738 { -
739 -
740 const QPointF d0 = a - b; -
741 const qreal w0 = d0.x() * d0.x() + d0.y() * d0.y(); -
742 -
743 -
744 const QPointF d = pa - pb; -
745 const qreal w = d.x() * d.x() + d.y() * d.y(); -
746 -
747 if (w == 0)
partially evaluated: w == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1201
0-1201
748 return;
never executed: return;
0
749 -
750 -
751 width *= sqrt(w0 / w); -
752 } -
753 -
754 QSpanBuffer buffer(d->blend, d->data, d->clipRect); -
755 -
756 if (q26Dot6Compare(pa.y(), pb.y())) {
evaluated: q26Dot6Compare(pa.y(), pb.y())
TRUEFALSE
yes
Evaluation Count:430
yes
Evaluation Count:771
430-771
757 const qreal x = (pa.x() + pb.x()) * 0.5f; -
758 const qreal dx = qAbs(pb.x() - pa.x()) * 0.5f; -
759 -
760 const qreal y = pa.y(); -
761 const qreal dy = width * dx; -
762 -
763 pa = QPointF(x, y - dy); -
764 pb = QPointF(x, y + dy); -
765 -
766 width = 1 / width; -
767 }
executed: }
Execution Count:430
430
768 -
769 if (q26Dot6Compare(pa.x(), pb.x())) {
evaluated: q26Dot6Compare(pa.x(), pb.x())
TRUEFALSE
yes
Evaluation Count:492
yes
Evaluation Count:709
492-709
770 if (pa.y() > pb.y())
evaluated: pa.y() > pb.y()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:488
4-488
771 qSwap(pa, pb);
executed: qSwap(pa, pb);
Execution Count:4
4
772 -
773 const qreal dy = pb.y() - pa.y(); -
774 const qreal halfWidth = 0.5f * width * dy; -
775 -
776 qreal left = pa.x() - halfWidth; -
777 qreal right = pa.x() + halfWidth; -
778 -
779 left = qBound(qreal(d->clipRect.left()), left, qreal(d->clipRect.right() + 1)); -
780 right = qBound(qreal(d->clipRect.left()), right, qreal(d->clipRect.right() + 1)); -
781 -
782 pa.ry() = qBound(qreal(d->clipRect.top()), pa.y(), qreal(d->clipRect.bottom() + 1)); -
783 pb.ry() = qBound(qreal(d->clipRect.top()), pb.y(), qreal(d->clipRect.bottom() + 1)); -
784 -
785 if (q26Dot6Compare(left, right) || q26Dot6Compare(pa.y(), pb.y()))
partially evaluated: q26Dot6Compare(left, right)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:492
partially evaluated: q26Dot6Compare(pa.y(), pb.y())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:492
0-492
786 return;
never executed: return;
0
787 -
788 if (d->antialiased) {
evaluated: d->antialiased
TRUEFALSE
yes
Evaluation Count:291
yes
Evaluation Count:201
201-291
789 const Q16Dot16 iLeft = int(left); -
790 const Q16Dot16 iRight = int(right); -
791 const Q16Dot16 leftWidth = ((iLeft + 1) << 16) -
792 - (int)((left) * 65536.); -
793 const Q16Dot16 rightWidth = (int)((right) * 65536.) -
794 - ((iRight) << 16); -
795 -
796 Q16Dot16 coverage[3]; -
797 int x[3]; -
798 int len[3]; -
799 -
800 int n = 1; -
801 if (iLeft == iRight) {
partially evaluated: iLeft == iRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:291
0-291
802 coverage[0] = (leftWidth + rightWidth) * 255; -
803 x[0] = iLeft; -
804 len[0] = 1; -
805 } else {
never executed: }
0
806 coverage[0] = leftWidth * 255; -
807 x[0] = iLeft; -
808 len[0] = 1; -
809 if (leftWidth == 65536) {
evaluated: leftWidth == 65536
TRUEFALSE
yes
Evaluation Count:265
yes
Evaluation Count:26
26-265
810 len[0] = iRight - iLeft; -
811 } else if (iRight - iLeft > 1) {
executed: }
Execution Count:265
evaluated: iRight - iLeft > 1
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:18
8-265
812 coverage[1] = ((255) << 16); -
813 x[1] = iLeft + 1; -
814 len[1] = iRight - iLeft - 1; -
815 ++n; -
816 }
executed: }
Execution Count:8
8
817 if (rightWidth) {
evaluated: rightWidth
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:265
26-265
818 coverage[n] = rightWidth * 255; -
819 x[n] = iRight; -
820 len[n] = 1; -
821 ++n; -
822 }
executed: }
Execution Count:26
26
823 }
executed: }
Execution Count:291
291
824 -
825 const Q16Dot16 iTopFP = ((int(pa.y())) << 16); -
826 const Q16Dot16 iBottomFP = ((int(pb.y())) << 16); -
827 const Q16Dot16 yPa = (int)((pa.y()) * 65536.); -
828 const Q16Dot16 yPb = (int)((pb.y()) * 65536.); -
829 for (Q16Dot16 yFP = iTopFP; yFP <= iBottomFP; yFP += 65536) {
evaluated: yFP <= iBottomFP
TRUEFALSE
yes
Evaluation Count:4988
yes
Evaluation Count:291
291-4988
830 const Q16Dot16 rowHeight = qMin(yFP + 65536, yPb) -
831 - qMax(yFP, yPa); -
832 const int y = ((yFP) >> 16); -
833 for (int i = 0; i < n; ++i) {
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:5106
yes
Evaluation Count:4988
4988-5106
834 buffer.addSpan(x[i], len[i], y, -
835 (((int)((qlonglong(rowHeight) * qlonglong(coverage[i])) >> 16)) >> 16)); -
836 }
executed: }
Execution Count:5106
5106
837 }
executed: }
Execution Count:4988
4988
838 } else {
executed: }
Execution Count:291
291
839 int iTop = int(pa.y() + 0.5f); -
840 int iBottom = pb.y() < 0.5f ? -1 : int(pb.y() - 0.5f);
partially evaluated: pb.y() < 0.5f
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:201
0-201
841 int iLeft = int(left + 0.5f); -
842 int iRight = right < 0.5f ? -1 : int(right - 0.5f);
partially evaluated: right < 0.5f
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:201
0-201
843 -
844 int iWidth = iRight - iLeft + 1; -
845 for (int y = iTop; y <= iBottom; ++y)
evaluated: y <= iBottom
TRUEFALSE
yes
Evaluation Count:7760
yes
Evaluation Count:201
201-7760
846 buffer.addSpan(iLeft, iWidth, y, 255);
executed: buffer.addSpan(iLeft, iWidth, y, 255);
Execution Count:7760
7760
847 }
executed: }
Execution Count:201
201
848 } else { -
849 if (pa.y() > pb.y())
evaluated: pa.y() > pb.y()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:685
24-685
850 qSwap(pa, pb);
executed: qSwap(pa, pb);
Execution Count:24
24
851 -
852 QPointF delta = pb - pa; -
853 delta *= 0.5f * width; -
854 const QPointF perp(delta.y(), -delta.x()); -
855 -
856 QPointF top; -
857 QPointF left; -
858 QPointF right; -
859 QPointF bottom; -
860 -
861 if (pa.x() < pb.x()) {
evaluated: pa.x() < pb.x()
TRUEFALSE
yes
Evaluation Count:403
yes
Evaluation Count:306
306-403
862 top = pa + perp; -
863 left = pa - perp; -
864 right = pb + perp; -
865 bottom = pb - perp; -
866 } else {
executed: }
Execution Count:403
403
867 top = pa - perp; -
868 left = pb - perp; -
869 right = pa + perp; -
870 bottom = pb + perp; -
871 }
executed: }
Execution Count:306
306
872 -
873 top = snapTo26Dot6Grid(top); -
874 bottom = snapTo26Dot6Grid(bottom); -
875 left = snapTo26Dot6Grid(left); -
876 right = snapTo26Dot6Grid(right); -
877 -
878 const qreal topBound = qBound(qreal(d->clipRect.top()), top.y(), qreal(d->clipRect.bottom())); -
879 const qreal bottomBound = qBound(qreal(d->clipRect.top()), bottom.y(), qreal(d->clipRect.bottom())); -
880 -
881 const QPointF topLeftEdge = left - top; -
882 const QPointF topRightEdge = right - top; -
883 const QPointF bottomLeftEdge = bottom - left; -
884 const QPointF bottomRightEdge = bottom - right; -
885 -
886 const qreal topLeftSlope = topLeftEdge.x() / topLeftEdge.y(); -
887 const qreal bottomLeftSlope = bottomLeftEdge.x() / bottomLeftEdge.y(); -
888 -
889 const qreal topRightSlope = topRightEdge.x() / topRightEdge.y(); -
890 const qreal bottomRightSlope = bottomRightEdge.x() / bottomRightEdge.y(); -
891 -
892 const Q16Dot16 topLeftSlopeFP = (int)((topLeftSlope) * 65536.); -
893 const Q16Dot16 topRightSlopeFP = (int)((topRightSlope) * 65536.); -
894 -
895 const Q16Dot16 bottomLeftSlopeFP = (int)((bottomLeftSlope) * 65536.); -
896 const Q16Dot16 bottomRightSlopeFP = (int)((bottomRightSlope) * 65536.); -
897 -
898 const Q16Dot16 invTopLeftSlopeFP = (int)((1 / topLeftSlope) * 65536.); -
899 const Q16Dot16 invTopRightSlopeFP = (int)((1 / topRightSlope) * 65536.); -
900 -
901 const Q16Dot16 invBottomLeftSlopeFP = (int)((1 / bottomLeftSlope) * 65536.); -
902 const Q16Dot16 invBottomRightSlopeFP = (int)((1 / bottomRightSlope) * 65536.); -
903 -
904 if (d->antialiased) {
evaluated: d->antialiased
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:682
27-682
905 const Q16Dot16 iTopFP = ((int(topBound)) << 16); -
906 const Q16Dot16 iLeftFP = ((int(left.y())) << 16); -
907 const Q16Dot16 iRightFP = ((int(right.y())) << 16); -
908 const Q16Dot16 iBottomFP = ((int(bottomBound)) << 16); -
909 -
910 Q16Dot16 leftIntersectAf = (int)((top.x() + (int(topBound) - top.y()) * topLeftSlope) * 65536.); -
911 Q16Dot16 rightIntersectAf = (int)((top.x() + (int(topBound) - top.y()) * topRightSlope) * 65536.); -
912 Q16Dot16 leftIntersectBf = 0; -
913 Q16Dot16 rightIntersectBf = 0; -
914 -
915 if (iLeftFP < iTopFP)
partially evaluated: iLeftFP < iTopFP
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-27
916 leftIntersectBf = (int)((left.x() + (int(topBound) - left.y()) * bottomLeftSlope) * 65536.);
never executed: leftIntersectBf = (int)((left.x() + (int(topBound) - left.y()) * bottomLeftSlope) * 65536.);
0
917 -
918 if (iRightFP < iTopFP)
partially evaluated: iRightFP < iTopFP
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-27
919 rightIntersectBf = (int)((right.x() + (int(topBound) - right.y()) * bottomRightSlope) * 65536.);
never executed: rightIntersectBf = (int)((right.x() + (int(topBound) - right.y()) * bottomRightSlope) * 65536.);
0
920 -
921 Q16Dot16 rowTop, rowBottomLeft, rowBottomRight, rowTopLeft, rowTopRight, rowBottom; -
922 Q16Dot16 topLeftIntersectAf, topLeftIntersectBf, topRightIntersectAf, topRightIntersectBf; -
923 Q16Dot16 bottomLeftIntersectAf, bottomLeftIntersectBf, bottomRightIntersectAf, bottomRightIntersectBf; -
924 -
925 int leftMin, leftMax, rightMin, rightMax; -
926 -
927 const Q16Dot16 yTopFP = (int)((top.y()) * 65536.); -
928 const Q16Dot16 yLeftFP = (int)((left.y()) * 65536.); -
929 const Q16Dot16 yRightFP = (int)((right.y()) * 65536.); -
930 const Q16Dot16 yBottomFP = (int)((bottom.y()) * 65536.); -
931 -
932 rowTop = qMax(iTopFP, yTopFP); -
933 topLeftIntersectAf = leftIntersectAf + -
934 (int)((qlonglong(topLeftSlopeFP) * qlonglong(rowTop - iTopFP)) >> 16); -
935 topRightIntersectAf = rightIntersectAf + -
936 (int)((qlonglong(topRightSlopeFP) * qlonglong(rowTop - iTopFP)) >> 16); -
937 -
938 Q16Dot16 yFP = iTopFP; -
939 while (yFP <= iBottomFP) {
evaluated: yFP <= iBottomFP
TRUEFALSE
yes
Evaluation Count:34342
yes
Evaluation Count:27
27-34342
940 rowBottomLeft = qMin(yFP + 65536, yLeftFP); -
941 rowBottomRight = qMin(yFP + 65536, yRightFP); -
942 rowTopLeft = qMax(yFP, yLeftFP); -
943 rowTopRight = qMax(yFP, yRightFP); -
944 rowBottom = qMin(yFP + 65536, yBottomFP); -
945 -
946 if (yFP == iLeftFP) {
evaluated: yFP == iLeftFP
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:34315
27-34315
947 const int y = ((yFP) >> 16); -
948 leftIntersectBf = (int)((left.x() + (y - left.y()) * bottomLeftSlope) * 65536.); -
949 topLeftIntersectBf = leftIntersectBf + (int)((qlonglong(bottomLeftSlopeFP) * qlonglong(rowTopLeft - yFP)) >> 16); -
950 bottomLeftIntersectAf = leftIntersectAf + (int)((qlonglong(topLeftSlopeFP) * qlonglong(rowBottomLeft - yFP)) >> 16); -
951 } else {
executed: }
Execution Count:27
27
952 topLeftIntersectBf = leftIntersectBf; -
953 bottomLeftIntersectAf = leftIntersectAf + topLeftSlopeFP; -
954 }
executed: }
Execution Count:34315
34315
955 -
956 if (yFP == iRightFP) {
evaluated: yFP == iRightFP
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:34323
19-34323
957 const int y = ((yFP) >> 16); -
958 rightIntersectBf = (int)((right.x() + (y - right.y()) * bottomRightSlope) * 65536.); -
959 topRightIntersectBf = rightIntersectBf + (int)((qlonglong(bottomRightSlopeFP) * qlonglong(rowTopRight - yFP)) >> 16); -
960 bottomRightIntersectAf = rightIntersectAf + (int)((qlonglong(topRightSlopeFP) * qlonglong(rowBottomRight - yFP)) >> 16); -
961 } else {
executed: }
Execution Count:19
19
962 topRightIntersectBf = rightIntersectBf; -
963 bottomRightIntersectAf = rightIntersectAf + topRightSlopeFP; -
964 }
executed: }
Execution Count:34323
34323
965 -
966 if (yFP == iBottomFP) {
evaluated: yFP == iBottomFP
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:34315
27-34315
967 bottomLeftIntersectBf = leftIntersectBf + (int)((qlonglong(bottomLeftSlopeFP) * qlonglong(rowBottom - yFP)) >> 16); -
968 bottomRightIntersectBf = rightIntersectBf + (int)((qlonglong(bottomRightSlopeFP) * qlonglong(rowBottom - yFP)) >> 16); -
969 } else {
executed: }
Execution Count:27
27
970 bottomLeftIntersectBf = leftIntersectBf + bottomLeftSlopeFP; -
971 bottomRightIntersectBf = rightIntersectBf + bottomRightSlopeFP; -
972 }
executed: }
Execution Count:34315
34315
973 -
974 if (yFP < iLeftFP) {
evaluated: yFP < iLeftFP
TRUEFALSE
yes
Evaluation Count:225
yes
Evaluation Count:34117
225-34117
975 leftMin = ((bottomLeftIntersectAf) >> 16); -
976 leftMax = ((topLeftIntersectAf) >> 16); -
977 } else if (yFP == iLeftFP) {
executed: }
Execution Count:225
evaluated: yFP == iLeftFP
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:34090
27-34090
978 leftMin = ((qMax(bottomLeftIntersectAf, topLeftIntersectBf)) >> 16); -
979 leftMax = ((qMax(topLeftIntersectAf, bottomLeftIntersectBf)) >> 16); -
980 } else {
executed: }
Execution Count:27
27
981 leftMin = ((topLeftIntersectBf) >> 16); -
982 leftMax = ((bottomLeftIntersectBf) >> 16); -
983 }
executed: }
Execution Count:34090
34090
984 -
985 leftMin = qBound(d->clipRect.left(), leftMin, d->clipRect.right()); -
986 leftMax = qBound(d->clipRect.left(), leftMax, d->clipRect.right()); -
987 -
988 if (yFP < iRightFP) {
evaluated: yFP < iRightFP
TRUEFALSE
yes
Evaluation Count:34093
yes
Evaluation Count:249
249-34093
989 rightMin = ((topRightIntersectAf) >> 16); -
990 rightMax = ((bottomRightIntersectAf) >> 16); -
991 } else if (yFP == iRightFP) {
executed: }
Execution Count:34093
evaluated: yFP == iRightFP
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:230
19-34093
992 rightMin = ((qMin(topRightIntersectAf, bottomRightIntersectBf)) >> 16); -
993 rightMax = ((qMin(bottomRightIntersectAf, topRightIntersectBf)) >> 16); -
994 } else {
executed: }
Execution Count:19
19
995 rightMin = ((bottomRightIntersectBf) >> 16); -
996 rightMax = ((topRightIntersectBf) >> 16); -
997 }
executed: }
Execution Count:230
230
998 -
999 rightMin = qBound(d->clipRect.left(), rightMin, d->clipRect.right()); -
1000 rightMax = qBound(d->clipRect.left(), rightMax, d->clipRect.right()); -
1001 -
1002 if (leftMax > rightMax)
partially evaluated: leftMax > rightMax
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34342
0-34342
1003 leftMax = rightMax;
never executed: leftMax = rightMax;
0
1004 if (rightMin < leftMin)
partially evaluated: rightMin < leftMin
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34342
0-34342
1005 rightMin = leftMin;
never executed: rightMin = leftMin;
0
1006 -
1007 Q16Dot16 rowHeight = rowBottom - rowTop; -
1008 -
1009 int x = leftMin; -
1010 while (x <= leftMax) {
evaluated: x <= leftMax
TRUEFALSE
yes
Evaluation Count:35898
yes
Evaluation Count:34342
34342-35898
1011 Q16Dot16 excluded = 0; -
1012 -
1013 if (yFP <= iLeftFP)
evaluated: yFP <= iLeftFP
TRUEFALSE
yes
Evaluation Count:379
yes
Evaluation Count:35519
379-35519
1014 excluded += intersectPixelFP(x, rowTop, rowBottomLeft, 379
1015 bottomLeftIntersectAf, topLeftIntersectAf, 379
1016 topLeftSlopeFP, invTopLeftSlopeFP);
executed: excluded += intersectPixelFP(x, rowTop, rowBottomLeft, bottomLeftIntersectAf, topLeftIntersectAf, topLeftSlopeFP, invTopLeftSlopeFP);
Execution Count:379
379
1017 if (yFP >= iLeftFP)
evaluated: yFP >= iLeftFP
TRUEFALSE
yes
Evaluation Count:35546
yes
Evaluation Count:352
352-35546
1018 excluded += intersectPixelFP(x, rowTopLeft, rowBottom, 35546
1019 topLeftIntersectBf, bottomLeftIntersectBf, 35546
1020 bottomLeftSlopeFP, invBottomLeftSlopeFP);
executed: excluded += intersectPixelFP(x, rowTopLeft, rowBottom, topLeftIntersectBf, bottomLeftIntersectBf, bottomLeftSlopeFP, invBottomLeftSlopeFP);
Execution Count:35546
35546
1021 -
1022 if (x >= rightMin) {
evaluated: x >= rightMin
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:35893
5-35893
1023 if (yFP <= iRightFP)
evaluated: yFP <= iRightFP
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
1024 excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, 3
1025 topRightIntersectAf, bottomRightIntersectAf, 3
1026 topRightSlopeFP, invTopRightSlopeFP);
executed: excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP);
Execution Count:3
3
1027 if (yFP >= iRightFP)
evaluated: yFP >= iRightFP
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
1028 excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, 3
1029 bottomRightIntersectBf, topRightIntersectBf, 3
1030 bottomRightSlopeFP, invBottomRightSlopeFP);
executed: excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP);
Execution Count:3
3
1031 }
executed: }
Execution Count:5
5
1032 -
1033 Q16Dot16 coverage = rowHeight - excluded; -
1034 buffer.addSpan(x, 1, ((yFP) >> 16), -
1035 ((255 * coverage) >> 16)); -
1036 ++x; -
1037 }
executed: }
Execution Count:35898
35898
1038 if (x < rightMin) {
evaluated: x < rightMin
TRUEFALSE
yes
Evaluation Count:34239
yes
Evaluation Count:103
103-34239
1039 buffer.addSpan(x, rightMin - x, ((yFP) >> 16), -
1040 ((255 * rowHeight) >> 16)); -
1041 x = rightMin; -
1042 }
executed: }
Execution Count:34239
34239
1043 while (x <= rightMax) {
evaluated: x <= rightMax
TRUEFALSE
yes
Evaluation Count:35913
yes
Evaluation Count:34342
34342-35913
1044 Q16Dot16 excluded = 0; -
1045 if (yFP <= iRightFP)
evaluated: yFP <= iRightFP
TRUEFALSE
yes
Evaluation Count:35557
yes
Evaluation Count:356
356-35557
1046 excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, 35557
1047 topRightIntersectAf, bottomRightIntersectAf, 35557
1048 topRightSlopeFP, invTopRightSlopeFP);
executed: excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP);
Execution Count:35557
35557
1049 if (yFP >= iRightFP)
evaluated: yFP >= iRightFP
TRUEFALSE
yes
Evaluation Count:386
yes
Evaluation Count:35527
386-35527
1050 excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, 386
1051 bottomRightIntersectBf, topRightIntersectBf, 386
1052 bottomRightSlopeFP, invBottomRightSlopeFP);
executed: excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP);
Execution Count:386
386
1053 -
1054 Q16Dot16 coverage = rowHeight - excluded; -
1055 buffer.addSpan(x, 1, ((yFP) >> 16), -
1056 ((255 * coverage) >> 16)); -
1057 ++x; -
1058 }
executed: }
Execution Count:35913
35913
1059 -
1060 leftIntersectAf += topLeftSlopeFP; -
1061 leftIntersectBf += bottomLeftSlopeFP; -
1062 rightIntersectAf += topRightSlopeFP; -
1063 rightIntersectBf += bottomRightSlopeFP; -
1064 topLeftIntersectAf = leftIntersectAf; -
1065 topRightIntersectAf = rightIntersectAf; -
1066 -
1067 yFP += 65536; -
1068 rowTop = yFP; -
1069 }
executed: }
Execution Count:34342
34342
1070 } else {
executed: }
Execution Count:27
27
1071 int iTop = int(top.y() + 0.5f); -
1072 int iLeft = left.y() < 0.5f ? -1 : int(left.y() - 0.5f);
evaluated: left.y() < 0.5f
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:680
2-680
1073 int iRight = right.y() < 0.5f ? -1 : int(right.y() - 0.5f);
evaluated: right.y() < 0.5f
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:680
2-680
1074 int iBottom = bottom.y() < 0.5f? -1 : int(bottom.y() - 0.5f);
partially evaluated: bottom.y() < 0.5f
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:682
0-682
1075 int iMiddle = qMin(iLeft, iRight); -
1076 -
1077 Q16Dot16 leftIntersectAf = (int)((top.x() + 0.5f + (iTop + 0.5f - top.y()) * topLeftSlope) * 65536.); -
1078 Q16Dot16 leftIntersectBf = (int)((left.x() + 0.5f + (iLeft + 1.5f - left.y()) * bottomLeftSlope) * 65536.); -
1079 Q16Dot16 rightIntersectAf = (int)((top.x() - 0.5f + (iTop + 0.5f - top.y()) * topRightSlope) * 65536.); -
1080 Q16Dot16 rightIntersectBf = (int)((right.x() - 0.5f + (iRight + 1.5f - right.y()) * bottomRightSlope) * 65536.); -
1081 -
1082 int ny; -
1083 int y = iTop; -
1084 ny = qMin(iMiddle + 1, d->clipRect.top()); if (y < ny) { leftIntersectAf += topLeftSlopeFP * (ny - y); rightIntersectAf += topRightSlopeFP * (ny - y); y = ny; } if (iMiddle > d->clipRect.bottom()) iMiddle = d->clipRect.bottom(); for (; y <= iMiddle; ++y) { const int x1 = qMax(((leftIntersectAf) >> 16), d->clipRect.left()); const int x2 = qMin(((rightIntersectAf) >> 16), d->clipRect.right()); if (x2 >= x1) buffer.addSpan(x1, x2 - x1 + 1, y, 255); leftIntersectAf += topLeftSlopeFP; rightIntersectAf += topRightSlopeFP; }
executed: }
Execution Count:205
never executed: iMiddle = d->clipRect.bottom();
executed: buffer.addSpan(x1, x2 - x1 + 1, y, 255);
Execution Count:1370
executed: }
Execution Count:1480
evaluated: y < ny
TRUEFALSE
yes
Evaluation Count:205
yes
Evaluation Count:477
partially evaluated: iMiddle > d->clipRect.bottom()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:682
evaluated: x2 >= x1
TRUEFALSE
yes
Evaluation Count:1370
yes
Evaluation Count:110
evaluated: y <= iMiddle
TRUEFALSE
yes
Evaluation Count:1480
yes
Evaluation Count:682
0-1480
1085 ny = qMin(iRight + 1, d->clipRect.top()); if (y < ny) { leftIntersectBf += bottomLeftSlopeFP * (ny - y); rightIntersectAf += topRightSlopeFP * (ny - y); y = ny; } if (iRight > d->clipRect.bottom()) iRight = d->clipRect.bottom(); for (; y <= iRight; ++y) { const int x1 = qMax(((leftIntersectBf) >> 16), d->clipRect.left()); const int x2 = qMin(((rightIntersectAf) >> 16), d->clipRect.right()); if (x2 >= x1) buffer.addSpan(x1, x2 - x1 + 1, y, 255); leftIntersectBf += bottomLeftSlopeFP; rightIntersectAf += topRightSlopeFP; }
executed: }
Execution Count:1
never executed: iRight = d->clipRect.bottom();
executed: buffer.addSpan(x1, x2 - x1 + 1, y, 255);
Execution Count:47613
executed: }
Execution Count:47613
evaluated: y < ny
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:681
partially evaluated: iRight > d->clipRect.bottom()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:682
partially evaluated: x2 >= x1
TRUEFALSE
yes
Evaluation Count:47613
no
Evaluation Count:0
evaluated: y <= iRight
TRUEFALSE
yes
Evaluation Count:47613
yes
Evaluation Count:682
0-47613
1086 ny = qMin(iLeft + 1, d->clipRect.top()); if (y < ny) { leftIntersectAf += topLeftSlopeFP * (ny - y); rightIntersectBf += bottomRightSlopeFP * (ny - y); y = ny; } if (iLeft > d->clipRect.bottom()) iLeft = d->clipRect.bottom(); for (; y <= iLeft; ++y) { const int x1 = qMax(((leftIntersectAf) >> 16), d->clipRect.left()); const int x2 = qMin(((rightIntersectBf) >> 16), d->clipRect.right()); if (x2 >= x1) buffer.addSpan(x1, x2 - x1 + 1, y, 255); leftIntersectAf += topLeftSlopeFP; rightIntersectBf += bottomRightSlopeFP; };
executed: }
Execution Count:3
executed: iLeft = d->clipRect.bottom();
Execution Count:12
executed: buffer.addSpan(x1, x2 - x1 + 1, y, 255);
Execution Count:36802
executed: }
Execution Count:36857
evaluated: y < ny
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:679
evaluated: iLeft > d->clipRect.bottom()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:670
evaluated: x2 >= x1
TRUEFALSE
yes
Evaluation Count:36802
yes
Evaluation Count:55
evaluated: y <= iLeft
TRUEFALSE
yes
Evaluation Count:36857
yes
Evaluation Count:682
3-36857
1087 ny = qMin(iBottom + 1, d->clipRect.top()); if (y < ny) { leftIntersectBf += bottomLeftSlopeFP * (ny - y); rightIntersectBf += bottomRightSlopeFP * (ny - y); y = ny; } if (iBottom > d->clipRect.bottom()) iBottom = d->clipRect.bottom(); for (; y <= iBottom; ++y) { const int x1 = qMax(((leftIntersectBf) >> 16), d->clipRect.left()); const int x2 = qMin(((rightIntersectBf) >> 16), d->clipRect.right()); if (x2 >= x1) buffer.addSpan(x1, x2 - x1 + 1, y, 255); leftIntersectBf += bottomLeftSlopeFP; rightIntersectBf += bottomRightSlopeFP; };
never executed: }
executed: iBottom = d->clipRect.bottom();
Execution Count:164
executed: buffer.addSpan(x1, x2 - x1 + 1, y, 255);
Execution Count:882
executed: }
Execution Count:994
partially evaluated: y < ny
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:682
evaluated: iBottom > d->clipRect.bottom()
TRUEFALSE
yes
Evaluation Count:164
yes
Evaluation Count:518
evaluated: x2 >= x1
TRUEFALSE
yes
Evaluation Count:882
yes
Evaluation Count:112
evaluated: y <= iBottom
TRUEFALSE
yes
Evaluation Count:994
yes
Evaluation Count:682
0-994
1088 -
1089 }
executed: }
Execution Count:682
682
1090 } -
1091} -
1092 -
1093void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule) -
1094{ -
1095 if (outline->n_points < 3 || outline->n_contours == 0)
evaluated: outline->n_points < 3
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:120386
partially evaluated: outline->n_contours == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120386
0-120386
1096 return;
executed: return;
Execution Count:9
9
1097 -
1098 const QT_FT_Vector *points = outline->points; -
1099 -
1100 QSpanBuffer buffer(d->blend, d->data, d->clipRect); -
1101 -
1102 -
1103 -
1104 -
1105 QT_FT_Pos min_y = points[0].y, max_y = points[0].y; -
1106 for (int i = 1; i < outline->n_points; ++i) {
evaluated: i < outline->n_points
TRUEFALSE
yes
Evaluation Count:769376
yes
Evaluation Count:120386
120386-769376
1107 const QT_FT_Vector &p = points[i]; -
1108 min_y = qMin(p.y, min_y); -
1109 max_y = qMax(p.y, max_y); -
1110 }
executed: }
Execution Count:769376
769376
1111 -
1112 int rounding = d->legacyRounding ? 32 - 1 : 0;
evaluated: d->legacyRounding
TRUEFALSE
yes
Evaluation Count:890
yes
Evaluation Count:119496
890-119496
1113 -
1114 int iTopBound = qMax(d->clipRect.top(), int((min_y + 32 + rounding) >> 6)); -
1115 int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32 + rounding) >> 6)); -
1116 -
1117 if (iTopBound > iBottomBound)
evaluated: iTopBound > iBottomBound
TRUEFALSE
yes
Evaluation Count:115
yes
Evaluation Count:120271
115-120271
1118 return;
executed: return;
Execution Count:115
115
1119 -
1120 d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer); -
1121 -
1122 int first = 0; -
1123 for (int i = 0; i < outline->n_contours; ++i) {
evaluated: i < outline->n_contours
TRUEFALSE
yes
Evaluation Count:171311
yes
Evaluation Count:120271
120271-171311
1124 const int last = outline->contours[i]; -
1125 for (int j = first; j < last; ++j) {
evaluated: j < last
TRUEFALSE
yes
Evaluation Count:705825
yes
Evaluation Count:171311
171311-705825
1126 if (outline->tags[j+1] == 2) {
partially evaluated: outline->tags[j+1] == 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:705825
0-705825
1127 qt_noop(); -
1128 d->scanConverter.mergeCurve(points[j], points[j+1], points[j+2], points[j+3]); -
1129 j += 2; -
1130 } else {
never executed: }
0
1131 d->scanConverter.mergeLine(points[j], points[j+1]); -
1132 }
executed: }
Execution Count:705825
705825
1133 } -
1134 -
1135 first = last + 1; -
1136 }
executed: }
Execution Count:171311
171311
1137 -
1138 d->scanConverter.end(); -
1139}
executed: }
Execution Count:120271
120271
1140 -
1141void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule) -
1142{ -
1143 if (path.isEmpty())
partially evaluated: path.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1144 return;
never executed: return;
0
1145 -
1146 QSpanBuffer buffer(d->blend, d->data, d->clipRect); -
1147 -
1148 QRectF bounds = path.controlPointRect(); -
1149 -
1150 double rounding = d->legacyRounding ? (32 - 1) / 64. : 0.0;
partially evaluated: d->legacyRounding
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1151 -
1152 int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + rounding)); -
1153 int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + rounding)); -
1154 -
1155 if (iTopBound > iBottomBound)
partially evaluated: iTopBound > iBottomBound
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1156 return;
never executed: return;
0
1157 -
1158 d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer); -
1159 -
1160 int subpathStart = 0; -
1161 QT_FT_Vector last = { 0, 0 }; -
1162 for (int i = 0; i < path.elementCount(); ++i) {
evaluated: i < path.elementCount()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
1163 switch (path.elementAt(i).type) { -
1164 case QPainterPath::LineToElement: -
1165 { -
1166 QT_FT_Vector p1 = last; -
1167 QT_FT_Vector p2 = PointToVector(path.elementAt(i)); -
1168 d->scanConverter.mergeLine(p1, p2); -
1169 last = p2; -
1170 break;
executed: break;
Execution Count:4
4
1171 } -
1172 case QPainterPath::MoveToElement: -
1173 { -
1174 if (i != 0) {
partially evaluated: i != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1175 QT_FT_Vector first = PointToVector(path.elementAt(subpathStart)); -
1176 -
1177 if (first.x != last.x || first.y != last.y)
never evaluated: first.x != last.x
never evaluated: first.y != last.y
0
1178 d->scanConverter.mergeLine(last, first);
never executed: d->scanConverter.mergeLine(last, first);
0
1179 }
never executed: }
0
1180 subpathStart = i; -
1181 last = PointToVector(path.elementAt(i)); -
1182 break;
executed: break;
Execution Count:1
1
1183 } -
1184 case QPainterPath::CurveToElement: -
1185 { -
1186 QT_FT_Vector p1 = last; -
1187 QT_FT_Vector p2 = PointToVector(path.elementAt(i)); -
1188 QT_FT_Vector p3 = PointToVector(path.elementAt(++i)); -
1189 QT_FT_Vector p4 = PointToVector(path.elementAt(++i)); -
1190 d->scanConverter.mergeCurve(p1, p2, p3, p4); -
1191 last = p4; -
1192 break;
never executed: break;
0
1193 } -
1194 default: -
1195 qt_noop(); -
1196 break;
never executed: break;
0
1197 } -
1198 }
executed: }
Execution Count:5
5
1199 -
1200 QT_FT_Vector first = PointToVector(path.elementAt(subpathStart)); -
1201 -
1202 -
1203 if (first.x != last.x || first.y != last.y)
partially evaluated: first.x != last.x
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: first.y != last.y
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1204 d->scanConverter.mergeLine(last, first);
never executed: d->scanConverter.mergeLine(last, first);
0
1205 -
1206 d->scanConverter.end(); -
1207}
executed: }
Execution Count:1
1
1208 -
1209 -
1210 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial