Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | static 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:43908 | 43908 |
7 | } | - |
8 | | - |
9 | inline static int F16Dot16FixedDiv(int x, int y) | - |
10 | { | - |
11 | if (qAbs(x) > 0x7fff) partially evaluated: qAbs(x) > 0x7fff no Evaluation Count:0 | yes Evaluation Count:71860 |
| 0-71860 |
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:71860 | 71860 |
14 | } | - |
15 | | - |
16 | typedef void (*DrawPixel)(QCosmeticStroker *stroker, int x, int y, int coverage); | - |
17 | | - |
18 | namespace { | - |
19 | | - |
20 | struct 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) { partially evaluated: reverse no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
32 | pattern = stroker->reversePattern; | - |
33 | offset = stroker->patternLength - stroker->patternOffset - delta - ((start & 63) - 32); | - |
34 | dashOn = 0; | - |
35 | } else { | 0 |
36 | pattern = stroker->pattern; | - |
37 | offset = stroker->patternOffset - ((start & 63) - 32); | - |
38 | dashOn = 1; | - |
39 | } executed: } Execution Count:2 | 2 |
40 | offset %= stroker->patternLength; | - |
41 | if (offset < 0) partially evaluated: offset < 0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
42 | offset += stroker->patternLength; never executed: offset += stroker->patternLength; | 0 |
43 | | - |
44 | dashIndex = 0; | - |
45 | while (offset>= pattern[dashIndex]) partially evaluated: offset>= pattern[dashIndex] no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
46 | ++dashIndex; never executed: ++dashIndex; | 0 |
47 | | - |
48 | | - |
49 | stroker->patternOffset += delta; | - |
50 | stroker->patternOffset %= stroker->patternLength; | - |
51 | } executed: } Execution Count:2 | 2 |
52 | | - |
53 | bool on() const { | - |
54 | return (dashIndex + dashOn) & 1; executed: return (dashIndex + dashOn) & 1; Execution Count:98 | 98 |
55 | } | - |
56 | void adjust() { | - |
57 | offset += 64; | - |
58 | if (offset >= pattern[dashIndex]) { evaluated: offset >= pattern[dashIndex] yes Evaluation Count:32 | yes Evaluation Count:66 |
| 32-66 |
59 | ++dashIndex; | - |
60 | dashIndex %= stroker->patternSize; | - |
61 | } executed: } Execution Count:32 | 32 |
62 | offset %= stroker->patternLength; | - |
63 | | - |
64 | } executed: } Execution Count:98 | 98 |
65 | }; | - |
66 | | - |
67 | struct NoDasher { | - |
68 | NoDasher(QCosmeticStroker *, bool, int, int) {} | - |
69 | bool on() const { return true; } executed: return true; Execution Count:4126778 | 4126778 |
70 | void adjust(int = 0) {} | - |
71 | }; | - |
72 | | - |
73 | }; | - |
74 | | - |
75 | template<DrawPixel drawPixel, class Dasher> | - |
76 | static void drawLine(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); | - |
77 | template<DrawPixel drawPixel, class Dasher> | - |
78 | static void drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); | - |
79 | | - |
80 | inline 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() yes Evaluation Count:1352 | yes Evaluation Count:4116683 |
evaluated: x > cl.right() yes Evaluation Count:10065 | yes Evaluation Count:4106618 |
evaluated: y < cl.y() yes Evaluation Count:4805 | yes Evaluation Count:4101813 |
evaluated: y > cl.bottom() yes Evaluation Count:23110 | yes Evaluation Count:4078703 |
| 1352-4116683 |
84 | return; executed: return; Execution Count:39332 | 39332 |
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 yes Evaluation Count:3894 | yes Evaluation Count:4074809 |
evaluated: y < lasty yes Evaluation Count:60269 | yes Evaluation Count:4014540 |
evaluated: y == lasty yes Evaluation Count:2643390 | yes Evaluation Count:1371150 |
evaluated: x < lastx yes Evaluation Count:1183 | yes Evaluation Count:2642207 |
| 1183-4074809 |
90 | stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); | - |
91 | stroker->current_span = 0; | - |
92 | } executed: } Execution Count:65346 | 65346 |
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:4078703 | 4078703 |
100 | | - |
101 | inline 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() yes Evaluation Count:2752 | yes Evaluation Count:33908 |
evaluated: x > cl.right() yes Evaluation Count:2232 | yes Evaluation Count:31676 |
evaluated: y < cl.y() yes Evaluation Count:1866 | yes Evaluation Count:29810 |
evaluated: y > cl.bottom() yes Evaluation Count:2050 | yes Evaluation Count:27760 |
| 1866-33908 |
105 | return; executed: return; Execution Count:8900 | 8900 |
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:27760 | 27760 |
111 | | - |
112 | inline 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() yes Evaluation Count:36 | yes Evaluation Count:18736 |
evaluated: x > cl.right() yes Evaluation Count:1348 | yes Evaluation Count:17388 |
partially evaluated: y < cl.y() no Evaluation Count:0 | yes Evaluation Count:17388 |
evaluated: y > cl.bottom() yes Evaluation Count:1240 | yes Evaluation Count:16148 |
| 0-18736 |
116 | return; executed: return; Execution Count:2624 | 2624 |
117 | | - |
118 | int offset = x + stroker->ppl*y; | - |
119 | stroker->pixels[offset] = sourceOver(stroker->pixels[offset], stroker->color); | - |
120 | } executed: } Execution Count:16148 | 16148 |
121 | | - |
122 | enum StrokeSelection { | - |
123 | Aliased = 0, | - |
124 | AntiAliased = 1, | - |
125 | Solid = 0, | - |
126 | Dashed = 2, | - |
127 | RegularDraw = 0, | - |
128 | FastDraw = 4 | - |
129 | }; | - |
130 | | - |
131 | static 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:32584 | 32584 |
139 | case Aliased|Solid|FastDraw: | - |
140 | stroke = &::drawLine<drawPixelARGB32Opaque, NoDasher>; | - |
141 | break; executed: break; Execution Count:228 | 228 |
142 | case Aliased|Dashed|RegularDraw: | - |
143 | stroke = &::drawLine<drawPixel, Dasher>; | - |
144 | break; executed: break; Execution Count:10 | 10 |
145 | case Aliased|Dashed|FastDraw: | - |
146 | stroke = &::drawLine<drawPixelARGB32Opaque, Dasher>; | - |
147 | break; | 0 |
148 | case AntiAliased|Solid|RegularDraw: | - |
149 | stroke = &::drawLineAA<drawPixel, NoDasher>; | - |
150 | break; executed: break; Execution Count:113 | 113 |
151 | case AntiAliased|Solid|FastDraw: | - |
152 | stroke = &::drawLineAA<drawPixelARGB32, NoDasher>; | - |
153 | break; executed: break; Execution Count:218 | 218 |
154 | case AntiAliased|Dashed|RegularDraw: | - |
155 | stroke = &::drawLineAA<drawPixel, Dasher>; | - |
156 | break; | 0 |
157 | case AntiAliased|Dashed|FastDraw: | - |
158 | stroke = &::drawLineAA<drawPixelARGB32, Dasher>; | - |
159 | break; | 0 |
160 | default: | - |
161 | qt_noop(); | - |
162 | stroke = 0; | - |
163 | } | 0 |
164 | return stroke; executed: return stroke; Execution Count:33153 | 33153 |
165 | } | - |
166 | | - |
167 | void 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 yes Evaluation Count:5139 | yes Evaluation Count:28014 |
partially evaluated: state->clip->enabled yes Evaluation Count:5139 | no Evaluation Count:0 |
evaluated: state->clip->hasRectClip yes Evaluation Count:4904 | yes Evaluation Count:235 |
partially evaluated: !state->clip->clipRect.isEmpty() yes Evaluation Count:4904 | no Evaluation Count:0 |
| 0-28014 |
171 | clip &= state->clip->clipRect; | - |
172 | blend = state->penData.unclipped_blend; | - |
173 | } executed: } Execution Count:4904 | 4904 |
174 | | - |
175 | int strokeSelection = 0; | - |
176 | if (blend == state->penData.unclipped_blend evaluated: blend == state->penData.unclipped_blend yes Evaluation Count:4904 | yes Evaluation Count:28249 |
| 4904-28249 |
177 | && state->penData.type == QSpanData::Solid evaluated: state->penData.type == QSpanData::Solid yes Evaluation Count:4898 | yes Evaluation Count:6 |
| 6-4898 |
178 | && (state->penData.rasterBuffer->format == QImage::Format_ARGB32_Premultiplied evaluated: state->penData.rasterBuffer->format == QImage::Format_ARGB32_Premultiplied yes Evaluation Count:438 | yes Evaluation Count:4460 |
| 438-4460 |
179 | || state->penData.rasterBuffer->format == QImage::Format_RGB32) evaluated: state->penData.rasterBuffer->format == QImage::Format_RGB32 yes Evaluation Count:8 | yes Evaluation Count:4452 |
| 8-4452 |
180 | && state->compositionMode() == QPainter::CompositionMode_SourceOver) partially evaluated: state->compositionMode() == QPainter::CompositionMode_SourceOver yes Evaluation Count:446 | no Evaluation Count:0 |
| 0-446 |
181 | strokeSelection |= FastDraw; executed: strokeSelection |= FastDraw; Execution Count:446 | 446 |
182 | | - |
183 | if (state->renderHints & QPainter::Antialiasing) evaluated: state->renderHints & QPainter::Antialiasing yes Evaluation Count:331 | yes Evaluation Count:32822 |
| 331-32822 |
184 | strokeSelection |= AntiAliased; executed: strokeSelection |= AntiAliased; Execution Count:331 | 331 |
185 | | - |
186 | const QVector<qreal> &penPattern = state->lastPen.dashPattern(); | - |
187 | if (penPattern.isEmpty()) { evaluated: penPattern.isEmpty() yes Evaluation Count:33143 | yes Evaluation Count:10 |
| 10-33143 |
188 | qt_noop(); | - |
189 | pattern = 0; | - |
190 | reversePattern = 0; | - |
191 | patternLength = 0; | - |
192 | patternSize = 0; | - |
193 | } else { executed: } Execution Count:33143 | 33143 |
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 yes Evaluation Count:20 | yes Evaluation Count:10 |
| 10-20 |
200 | patternLength += (int) qMax(1. , penPattern.at(i)*64.); | - |
201 | pattern[i] = patternLength; | - |
202 | } executed: } Execution Count:20 | 20 |
203 | patternLength = 0; | - |
204 | for (int i = 0; i < patternSize; ++i) { evaluated: i < patternSize yes Evaluation Count:20 | yes Evaluation Count:10 |
| 10-20 |
205 | patternLength += (int) qMax(1., penPattern.at(patternSize - 1 - i)*64.); | - |
206 | reversePattern[i] = patternLength; | - |
207 | } executed: } Execution Count:20 | 20 |
208 | strokeSelection |= Dashed; | - |
209 | | - |
210 | } executed: } Execution Count:10 | 10 |
211 | | - |
212 | stroke = strokeLine(strokeSelection); | - |
213 | | - |
214 | qreal width = state->lastPen.widthF(); | - |
215 | if (width == 0) evaluated: width == 0 yes Evaluation Count:981 | yes Evaluation Count:32172 |
| 981-32172 |
216 | opacity = 256; executed: opacity = 256; Execution Count:981 | 981 |
217 | else if (qt_pen_is_cosmetic(state->lastPen, state->renderHints)) evaluated: qt_pen_is_cosmetic(state->lastPen, state->renderHints) yes Evaluation Count:887 | yes Evaluation Count:31285 |
| 887-31285 |
218 | opacity = (int) 256*width; executed: opacity = (int) 256*width; Execution Count:887 | 887 |
219 | else | - |
220 | opacity = (int) 256*width*state->txscale; executed: opacity = (int) 256*width*state->txscale; Execution Count:31285 | 31285 |
221 | opacity = qBound(0, opacity, 256); | - |
222 | | - |
223 | drawCaps = state->lastPen.capStyle() != Qt::FlatCap; | - |
224 | | - |
225 | if (strokeSelection & FastDraw) { evaluated: strokeSelection & FastDraw yes Evaluation Count:446 | yes Evaluation Count:32707 |
| 446-32707 |
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:446 | 446 |
231 | | - |
232 | | - |
233 | xmin = clip.left() - 1; | - |
234 | xmax = clip.right() + 2; | - |
235 | ymin = clip.top() - 1; | - |
236 | ymax = clip.bottom() + 2; | - |
237 | | - |
238 | lastPixel.x = -1; | - |
239 | } executed: } Execution Count:33153 | 33153 |
240 | | - |
241 | | - |
242 | bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2) | - |
243 | { | - |
244 | | - |
245 | | - |
246 | if (x1 < xmin) { evaluated: x1 < xmin yes Evaluation Count:605 | yes Evaluation Count:75636 |
| 605-75636 |
247 | if (x2 <= xmin) evaluated: x2 <= xmin yes Evaluation Count:268 | yes Evaluation Count:337 |
| 268-337 |
248 | goto clipped; executed: goto clipped; Execution Count:268 | 268 |
249 | y1 += (y2 - y1)/(x2 - x1) * (xmin - x1); | - |
250 | x1 = xmin; | - |
251 | } else if (x1 > xmax) { evaluated: x1 > xmax yes Evaluation Count:1956 | yes Evaluation Count:73680 |
executed: } Execution Count:337 | 337-73680 |
252 | if (x2 >= xmax) evaluated: x2 >= xmax yes Evaluation Count:1920 | yes Evaluation Count:36 |
| 36-1920 |
253 | goto clipped; executed: goto clipped; Execution Count:1920 | 1920 |
254 | y1 += (y2 - y1)/(x2 - x1) * (xmax - x1); | - |
255 | x1 = xmax; | - |
256 | } executed: } Execution Count:36 | 36 |
257 | if (x2 < xmin) { evaluated: x2 < xmin yes Evaluation Count:14 | yes Evaluation Count:74039 |
| 14-74039 |
258 | lastPixel.x = -1; | - |
259 | y2 += (y2 - y1)/(x2 - x1) * (xmin - x2); | - |
260 | x2 = xmin; | - |
261 | } else if (x2 > xmax) { evaluated: x2 > xmax yes Evaluation Count:1407 | yes Evaluation Count:72632 |
executed: } Execution Count:14 | 14-72632 |
262 | lastPixel.x = -1; | - |
263 | y2 += (y2 - y1)/(x2 - x1) * (xmax - x2); | - |
264 | x2 = xmax; | - |
265 | } executed: } Execution Count:1407 | 1407 |
266 | | - |
267 | if (y1 < ymin) { evaluated: y1 < ymin yes Evaluation Count:458 | yes Evaluation Count:73595 |
| 458-73595 |
268 | if (y2 <= ymin) evaluated: y2 <= ymin yes Evaluation Count:449 | yes Evaluation Count:9 |
| 9-449 |
269 | goto clipped; executed: goto clipped; Execution Count:449 | 449 |
270 | x1 += (x2 - x1)/(y2 - y1) * (ymin - y1); | - |
271 | y1 = ymin; | - |
272 | } else if (y1 > ymax) { evaluated: y1 > ymax yes Evaluation Count:2275 | yes Evaluation Count:71320 |
executed: } Execution Count:9 | 9-71320 |
273 | if (y2 >= ymax) evaluated: y2 >= ymax yes Evaluation Count:1385 | yes Evaluation Count:890 |
| 890-1385 |
274 | goto clipped; executed: goto clipped; Execution Count:1385 | 1385 |
275 | x1 += (x2 - x1)/(y2 - y1) * (ymax - y1); | - |
276 | y1 = ymax; | - |
277 | } executed: } Execution Count:890 | 890 |
278 | if (y2 < ymin) { evaluated: y2 < ymin yes Evaluation Count:96 | yes Evaluation Count:72123 |
| 96-72123 |
279 | lastPixel.x = -1; | - |
280 | x2 += (x2 - x1)/(y2 - y1) * (ymin - y2); | - |
281 | y2 = ymin; | - |
282 | } else if (y2 > ymax) { evaluated: y2 > ymax yes Evaluation Count:80 | yes Evaluation Count:72043 |
executed: } Execution Count:96 | 80-72043 |
283 | lastPixel.x = -1; | - |
284 | x2 += (x2 - x1)/(y2 - y1) * (ymax - y2); | - |
285 | y2 = ymax; | - |
286 | } executed: } Execution Count:80 | 80 |
287 | | - |
288 | return false; executed: return false; Execution Count:72219 | 72219 |
289 | | - |
290 | clipped: | - |
291 | lastPixel.x = -1; | - |
292 | return true; executed: return true; Execution Count:4022 | 4022 |
293 | } | - |
294 | | - |
295 | | - |
296 | void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2) | - |
297 | { | - |
298 | if (p1 == p2) { evaluated: p1 == p2 yes Evaluation Count:60 | yes Evaluation Count:4813 |
| 60-4813 |
299 | drawPoints(&p1, 1); | - |
300 | return; executed: return; Execution Count:60 | 60 |
301 | } | - |
302 | | - |
303 | QPointF start = p1 * state->matrix; | - |
304 | QPointF end = p2 * state->matrix; | - |
305 | | - |
306 | patternOffset = state->lastPen.dashOffset()*64; | - |
307 | lastPixel.x = -1; | - |
308 | | - |
309 | stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0); | - |
310 | | - |
311 | blend(current_span, spans, &state->penData); | - |
312 | current_span = 0; | - |
313 | } executed: } Execution Count:4813 | 4813 |
314 | | - |
315 | void QCosmeticStroker::drawPoints(const QPoint *points, int num) | - |
316 | { | - |
317 | const QPoint *end = points + num; | - |
318 | while (points < end) { evaluated: points < end yes Evaluation Count:154 | yes Evaluation Count:146 |
| 146-154 |
319 | QPointF p = QPointF(*points) * state->matrix; | - |
320 | drawPixel(this, qRound(p.x()), qRound(p.y()), 255); | - |
321 | ++points; | - |
322 | } executed: } Execution Count:154 | 154 |
323 | | - |
324 | blend(current_span, spans, &state->penData); | - |
325 | current_span = 0; | - |
326 | } executed: } Execution Count:146 | 146 |
327 | | - |
328 | void QCosmeticStroker::drawPoints(const QPointF *points, int num) | - |
329 | { | - |
330 | const QPointF *end = points + num; | - |
331 | while (points < end) { evaluated: points < end yes Evaluation Count:60 | yes Evaluation Count:60 |
| 60 |
332 | QPointF p = (*points) * state->matrix; | - |
333 | drawPixel(this, qRound(p.x()), qRound(p.y()), 255); | - |
334 | ++points; | - |
335 | } executed: } Execution Count:60 | 60 |
336 | | - |
337 | blend(current_span, spans, &state->penData); | - |
338 | current_span = 0; | - |
339 | } executed: } Execution Count:60 | 60 |
340 | | - |
341 | void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal ry2) | - |
342 | { | - |
343 | | - |
344 | | - |
345 | | - |
346 | | - |
347 | | - |
348 | | - |
349 | | - |
350 | lastPixel.x = -1; | - |
351 | lastPixel.y = -1; | - |
352 | | - |
353 | if (clipLine(rx1, ry1, rx2, ry2)) evaluated: clipLine(rx1, ry1, rx2, ry2) yes Evaluation Count:145 | yes Evaluation Count:2972 |
| 145-2972 |
354 | return; executed: return; Execution Count:145 | 145 |
355 | | - |
356 | const int half = legacyRounding ? 31 : 0; evaluated: legacyRounding yes Evaluation Count:634 | yes Evaluation Count:2338 |
| 634-2338 |
357 | int x1 = ((int)((rx1)*64.)) + half; | - |
358 | int y1 = ((int)((ry1)*64.)) + half; | - |
359 | int x2 = ((int)((rx2)*64.)) + half; | - |
360 | int y2 = ((int)((ry2)*64.)) + half; | - |
361 | | - |
362 | int dx = qAbs(x2 - x1); | - |
363 | int dy = qAbs(y2 - y1); | - |
364 | | - |
365 | if (dx < dy) { evaluated: dx < dy yes Evaluation Count:1831 | yes Evaluation Count:1141 |
| 1141-1831 |
366 | | - |
367 | bool swapped = false; | - |
368 | if (y1 > y2) { evaluated: y1 > y2 yes Evaluation Count:1727 | yes Evaluation Count:104 |
| 104-1727 |
369 | swapped = true; | - |
370 | qSwap(y1, y2); | - |
371 | qSwap(x1, x2); | - |
372 | } executed: } Execution Count:1727 | 1727 |
373 | int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); | - |
374 | int x = x1 << 10; | - |
375 | | - |
376 | int y = (y1 + 32) >> 6; | - |
377 | int ys = (y2 + 32) >> 6; | - |
378 | | - |
379 | if (y != ys) { partially evaluated: y != ys yes Evaluation Count:1831 | no Evaluation Count:0 |
| 0-1831 |
380 | x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; | - |
381 | | - |
382 | if (swapped) { evaluated: swapped yes Evaluation Count:1727 | yes Evaluation Count:104 |
| 104-1727 |
383 | lastPixel.x = x >> 16; | - |
384 | lastPixel.y = y; | - |
385 | lastDir = QCosmeticStroker::BottomToTop; | - |
386 | } else { executed: } Execution Count:1727 | 1727 |
387 | lastPixel.x = (x + (ys - y - 1)*xinc) >> 16; | - |
388 | lastPixel.y = ys - 1; | - |
389 | lastDir = QCosmeticStroker::TopToBottom; | - |
390 | } executed: } Execution Count:104 | 104 |
391 | lastAxisAligned = qAbs(xinc) < (1 << 14); | - |
392 | } executed: } Execution Count:1831 | 1831 |
393 | } else { executed: } Execution Count:1831 | 1831 |
394 | | - |
395 | if (!dx) evaluated: !dx yes Evaluation Count:87 | yes Evaluation Count:1054 |
| 87-1054 |
396 | return; executed: return; Execution Count:87 | 87 |
397 | | - |
398 | bool swapped = false; | - |
399 | if (x1 > x2) { evaluated: x1 > x2 yes Evaluation Count:644 | yes Evaluation Count:410 |
| 410-644 |
400 | swapped = true; | - |
401 | qSwap(x1, x2); | - |
402 | qSwap(y1, y2); | - |
403 | } executed: } Execution Count:644 | 644 |
404 | int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); | - |
405 | int y = y1 << 10; | - |
406 | | - |
407 | int x = (x1 + 32) >> 6; | - |
408 | int xs = (x2 + 32) >> 6; | - |
409 | | - |
410 | if (x != xs) { evaluated: x != xs yes Evaluation Count:940 | yes Evaluation Count:114 |
| 114-940 |
411 | y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; | - |
412 | | - |
413 | if (swapped) { evaluated: swapped yes Evaluation Count:644 | yes Evaluation Count:296 |
| 296-644 |
414 | lastPixel.x = x; | - |
415 | lastPixel.y = y >> 16; | - |
416 | lastDir = QCosmeticStroker::RightToLeft; | - |
417 | } else { executed: } Execution Count:644 | 644 |
418 | lastPixel.x = xs - 1; | - |
419 | lastPixel.y = (y + (xs - x - 1)*yinc) >> 16; | - |
420 | lastDir = QCosmeticStroker::LeftToRight; | - |
421 | } executed: } Execution Count:296 | 296 |
422 | lastAxisAligned = qAbs(yinc) < (1 << 14); | - |
423 | } executed: } Execution Count:940 | 940 |
424 | } executed: } Execution Count:1054 | 1054 |
425 | | - |
426 | } | - |
427 | | - |
428 | static inline const QPainterPath::ElementType *subPath(const QPainterPath::ElementType *t, const QPainterPath::ElementType *end, | - |
429 | const qreal *points, bool *closed) | - |
430 | { | - |
431 | const QPainterPath::ElementType *start = t; | - |
432 | ++t; | - |
433 | | - |
434 | | - |
435 | while (t < end) { evaluated: t < end yes Evaluation Count:4852 | yes Evaluation Count:341 |
| 341-4852 |
436 | if (*t == QPainterPath::MoveToElement) evaluated: *t == QPainterPath::MoveToElement yes Evaluation Count:30 | yes Evaluation Count:4822 |
| 30-4822 |
437 | break; executed: break; Execution Count:30 | 30 |
438 | ++t; | - |
439 | } executed: } Execution Count:4822 | 4822 |
440 | | - |
441 | int offset = t - start - 1; | - |
442 | | - |
443 | *closed = (points[0] == points[2*offset] && points[1] == points[2*offset + 1]); evaluated: points[0] == points[2*offset] yes Evaluation Count:341 | yes Evaluation Count:30 |
evaluated: points[1] == points[2*offset + 1] yes Evaluation Count:317 | yes Evaluation Count:24 |
| 24-341 |
444 | | - |
445 | return t; executed: return t; Execution Count:371 | 371 |
446 | } | - |
447 | | - |
448 | void QCosmeticStroker::drawPath(const QVectorPath &path) | - |
449 | { | - |
450 | | - |
451 | | - |
452 | if (path.isEmpty()) partially evaluated: path.isEmpty() no Evaluation Count:0 | yes Evaluation Count:28565 |
| 0-28565 |
453 | return; | 0 |
454 | | - |
455 | const qreal *points = path.points(); | - |
456 | const QPainterPath::ElementType *type = path.elements(); | - |
457 | | - |
458 | if (type) { evaluated: type yes Evaluation Count:341 | yes Evaluation Count:28224 |
| 341-28224 |
459 | const QPainterPath::ElementType *end = type + path.elementCount(); | - |
460 | | - |
461 | while (type < end) { evaluated: type < end yes Evaluation Count:371 | yes Evaluation Count:341 |
| 341-371 |
462 | qt_noop(); | - |
463 | | - |
464 | QPointF p = QPointF(points[0], points[1]) * state->matrix; | - |
465 | patternOffset = state->lastPen.dashOffset()*64; | - |
466 | lastPixel.x = -1; | - |
467 | | - |
468 | bool closed; | - |
469 | const QPainterPath::ElementType *e = subPath(type, end, points, &closed); | - |
470 | if (closed) { evaluated: closed yes Evaluation Count:317 | yes Evaluation Count:54 |
| 54-317 |
471 | const qreal *p = points + 2*(e-type); | - |
472 | QPointF p1 = QPointF(p[-4], p[-3]) * state->matrix; | - |
473 | QPointF p2 = QPointF(p[-2], p[-1]) * state->matrix; | - |
474 | calculateLastPoint(p1.x(), p1.y(), p2.x(), p2.y()); | - |
475 | } executed: } Execution Count:317 | 317 |
476 | int caps = (!closed & drawCaps) ? CapBegin : NoCaps; evaluated: (!closed & drawCaps) yes Evaluation Count:54 | yes Evaluation Count:317 |
| 54-317 |
477 | | - |
478 | | - |
479 | points += 2; | - |
480 | ++type; | - |
481 | | - |
482 | while (type < e) { evaluated: type < e yes Evaluation Count:2434 | yes Evaluation Count:371 |
| 371-2434 |
483 | QPointF p2 = QPointF(points[0], points[1]) * state->matrix; | - |
484 | switch (*type) { | - |
485 | case QPainterPath::MoveToElement: | - |
486 | qt_noop(); | - |
487 | break; | 0 |
488 | | - |
489 | case QPainterPath::LineToElement: | - |
490 | if (!closed && drawCaps && type == e - 1) evaluated: !closed yes Evaluation Count:48 | yes Evaluation Count:1192 |
partially evaluated: drawCaps yes Evaluation Count:48 | no Evaluation Count:0 |
partially evaluated: type == e - 1 yes Evaluation Count:48 | no Evaluation Count:0 |
| 0-1192 |
491 | caps |= CapEnd; executed: caps |= CapEnd; Execution Count:48 | 48 |
492 | stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); | - |
493 | p = p2; | - |
494 | points += 2; | - |
495 | ++type; | - |
496 | break; executed: break; Execution Count:1240 | 1240 |
497 | | - |
498 | case QPainterPath::CurveToElement: { | - |
499 | if (!closed && drawCaps && type == e - 3) evaluated: !closed yes Evaluation Count:18 | yes Evaluation Count:1176 |
partially evaluated: drawCaps yes Evaluation Count:18 | no Evaluation Count:0 |
evaluated: type == e - 3 yes Evaluation Count:6 | yes Evaluation Count:12 |
| 0-1176 |
500 | caps |= CapEnd; executed: caps |= CapEnd; Execution Count:6 | 6 |
501 | QPointF p3 = QPointF(points[2], points[3]) * state->matrix; | - |
502 | QPointF p4 = QPointF(points[4], points[5]) * state->matrix; | - |
503 | renderCubic(p, p2, p3, p4, caps); | - |
504 | p = p4; | - |
505 | type += 3; | - |
506 | points += 6; | - |
507 | break; executed: break; Execution Count:1194 | 1194 |
508 | } | - |
509 | case QPainterPath::CurveToDataElement: | - |
510 | qt_noop(); | - |
511 | break; | 0 |
512 | } | - |
513 | caps = NoCaps; | - |
514 | } executed: } Execution Count:2434 | 2434 |
515 | } executed: } Execution Count:371 | 371 |
516 | } else { executed: } Execution Count:341 | 341 |
517 | QPointF p = QPointF(points[0], points[1]) * state->matrix; | - |
518 | QPointF movedTo = p; | - |
519 | patternOffset = state->lastPen.dashOffset()*64; | - |
520 | lastPixel.x = -1; | - |
521 | | - |
522 | const qreal *end = points + 2*path.elementCount(); | - |
523 | | - |
524 | bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]); evaluated: path.hasImplicitClose() yes Evaluation Count:2795 | yes Evaluation Count:25429 |
evaluated: points[0] == end[-2] yes Evaluation Count:5 | yes Evaluation Count:25424 |
partially evaluated: points[1] == end[-1] yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-25429 |
525 | int caps = (!closed & drawCaps) ? CapBegin : NoCaps; evaluated: (!closed & drawCaps) yes Evaluation Count:25424 | yes Evaluation Count:2800 |
| 2800-25424 |
526 | if (closed) { evaluated: closed yes Evaluation Count:2800 | yes Evaluation Count:25424 |
| 2800-25424 |
527 | QPointF p2 = QPointF(end[-2], end[-1]) * state->matrix; | - |
528 | calculateLastPoint(p2.x(), p2.y(), p.x(), p.y()); | - |
529 | } executed: } Execution Count:2800 | 2800 |
530 | | - |
531 | points += 2; | - |
532 | while (points < end) { evaluated: points < end yes Evaluation Count:60428 | yes Evaluation Count:28224 |
| 28224-60428 |
533 | QPointF p2 = QPointF(points[0], points[1]) * state->matrix; | - |
534 | | - |
535 | if (!closed && drawCaps && points == end - 2) evaluated: !closed yes Evaluation Count:51648 | yes Evaluation Count:8780 |
partially evaluated: drawCaps yes Evaluation Count:51648 | no Evaluation Count:0 |
evaluated: points == end - 2 yes Evaluation Count:25424 | yes Evaluation Count:26224 |
| 0-51648 |
536 | caps |= CapEnd; executed: caps |= CapEnd; Execution Count:25424 | 25424 |
537 | | - |
538 | stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); | - |
539 | | - |
540 | p = p2; | - |
541 | points += 2; | - |
542 | caps = NoCaps; | - |
543 | } executed: } Execution Count:60428 | 60428 |
544 | if (path.hasImplicitClose()) evaluated: path.hasImplicitClose() yes Evaluation Count:2795 | yes Evaluation Count:25429 |
| 2795-25429 |
545 | 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:2795 | 2795 |
546 | } executed: } Execution Count:28224 | 28224 |
547 | | - |
548 | | - |
549 | blend(current_span, spans, &state->penData); | - |
550 | current_span = 0; | - |
551 | } executed: } Execution Count:28565 | 28565 |
552 | | - |
553 | void QCosmeticStroker::renderCubic(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4, int caps) | - |
554 | { | - |
555 | | - |
556 | const int maxSubDivisions = 6; | - |
557 | PointF points[3*maxSubDivisions + 4]; | - |
558 | | - |
559 | points[3].x = p1.x(); | - |
560 | points[3].y = p1.y(); | - |
561 | points[2].x = p2.x(); | - |
562 | points[2].y = p2.y(); | - |
563 | points[1].x = p3.x(); | - |
564 | points[1].y = p3.y(); | - |
565 | points[0].x = p4.x(); | - |
566 | points[0].y = p4.y(); | - |
567 | | - |
568 | PointF *p = points; | - |
569 | int level = maxSubDivisions; | - |
570 | | - |
571 | renderCubicSubdivision(p, level, caps); | - |
572 | } executed: } Execution Count:1194 | 1194 |
573 | | - |
574 | static void splitCubic(QCosmeticStroker::PointF *points) | - |
575 | { | - |
576 | const qreal half = .5; | - |
577 | qreal a, b, c, d; | - |
578 | | - |
579 | points[6].x = points[3].x; | - |
580 | c = points[1].x; | - |
581 | d = points[2].x; | - |
582 | points[1].x = a = ( points[0].x + c ) * half; | - |
583 | points[5].x = b = ( points[3].x + d ) * half; | - |
584 | c = ( c + d ) * half; | - |
585 | points[2].x = a = ( a + c ) * half; | - |
586 | points[4].x = b = ( b + c ) * half; | - |
587 | points[3].x = ( a + b ) * half; | - |
588 | | - |
589 | points[6].y = points[3].y; | - |
590 | c = points[1].y; | - |
591 | d = points[2].y; | - |
592 | points[1].y = a = ( points[0].y + c ) * half; | - |
593 | points[5].y = b = ( points[3].y + d ) * half; | - |
594 | c = ( c + d ) * half; | - |
595 | points[2].y = a = ( a + c ) * half; | - |
596 | points[4].y = b = ( b + c ) * half; | - |
597 | points[3].y = ( a + b ) * half; | - |
598 | } executed: } Execution Count:2654 | 2654 |
599 | | - |
600 | void QCosmeticStroker::renderCubicSubdivision(QCosmeticStroker::PointF *points, int level, int caps) | - |
601 | { | - |
602 | if (level) { partially evaluated: level yes Evaluation Count:6502 | no Evaluation Count:0 |
| 0-6502 |
603 | qreal dx = points[3].x - points[0].x; | - |
604 | qreal dy = points[3].y - points[0].y; | - |
605 | qreal len = ((qreal).25) * (qAbs(dx) + qAbs(dy)); | - |
606 | | - |
607 | 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 yes Evaluation Count:2584 | yes Evaluation Count:3918 |
| 2584-3918 |
608 | 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 yes Evaluation Count:70 | yes Evaluation Count:3848 |
| 70-3848 |
609 | splitCubic(points); | - |
610 | | - |
611 | --level; | - |
612 | renderCubicSubdivision(points + 3, level, caps & CapBegin); | - |
613 | renderCubicSubdivision(points, level, caps & CapEnd); | - |
614 | return; executed: return; Execution Count:2654 | 2654 |
615 | } | - |
616 | } executed: } Execution Count:3848 | 3848 |
617 | | - |
618 | stroke(this, points[3].x, points[3].y, points[0].x, points[0].y, caps); | - |
619 | } executed: } Execution Count:3848 | 3848 |
620 | | - |
621 | static inline int swapCaps(int caps) | - |
622 | { | - |
623 | return ((caps & QCosmeticStroker::CapBegin) << 1) | | 32122 |
624 | ((caps & QCosmeticStroker::CapEnd) >> 1); executed: return ((caps & QCosmeticStroker::CapBegin) << 1) | ((caps & QCosmeticStroker::CapEnd) >> 1); Execution Count:32122 | 32122 |
625 | } | - |
626 | | - |
627 | | - |
628 | static inline void capAdjust(int caps, int &x1, int &x2, int &y, int yinc) | - |
629 | { | - |
630 | if (caps & QCosmeticStroker::CapBegin) { evaluated: caps & QCosmeticStroker::CapBegin yes Evaluation Count:28452 | yes Evaluation Count:40523 |
| 28452-40523 |
631 | x1 -= 32; | - |
632 | y -= yinc >> 1; | - |
633 | } executed: } Execution Count:28452 | 28452 |
634 | if (caps & QCosmeticStroker::CapEnd) { evaluated: caps & QCosmeticStroker::CapEnd yes Evaluation Count:29376 | yes Evaluation Count:39599 |
| 29376-39599 |
635 | x2 += 32; | - |
636 | } executed: } Execution Count:29376 | 29376 |
637 | } executed: } Execution Count:68975 | 68975 |
638 | | - |
639 | | - |
640 | | - |
641 | | - |
642 | | - |
643 | template<DrawPixel drawPixel, class Dasher> | - |
644 | static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) | - |
645 | { | - |
646 | if (stroker->clipLine(rx1, ry1, rx2, ry2)) evaluated: stroker->clipLine(rx1, ry1, rx2, ry2) yes Evaluation Count:3395 | yes Evaluation Count:66922 |
| 3395-66922 |
647 | return; executed: return; Execution Count:3395 | 3395 |
648 | | - |
649 | const int half = stroker->legacyRounding ? 31 : 0; evaluated: stroker->legacyRounding yes Evaluation Count:3421 | yes Evaluation Count:63501 |
| 3421-63501 |
650 | int x1 = ((int)((rx1)*64.)) + half; | - |
651 | int y1 = ((int)((ry1)*64.)) + half; | - |
652 | int x2 = ((int)((rx2)*64.)) + half; | - |
653 | int y2 = ((int)((ry2)*64.)) + half; | - |
654 | | - |
655 | int dx = qAbs(x2 - x1); | - |
656 | int dy = qAbs(y2 - y1); | - |
657 | | - |
658 | QCosmeticStroker::Point last = stroker->lastPixel; | - |
659 | | - |
660 | | - |
661 | | - |
662 | if (dx < dy) { evaluated: dx < dy yes Evaluation Count:31673 | yes Evaluation Count:35249 |
| 31673-35249 |
663 | | - |
664 | QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom; | - |
665 | | - |
666 | bool swapped = false; | - |
667 | if (y1 > y2) { evaluated: y1 > y2 yes Evaluation Count:27218 | yes Evaluation Count:4455 |
| 4455-27218 |
668 | swapped = true; | - |
669 | qSwap(y1, y2); | - |
670 | qSwap(x1, x2); | - |
671 | caps = swapCaps(caps); | - |
672 | dir = QCosmeticStroker::BottomToTop; | - |
673 | } executed: } Execution Count:27218 | 27218 |
674 | int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); | - |
675 | int x = x1 << 10; | - |
676 | | - |
677 | if ((stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir) evaluated: (stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir yes Evaluation Count:211 | yes Evaluation Count:31462 |
| 211-31462 |
678 | caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; executed: caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; Execution Count:211 evaluated: swapped yes Evaluation Count:112 | yes Evaluation Count:99 |
| 99-211 |
679 | | - |
680 | capAdjust(caps, y1, y2, x, xinc); | - |
681 | | - |
682 | int y = (y1 + 32) >> 6; | - |
683 | int ys = (y2 + 32) >> 6; | - |
684 | | - |
685 | if (y != ys) { evaluated: y != ys yes Evaluation Count:31663 | yes Evaluation Count:10 |
| 10-31663 |
686 | x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; | - |
687 | | - |
688 | | - |
689 | QCosmeticStroker::Point first; | - |
690 | first.x = x >> 16; | - |
691 | first.y = y; | - |
692 | last.x = (x + (ys - y - 1)*xinc) >> 16; | - |
693 | last.y = ys - 1; | - |
694 | if (swapped) evaluated: swapped yes Evaluation Count:27213 | yes Evaluation Count:4450 |
| 4450-27213 |
695 | qSwap(first, last); executed: qSwap(first, last); Execution Count:27213 | 27213 |
696 | | - |
697 | bool axisAligned = qAbs(xinc) < (1 << 14); | - |
698 | if (stroker->lastPixel.x >= 0) { evaluated: stroker->lastPixel.x >= 0 yes Evaluation Count:17254 | yes Evaluation Count:14409 |
| 14409-17254 |
699 | if (first.x == stroker->lastPixel.x && evaluated: first.x == stroker->lastPixel.x yes Evaluation Count:3161 | yes Evaluation Count:14093 |
| 3161-14093 |
700 | first.y == stroker->lastPixel.y) { evaluated: first.y == stroker->lastPixel.y yes Evaluation Count:554 | yes Evaluation Count:2607 |
| 554-2607 |
701 | | - |
702 | if (swapped) { evaluated: swapped yes Evaluation Count:257 | yes Evaluation Count:297 |
| 257-297 |
703 | --ys; | - |
704 | } else { executed: } Execution Count:257 | 257 |
705 | ++y; | - |
706 | x += xinc; | - |
707 | } executed: } Execution Count:297 | 297 |
708 | } else if (stroker->lastDir != dir && evaluated: stroker->lastDir != dir yes Evaluation Count:15314 | yes Evaluation Count:1386 |
| 1386-15314 |
709 | (((axisAligned && stroker->lastAxisAligned) && evaluated: axisAligned yes Evaluation Count:14918 | yes Evaluation Count:396 |
evaluated: stroker->lastAxisAligned yes Evaluation Count:14517 | yes Evaluation Count:401 |
| 396-14918 |
710 | stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) || evaluated: stroker->lastPixel.x != first.x yes Evaluation Count:12964 | yes Evaluation Count:1553 |
evaluated: stroker->lastPixel.y != first.y yes Evaluation Count:11404 | yes Evaluation Count:1560 |
| 1553-12964 |
711 | (qAbs(stroker->lastPixel.x - first.x) > 1 || partially evaluated: qAbs(stroker->lastPixel.x - first.x) > 1 no Evaluation Count:0 | yes Evaluation Count:3910 |
| 0-3910 |
712 | qAbs(stroker->lastPixel.y - first.y) > 1))) { evaluated: qAbs(stroker->lastPixel.y - first.y) > 1 yes Evaluation Count:125 | yes Evaluation Count:3785 |
| 125-3785 |
713 | | - |
714 | if (swapped) { evaluated: swapped yes Evaluation Count:11515 | yes Evaluation Count:14 |
| 14-11515 |
715 | ++ys; | - |
716 | } else { executed: } Execution Count:11515 | 11515 |
717 | --y; | - |
718 | x -= xinc; | - |
719 | } executed: } Execution Count:14 | 14 |
720 | } | - |
721 | } | - |
722 | stroker->lastDir = dir; | - |
723 | stroker->lastAxisAligned = axisAligned; | - |
724 | | - |
725 | Dasher dasher(stroker, swapped, y << 6, ys << 6); | - |
726 | | - |
727 | do { | - |
728 | if (dasher.on()) partially evaluated: dasher.on() yes Evaluation Count:1343386 | no Evaluation Count:0 |
| 0-1343386 |
729 | drawPixel(stroker, x >> 16, y, 255); executed: drawPixel(stroker, x >> 16, y, 255); Execution Count:1343386 | 1343386 |
730 | dasher.adjust(); | - |
731 | x += xinc; | - |
732 | } while (++y < ys); executed: } Execution Count:1343386 evaluated: ++y < ys yes Evaluation Count:1311723 | yes Evaluation Count:31663 |
| 31663-1343386 |
733 | } executed: } Execution Count:31663 | 31663 |
734 | } else { executed: } Execution Count:31673 | 31673 |
735 | | - |
736 | if (!dx) evaluated: !dx yes Evaluation Count:226 | yes Evaluation Count:35023 |
| 226-35023 |
737 | return; executed: return; Execution Count:226 | 226 |
738 | | - |
739 | QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight; | - |
740 | | - |
741 | bool swapped = false; | - |
742 | if (x1 > x2) { evaluated: x1 > x2 yes Evaluation Count:3960 | yes Evaluation Count:31063 |
| 3960-31063 |
743 | swapped = true; | - |
744 | qSwap(x1, x2); | - |
745 | qSwap(y1, y2); | - |
746 | caps = swapCaps(caps); | - |
747 | dir = QCosmeticStroker::RightToLeft; | - |
748 | } executed: } Execution Count:3960 | 3960 |
749 | int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); | - |
750 | int y = y1 << 10; | - |
751 | | - |
752 | if ((stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir) evaluated: (stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir yes Evaluation Count:1346 | yes Evaluation Count:33677 |
| 1346-33677 |
753 | caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; executed: caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; Execution Count:1346 evaluated: swapped yes Evaluation Count:708 | yes Evaluation Count:638 |
| 638-1346 |
754 | | - |
755 | capAdjust(caps, x1, x2, y, yinc); | - |
756 | | - |
757 | int x = (x1 + 32) >> 6; | - |
758 | int xs = (x2 + 32) >> 6; | - |
759 | | - |
760 | if (x != xs) { evaluated: x != xs yes Evaluation Count:35019 | yes Evaluation Count:4 |
| 4-35019 |
761 | y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; | - |
762 | | - |
763 | | - |
764 | QCosmeticStroker::Point first; | - |
765 | first.x = x; | - |
766 | first.y = y >> 16; | - |
767 | last.x = xs - 1; | - |
768 | last.y = (y + (xs - x - 1)*yinc) >> 16; | - |
769 | if (swapped) evaluated: swapped yes Evaluation Count:3958 | yes Evaluation Count:31061 |
| 3958-31061 |
770 | qSwap(first, last); executed: qSwap(first, last); Execution Count:3958 | 3958 |
771 | | - |
772 | bool axisAligned = qAbs(yinc) < (1 << 14); | - |
773 | if (stroker->lastPixel.x >= 0) { evaluated: stroker->lastPixel.x >= 0 yes Evaluation Count:19806 | yes Evaluation Count:15213 |
| 15213-19806 |
774 | if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) { evaluated: first.x == stroker->lastPixel.x yes Evaluation Count:14688 | yes Evaluation Count:5118 |
evaluated: first.y == stroker->lastPixel.y yes Evaluation Count:14452 | yes Evaluation Count:236 |
| 236-14688 |
775 | | - |
776 | if (swapped) { evaluated: swapped yes Evaluation Count:256 | yes Evaluation Count:14196 |
| 256-14196 |
777 | --xs; | - |
778 | } else { executed: } Execution Count:256 | 256 |
779 | ++x; | - |
780 | y += yinc; | - |
781 | } executed: } Execution Count:14196 | 14196 |
782 | } else if (stroker->lastDir != dir && evaluated: stroker->lastDir != dir yes Evaluation Count:2849 | yes Evaluation Count:2505 |
| 2505-2849 |
783 | (((axisAligned && stroker->lastAxisAligned) && evaluated: axisAligned yes Evaluation Count:1880 | yes Evaluation Count:969 |
evaluated: stroker->lastAxisAligned yes Evaluation Count:1633 | yes Evaluation Count:247 |
| 247-1880 |
784 | stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) || evaluated: stroker->lastPixel.x != first.x yes Evaluation Count:1589 | yes Evaluation Count:44 |
evaluated: stroker->lastPixel.y != first.y yes Evaluation Count:1549 | yes Evaluation Count:40 |
| 40-1589 |
785 | (qAbs(stroker->lastPixel.x - first.x) > 1 || partially evaluated: qAbs(stroker->lastPixel.x - first.x) > 1 no Evaluation Count:0 | yes Evaluation Count:1300 |
| 0-1300 |
786 | qAbs(stroker->lastPixel.y - first.y) > 1))) { evaluated: qAbs(stroker->lastPixel.y - first.y) > 1 yes Evaluation Count:25 | yes Evaluation Count:1275 |
| 25-1275 |
787 | | - |
788 | if (swapped) { evaluated: swapped yes Evaluation Count:1573 | yes Evaluation Count:1 |
| 1-1573 |
789 | ++xs; | - |
790 | } else { executed: } Execution Count:1573 | 1573 |
791 | --x; | - |
792 | y -= yinc; | - |
793 | } executed: } Execution Count:1 | 1 |
794 | } | - |
795 | } | - |
796 | stroker->lastDir = dir; | - |
797 | stroker->lastAxisAligned = axisAligned; | - |
798 | | - |
799 | Dasher dasher(stroker, swapped, x << 6, xs << 6); | - |
800 | | - |
801 | do { | - |
802 | if (dasher.on()) evaluated: dasher.on() yes Evaluation Count:2737049 | yes Evaluation Count:32 |
| 32-2737049 |
803 | drawPixel(stroker, x, y >> 16, 255); executed: drawPixel(stroker, x, y >> 16, 255); Execution Count:2737049 | 2737049 |
804 | dasher.adjust(); | - |
805 | y += yinc; | - |
806 | } while (++x < xs); executed: } Execution Count:2737081 evaluated: ++x < xs yes Evaluation Count:2702062 | yes Evaluation Count:35019 |
| 35019-2737081 |
807 | } executed: } Execution Count:35019 | 35019 |
808 | } executed: } Execution Count:35023 | 35023 |
809 | stroker->lastPixel = last; | - |
810 | } executed: } Execution Count:66696 | 66696 |
811 | | - |
812 | | - |
813 | template<DrawPixel drawPixel, class Dasher> | - |
814 | static void drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) | - |
815 | { | - |
816 | if (stroker->clipLine(rx1, ry1, rx2, ry2)) evaluated: stroker->clipLine(rx1, ry1, rx2, ry2) yes Evaluation Count:482 | yes Evaluation Count:2325 |
| 482-2325 |
817 | return; executed: return; Execution Count:482 | 482 |
818 | | - |
819 | int x1 = ((int)((rx1)*64.)); | - |
820 | int y1 = ((int)((ry1)*64.)); | - |
821 | int x2 = ((int)((rx2)*64.)); | - |
822 | int y2 = ((int)((ry2)*64.)); | - |
823 | | - |
824 | int dx = x2 - x1; | - |
825 | int dy = y2 - y1; | - |
826 | | - |
827 | if (qAbs(dx) < qAbs(dy)) { evaluated: qAbs(dx) < qAbs(dy) yes Evaluation Count:1030 | yes Evaluation Count:1295 |
| 1030-1295 |
828 | | - |
829 | | - |
830 | int xinc = F16Dot16FixedDiv(dx, dy); | - |
831 | | - |
832 | bool swapped = false; | - |
833 | if (y1 > y2) { evaluated: y1 > y2 yes Evaluation Count:463 | yes Evaluation Count:567 |
| 463-567 |
834 | qSwap(y1, y2); | - |
835 | qSwap(x1, x2); | - |
836 | swapped = true; | - |
837 | caps = swapCaps(caps); | - |
838 | } executed: } Execution Count:463 | 463 |
839 | | - |
840 | int x = (x1 - 32) << 10; | - |
841 | x -= ( ((y1 & 63) - 32) * xinc ) >> 6; | - |
842 | | - |
843 | capAdjust(caps, y1, y2, x, xinc); | - |
844 | | - |
845 | Dasher dasher(stroker, swapped, y1, y2); | - |
846 | | - |
847 | int y = y1 >> 6; | - |
848 | int ys = y2 >> 6; | - |
849 | | - |
850 | int alphaStart, alphaEnd; | - |
851 | if (y == ys) { partially evaluated: y == ys no Evaluation Count:0 | yes Evaluation Count:1030 |
| 0-1030 |
852 | alphaStart = y2 - y1; | - |
853 | qt_noop(); | - |
854 | alphaEnd = 0; | - |
855 | } else { | 0 |
856 | alphaStart = 64 - (y1 & 63); | - |
857 | alphaEnd = (y2 & 63); | - |
858 | } executed: } Execution Count:1030 | 1030 |
859 | | - |
860 | | - |
861 | | - |
862 | | - |
863 | if (dasher.on()) { partially evaluated: dasher.on() yes Evaluation Count:1030 | no Evaluation Count:0 |
| 0-1030 |
864 | uint alpha = (quint8)(x >> 8); | - |
865 | drawPixel(stroker, x>>16, y, (255-alpha) * alphaStart >> 6); | - |
866 | drawPixel(stroker, (x>>16) + 1, y, alpha * alphaStart >> 6); | - |
867 | } executed: } Execution Count:1030 | 1030 |
868 | dasher.adjust(); | - |
869 | x += xinc; | - |
870 | ++y; | - |
871 | if (y < ys) { evaluated: y < ys yes Evaluation Count:805 | yes Evaluation Count:225 |
| 225-805 |
872 | do { | - |
873 | if (dasher.on()) { partially evaluated: dasher.on() yes Evaluation Count:14943 | no Evaluation Count:0 |
| 0-14943 |
874 | uint alpha = (quint8)(x >> 8); | - |
875 | drawPixel(stroker, x>>16, y, (255-alpha)); | - |
876 | drawPixel(stroker, (x>>16) + 1, y, alpha); | - |
877 | } executed: } Execution Count:14943 | 14943 |
878 | dasher.adjust(); | - |
879 | x += xinc; | - |
880 | } while (++y < ys); executed: } Execution Count:14943 evaluated: ++y < ys yes Evaluation Count:14138 | yes Evaluation Count:805 |
| 805-14943 |
881 | } executed: } Execution Count:805 | 805 |
882 | | - |
883 | if (alphaEnd && dasher.on()) { evaluated: alphaEnd yes Evaluation Count:683 | yes Evaluation Count:347 |
partially evaluated: dasher.on() yes Evaluation Count:683 | no Evaluation Count:0 |
| 0-683 |
884 | uint alpha = (quint8)(x >> 8); | - |
885 | drawPixel(stroker, x>>16, y, (255-alpha) * alphaEnd >> 6); | - |
886 | drawPixel(stroker, (x>>16) + 1, y, alpha * alphaEnd >> 6); | - |
887 | } executed: } Execution Count:683 | 683 |
888 | } else { executed: } Execution Count:1030 | 1030 |
889 | | - |
890 | if (!dx) evaluated: !dx yes Evaluation Count:46 | yes Evaluation Count:1249 |
| 46-1249 |
891 | return; executed: return; Execution Count:46 | 46 |
892 | | - |
893 | int yinc = F16Dot16FixedDiv(dy, dx); | - |
894 | | - |
895 | bool swapped = false; | - |
896 | if (x1 > x2) { evaluated: x1 > x2 yes Evaluation Count:481 | yes Evaluation Count:768 |
| 481-768 |
897 | qSwap(x1, x2); | - |
898 | qSwap(y1, y2); | - |
899 | swapped = true; | - |
900 | caps = swapCaps(caps); | - |
901 | } executed: } Execution Count:481 | 481 |
902 | | - |
903 | int y = (y1 - 32) << 10; | - |
904 | y -= ( ((x1 & 63) - 32) * yinc ) >> 6; | - |
905 | | - |
906 | capAdjust(caps, x1, x2, y, yinc); | - |
907 | | - |
908 | Dasher dasher(stroker, swapped, x1, x2); | - |
909 | | - |
910 | int x = x1 >> 6; | - |
911 | int xs = x2 >> 6; | - |
912 | | - |
913 | | - |
914 | | - |
915 | int alphaStart, alphaEnd; | - |
916 | if (x == xs) { partially evaluated: x == xs no Evaluation Count:0 | yes Evaluation Count:1249 |
| 0-1249 |
917 | alphaStart = x2 - x1; | - |
918 | qt_noop(); | - |
919 | alphaEnd = 0; | - |
920 | } else { | 0 |
921 | alphaStart = 64 - (x1 & 63); | - |
922 | alphaEnd = (x2 & 63); | - |
923 | } executed: } Execution Count:1249 | 1249 |
924 | | - |
925 | | - |
926 | if (dasher.on()) { partially evaluated: dasher.on() yes Evaluation Count:1249 | no Evaluation Count:0 |
| 0-1249 |
927 | uint alpha = (quint8)(y >> 8); | - |
928 | drawPixel(stroker, x, y>>16, (255-alpha) * alphaStart >> 6); | - |
929 | drawPixel(stroker, x, (y>>16) + 1, alpha * alphaStart >> 6); | - |
930 | } executed: } Execution Count:1249 | 1249 |
931 | dasher.adjust(); | - |
932 | y += yinc; | - |
933 | ++x; | - |
934 | | - |
935 | if (x < xs) { evaluated: x < xs yes Evaluation Count:1024 | yes Evaluation Count:225 |
| 225-1024 |
936 | do { | - |
937 | if (dasher.on()) { partially evaluated: dasher.on() yes Evaluation Count:27637 | no Evaluation Count:0 |
| 0-27637 |
938 | uint alpha = (quint8)(y >> 8); | - |
939 | drawPixel(stroker, x, y>>16, (255-alpha)); | - |
940 | drawPixel(stroker, x, (y>>16) + 1, alpha); | - |
941 | } executed: } Execution Count:27637 | 27637 |
942 | dasher.adjust(); | - |
943 | y += yinc; | - |
944 | } while (++x < xs); executed: } Execution Count:27637 evaluated: ++x < xs yes Evaluation Count:26613 | yes Evaluation Count:1024 |
| 1024-27637 |
945 | } executed: } Execution Count:1024 | 1024 |
946 | | - |
947 | if (alphaEnd && dasher.on()) { evaluated: alphaEnd yes Evaluation Count:867 | yes Evaluation Count:382 |
partially evaluated: dasher.on() yes Evaluation Count:867 | no Evaluation Count:0 |
| 0-867 |
948 | uint alpha = (quint8)(y >> 8); | - |
949 | drawPixel(stroker, x, y>>16, (255-alpha) * alphaEnd >> 6); | - |
950 | drawPixel(stroker, x, (y>>16) + 1, alpha * alphaEnd >> 6); | - |
951 | } executed: } Execution Count:867 | 867 |
952 | } executed: } Execution Count:1249 | 1249 |
953 | } | - |
954 | | - |
955 | | - |
956 | | - |
| | |