painting/qcosmeticstroker.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4static inline uint sourceOver(uint d, uint color) -
5{ -
6 return color + BYTE_MUL(d, qAlpha(~color));
executed: return color + BYTE_MUL(d, qAlpha(~color));
Execution Count:46378
46378
7} -
8 -
9inline static int F16Dot16FixedDiv(int x, int y) -
10{ -
11 if (qAbs(x) > 0x7fff)
partially evaluated: qAbs(x) > 0x7fff
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:152545
0-152545
12 return (((qlonglong)x) << 16) / y;
never executed: return (((qlonglong)x) << 16) / y;
0
13 return (x << 16) / y;
executed: return (x << 16) / y;
Execution Count:152545
152545
14} -
15 -
16typedef void (*DrawPixel)(QCosmeticStroker *stroker, int x, int y, int coverage); -
17 -
18namespace { -
19 -
20struct Dasher { -
21 QCosmeticStroker *stroker; -
22 int *pattern; -
23 int offset; -
24 int dashIndex; -
25 int dashOn; -
26 -
27 Dasher(QCosmeticStroker *s, bool reverse, int start, int stop) -
28 : stroker(s) -
29 { -
30 int delta = stop - start; -
31 if (reverse) {
evaluated: reverse
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:10
8-10
32 pattern = stroker->reversePattern; -
33 offset = stroker->patternLength - stroker->patternOffset - delta - ((start & 63) - 32); -
34 dashOn = 0; -
35 } else {
executed: }
Execution Count:8
8
36 pattern = stroker->pattern; -
37 offset = stroker->patternOffset - ((start & 63) - 32); -
38 dashOn = 1; -
39 }
executed: }
Execution Count:10
10
40 offset %= stroker->patternLength; -
41 if (offset < 0)
evaluated: offset < 0
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:10
8-10
42 offset += stroker->patternLength;
executed: offset += stroker->patternLength;
Execution Count:8
8
43 -
44 dashIndex = 0; -
45 while (offset>= pattern[dashIndex])
evaluated: offset>= pattern[dashIndex]
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:18
2-18
46 ++dashIndex;
executed: ++dashIndex;
Execution Count:2
2
47 -
48 -
49 stroker->patternOffset += delta; -
50 stroker->patternOffset %= stroker->patternLength; -
51 }
executed: }
Execution Count:18
18
52 -
53 bool on() const { -
54 return (dashIndex + dashOn) & 1;
executed: return (dashIndex + dashOn) & 1;
Execution Count:618
618
55 } -
56 void adjust() { -
57 offset += 64; -
58 if (offset >= pattern[dashIndex]) {
evaluated: offset >= pattern[dashIndex]
TRUEFALSE
yes
Evaluation Count:202
yes
Evaluation Count:416
202-416
59 ++dashIndex; -
60 dashIndex %= stroker->patternSize; -
61 }
executed: }
Execution Count:202
202
62 offset %= stroker->patternLength; -
63 -
64 }
executed: }
Execution Count:618
618
65}; -
66 -
67struct NoDasher { -
68 NoDasher(QCosmeticStroker *, bool, int, int) {} -
69 bool on() const { return true; }
executed: return true;
Execution Count:7493218
7493218
70 void adjust(int = 0) {} -
71}; -
72 -
73}; -
74 -
75template<DrawPixel drawPixel, class Dasher> -
76static void drawLine(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); -
77template<DrawPixel drawPixel, class Dasher> -
78static void drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); -
79 -
80inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) -
81{ -
82 const QRect &cl = stroker->clip; -
83 if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
evaluated: x < cl.x()
TRUEFALSE
yes
Evaluation Count:64154
yes
Evaluation Count:7427907
evaluated: x > cl.right()
TRUEFALSE
yes
Evaluation Count:179541
yes
Evaluation Count:7248366
evaluated: y < cl.y()
TRUEFALSE
yes
Evaluation Count:33043
yes
Evaluation Count:7215323
evaluated: y > cl.bottom()
TRUEFALSE
yes
Evaluation Count:98303
yes
Evaluation Count:7117020
33043-7427907
84 return;
executed: return;
Execution Count:375041
375041
85 -
86 int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; -
87 int lasty = stroker->spans[stroker->current_span-1].y; -
88 -
89 if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) {
evaluated: stroker->current_span == QCosmeticStroker::NSPANS
TRUEFALSE
yes
Evaluation Count:5995
yes
Evaluation Count:7111025
evaluated: y < lasty
TRUEFALSE
yes
Evaluation Count:101491
yes
Evaluation Count:7009534
evaluated: y == lasty
TRUEFALSE
yes
Evaluation Count:4441238
yes
Evaluation Count:2568296
evaluated: x < lastx
TRUEFALSE
yes
Evaluation Count:1378
yes
Evaluation Count:4439860
1378-7111025
90 stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); -
91 stroker->current_span = 0; -
92 }
executed: }
Execution Count:108864
108864
93 -
94 stroker->spans[stroker->current_span].x = ushort(x); -
95 stroker->spans[stroker->current_span].len = 1; -
96 stroker->spans[stroker->current_span].y = y; -
97 stroker->spans[stroker->current_span].coverage = coverage*stroker->opacity >> 8; -
98 ++stroker->current_span; -
99}
executed: }
Execution Count:7117020
7117020
100 -
101inline void drawPixelARGB32(QCosmeticStroker *stroker, int x, int y, int coverage) -
102{ -
103 const QRect &cl = stroker->clip; -
104 if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
evaluated: x < cl.x()
TRUEFALSE
yes
Evaluation Count:3150
yes
Evaluation Count:33982
evaluated: x > cl.right()
TRUEFALSE
yes
Evaluation Count:2256
yes
Evaluation Count:31726
evaluated: y < cl.y()
TRUEFALSE
yes
Evaluation Count:1866
yes
Evaluation Count:29860
evaluated: y > cl.bottom()
TRUEFALSE
yes
Evaluation Count:2054
yes
Evaluation Count:27806
1866-33982
105 return;
executed: return;
Execution Count:9326
9326
106 -
107 int offset = x + stroker->ppl*y; -
108 uint c = BYTE_MUL(stroker->color, coverage); -
109 stroker->pixels[offset] = sourceOver(stroker->pixels[offset], c); -
110}
executed: }
Execution Count:27806
27806
111 -
112inline void drawPixelARGB32Opaque(QCosmeticStroker *stroker, int x, int y, int) -
113{ -
114 const QRect &cl = stroker->clip; -
115 if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
evaluated: x < cl.x()
TRUEFALSE
yes
Evaluation Count:76
yes
Evaluation Count:21528
evaluated: x > cl.right()
TRUEFALSE
yes
Evaluation Count:1528
yes
Evaluation Count:20000
evaluated: y < cl.y()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:19976
evaluated: y > cl.bottom()
TRUEFALSE
yes
Evaluation Count:1404
yes
Evaluation Count:18572
24-21528
116 return;
executed: return;
Execution Count:3032
3032
117 -
118 int offset = x + stroker->ppl*y; -
119 stroker->pixels[offset] = sourceOver(stroker->pixels[offset], stroker->color); -
120}
executed: }
Execution Count:18572
18572
121 -
122enum StrokeSelection { -
123 Aliased = 0, -
124 AntiAliased = 1, -
125 Solid = 0, -
126 Dashed = 2, -
127 RegularDraw = 0, -
128 FastDraw = 4 -
129}; -
130 -
131static StrokeLine strokeLine(int strokeSelection) -
132{ -
133 StrokeLine stroke; -
134 -
135 switch (strokeSelection) { -
136 case Aliased|Solid|RegularDraw: -
137 stroke = &::drawLine<drawPixel, NoDasher>; -
138 break;
executed: break;
Execution Count:71033
71033
139 case Aliased|Solid|FastDraw: -
140 stroke = &::drawLine<drawPixelARGB32Opaque, NoDasher>; -
141 break;
executed: break;
Execution Count:248
248
142 case Aliased|Dashed|RegularDraw: -
143 stroke = &::drawLine<drawPixel, Dasher>; -
144 break;
executed: break;
Execution Count:19
19
145 case Aliased|Dashed|FastDraw: -
146 stroke = &::drawLine<drawPixelARGB32Opaque, Dasher>; -
147 break;
executed: break;
Execution Count:4
4
148 case AntiAliased|Solid|RegularDraw: -
149 stroke = &::drawLineAA<drawPixel, NoDasher>; -
150 break;
executed: break;
Execution Count:177
177
151 case AntiAliased|Solid|FastDraw: -
152 stroke = &::drawLineAA<drawPixelARGB32, NoDasher>; -
153 break;
executed: break;
Execution Count:219
219
154 case AntiAliased|Dashed|RegularDraw: -
155 stroke = &::drawLineAA<drawPixel, Dasher>; -
156 break;
never executed: break;
0
157 case AntiAliased|Dashed|FastDraw: -
158 stroke = &::drawLineAA<drawPixelARGB32, Dasher>; -
159 break;
never executed: break;
0
160 default: -
161 qt_noop(); -
162 stroke = 0; -
163 }
never executed: }
0
164 return stroke;
executed: return stroke;
Execution Count:71700
71700
165} -
166 -
167void QCosmeticStroker::setup() -
168{ -
169 blend = state->penData.blend; -
170 if (state->clip && state->clip->enabled && state->clip->hasRectClip && !state->clip->clipRect.isEmpty()) {
evaluated: state->clip
TRUEFALSE
yes
Evaluation Count:9194
yes
Evaluation Count:62506
partially evaluated: state->clip->enabled
TRUEFALSE
yes
Evaluation Count:9194
no
Evaluation Count:0
evaluated: state->clip->hasRectClip
TRUEFALSE
yes
Evaluation Count:8526
yes
Evaluation Count:668
partially evaluated: !state->clip->clipRect.isEmpty()
TRUEFALSE
yes
Evaluation Count:8526
no
Evaluation Count:0
0-62506
171 clip &= state->clip->clipRect; -
172 blend = state->penData.unclipped_blend; -
173 }
executed: }
Execution Count:8526
8526
174 -
175 int strokeSelection = 0; -
176 if (blend == state->penData.unclipped_blend
evaluated: blend == state->penData.unclipped_blend
TRUEFALSE
yes
Evaluation Count:8526
yes
Evaluation Count:63174
8526-63174
177 && state->penData.type == QSpanData::Solid
evaluated: state->penData.type == QSpanData::Solid
TRUEFALSE
yes
Evaluation Count:8520
yes
Evaluation Count:6
6-8520
178 && (state->penData.rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
evaluated: state->penData.rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
TRUEFALSE
yes
Evaluation Count:442
yes
Evaluation Count:8078
442-8078
179 || state->penData.rasterBuffer->format == QImage::Format_RGB32)
evaluated: state->penData.rasterBuffer->format == QImage::Format_RGB32
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:8049
29-8049
180 && state->compositionMode() == QPainter::CompositionMode_SourceOver)
partially evaluated: state->compositionMode() == QPainter::CompositionMode_SourceOver
TRUEFALSE
yes
Evaluation Count:471
no
Evaluation Count:0
0-471
181 strokeSelection |= FastDraw;
executed: strokeSelection |= FastDraw;
Execution Count:471
471
182 -
183 if (state->renderHints & QPainter::Antialiasing)
evaluated: state->renderHints & QPainter::Antialiasing
TRUEFALSE
yes
Evaluation Count:396
yes
Evaluation Count:71304
396-71304
184 strokeSelection |= AntiAliased;
executed: strokeSelection |= AntiAliased;
Execution Count:396
396
185 -
186 const QVector<qreal> &penPattern = state->lastPen.dashPattern(); -
187 if (penPattern.isEmpty()) {
evaluated: penPattern.isEmpty()
TRUEFALSE
yes
Evaluation Count:71677
yes
Evaluation Count:23
23-71677
188 qt_noop(); -
189 pattern = 0; -
190 reversePattern = 0; -
191 patternLength = 0; -
192 patternSize = 0; -
193 } else {
executed: }
Execution Count:71677
71677
194 pattern = (int *)malloc(penPattern.size()*sizeof(int)); -
195 reversePattern = (int *)malloc(penPattern.size()*sizeof(int)); -
196 patternSize = penPattern.size(); -
197 -
198 patternLength = 0; -
199 for (int i = 0; i < patternSize; ++i) {
evaluated: i < patternSize
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:23
23-46
200 patternLength += (int) qMax(1. , penPattern.at(i)*64.); -
201 pattern[i] = patternLength; -
202 }
executed: }
Execution Count:46
46
203 patternLength = 0; -
204 for (int i = 0; i < patternSize; ++i) {
evaluated: i < patternSize
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:23
23-46
205 patternLength += (int) qMax(1., penPattern.at(patternSize - 1 - i)*64.); -
206 reversePattern[i] = patternLength; -
207 }
executed: }
Execution Count:46
46
208 strokeSelection |= Dashed; -
209 -
210 }
executed: }
Execution Count:23
23
211 -
212 stroke = strokeLine(strokeSelection); -
213 -
214 qreal width = state->lastPen.widthF(); -
215 if (width == 0)
evaluated: width == 0
TRUEFALSE
yes
Evaluation Count:1879
yes
Evaluation Count:69821
1879-69821
216 opacity = 256;
executed: opacity = 256;
Execution Count:1879
1879
217 else if (qt_pen_is_cosmetic(state->lastPen, state->renderHints))
evaluated: qt_pen_is_cosmetic(state->lastPen, state->renderHints)
TRUEFALSE
yes
Evaluation Count:990
yes
Evaluation Count:68831
990-68831
218 opacity = (int) 256*width;
executed: opacity = (int) 256*width;
Execution Count:990
990
219 else -
220 opacity = (int) 256*width*state->txscale;
executed: opacity = (int) 256*width*state->txscale;
Execution Count:68831
68831
221 opacity = qBound(0, opacity, 256); -
222 -
223 drawCaps = state->lastPen.capStyle() != Qt::FlatCap; -
224 -
225 if (strokeSelection & FastDraw) {
evaluated: strokeSelection & FastDraw
TRUEFALSE
yes
Evaluation Count:471
yes
Evaluation Count:71229
471-71229
226 color = INTERPOLATE_PIXEL_256(state->penData.solid.color, opacity, 0, 0); -
227 QRasterBuffer *buffer = state->penData.rasterBuffer; -
228 pixels = (uint *)buffer->buffer(); -
229 ppl = buffer->bytesPerLine()>>2; -
230 }
executed: }
Execution Count:471
471
231 -
232 -
233 -
234 -
235 -
236 xmin = deviceRect.left() - 1; -
237 xmax = deviceRect.right() + 2; -
238 ymin = deviceRect.top() - 1; -
239 ymax = deviceRect.bottom() + 2; -
240 -
241 lastPixel.x = -1; -
242}
executed: }
Execution Count:71700
71700
243 -
244 -
245bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2) -
246{ -
247 -
248 -
249 if (x1 < xmin) {
evaluated: x1 < xmin
TRUEFALSE
yes
Evaluation Count:141
yes
Evaluation Count:155156
141-155156
250 if (x2 <= xmin)
evaluated: x2 <= xmin
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:72
69-72
251 goto clipped;
executed: goto clipped;
Execution Count:69
69
252 y1 += (y2 - y1)/(x2 - x1) * (xmin - x1); -
253 x1 = xmin; -
254 } else if (x1 > xmax) {
evaluated: x1 > xmax
TRUEFALSE
yes
Evaluation Count:1196
yes
Evaluation Count:153960
executed: }
Execution Count:72
72-153960
255 if (x2 >= xmax)
evaluated: x2 >= xmax
TRUEFALSE
yes
Evaluation Count:1177
yes
Evaluation Count:19
19-1177
256 goto clipped;
executed: goto clipped;
Execution Count:1177
1177
257 y1 += (y2 - y1)/(x2 - x1) * (xmax - x1); -
258 x1 = xmax; -
259 }
executed: }
Execution Count:19
19
260 if (x2 < xmin) {
evaluated: x2 < xmin
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:154028
23-154028
261 lastPixel.x = -1; -
262 y2 += (y2 - y1)/(x2 - x1) * (xmin - x2); -
263 x2 = xmin; -
264 } else if (x2 > xmax) {
evaluated: x2 > xmax
TRUEFALSE
yes
Evaluation Count:1135
yes
Evaluation Count:152893
executed: }
Execution Count:23
23-152893
265 lastPixel.x = -1; -
266 y2 += (y2 - y1)/(x2 - x1) * (xmax - x2); -
267 x2 = xmax; -
268 }
executed: }
Execution Count:1135
1135
269 -
270 if (y1 < ymin) {
evaluated: y1 < ymin
TRUEFALSE
yes
Evaluation Count:138
yes
Evaluation Count:153913
138-153913
271 if (y2 <= ymin)
evaluated: y2 <= ymin
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:35
35-103
272 goto clipped;
executed: goto clipped;
Execution Count:103
103
273 x1 += (x2 - x1)/(y2 - y1) * (ymin - y1); -
274 y1 = ymin; -
275 } else if (y1 > ymax) {
evaluated: y1 > ymax
TRUEFALSE
yes
Evaluation Count:2091
yes
Evaluation Count:151822
executed: }
Execution Count:35
35-151822
276 if (y2 >= ymax)
evaluated: y2 >= ymax
TRUEFALSE
yes
Evaluation Count:1173
yes
Evaluation Count:918
918-1173
277 goto clipped;
executed: goto clipped;
Execution Count:1173
1173
278 x1 += (x2 - x1)/(y2 - y1) * (ymax - y1); -
279 y1 = ymax; -
280 }
executed: }
Execution Count:918
918
281 if (y2 < ymin) {
evaluated: y2 < ymin
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:152705
70-152705
282 lastPixel.x = -1; -
283 x2 += (x2 - x1)/(y2 - y1) * (ymin - y2); -
284 y2 = ymin; -
285 } else if (y2 > ymax) {
evaluated: y2 > ymax
TRUEFALSE
yes
Evaluation Count:85
yes
Evaluation Count:152620
executed: }
Execution Count:70
70-152620
286 lastPixel.x = -1; -
287 x2 += (x2 - x1)/(y2 - y1) * (ymax - y2); -
288 y2 = ymax; -
289 }
executed: }
Execution Count:85
85
290 -
291 return false;
executed: return false;
Execution Count:152775
152775
292 -
293 clipped: -
294 lastPixel.x = -1; -
295 return true;
executed: return true;
Execution Count:2522
2522
296} -
297 -
298 -
299void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2) -
300{ -
301 if (p1 == p2) {
evaluated: p1 == p2
TRUEFALSE
yes
Evaluation Count:81
yes
Evaluation Count:6447
81-6447
302 drawPoints(&p1, 1); -
303 return;
executed: return;
Execution Count:81
81
304 } -
305 -
306 QPointF start = p1 * state->matrix; -
307 QPointF end = p2 * state->matrix; -
308 -
309 patternOffset = state->lastPen.dashOffset()*64; -
310 lastPixel.x = -1; -
311 -
312 stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0); -
313 -
314 blend(current_span, spans, &state->penData); -
315 current_span = 0; -
316}
executed: }
Execution Count:6447
6447
317 -
318void QCosmeticStroker::drawPoints(const QPoint *points, int num) -
319{ -
320 const QPoint *end = points + num; -
321 while (points < end) {
evaluated: points < end
TRUEFALSE
yes
Evaluation Count:143
yes
Evaluation Count:135
135-143
322 QPointF p = QPointF(*points) * state->matrix; -
323 drawPixel(this, qRound(p.x()), qRound(p.y()), 255); -
324 ++points; -
325 }
executed: }
Execution Count:143
143
326 -
327 blend(current_span, spans, &state->penData); -
328 current_span = 0; -
329}
executed: }
Execution Count:135
135
330 -
331void QCosmeticStroker::drawPoints(const QPointF *points, int num) -
332{ -
333 const QPointF *end = points + num; -
334 while (points < end) {
evaluated: points < end
TRUEFALSE
yes
Evaluation Count:81
yes
Evaluation Count:81
81
335 QPointF p = (*points) * state->matrix; -
336 drawPixel(this, qRound(p.x()), qRound(p.y()), 255); -
337 ++points; -
338 }
executed: }
Execution Count:81
81
339 -
340 blend(current_span, spans, &state->penData); -
341 current_span = 0; -
342}
executed: }
Execution Count:81
81
343 -
344void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal ry2) -
345{ -
346 -
347 -
348 -
349 -
350 -
351 -
352 -
353 lastPixel.x = -1; -
354 lastPixel.y = -1; -
355 -
356 if (clipLine(rx1, ry1, rx2, ry2))
evaluated: clipLine(rx1, ry1, rx2, ry2)
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:4245
42-4245
357 return;
executed: return;
Execution Count:42
42
358 -
359 const int half = legacyRounding ? 31 : 0;
evaluated: legacyRounding
TRUEFALSE
yes
Evaluation Count:834
yes
Evaluation Count:3411
834-3411
360 int x1 = ((int)((rx1)*64.)) + half; -
361 int y1 = ((int)((ry1)*64.)) + half; -
362 int x2 = ((int)((rx2)*64.)) + half; -
363 int y2 = ((int)((ry2)*64.)) + half; -
364 -
365 int dx = qAbs(x2 - x1); -
366 int dy = qAbs(y2 - y1); -
367 -
368 if (dx < dy) {
evaluated: dx < dy
TRUEFALSE
yes
Evaluation Count:2891
yes
Evaluation Count:1354
1354-2891
369 -
370 bool swapped = false; -
371 if (y1 > y2) {
evaluated: y1 > y2
TRUEFALSE
yes
Evaluation Count:2787
yes
Evaluation Count:104
104-2787
372 swapped = true; -
373 qSwap(y1, y2); -
374 qSwap(x1, x2); -
375 }
executed: }
Execution Count:2787
2787
376 int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); -
377 int x = x1 << 10; -
378 -
379 int y = (y1 + 32) >> 6; -
380 int ys = (y2 + 32) >> 6; -
381 -
382 if (y != ys) {
evaluated: y != ys
TRUEFALSE
yes
Evaluation Count:2890
yes
Evaluation Count:1
1-2890
383 x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; -
384 -
385 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:2786
yes
Evaluation Count:104
104-2786
386 lastPixel.x = x >> 16; -
387 lastPixel.y = y; -
388 lastDir = QCosmeticStroker::BottomToTop; -
389 } else {
executed: }
Execution Count:2786
2786
390 lastPixel.x = (x + (ys - y - 1)*xinc) >> 16; -
391 lastPixel.y = ys - 1; -
392 lastDir = QCosmeticStroker::TopToBottom; -
393 }
executed: }
Execution Count:104
104
394 lastAxisAligned = qAbs(xinc) < (1 << 14); -
395 }
executed: }
Execution Count:2890
2890
396 } else {
executed: }
Execution Count:2891
2891
397 -
398 if (!dx)
evaluated: !dx
TRUEFALSE
yes
Evaluation Count:90
yes
Evaluation Count:1264
90-1264
399 return;
executed: return;
Execution Count:90
90
400 -
401 bool swapped = false; -
402 if (x1 > x2) {
evaluated: x1 > x2
TRUEFALSE
yes
Evaluation Count:834
yes
Evaluation Count:430
430-834
403 swapped = true; -
404 qSwap(x1, x2); -
405 qSwap(y1, y2); -
406 }
executed: }
Execution Count:834
834
407 int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); -
408 int y = y1 << 10; -
409 -
410 int x = (x1 + 32) >> 6; -
411 int xs = (x2 + 32) >> 6; -
412 -
413 if (x != xs) {
evaluated: x != xs
TRUEFALSE
yes
Evaluation Count:1150
yes
Evaluation Count:114
114-1150
414 y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; -
415 -
416 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:834
yes
Evaluation Count:316
316-834
417 lastPixel.x = x; -
418 lastPixel.y = y >> 16; -
419 lastDir = QCosmeticStroker::RightToLeft; -
420 } else {
executed: }
Execution Count:834
834
421 lastPixel.x = xs - 1; -
422 lastPixel.y = (y + (xs - x - 1)*yinc) >> 16; -
423 lastDir = QCosmeticStroker::LeftToRight; -
424 }
executed: }
Execution Count:316
316
425 lastAxisAligned = qAbs(yinc) < (1 << 14); -
426 }
executed: }
Execution Count:1150
1150
427 }
executed: }
Execution Count:1264
1264
428 -
429} -
430 -
431static inline const QPainterPath::ElementType *subPath(const QPainterPath::ElementType *t, const QPainterPath::ElementType *end, -
432 const qreal *points, bool *closed) -
433{ -
434 const QPainterPath::ElementType *start = t; -
435 ++t; -
436 -
437 -
438 while (t < end) {
evaluated: t < end
TRUEFALSE
yes
Evaluation Count:4874
yes
Evaluation Count:345
345-4874
439 if (*t == QPainterPath::MoveToElement)
evaluated: *t == QPainterPath::MoveToElement
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:4844
30-4844
440 break;
executed: break;
Execution Count:30
30
441 ++t; -
442 }
executed: }
Execution Count:4844
4844
443 -
444 int offset = t - start - 1; -
445 -
446 *closed = (points[0] == points[2*offset] && points[1] == points[2*offset + 1]);
evaluated: points[0] == points[2*offset]
TRUEFALSE
yes
Evaluation Count:339
yes
Evaluation Count:36
evaluated: points[1] == points[2*offset + 1]
TRUEFALSE
yes
Evaluation Count:315
yes
Evaluation Count:24
24-339
447 -
448 return t;
executed: return t;
Execution Count:375
375
449} -
450 -
451void QCosmeticStroker::drawPath(const QVectorPath &path) -
452{ -
453 -
454 -
455 if (path.isEmpty())
partially evaluated: path.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65526
0-65526
456 return;
never executed: return;
0
457 -
458 const qreal *points = path.points(); -
459 const QPainterPath::ElementType *type = path.elements(); -
460 -
461 if (type) {
evaluated: type
TRUEFALSE
yes
Evaluation Count:345
yes
Evaluation Count:65181
345-65181
462 const QPainterPath::ElementType *end = type + path.elementCount(); -
463 -
464 while (type < end) {
evaluated: type < end
TRUEFALSE
yes
Evaluation Count:375
yes
Evaluation Count:345
345-375
465 qt_noop(); -
466 -
467 QPointF p = QPointF(points[0], points[1]) * state->matrix; -
468 patternOffset = state->lastPen.dashOffset()*64; -
469 lastPixel.x = -1; -
470 -
471 bool closed; -
472 const QPainterPath::ElementType *e = subPath(type, end, points, &closed); -
473 if (closed) {
evaluated: closed
TRUEFALSE
yes
Evaluation Count:315
yes
Evaluation Count:60
60-315
474 const qreal *p = points + 2*(e-type); -
475 QPointF p1 = QPointF(p[-4], p[-3]) * state->matrix; -
476 QPointF p2 = QPointF(p[-2], p[-1]) * state->matrix; -
477 calculateLastPoint(p1.x(), p1.y(), p2.x(), p2.y()); -
478 }
executed: }
Execution Count:315
315
479 int caps = (!closed & drawCaps) ? CapBegin : NoCaps;
evaluated: (!closed & drawCaps)
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:315
60-315
480 -
481 -
482 points += 2; -
483 ++type; -
484 -
485 while (type < e) {
evaluated: type < e
TRUEFALSE
yes
Evaluation Count:2436
yes
Evaluation Count:375
375-2436
486 QPointF p2 = QPointF(points[0], points[1]) * state->matrix; -
487 switch (*type) { -
488 case QPainterPath::MoveToElement: -
489 qt_noop(); -
490 break;
never executed: break;
0
491 -
492 case QPainterPath::LineToElement: -
493 if (!closed && drawCaps && type == e - 1)
evaluated: !closed
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:1184
partially evaluated: drawCaps
TRUEFALSE
yes
Evaluation Count:48
no
Evaluation Count:0
partially evaluated: type == e - 1
TRUEFALSE
yes
Evaluation Count:48
no
Evaluation Count:0
0-1184
494 caps |= CapEnd;
executed: caps |= CapEnd;
Execution Count:48
48
495 stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); -
496 p = p2; -
497 points += 2; -
498 ++type; -
499 break;
executed: break;
Execution Count:1232
1232
500 -
501 case QPainterPath::CurveToElement: { -
502 if (!closed && drawCaps && type == e - 3)
evaluated: !closed
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:1168
partially evaluated: drawCaps
TRUEFALSE
yes
Evaluation Count:36
no
Evaluation Count:0
evaluated: type == e - 3
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:24
0-1168
503 caps |= CapEnd;
executed: caps |= CapEnd;
Execution Count:12
12
504 QPointF p3 = QPointF(points[2], points[3]) * state->matrix; -
505 QPointF p4 = QPointF(points[4], points[5]) * state->matrix; -
506 renderCubic(p, p2, p3, p4, caps); -
507 p = p4; -
508 type += 3; -
509 points += 6; -
510 break;
executed: break;
Execution Count:1204
1204
511 } -
512 case QPainterPath::CurveToDataElement: -
513 qt_noop(); -
514 break;
never executed: break;
0
515 } -
516 caps = NoCaps; -
517 }
executed: }
Execution Count:2436
2436
518 }
executed: }
Execution Count:375
375
519 } else {
executed: }
Execution Count:345
345
520 QPointF p = QPointF(points[0], points[1]) * state->matrix; -
521 QPointF movedTo = p; -
522 patternOffset = state->lastPen.dashOffset()*64; -
523 lastPixel.x = -1; -
524 -
525 const qreal *end = points + 2*path.elementCount(); -
526 -
527 bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]);
evaluated: path.hasImplicitClose()
TRUEFALSE
yes
Evaluation Count:3967
yes
Evaluation Count:61214
evaluated: points[0] == end[-2]
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:61209
partially evaluated: points[1] == end[-1]
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-61214
528 int caps = (!closed & drawCaps) ? CapBegin : NoCaps;
evaluated: (!closed & drawCaps)
TRUEFALSE
yes
Evaluation Count:61209
yes
Evaluation Count:3972
3972-61209
529 if (closed) {
evaluated: closed
TRUEFALSE
yes
Evaluation Count:3972
yes
Evaluation Count:61209
3972-61209
530 QPointF p2 = QPointF(end[-2], end[-1]) * state->matrix; -
531 calculateLastPoint(p2.x(), p2.y(), p.x(), p.y()); -
532 }
executed: }
Execution Count:3972
3972
533 -
534 points += 2; -
535 while (points < end) {
evaluated: points < end
TRUEFALSE
yes
Evaluation Count:135464
yes
Evaluation Count:65181
65181-135464
536 QPointF p2 = QPointF(points[0], points[1]) * state->matrix; -
537 -
538 if (!closed && drawCaps && points == end - 2)
evaluated: !closed
TRUEFALSE
yes
Evaluation Count:123250
yes
Evaluation Count:12214
partially evaluated: drawCaps
TRUEFALSE
yes
Evaluation Count:123250
no
Evaluation Count:0
evaluated: points == end - 2
TRUEFALSE
yes
Evaluation Count:61209
yes
Evaluation Count:62041
0-123250
539 caps |= CapEnd;
executed: caps |= CapEnd;
Execution Count:61209
61209
540 -
541 stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); -
542 -
543 p = p2; -
544 points += 2; -
545 caps = NoCaps; -
546 }
executed: }
Execution Count:135464
135464
547 if (path.hasImplicitClose())
evaluated: path.hasImplicitClose()
TRUEFALSE
yes
Evaluation Count:3967
yes
Evaluation Count:61214
3967-61214
548 stroke(this, p.x(), p.y(), movedTo.x(), movedTo.y(), NoCaps);
executed: stroke(this, p.x(), p.y(), movedTo.x(), movedTo.y(), NoCaps);
Execution Count:3967
3967
549 }
executed: }
Execution Count:65181
65181
550 -
551 -
552 blend(current_span, spans, &state->penData); -
553 current_span = 0; -
554}
executed: }
Execution Count:65526
65526
555 -
556void QCosmeticStroker::renderCubic(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4, int caps) -
557{ -
558 -
559 const int maxSubDivisions = 6; -
560 PointF points[3*maxSubDivisions + 4]; -
561 -
562 points[3].x = p1.x(); -
563 points[3].y = p1.y(); -
564 points[2].x = p2.x(); -
565 points[2].y = p2.y(); -
566 points[1].x = p3.x(); -
567 points[1].y = p3.y(); -
568 points[0].x = p4.x(); -
569 points[0].y = p4.y(); -
570 -
571 PointF *p = points; -
572 int level = maxSubDivisions; -
573 -
574 renderCubicSubdivision(p, level, caps); -
575}
executed: }
Execution Count:1204
1204
576 -
577static void splitCubic(QCosmeticStroker::PointF *points) -
578{ -
579 const qreal half = .5; -
580 qreal a, b, c, d; -
581 -
582 points[6].x = points[3].x; -
583 c = points[1].x; -
584 d = points[2].x; -
585 points[1].x = a = ( points[0].x + c ) * half; -
586 points[5].x = b = ( points[3].x + d ) * half; -
587 c = ( c + d ) * half; -
588 points[2].x = a = ( a + c ) * half; -
589 points[4].x = b = ( b + c ) * half; -
590 points[3].x = ( a + b ) * half; -
591 -
592 points[6].y = points[3].y; -
593 c = points[1].y; -
594 d = points[2].y; -
595 points[1].y = a = ( points[0].y + c ) * half; -
596 points[5].y = b = ( points[3].y + d ) * half; -
597 c = ( c + d ) * half; -
598 points[2].y = a = ( a + c ) * half; -
599 points[4].y = b = ( b + c ) * half; -
600 points[3].y = ( a + b ) * half; -
601}
executed: }
Execution Count:2696
2696
602 -
603void QCosmeticStroker::renderCubicSubdivision(QCosmeticStroker::PointF *points, int level, int caps) -
604{ -
605 if (level) {
partially evaluated: level
TRUEFALSE
yes
Evaluation Count:6596
no
Evaluation Count:0
0-6596
606 qreal dx = points[3].x - points[0].x; -
607 qreal dy = points[3].y - points[0].y; -
608 qreal len = ((qreal).25) * (qAbs(dx) + qAbs(dy)); -
609 -
610 if (qAbs(dx * (points[0].y - points[2].y) - dy * (points[0].x - points[2].x)) >= len ||
evaluated: qAbs(dx * (points[0].y - points[2].y) - dy * (points[0].x - points[2].x)) >= len
TRUEFALSE
yes
Evaluation Count:2624
yes
Evaluation Count:3972
2624-3972
611 qAbs(dx * (points[0].y - points[1].y) - dy * (points[0].x - points[1].x)) >= len) {
evaluated: qAbs(dx * (points[0].y - points[1].y) - dy * (points[0].x - points[1].x)) >= len
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:3900
72-3900
612 splitCubic(points); -
613 -
614 --level; -
615 renderCubicSubdivision(points + 3, level, caps & CapBegin); -
616 renderCubicSubdivision(points, level, caps & CapEnd); -
617 return;
executed: return;
Execution Count:2696
2696
618 } -
619 }
executed: }
Execution Count:3900
3900
620 -
621 stroke(this, points[3].x, points[3].y, points[0].x, points[0].y, caps); -
622}
executed: }
Execution Count:3900
3900
623 -
624static inline int swapCaps(int caps) -
625{ -
626 return ((caps & QCosmeticStroker::CapBegin) << 1) | 71030
627 ((caps & QCosmeticStroker::CapEnd) >> 1);
executed: return ((caps & QCosmeticStroker::CapBegin) << 1) | ((caps & QCosmeticStroker::CapEnd) >> 1);
Execution Count:71030
71030
628} -
629 -
630 -
631static inline void capAdjust(int caps, int &x1, int &x2, int &y, int yinc) -
632{ -
633 if (caps & QCosmeticStroker::CapBegin) {
evaluated: caps & QCosmeticStroker::CapBegin
TRUEFALSE
yes
Evaluation Count:66539
yes
Evaluation Count:81851
66539-81851
634 x1 -= 32; -
635 y -= yinc >> 1; -
636 }
executed: }
Execution Count:66539
66539
637 if (caps & QCosmeticStroker::CapEnd) {
evaluated: caps & QCosmeticStroker::CapEnd
TRUEFALSE
yes
Evaluation Count:67574
yes
Evaluation Count:80816
67574-80816
638 x2 += 32; -
639 }
executed: }
Execution Count:67574
67574
640}
executed: }
Execution Count:148390
148390
641 -
642 -
643 -
644 -
645 -
646template<DrawPixel drawPixel, class Dasher> -
647static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) -
648{ -
649 if (stroker->clipLine(rx1, ry1, rx2, ry2))
evaluated: stroker->clipLine(rx1, ry1, rx2, ry2)
TRUEFALSE
yes
Evaluation Count:2128
yes
Evaluation Count:145831
2128-145831
650 return;
executed: return;
Execution Count:2128
2128
651 -
652 const int half = stroker->legacyRounding ? 31 : 0;
evaluated: stroker->legacyRounding
TRUEFALSE
yes
Evaluation Count:4066
yes
Evaluation Count:141765
4066-141765
653 int x1 = ((int)((rx1)*64.)) + half; -
654 int y1 = ((int)((ry1)*64.)) + half; -
655 int x2 = ((int)((rx2)*64.)) + half; -
656 int y2 = ((int)((ry2)*64.)) + half; -
657 -
658 int dx = qAbs(x2 - x1); -
659 int dy = qAbs(y2 - y1); -
660 -
661 QCosmeticStroker::Point last = stroker->lastPixel; -
662 -
663 -
664 -
665 if (dx < dy) {
evaluated: dx < dy
TRUEFALSE
yes
Evaluation Count:70617
yes
Evaluation Count:75214
70617-75214
666 -
667 QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom; -
668 -
669 bool swapped = false; -
670 if (y1 > y2) {
evaluated: y1 > y2
TRUEFALSE
yes
Evaluation Count:64514
yes
Evaluation Count:6103
6103-64514
671 swapped = true; -
672 qSwap(y1, y2); -
673 qSwap(x1, x2); -
674 caps = swapCaps(caps); -
675 dir = QCosmeticStroker::BottomToTop; -
676 }
executed: }
Execution Count:64514
64514
677 int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); -
678 int x = x1 << 10; -
679 -
680 if ((stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir)
evaluated: (stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir
TRUEFALSE
yes
Evaluation Count:252
yes
Evaluation Count:70365
252-70365
681 caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
executed: caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
Execution Count:252
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:154
yes
Evaluation Count:98
98-252
682 -
683 capAdjust(caps, y1, y2, x, xinc); -
684 -
685 int y = (y1 + 32) >> 6; -
686 int ys = (y2 + 32) >> 6; -
687 -
688 if (y != ys) {
evaluated: y != ys
TRUEFALSE
yes
Evaluation Count:70603
yes
Evaluation Count:14
14-70603
689 x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; -
690 -
691 -
692 QCosmeticStroker::Point first; -
693 first.x = x >> 16; -
694 first.y = y; -
695 last.x = (x + (ys - y - 1)*xinc) >> 16; -
696 last.y = ys - 1; -
697 if (swapped)
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:64509
yes
Evaluation Count:6094
6094-64509
698 qSwap(first, last);
executed: qSwap(first, last);
Execution Count:64509
64509
699 -
700 bool axisAligned = qAbs(xinc) < (1 << 14); -
701 if (stroker->lastPixel.x >= 0) {
evaluated: stroker->lastPixel.x >= 0
TRUEFALSE
yes
Evaluation Count:37392
yes
Evaluation Count:33211
33211-37392
702 if (first.x == stroker->lastPixel.x &&
evaluated: first.x == stroker->lastPixel.x
TRUEFALSE
yes
Evaluation Count:4166
yes
Evaluation Count:33226
4166-33226
703 first.y == stroker->lastPixel.y) {
evaluated: first.y == stroker->lastPixel.y
TRUEFALSE
yes
Evaluation Count:553
yes
Evaluation Count:3613
553-3613
704 -
705 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:251
yes
Evaluation Count:302
251-302
706 --ys; -
707 } else {
executed: }
Execution Count:251
251
708 ++y; -
709 x += xinc; -
710 }
executed: }
Execution Count:302
302
711 } else if (stroker->lastDir != dir &&
evaluated: stroker->lastDir != dir
TRUEFALSE
yes
Evaluation Count:35475
yes
Evaluation Count:1364
1364-35475
712 (((axisAligned && stroker->lastAxisAligned) &&
evaluated: axisAligned
TRUEFALSE
yes
Evaluation Count:35072
yes
Evaluation Count:403
evaluated: stroker->lastAxisAligned
TRUEFALSE
yes
Evaluation Count:34654
yes
Evaluation Count:418
403-35072
713 stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
evaluated: stroker->lastPixel.x != first.x
TRUEFALSE
yes
Evaluation Count:32096
yes
Evaluation Count:2558
evaluated: stroker->lastPixel.y != first.y
TRUEFALSE
yes
Evaluation Count:29533
yes
Evaluation Count:2563
2558-32096
714 (qAbs(stroker->lastPixel.x - first.x) > 1 ||
partially evaluated: qAbs(stroker->lastPixel.x - first.x) > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5942
0-5942
715 qAbs(stroker->lastPixel.y - first.y) > 1))) {
evaluated: qAbs(stroker->lastPixel.y - first.y) > 1
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:5812
130-5812
716 -
717 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:29650
yes
Evaluation Count:13
13-29650
718 ++ys; -
719 } else {
executed: }
Execution Count:29650
29650
720 --y; -
721 x -= xinc; -
722 }
executed: }
Execution Count:13
13
723 } -
724 } -
725 stroker->lastDir = dir; -
726 stroker->lastAxisAligned = axisAligned; -
727 -
728 Dasher dasher(stroker, swapped, y << 6, ys << 6); -
729 -
730 do { -
731 if (dasher.on())
evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:2633002
yes
Evaluation Count:82
82-2633002
732 drawPixel(stroker, x >> 16, y, 255);
executed: drawPixel(stroker, x >> 16, y, 255);
Execution Count:2633002
2633002
733 dasher.adjust(); -
734 x += xinc; -
735 } while (++y < ys);
executed: }
Execution Count:2633084
evaluated: ++y < ys
TRUEFALSE
yes
Evaluation Count:2562481
yes
Evaluation Count:70603
70603-2633084
736 }
executed: }
Execution Count:70603
70603
737 } else {
executed: }
Execution Count:70617
70617
738 -
739 if (!dx)
evaluated: !dx
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:75120
94-75120
740 return;
executed: return;
Execution Count:94
94
741 -
742 QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight; -
743 -
744 bool swapped = false; -
745 if (x1 > x2) {
evaluated: x1 > x2
TRUEFALSE
yes
Evaluation Count:5346
yes
Evaluation Count:69774
5346-69774
746 swapped = true; -
747 qSwap(x1, x2); -
748 qSwap(y1, y2); -
749 caps = swapCaps(caps); -
750 dir = QCosmeticStroker::RightToLeft; -
751 }
executed: }
Execution Count:5346
5346
752 int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); -
753 int y = y1 << 10; -
754 -
755 if ((stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir)
evaluated: (stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir
TRUEFALSE
yes
Evaluation Count:1747
yes
Evaluation Count:73373
1747-73373
756 caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
executed: caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
Execution Count:1747
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:911
yes
Evaluation Count:836
836-1747
757 -
758 capAdjust(caps, x1, x2, y, yinc); -
759 -
760 int x = (x1 + 32) >> 6; -
761 int xs = (x2 + 32) >> 6; -
762 -
763 if (x != xs) {
evaluated: x != xs
TRUEFALSE
yes
Evaluation Count:75116
yes
Evaluation Count:4
4-75116
764 y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; -
765 -
766 -
767 QCosmeticStroker::Point first; -
768 first.x = x; -
769 first.y = y >> 16; -
770 last.x = xs - 1; -
771 last.y = (y + (xs - x - 1)*yinc) >> 16; -
772 if (swapped)
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:5344
yes
Evaluation Count:69772
5344-69772
773 qSwap(first, last);
executed: qSwap(first, last);
Execution Count:5344
5344
774 -
775 bool axisAligned = qAbs(yinc) < (1 << 14); -
776 if (stroker->lastPixel.x >= 0) {
evaluated: stroker->lastPixel.x >= 0
TRUEFALSE
yes
Evaluation Count:40588
yes
Evaluation Count:34528
34528-40588
777 if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) {
evaluated: first.x == stroker->lastPixel.x
TRUEFALSE
yes
Evaluation Count:34065
yes
Evaluation Count:6523
evaluated: first.y == stroker->lastPixel.y
TRUEFALSE
yes
Evaluation Count:33820
yes
Evaluation Count:245
245-34065
778 -
779 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:252
yes
Evaluation Count:33568
252-33568
780 --xs; -
781 } else {
executed: }
Execution Count:252
252
782 ++x; -
783 y += yinc; -
784 }
executed: }
Execution Count:33568
33568
785 } else if (stroker->lastDir != dir &&
evaluated: stroker->lastDir != dir
TRUEFALSE
yes
Evaluation Count:4072
yes
Evaluation Count:2696
2696-4072
786 (((axisAligned && stroker->lastAxisAligned) &&
evaluated: axisAligned
TRUEFALSE
yes
Evaluation Count:2915
yes
Evaluation Count:1157
evaluated: stroker->lastAxisAligned
TRUEFALSE
yes
Evaluation Count:2637
yes
Evaluation Count:278
278-2915
787 stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
evaluated: stroker->lastPixel.x != first.x
TRUEFALSE
yes
Evaluation Count:2593
yes
Evaluation Count:44
evaluated: stroker->lastPixel.y != first.y
TRUEFALSE
yes
Evaluation Count:2555
yes
Evaluation Count:38
38-2593
788 (qAbs(stroker->lastPixel.x - first.x) > 1 ||
partially evaluated: qAbs(stroker->lastPixel.x - first.x) > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1517
0-1517
789 qAbs(stroker->lastPixel.y - first.y) > 1))) {
evaluated: qAbs(stroker->lastPixel.y - first.y) > 1
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:1491
26-1491
790 -
791 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:2576
yes
Evaluation Count:5
5-2576
792 ++xs; -
793 } else {
executed: }
Execution Count:2576
2576
794 --x; -
795 y -= yinc; -
796 }
executed: }
Execution Count:5
5
797 } -
798 } -
799 stroker->lastDir = dir; -
800 stroker->lastAxisAligned = axisAligned; -
801 -
802 Dasher dasher(stroker, swapped, x << 6, xs << 6); -
803 -
804 do { -
805 if (dasher.on())
evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:4803705
yes
Evaluation Count:114
114-4803705
806 drawPixel(stroker, x, y >> 16, 255);
executed: drawPixel(stroker, x, y >> 16, 255);
Execution Count:4803705
4803705
807 dasher.adjust(); -
808 y += yinc; -
809 } while (++x < xs);
executed: }
Execution Count:4803819
evaluated: ++x < xs
TRUEFALSE
yes
Evaluation Count:4728703
yes
Evaluation Count:75116
75116-4803819
810 }
executed: }
Execution Count:75116
75116
811 }
executed: }
Execution Count:75120
75120
812 stroker->lastPixel = last; -
813}
executed: }
Execution Count:145737
145737
814 -
815 -
816template<DrawPixel drawPixel, class Dasher> -
817static void drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) -
818{ -
819 if (stroker->clipLine(rx1, ry1, rx2, ry2))
evaluated: stroker->clipLine(rx1, ry1, rx2, ry2)
TRUEFALSE
yes
Evaluation Count:352
yes
Evaluation Count:2699
352-2699
820 return;
executed: return;
Execution Count:352
352
821 -
822 int x1 = ((int)((rx1)*64.)); -
823 int y1 = ((int)((ry1)*64.)); -
824 int x2 = ((int)((rx2)*64.)); -
825 int y2 = ((int)((ry2)*64.)); -
826 -
827 int dx = x2 - x1; -
828 int dy = y2 - y1; -
829 -
830 if (qAbs(dx) < qAbs(dy)) {
evaluated: qAbs(dx) < qAbs(dy)
TRUEFALSE
yes
Evaluation Count:1200
yes
Evaluation Count:1499
1200-1499
831 -
832 -
833 int xinc = F16Dot16FixedDiv(dx, dy); -
834 -
835 bool swapped = false; -
836 if (y1 > y2) {
evaluated: y1 > y2
TRUEFALSE
yes
Evaluation Count:552
yes
Evaluation Count:648
552-648
837 qSwap(y1, y2); -
838 qSwap(x1, x2); -
839 swapped = true; -
840 caps = swapCaps(caps); -
841 }
executed: }
Execution Count:552
552
842 -
843 int x = (x1 - 32) << 10; -
844 x -= ( ((y1 & 63) - 32) * xinc ) >> 6; -
845 -
846 capAdjust(caps, y1, y2, x, xinc); -
847 -
848 Dasher dasher(stroker, swapped, y1, y2); -
849 -
850 int y = y1 >> 6; -
851 int ys = y2 >> 6; -
852 -
853 int alphaStart, alphaEnd; -
854 if (y == ys) {
partially evaluated: y == ys
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1200
0-1200
855 alphaStart = y2 - y1; -
856 qt_noop(); -
857 alphaEnd = 0; -
858 } else {
never executed: }
0
859 alphaStart = 64 - (y1 & 63); -
860 alphaEnd = (y2 & 63); -
861 }
executed: }
Execution Count:1200
1200
862 -
863 -
864 -
865 -
866 if (dasher.on()) {
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:1200
no
Evaluation Count:0
0-1200
867 uint alpha = (quint8)(x >> 8); -
868 drawPixel(stroker, x>>16, y, (255-alpha) * alphaStart >> 6); -
869 drawPixel(stroker, (x>>16) + 1, y, alpha * alphaStart >> 6); -
870 }
executed: }
Execution Count:1200
1200
871 dasher.adjust(); -
872 x += xinc; -
873 ++y; -
874 if (y < ys) {
evaluated: y < ys
TRUEFALSE
yes
Evaluation Count:921
yes
Evaluation Count:279
279-921
875 do { -
876 if (dasher.on()) {
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:19395
no
Evaluation Count:0
0-19395
877 uint alpha = (quint8)(x >> 8); -
878 drawPixel(stroker, x>>16, y, (255-alpha)); -
879 drawPixel(stroker, (x>>16) + 1, y, alpha); -
880 }
executed: }
Execution Count:19395
19395
881 dasher.adjust(); -
882 x += xinc; -
883 } while (++y < ys);
executed: }
Execution Count:19395
evaluated: ++y < ys
TRUEFALSE
yes
Evaluation Count:18474
yes
Evaluation Count:921
921-19395
884 }
executed: }
Execution Count:921
921
885 -
886 if (alphaEnd && dasher.on()) {
evaluated: alphaEnd
TRUEFALSE
yes
Evaluation Count:853
yes
Evaluation Count:347
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:853
no
Evaluation Count:0
0-853
887 uint alpha = (quint8)(x >> 8); -
888 drawPixel(stroker, x>>16, y, (255-alpha) * alphaEnd >> 6); -
889 drawPixel(stroker, (x>>16) + 1, y, alpha * alphaEnd >> 6); -
890 }
executed: }
Execution Count:853
853
891 } else {
executed: }
Execution Count:1200
1200
892 -
893 if (!dx)
evaluated: !dx
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:1453
46-1453
894 return;
executed: return;
Execution Count:46
46
895 -
896 int yinc = F16Dot16FixedDiv(dy, dx); -
897 -
898 bool swapped = false; -
899 if (x1 > x2) {
evaluated: x1 > x2
TRUEFALSE
yes
Evaluation Count:618
yes
Evaluation Count:835
618-835
900 qSwap(x1, x2); -
901 qSwap(y1, y2); -
902 swapped = true; -
903 caps = swapCaps(caps); -
904 }
executed: }
Execution Count:618
618
905 -
906 int y = (y1 - 32) << 10; -
907 y -= ( ((x1 & 63) - 32) * yinc ) >> 6; -
908 -
909 capAdjust(caps, x1, x2, y, yinc); -
910 -
911 Dasher dasher(stroker, swapped, x1, x2); -
912 -
913 int x = x1 >> 6; -
914 int xs = x2 >> 6; -
915 -
916 -
917 -
918 int alphaStart, alphaEnd; -
919 if (x == xs) {
partially evaluated: x == xs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1453
0-1453
920 alphaStart = x2 - x1; -
921 qt_noop(); -
922 alphaEnd = 0; -
923 } else {
never executed: }
0
924 alphaStart = 64 - (x1 & 63); -
925 alphaEnd = (x2 & 63); -
926 }
executed: }
Execution Count:1453
1453
927 -
928 -
929 if (dasher.on()) {
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:1453
no
Evaluation Count:0
0-1453
930 uint alpha = (quint8)(y >> 8); -
931 drawPixel(stroker, x, y>>16, (255-alpha) * alphaStart >> 6); -
932 drawPixel(stroker, x, (y>>16) + 1, alpha * alphaStart >> 6); -
933 }
executed: }
Execution Count:1453
1453
934 dasher.adjust(); -
935 y += yinc; -
936 ++x; -
937 -
938 if (x < xs) {
evaluated: x < xs
TRUEFALSE
yes
Evaluation Count:1174
yes
Evaluation Count:279
279-1174
939 do { -
940 if (dasher.on()) {
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:33017
no
Evaluation Count:0
0-33017
941 uint alpha = (quint8)(y >> 8); -
942 drawPixel(stroker, x, y>>16, (255-alpha)); -
943 drawPixel(stroker, x, (y>>16) + 1, alpha); -
944 }
executed: }
Execution Count:33017
33017
945 dasher.adjust(); -
946 y += yinc; -
947 } while (++x < xs);
executed: }
Execution Count:33017
evaluated: ++x < xs
TRUEFALSE
yes
Evaluation Count:31843
yes
Evaluation Count:1174
1174-33017
948 }
executed: }
Execution Count:1174
1174
949 -
950 if (alphaEnd && dasher.on()) {
evaluated: alphaEnd
TRUEFALSE
yes
Evaluation Count:1015
yes
Evaluation Count:438
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:1015
no
Evaluation Count:0
0-1015
951 uint alpha = (quint8)(y >> 8); -
952 drawPixel(stroker, x, y>>16, (255-alpha) * alphaEnd >> 6); -
953 drawPixel(stroker, x, (y>>16) + 1, alpha * alphaEnd >> 6); -
954 }
executed: }
Execution Count:1015
1015
955 }
executed: }
Execution Count:1453
1453
956} -
957 -
958 -
959 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial