painting/qcosmeticstroker.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qcosmeticstroker_p.h" -
43#include "private/qpainterpath_p.h" -
44#include <qdebug.h> -
45#include <math.h> -
46 -
47QT_BEGIN_NAMESPACE -
48 -
49#if 0 -
50inline QString capString(int caps) -
51{ -
52 QString str; -
53 if (caps & QCosmeticStroker::CapBegin) { -
54 str += "CapBegin "; -
55 } -
56 if (caps & QCosmeticStroker::CapEnd) { -
57 str += "CapEnd "; -
58 } -
59 return str; -
60} -
61#endif -
62 -
63#define toF26Dot6(x) ((int)((x)*64.)) -
64 -
65static inline uint sourceOver(uint d, uint color) -
66{ -
67 return color + BYTE_MUL(d, qAlpha(~color));
executed: return color + BYTE_MUL(d, qAlpha(~color));
Execution Count:43908
43908
68} -
69 -
70inline static int F16Dot16FixedDiv(int x, int y) -
71{ -
72 if (qAbs(x) > 0x7fff)
partially evaluated: qAbs(x) > 0x7fff
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:71860
0-71860
73 return (((qlonglong)x) << 16) / y;
never executed: return (((qlonglong)x) << 16) / y;
0
74 return (x << 16) / y;
executed: return (x << 16) / y;
Execution Count:71860
71860
75} -
76 -
77typedef void (*DrawPixel)(QCosmeticStroker *stroker, int x, int y, int coverage); -
78 -
79namespace { -
80 -
81struct Dasher { -
82 QCosmeticStroker *stroker; -
83 int *pattern; -
84 int offset; -
85 int dashIndex; -
86 int dashOn; -
87 -
88 Dasher(QCosmeticStroker *s, bool reverse, int start, int stop) -
89 : stroker(s) -
90 { -
91 int delta = stop - start;
executed (the execution status of this line is deduced): int delta = stop - start;
-
92 if (reverse) {
partially evaluated: reverse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
93 pattern = stroker->reversePattern;
never executed (the execution status of this line is deduced): pattern = stroker->reversePattern;
-
94 offset = stroker->patternLength - stroker->patternOffset - delta - ((start & 63) - 32);
never executed (the execution status of this line is deduced): offset = stroker->patternLength - stroker->patternOffset - delta - ((start & 63) - 32);
-
95 dashOn = 0;
never executed (the execution status of this line is deduced): dashOn = 0;
-
96 } else {
never executed: }
0
97 pattern = stroker->pattern;
executed (the execution status of this line is deduced): pattern = stroker->pattern;
-
98 offset = stroker->patternOffset - ((start & 63) - 32);
executed (the execution status of this line is deduced): offset = stroker->patternOffset - ((start & 63) - 32);
-
99 dashOn = 1;
executed (the execution status of this line is deduced): dashOn = 1;
-
100 }
executed: }
Execution Count:2
2
101 offset %= stroker->patternLength;
executed (the execution status of this line is deduced): offset %= stroker->patternLength;
-
102 if (offset < 0)
partially evaluated: offset < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
103 offset += stroker->patternLength;
never executed: offset += stroker->patternLength;
0
104 -
105 dashIndex = 0;
executed (the execution status of this line is deduced): dashIndex = 0;
-
106 while (offset>= pattern[dashIndex])
partially evaluated: offset>= pattern[dashIndex]
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
107 ++dashIndex;
never executed: ++dashIndex;
0
108 -
109// qDebug() << " dasher" << offset/64. << reverse << dashIndex; -
110 stroker->patternOffset += delta;
executed (the execution status of this line is deduced): stroker->patternOffset += delta;
-
111 stroker->patternOffset %= stroker->patternLength;
executed (the execution status of this line is deduced): stroker->patternOffset %= stroker->patternLength;
-
112 }
executed: }
Execution Count:2
2
113 -
114 bool on() const { -
115 return (dashIndex + dashOn) & 1;
executed: return (dashIndex + dashOn) & 1;
Execution Count:98
98
116 } -
117 void adjust() { -
118 offset += 64;
executed (the execution status of this line is deduced): offset += 64;
-
119 if (offset >= pattern[dashIndex]) {
evaluated: offset >= pattern[dashIndex]
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:66
32-66
120 ++dashIndex;
executed (the execution status of this line is deduced): ++dashIndex;
-
121 dashIndex %= stroker->patternSize;
executed (the execution status of this line is deduced): dashIndex %= stroker->patternSize;
-
122 }
executed: }
Execution Count:32
32
123 offset %= stroker->patternLength;
executed (the execution status of this line is deduced): offset %= stroker->patternLength;
-
124// qDebug() << "dasher.adjust" << offset/64. << dashIndex; -
125 }
executed: }
Execution Count:98
98
126}; -
127 -
128struct NoDasher { -
129 NoDasher(QCosmeticStroker *, bool, int, int) {} -
130 bool on() const { return true; }
executed: return true;
Execution Count:4126778
4126778
131 void adjust(int = 0) {} -
132}; -
133 -
134}; -
135 -
136template<DrawPixel drawPixel, class Dasher> -
137static void drawLine(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); -
138template<DrawPixel drawPixel, class Dasher> -
139static void drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); -
140 -
141inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) -
142{ -
143 const QRect &cl = stroker->clip;
executed (the execution status of this line is deduced): const QRect &cl = stroker->clip;
-
144 if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
evaluated: x < cl.x()
TRUEFALSE
yes
Evaluation Count:1352
yes
Evaluation Count:4116683
evaluated: x > cl.right()
TRUEFALSE
yes
Evaluation Count:10065
yes
Evaluation Count:4106618
evaluated: y < cl.y()
TRUEFALSE
yes
Evaluation Count:4805
yes
Evaluation Count:4101813
evaluated: y > cl.bottom()
TRUEFALSE
yes
Evaluation Count:23110
yes
Evaluation Count:4078703
1352-4116683
145 return;
executed: return;
Execution Count:39332
39332
146 -
147 int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ;
executed (the execution status of this line is deduced): int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ;
-
148 int lasty = stroker->spans[stroker->current_span-1].y;
executed (the execution status of this line is deduced): int lasty = stroker->spans[stroker->current_span-1].y;
-
149 -
150 if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) {
evaluated: stroker->current_span == QCosmeticStroker::NSPANS
TRUEFALSE
yes
Evaluation Count:3894
yes
Evaluation Count:4074809
evaluated: y < lasty
TRUEFALSE
yes
Evaluation Count:60269
yes
Evaluation Count:4014540
evaluated: y == lasty
TRUEFALSE
yes
Evaluation Count:2643390
yes
Evaluation Count:1371150
evaluated: x < lastx
TRUEFALSE
yes
Evaluation Count:1183
yes
Evaluation Count:2642207
1183-4074809
151 stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData);
executed (the execution status of this line is deduced): stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData);
-
152 stroker->current_span = 0;
executed (the execution status of this line is deduced): stroker->current_span = 0;
-
153 }
executed: }
Execution Count:65346
65346
154 -
155 stroker->spans[stroker->current_span].x = ushort(x);
executed (the execution status of this line is deduced): stroker->spans[stroker->current_span].x = ushort(x);
-
156 stroker->spans[stroker->current_span].len = 1;
executed (the execution status of this line is deduced): stroker->spans[stroker->current_span].len = 1;
-
157 stroker->spans[stroker->current_span].y = y;
executed (the execution status of this line is deduced): stroker->spans[stroker->current_span].y = y;
-
158 stroker->spans[stroker->current_span].coverage = coverage*stroker->opacity >> 8;
executed (the execution status of this line is deduced): stroker->spans[stroker->current_span].coverage = coverage*stroker->opacity >> 8;
-
159 ++stroker->current_span;
executed (the execution status of this line is deduced): ++stroker->current_span;
-
160}
executed: }
Execution Count:4078703
4078703
161 -
162inline void drawPixelARGB32(QCosmeticStroker *stroker, int x, int y, int coverage) -
163{ -
164 const QRect &cl = stroker->clip;
executed (the execution status of this line is deduced): const QRect &cl = stroker->clip;
-
165 if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
evaluated: x < cl.x()
TRUEFALSE
yes
Evaluation Count:2752
yes
Evaluation Count:33908
evaluated: x > cl.right()
TRUEFALSE
yes
Evaluation Count:2232
yes
Evaluation Count:31676
evaluated: y < cl.y()
TRUEFALSE
yes
Evaluation Count:1866
yes
Evaluation Count:29810
evaluated: y > cl.bottom()
TRUEFALSE
yes
Evaluation Count:2050
yes
Evaluation Count:27760
1866-33908
166 return;
executed: return;
Execution Count:8900
8900
167 -
168 int offset = x + stroker->ppl*y;
executed (the execution status of this line is deduced): int offset = x + stroker->ppl*y;
-
169 uint c = BYTE_MUL(stroker->color, coverage);
executed (the execution status of this line is deduced): uint c = BYTE_MUL(stroker->color, coverage);
-
170 stroker->pixels[offset] = sourceOver(stroker->pixels[offset], c);
executed (the execution status of this line is deduced): stroker->pixels[offset] = sourceOver(stroker->pixels[offset], c);
-
171}
executed: }
Execution Count:27760
27760
172 -
173inline void drawPixelARGB32Opaque(QCosmeticStroker *stroker, int x, int y, int) -
174{ -
175 const QRect &cl = stroker->clip;
executed (the execution status of this line is deduced): const QRect &cl = stroker->clip;
-
176 if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
evaluated: x < cl.x()
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:18736
evaluated: x > cl.right()
TRUEFALSE
yes
Evaluation Count:1348
yes
Evaluation Count:17388
partially evaluated: y < cl.y()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17388
evaluated: y > cl.bottom()
TRUEFALSE
yes
Evaluation Count:1240
yes
Evaluation Count:16148
0-18736
177 return;
executed: return;
Execution Count:2624
2624
178 -
179 int offset = x + stroker->ppl*y;
executed (the execution status of this line is deduced): int offset = x + stroker->ppl*y;
-
180 stroker->pixels[offset] = sourceOver(stroker->pixels[offset], stroker->color);
executed (the execution status of this line is deduced): stroker->pixels[offset] = sourceOver(stroker->pixels[offset], stroker->color);
-
181}
executed: }
Execution Count:16148
16148
182 -
183enum StrokeSelection { -
184 Aliased = 0, -
185 AntiAliased = 1, -
186 Solid = 0, -
187 Dashed = 2, -
188 RegularDraw = 0, -
189 FastDraw = 4 -
190}; -
191 -
192static StrokeLine strokeLine(int strokeSelection) -
193{ -
194 StrokeLine stroke;
executed (the execution status of this line is deduced): StrokeLine stroke;
-
195 -
196 switch (strokeSelection) { -
197 case Aliased|Solid|RegularDraw: -
198 stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixel, NoDasher>;
executed (the execution status of this line is deduced): stroke = &::drawLine<drawPixel, NoDasher>;
-
199 break;
executed: break;
Execution Count:32584
32584
200 case Aliased|Solid|FastDraw: -
201 stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixelARGB32Opaque, NoDasher>;
executed (the execution status of this line is deduced): stroke = &::drawLine<drawPixelARGB32Opaque, NoDasher>;
-
202 break;
executed: break;
Execution Count:228
228
203 case Aliased|Dashed|RegularDraw: -
204 stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixel, Dasher>;
executed (the execution status of this line is deduced): stroke = &::drawLine<drawPixel, Dasher>;
-
205 break;
executed: break;
Execution Count:10
10
206 case Aliased|Dashed|FastDraw: -
207 stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixelARGB32Opaque, Dasher>;
never executed (the execution status of this line is deduced): stroke = &::drawLine<drawPixelARGB32Opaque, Dasher>;
-
208 break;
never executed: break;
0
209 case AntiAliased|Solid|RegularDraw: -
210 stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixel, NoDasher>;
executed (the execution status of this line is deduced): stroke = &::drawLineAA<drawPixel, NoDasher>;
-
211 break;
executed: break;
Execution Count:113
113
212 case AntiAliased|Solid|FastDraw: -
213 stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixelARGB32, NoDasher>;
executed (the execution status of this line is deduced): stroke = &::drawLineAA<drawPixelARGB32, NoDasher>;
-
214 break;
executed: break;
Execution Count:218
218
215 case AntiAliased|Dashed|RegularDraw: -
216 stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixel, Dasher>;
never executed (the execution status of this line is deduced): stroke = &::drawLineAA<drawPixel, Dasher>;
-
217 break;
never executed: break;
0
218 case AntiAliased|Dashed|FastDraw: -
219 stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixelARGB32, Dasher>;
never executed (the execution status of this line is deduced): stroke = &::drawLineAA<drawPixelARGB32, Dasher>;
-
220 break;
never executed: break;
0
221 default: -
222 Q_ASSERT(false);
never executed (the execution status of this line is deduced): qt_noop();
-
223 stroke = 0;
never executed (the execution status of this line is deduced): stroke = 0;
-
224 }
never executed: }
0
225 return stroke;
executed: return stroke;
Execution Count:33153
33153
226} -
227 -
228void QCosmeticStroker::setup() -
229{ -
230 blend = state->penData.blend;
executed (the execution status of this line is deduced): blend = state->penData.blend;
-
231 if (state->clip && state->clip->enabled && state->clip->hasRectClip && !state->clip->clipRect.isEmpty()) {
evaluated: state->clip
TRUEFALSE
yes
Evaluation Count:5139
yes
Evaluation Count:28014
partially evaluated: state->clip->enabled
TRUEFALSE
yes
Evaluation Count:5139
no
Evaluation Count:0
evaluated: state->clip->hasRectClip
TRUEFALSE
yes
Evaluation Count:4904
yes
Evaluation Count:235
partially evaluated: !state->clip->clipRect.isEmpty()
TRUEFALSE
yes
Evaluation Count:4904
no
Evaluation Count:0
0-28014
232 clip &= state->clip->clipRect;
executed (the execution status of this line is deduced): clip &= state->clip->clipRect;
-
233 blend = state->penData.unclipped_blend;
executed (the execution status of this line is deduced): blend = state->penData.unclipped_blend;
-
234 }
executed: }
Execution Count:4904
4904
235 -
236 int strokeSelection = 0;
executed (the execution status of this line is deduced): int strokeSelection = 0;
-
237 if (blend == state->penData.unclipped_blend
evaluated: blend == state->penData.unclipped_blend
TRUEFALSE
yes
Evaluation Count:4904
yes
Evaluation Count:28249
4904-28249
238 && state->penData.type == QSpanData::Solid
evaluated: state->penData.type == QSpanData::Solid
TRUEFALSE
yes
Evaluation Count:4898
yes
Evaluation Count:6
6-4898
239 && (state->penData.rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
evaluated: state->penData.rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
TRUEFALSE
yes
Evaluation Count:438
yes
Evaluation Count:4460
438-4460
240 || state->penData.rasterBuffer->format == QImage::Format_RGB32)
evaluated: state->penData.rasterBuffer->format == QImage::Format_RGB32
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:4452
8-4452
241 && state->compositionMode() == QPainter::CompositionMode_SourceOver)
partially evaluated: state->compositionMode() == QPainter::CompositionMode_SourceOver
TRUEFALSE
yes
Evaluation Count:446
no
Evaluation Count:0
0-446
242 strokeSelection |= FastDraw;
executed: strokeSelection |= FastDraw;
Execution Count:446
446
243 -
244 if (state->renderHints & QPainter::Antialiasing)
evaluated: state->renderHints & QPainter::Antialiasing
TRUEFALSE
yes
Evaluation Count:331
yes
Evaluation Count:32822
331-32822
245 strokeSelection |= AntiAliased;
executed: strokeSelection |= AntiAliased;
Execution Count:331
331
246 -
247 const QVector<qreal> &penPattern = state->lastPen.dashPattern();
executed (the execution status of this line is deduced): const QVector<qreal> &penPattern = state->lastPen.dashPattern();
-
248 if (penPattern.isEmpty()) {
evaluated: penPattern.isEmpty()
TRUEFALSE
yes
Evaluation Count:33143
yes
Evaluation Count:10
10-33143
249 Q_ASSERT(!pattern && !reversePattern);
executed (the execution status of this line is deduced): qt_noop();
-
250 pattern = 0;
executed (the execution status of this line is deduced): pattern = 0;
-
251 reversePattern = 0;
executed (the execution status of this line is deduced): reversePattern = 0;
-
252 patternLength = 0;
executed (the execution status of this line is deduced): patternLength = 0;
-
253 patternSize = 0;
executed (the execution status of this line is deduced): patternSize = 0;
-
254 } else {
executed: }
Execution Count:33143
33143
255 pattern = (int *)malloc(penPattern.size()*sizeof(int));
executed (the execution status of this line is deduced): pattern = (int *)malloc(penPattern.size()*sizeof(int));
-
256 reversePattern = (int *)malloc(penPattern.size()*sizeof(int));
executed (the execution status of this line is deduced): reversePattern = (int *)malloc(penPattern.size()*sizeof(int));
-
257 patternSize = penPattern.size();
executed (the execution status of this line is deduced): patternSize = penPattern.size();
-
258 -
259 patternLength = 0;
executed (the execution status of this line is deduced): patternLength = 0;
-
260 for (int i = 0; i < patternSize; ++i) {
evaluated: i < patternSize
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:10
10-20
261 patternLength += (int) qMax(1. , penPattern.at(i)*64.);
executed (the execution status of this line is deduced): patternLength += (int) qMax(1. , penPattern.at(i)*64.);
-
262 pattern[i] = patternLength;
executed (the execution status of this line is deduced): pattern[i] = patternLength;
-
263 }
executed: }
Execution Count:20
20
264 patternLength = 0;
executed (the execution status of this line is deduced): patternLength = 0;
-
265 for (int i = 0; i < patternSize; ++i) {
evaluated: i < patternSize
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:10
10-20
266 patternLength += (int) qMax(1., penPattern.at(patternSize - 1 - i)*64.);
executed (the execution status of this line is deduced): patternLength += (int) qMax(1., penPattern.at(patternSize - 1 - i)*64.);
-
267 reversePattern[i] = patternLength;
executed (the execution status of this line is deduced): reversePattern[i] = patternLength;
-
268 }
executed: }
Execution Count:20
20
269 strokeSelection |= Dashed;
executed (the execution status of this line is deduced): strokeSelection |= Dashed;
-
270// qDebug() << "setup: size=" << patternSize << "length=" << patternLength/64.; -
271 }
executed: }
Execution Count:10
10
272 -
273 stroke = strokeLine(strokeSelection);
executed (the execution status of this line is deduced): stroke = strokeLine(strokeSelection);
-
274 -
275 qreal width = state->lastPen.widthF();
executed (the execution status of this line is deduced): qreal width = state->lastPen.widthF();
-
276 if (width == 0)
evaluated: width == 0
TRUEFALSE
yes
Evaluation Count:981
yes
Evaluation Count:32172
981-32172
277 opacity = 256;
executed: opacity = 256;
Execution Count:981
981
278 else if (qt_pen_is_cosmetic(state->lastPen, state->renderHints))
evaluated: qt_pen_is_cosmetic(state->lastPen, state->renderHints)
TRUEFALSE
yes
Evaluation Count:887
yes
Evaluation Count:31285
887-31285
279 opacity = (int) 256*width;
executed: opacity = (int) 256*width;
Execution Count:887
887
280 else -
281 opacity = (int) 256*width*state->txscale;
executed: opacity = (int) 256*width*state->txscale;
Execution Count:31285
31285
282 opacity = qBound(0, opacity, 256);
executed (the execution status of this line is deduced): opacity = qBound(0, opacity, 256);
-
283 -
284 drawCaps = state->lastPen.capStyle() != Qt::FlatCap;
executed (the execution status of this line is deduced): drawCaps = state->lastPen.capStyle() != Qt::FlatCap;
-
285 -
286 if (strokeSelection & FastDraw) {
evaluated: strokeSelection & FastDraw
TRUEFALSE
yes
Evaluation Count:446
yes
Evaluation Count:32707
446-32707
287 color = INTERPOLATE_PIXEL_256(state->penData.solid.color, opacity, 0, 0);
executed (the execution status of this line is deduced): color = INTERPOLATE_PIXEL_256(state->penData.solid.color, opacity, 0, 0);
-
288 QRasterBuffer *buffer = state->penData.rasterBuffer;
executed (the execution status of this line is deduced): QRasterBuffer *buffer = state->penData.rasterBuffer;
-
289 pixels = (uint *)buffer->buffer();
executed (the execution status of this line is deduced): pixels = (uint *)buffer->buffer();
-
290 ppl = buffer->bytesPerLine()>>2;
executed (the execution status of this line is deduced): ppl = buffer->bytesPerLine()>>2;
-
291 }
executed: }
Execution Count:446
446
292 -
293 // setup FP clip bounds -
294 xmin = clip.left() - 1;
executed (the execution status of this line is deduced): xmin = clip.left() - 1;
-
295 xmax = clip.right() + 2;
executed (the execution status of this line is deduced): xmax = clip.right() + 2;
-
296 ymin = clip.top() - 1;
executed (the execution status of this line is deduced): ymin = clip.top() - 1;
-
297 ymax = clip.bottom() + 2;
executed (the execution status of this line is deduced): ymax = clip.bottom() + 2;
-
298 -
299 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
300}
executed: }
Execution Count:33153
33153
301 -
302// returns true if the whole line gets clipped away -
303bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2) -
304{ -
305 // basic/rough clipping is done in floating point coordinates to avoid -
306 // integer overflow problems. -
307 if (x1 < xmin) {
evaluated: x1 < xmin
TRUEFALSE
yes
Evaluation Count:605
yes
Evaluation Count:75636
605-75636
308 if (x2 <= xmin)
evaluated: x2 <= xmin
TRUEFALSE
yes
Evaluation Count:268
yes
Evaluation Count:337
268-337
309 goto clipped;
executed: goto clipped;
Execution Count:268
268
310 y1 += (y2 - y1)/(x2 - x1) * (xmin - x1);
executed (the execution status of this line is deduced): y1 += (y2 - y1)/(x2 - x1) * (xmin - x1);
-
311 x1 = xmin;
executed (the execution status of this line is deduced): x1 = xmin;
-
312 } else if (x1 > xmax) {
executed: }
Execution Count:337
evaluated: x1 > xmax
TRUEFALSE
yes
Evaluation Count:1956
yes
Evaluation Count:73680
337-73680
313 if (x2 >= xmax)
evaluated: x2 >= xmax
TRUEFALSE
yes
Evaluation Count:1920
yes
Evaluation Count:36
36-1920
314 goto clipped;
executed: goto clipped;
Execution Count:1920
1920
315 y1 += (y2 - y1)/(x2 - x1) * (xmax - x1);
executed (the execution status of this line is deduced): y1 += (y2 - y1)/(x2 - x1) * (xmax - x1);
-
316 x1 = xmax;
executed (the execution status of this line is deduced): x1 = xmax;
-
317 }
executed: }
Execution Count:36
36
318 if (x2 < xmin) {
evaluated: x2 < xmin
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:74039
14-74039
319 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
320 y2 += (y2 - y1)/(x2 - x1) * (xmin - x2);
executed (the execution status of this line is deduced): y2 += (y2 - y1)/(x2 - x1) * (xmin - x2);
-
321 x2 = xmin;
executed (the execution status of this line is deduced): x2 = xmin;
-
322 } else if (x2 > xmax) {
executed: }
Execution Count:14
evaluated: x2 > xmax
TRUEFALSE
yes
Evaluation Count:1407
yes
Evaluation Count:72632
14-72632
323 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
324 y2 += (y2 - y1)/(x2 - x1) * (xmax - x2);
executed (the execution status of this line is deduced): y2 += (y2 - y1)/(x2 - x1) * (xmax - x2);
-
325 x2 = xmax;
executed (the execution status of this line is deduced): x2 = xmax;
-
326 }
executed: }
Execution Count:1407
1407
327 -
328 if (y1 < ymin) {
evaluated: y1 < ymin
TRUEFALSE
yes
Evaluation Count:458
yes
Evaluation Count:73595
458-73595
329 if (y2 <= ymin)
evaluated: y2 <= ymin
TRUEFALSE
yes
Evaluation Count:449
yes
Evaluation Count:9
9-449
330 goto clipped;
executed: goto clipped;
Execution Count:449
449
331 x1 += (x2 - x1)/(y2 - y1) * (ymin - y1);
executed (the execution status of this line is deduced): x1 += (x2 - x1)/(y2 - y1) * (ymin - y1);
-
332 y1 = ymin;
executed (the execution status of this line is deduced): y1 = ymin;
-
333 } else if (y1 > ymax) {
executed: }
Execution Count:9
evaluated: y1 > ymax
TRUEFALSE
yes
Evaluation Count:2275
yes
Evaluation Count:71320
9-71320
334 if (y2 >= ymax)
evaluated: y2 >= ymax
TRUEFALSE
yes
Evaluation Count:1385
yes
Evaluation Count:890
890-1385
335 goto clipped;
executed: goto clipped;
Execution Count:1385
1385
336 x1 += (x2 - x1)/(y2 - y1) * (ymax - y1);
executed (the execution status of this line is deduced): x1 += (x2 - x1)/(y2 - y1) * (ymax - y1);
-
337 y1 = ymax;
executed (the execution status of this line is deduced): y1 = ymax;
-
338 }
executed: }
Execution Count:890
890
339 if (y2 < ymin) {
evaluated: y2 < ymin
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:72123
96-72123
340 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
341 x2 += (x2 - x1)/(y2 - y1) * (ymin - y2);
executed (the execution status of this line is deduced): x2 += (x2 - x1)/(y2 - y1) * (ymin - y2);
-
342 y2 = ymin;
executed (the execution status of this line is deduced): y2 = ymin;
-
343 } else if (y2 > ymax) {
executed: }
Execution Count:96
evaluated: y2 > ymax
TRUEFALSE
yes
Evaluation Count:80
yes
Evaluation Count:72043
80-72043
344 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
345 x2 += (x2 - x1)/(y2 - y1) * (ymax - y2);
executed (the execution status of this line is deduced): x2 += (x2 - x1)/(y2 - y1) * (ymax - y2);
-
346 y2 = ymax;
executed (the execution status of this line is deduced): y2 = ymax;
-
347 }
executed: }
Execution Count:80
80
348 -
349 return false;
executed: return false;
Execution Count:72219
72219
350 -
351 clipped: -
352 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
353 return true;
executed: return true;
Execution Count:4022
4022
354} -
355 -
356 -
357void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2) -
358{ -
359 if (p1 == p2) {
evaluated: p1 == p2
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:4813
60-4813
360 drawPoints(&p1, 1);
executed (the execution status of this line is deduced): drawPoints(&p1, 1);
-
361 return;
executed: return;
Execution Count:60
60
362 } -
363 -
364 QPointF start = p1 * state->matrix;
executed (the execution status of this line is deduced): QPointF start = p1 * state->matrix;
-
365 QPointF end = p2 * state->matrix;
executed (the execution status of this line is deduced): QPointF end = p2 * state->matrix;
-
366 -
367 patternOffset = state->lastPen.dashOffset()*64;
executed (the execution status of this line is deduced): patternOffset = state->lastPen.dashOffset()*64;
-
368 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
369 -
370 stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0);
executed (the execution status of this line is deduced): stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0);
-
371 -
372 blend(current_span, spans, &state->penData);
executed (the execution status of this line is deduced): blend(current_span, spans, &state->penData);
-
373 current_span = 0;
executed (the execution status of this line is deduced): current_span = 0;
-
374}
executed: }
Execution Count:4813
4813
375 -
376void QCosmeticStroker::drawPoints(const QPoint *points, int num) -
377{ -
378 const QPoint *end = points + num;
executed (the execution status of this line is deduced): const QPoint *end = points + num;
-
379 while (points < end) {
evaluated: points < end
TRUEFALSE
yes
Evaluation Count:154
yes
Evaluation Count:146
146-154
380 QPointF p = QPointF(*points) * state->matrix;
executed (the execution status of this line is deduced): QPointF p = QPointF(*points) * state->matrix;
-
381 drawPixel(this, qRound(p.x()), qRound(p.y()), 255);
executed (the execution status of this line is deduced): drawPixel(this, qRound(p.x()), qRound(p.y()), 255);
-
382 ++points;
executed (the execution status of this line is deduced): ++points;
-
383 }
executed: }
Execution Count:154
154
384 -
385 blend(current_span, spans, &state->penData);
executed (the execution status of this line is deduced): blend(current_span, spans, &state->penData);
-
386 current_span = 0;
executed (the execution status of this line is deduced): current_span = 0;
-
387}
executed: }
Execution Count:146
146
388 -
389void QCosmeticStroker::drawPoints(const QPointF *points, int num) -
390{ -
391 const QPointF *end = points + num;
executed (the execution status of this line is deduced): const QPointF *end = points + num;
-
392 while (points < end) {
evaluated: points < end
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:60
60
393 QPointF p = (*points) * state->matrix;
executed (the execution status of this line is deduced): QPointF p = (*points) * state->matrix;
-
394 drawPixel(this, qRound(p.x()), qRound(p.y()), 255);
executed (the execution status of this line is deduced): drawPixel(this, qRound(p.x()), qRound(p.y()), 255);
-
395 ++points;
executed (the execution status of this line is deduced): ++points;
-
396 }
executed: }
Execution Count:60
60
397 -
398 blend(current_span, spans, &state->penData);
executed (the execution status of this line is deduced): blend(current_span, spans, &state->penData);
-
399 current_span = 0;
executed (the execution status of this line is deduced): current_span = 0;
-
400}
executed: }
Execution Count:60
60
401 -
402void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal ry2) -
403{ -
404 // this is basically the same code as used in the aliased stroke method, -
405 // but it only determines the direction and last point of a line -
406 // -
407 // This is being used to have proper dropout control for closed contours -
408 // by calculating the direction and last pixel of the last segment in the contour. -
409 // the info is then used to perform dropout control when drawing the first line segment -
410 // of the contour -
411 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
412 lastPixel.y = -1;
executed (the execution status of this line is deduced): lastPixel.y = -1;
-
413 -
414 if (clipLine(rx1, ry1, rx2, ry2))
evaluated: clipLine(rx1, ry1, rx2, ry2)
TRUEFALSE
yes
Evaluation Count:145
yes
Evaluation Count:2972
145-2972
415 return;
executed: return;
Execution Count:145
145
416 -
417 const int half = legacyRounding ? 31 : 0;
evaluated: legacyRounding
TRUEFALSE
yes
Evaluation Count:634
yes
Evaluation Count:2338
634-2338
418 int x1 = toF26Dot6(rx1) + half;
executed (the execution status of this line is deduced): int x1 = ((int)((rx1)*64.)) + half;
-
419 int y1 = toF26Dot6(ry1) + half;
executed (the execution status of this line is deduced): int y1 = ((int)((ry1)*64.)) + half;
-
420 int x2 = toF26Dot6(rx2) + half;
executed (the execution status of this line is deduced): int x2 = ((int)((rx2)*64.)) + half;
-
421 int y2 = toF26Dot6(ry2) + half;
executed (the execution status of this line is deduced): int y2 = ((int)((ry2)*64.)) + half;
-
422 -
423 int dx = qAbs(x2 - x1);
executed (the execution status of this line is deduced): int dx = qAbs(x2 - x1);
-
424 int dy = qAbs(y2 - y1);
executed (the execution status of this line is deduced): int dy = qAbs(y2 - y1);
-
425 -
426 if (dx < dy) {
evaluated: dx < dy
TRUEFALSE
yes
Evaluation Count:1831
yes
Evaluation Count:1141
1141-1831
427 // vertical -
428 bool swapped = false;
executed (the execution status of this line is deduced): bool swapped = false;
-
429 if (y1 > y2) {
evaluated: y1 > y2
TRUEFALSE
yes
Evaluation Count:1727
yes
Evaluation Count:104
104-1727
430 swapped = true;
executed (the execution status of this line is deduced): swapped = true;
-
431 qSwap(y1, y2);
executed (the execution status of this line is deduced): qSwap(y1, y2);
-
432 qSwap(x1, x2);
executed (the execution status of this line is deduced): qSwap(x1, x2);
-
433 }
executed: }
Execution Count:1727
1727
434 int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
executed (the execution status of this line is deduced): int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
-
435 int x = x1 << 10;
executed (the execution status of this line is deduced): int x = x1 << 10;
-
436 -
437 int y = (y1 + 32) >> 6;
executed (the execution status of this line is deduced): int y = (y1 + 32) >> 6;
-
438 int ys = (y2 + 32) >> 6;
executed (the execution status of this line is deduced): int ys = (y2 + 32) >> 6;
-
439 -
440 if (y != ys) {
partially evaluated: y != ys
TRUEFALSE
yes
Evaluation Count:1831
no
Evaluation Count:0
0-1831
441 x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6;
executed (the execution status of this line is deduced): x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6;
-
442 -
443 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:1727
yes
Evaluation Count:104
104-1727
444 lastPixel.x = x >> 16;
executed (the execution status of this line is deduced): lastPixel.x = x >> 16;
-
445 lastPixel.y = y;
executed (the execution status of this line is deduced): lastPixel.y = y;
-
446 lastDir = QCosmeticStroker::BottomToTop;
executed (the execution status of this line is deduced): lastDir = QCosmeticStroker::BottomToTop;
-
447 } else {
executed: }
Execution Count:1727
1727
448 lastPixel.x = (x + (ys - y - 1)*xinc) >> 16;
executed (the execution status of this line is deduced): lastPixel.x = (x + (ys - y - 1)*xinc) >> 16;
-
449 lastPixel.y = ys - 1;
executed (the execution status of this line is deduced): lastPixel.y = ys - 1;
-
450 lastDir = QCosmeticStroker::TopToBottom;
executed (the execution status of this line is deduced): lastDir = QCosmeticStroker::TopToBottom;
-
451 }
executed: }
Execution Count:104
104
452 lastAxisAligned = qAbs(xinc) < (1 << 14);
executed (the execution status of this line is deduced): lastAxisAligned = qAbs(xinc) < (1 << 14);
-
453 }
executed: }
Execution Count:1831
1831
454 } else {
executed: }
Execution Count:1831
1831
455 // horizontal -
456 if (!dx)
evaluated: !dx
TRUEFALSE
yes
Evaluation Count:87
yes
Evaluation Count:1054
87-1054
457 return;
executed: return;
Execution Count:87
87
458 -
459 bool swapped = false;
executed (the execution status of this line is deduced): bool swapped = false;
-
460 if (x1 > x2) {
evaluated: x1 > x2
TRUEFALSE
yes
Evaluation Count:644
yes
Evaluation Count:410
410-644
461 swapped = true;
executed (the execution status of this line is deduced): swapped = true;
-
462 qSwap(x1, x2);
executed (the execution status of this line is deduced): qSwap(x1, x2);
-
463 qSwap(y1, y2);
executed (the execution status of this line is deduced): qSwap(y1, y2);
-
464 }
executed: }
Execution Count:644
644
465 int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
executed (the execution status of this line is deduced): int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
-
466 int y = y1 << 10;
executed (the execution status of this line is deduced): int y = y1 << 10;
-
467 -
468 int x = (x1 + 32) >> 6;
executed (the execution status of this line is deduced): int x = (x1 + 32) >> 6;
-
469 int xs = (x2 + 32) >> 6;
executed (the execution status of this line is deduced): int xs = (x2 + 32) >> 6;
-
470 -
471 if (x != xs) {
evaluated: x != xs
TRUEFALSE
yes
Evaluation Count:940
yes
Evaluation Count:114
114-940
472 y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6;
executed (the execution status of this line is deduced): y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6;
-
473 -
474 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:644
yes
Evaluation Count:296
296-644
475 lastPixel.x = x;
executed (the execution status of this line is deduced): lastPixel.x = x;
-
476 lastPixel.y = y >> 16;
executed (the execution status of this line is deduced): lastPixel.y = y >> 16;
-
477 lastDir = QCosmeticStroker::RightToLeft;
executed (the execution status of this line is deduced): lastDir = QCosmeticStroker::RightToLeft;
-
478 } else {
executed: }
Execution Count:644
644
479 lastPixel.x = xs - 1;
executed (the execution status of this line is deduced): lastPixel.x = xs - 1;
-
480 lastPixel.y = (y + (xs - x - 1)*yinc) >> 16;
executed (the execution status of this line is deduced): lastPixel.y = (y + (xs - x - 1)*yinc) >> 16;
-
481 lastDir = QCosmeticStroker::LeftToRight;
executed (the execution status of this line is deduced): lastDir = QCosmeticStroker::LeftToRight;
-
482 }
executed: }
Execution Count:296
296
483 lastAxisAligned = qAbs(yinc) < (1 << 14);
executed (the execution status of this line is deduced): lastAxisAligned = qAbs(yinc) < (1 << 14);
-
484 }
executed: }
Execution Count:940
940
485 }
executed: }
Execution Count:1054
1054
486// qDebug() << " moveTo: setting last pixel to x/y dir" << lastPixel.x << lastPixel.y << lastDir; -
487} -
488 -
489static inline const QPainterPath::ElementType *subPath(const QPainterPath::ElementType *t, const QPainterPath::ElementType *end, -
490 const qreal *points, bool *closed) -
491{ -
492 const QPainterPath::ElementType *start = t;
executed (the execution status of this line is deduced): const QPainterPath::ElementType *start = t;
-
493 ++t;
executed (the execution status of this line is deduced): ++t;
-
494 -
495 // find out if the subpath is closed -
496 while (t < end) {
evaluated: t < end
TRUEFALSE
yes
Evaluation Count:4852
yes
Evaluation Count:341
341-4852
497 if (*t == QPainterPath::MoveToElement)
evaluated: *t == QPainterPath::MoveToElement
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:4822
30-4822
498 break;
executed: break;
Execution Count:30
30
499 ++t;
executed (the execution status of this line is deduced): ++t;
-
500 }
executed: }
Execution Count:4822
4822
501 -
502 int offset = t - start - 1;
executed (the execution status of this line is deduced): int offset = t - start - 1;
-
503// qDebug() << "subpath" << offset << points[0] << points[1] << points[2*offset] << points[2*offset+1]; -
504 *closed = (points[0] == points[2*offset] && points[1] == points[2*offset + 1]);
evaluated: points[0] == points[2*offset]
TRUEFALSE
yes
Evaluation Count:341
yes
Evaluation Count:30
evaluated: points[1] == points[2*offset + 1]
TRUEFALSE
yes
Evaluation Count:317
yes
Evaluation Count:24
24-341
505 -
506 return t;
executed: return t;
Execution Count:371
371
507} -
508 -
509void QCosmeticStroker::drawPath(const QVectorPath &path) -
510{ -
511// qDebug() << ">>>> drawpath" << path.convertToPainterPath() -
512// << "antialiasing:" << (bool)(state->renderHints & QPainter::Antialiasing) << " implicit close:" << path.hasImplicitClose(); -
513 if (path.isEmpty())
partially evaluated: path.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28565
0-28565
514 return;
never executed: return;
0
515 -
516 const qreal *points = path.points();
executed (the execution status of this line is deduced): const qreal *points = path.points();
-
517 const QPainterPath::ElementType *type = path.elements();
executed (the execution status of this line is deduced): const QPainterPath::ElementType *type = path.elements();
-
518 -
519 if (type) {
evaluated: type
TRUEFALSE
yes
Evaluation Count:341
yes
Evaluation Count:28224
341-28224
520 const QPainterPath::ElementType *end = type + path.elementCount();
executed (the execution status of this line is deduced): const QPainterPath::ElementType *end = type + path.elementCount();
-
521 -
522 while (type < end) {
evaluated: type < end
TRUEFALSE
yes
Evaluation Count:371
yes
Evaluation Count:341
341-371
523 Q_ASSERT(type == path.elements() || *type == QPainterPath::MoveToElement);
executed (the execution status of this line is deduced): qt_noop();
-
524 -
525 QPointF p = QPointF(points[0], points[1]) * state->matrix;
executed (the execution status of this line is deduced): QPointF p = QPointF(points[0], points[1]) * state->matrix;
-
526 patternOffset = state->lastPen.dashOffset()*64;
executed (the execution status of this line is deduced): patternOffset = state->lastPen.dashOffset()*64;
-
527 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
528 -
529 bool closed;
executed (the execution status of this line is deduced): bool closed;
-
530 const QPainterPath::ElementType *e = subPath(type, end, points, &closed);
executed (the execution status of this line is deduced): const QPainterPath::ElementType *e = subPath(type, end, points, &closed);
-
531 if (closed) {
evaluated: closed
TRUEFALSE
yes
Evaluation Count:317
yes
Evaluation Count:54
54-317
532 const qreal *p = points + 2*(e-type);
executed (the execution status of this line is deduced): const qreal *p = points + 2*(e-type);
-
533 QPointF p1 = QPointF(p[-4], p[-3]) * state->matrix;
executed (the execution status of this line is deduced): QPointF p1 = QPointF(p[-4], p[-3]) * state->matrix;
-
534 QPointF p2 = QPointF(p[-2], p[-1]) * state->matrix;
executed (the execution status of this line is deduced): QPointF p2 = QPointF(p[-2], p[-1]) * state->matrix;
-
535 calculateLastPoint(p1.x(), p1.y(), p2.x(), p2.y());
executed (the execution status of this line is deduced): calculateLastPoint(p1.x(), p1.y(), p2.x(), p2.y());
-
536 }
executed: }
Execution Count:317
317
537 int caps = (!closed & drawCaps) ? CapBegin : NoCaps;
evaluated: (!closed & drawCaps)
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:317
54-317
538// qDebug() << "closed =" << closed << capString(caps); -
539 -
540 points += 2;
executed (the execution status of this line is deduced): points += 2;
-
541 ++type;
executed (the execution status of this line is deduced): ++type;
-
542 -
543 while (type < e) {
evaluated: type < e
TRUEFALSE
yes
Evaluation Count:2434
yes
Evaluation Count:371
371-2434
544 QPointF p2 = QPointF(points[0], points[1]) * state->matrix;
executed (the execution status of this line is deduced): QPointF p2 = QPointF(points[0], points[1]) * state->matrix;
-
545 switch (*type) { -
546 case QPainterPath::MoveToElement: -
547 Q_ASSERT(!"Logic error");
never executed (the execution status of this line is deduced): qt_noop();
-
548 break;
never executed: break;
0
549 -
550 case QPainterPath::LineToElement: -
551 if (!closed && drawCaps && type == e - 1)
evaluated: !closed
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:1192
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-1192
552 caps |= CapEnd;
executed: caps |= CapEnd;
Execution Count:48
48
553 stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps);
executed (the execution status of this line is deduced): stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps);
-
554 p = p2;
executed (the execution status of this line is deduced): p = p2;
-
555 points += 2;
executed (the execution status of this line is deduced): points += 2;
-
556 ++type;
executed (the execution status of this line is deduced): ++type;
-
557 break;
executed: break;
Execution Count:1240
1240
558 -
559 case QPainterPath::CurveToElement: { -
560 if (!closed && drawCaps && type == e - 3)
evaluated: !closed
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:1176
partially evaluated: drawCaps
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
evaluated: type == e - 3
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:12
0-1176
561 caps |= CapEnd;
executed: caps |= CapEnd;
Execution Count:6
6
562 QPointF p3 = QPointF(points[2], points[3]) * state->matrix;
executed (the execution status of this line is deduced): QPointF p3 = QPointF(points[2], points[3]) * state->matrix;
-
563 QPointF p4 = QPointF(points[4], points[5]) * state->matrix;
executed (the execution status of this line is deduced): QPointF p4 = QPointF(points[4], points[5]) * state->matrix;
-
564 renderCubic(p, p2, p3, p4, caps);
executed (the execution status of this line is deduced): renderCubic(p, p2, p3, p4, caps);
-
565 p = p4;
executed (the execution status of this line is deduced): p = p4;
-
566 type += 3;
executed (the execution status of this line is deduced): type += 3;
-
567 points += 6;
executed (the execution status of this line is deduced): points += 6;
-
568 break;
executed: break;
Execution Count:1194
1194
569 } -
570 case QPainterPath::CurveToDataElement: -
571 Q_ASSERT(!"QPainterPath::toSubpathPolygons(), bad element type");
never executed (the execution status of this line is deduced): qt_noop();
-
572 break;
never executed: break;
0
573 } -
574 caps = NoCaps;
executed (the execution status of this line is deduced): caps = NoCaps;
-
575 }
executed: }
Execution Count:2434
2434
576 }
executed: }
Execution Count:371
371
577 } else { // !type, simple polygon
executed: }
Execution Count:341
341
578 QPointF p = QPointF(points[0], points[1]) * state->matrix;
executed (the execution status of this line is deduced): QPointF p = QPointF(points[0], points[1]) * state->matrix;
-
579 QPointF movedTo = p;
executed (the execution status of this line is deduced): QPointF movedTo = p;
-
580 patternOffset = state->lastPen.dashOffset()*64;
executed (the execution status of this line is deduced): patternOffset = state->lastPen.dashOffset()*64;
-
581 lastPixel.x = -1;
executed (the execution status of this line is deduced): lastPixel.x = -1;
-
582 -
583 const qreal *end = points + 2*path.elementCount();
executed (the execution status of this line is deduced): const qreal *end = points + 2*path.elementCount();
-
584 // handle closed path case -
585 bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]);
evaluated: path.hasImplicitClose()
TRUEFALSE
yes
Evaluation Count:2795
yes
Evaluation Count:25429
evaluated: points[0] == end[-2]
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:25424
partially evaluated: points[1] == end[-1]
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-25429
586 int caps = (!closed & drawCaps) ? CapBegin : NoCaps;
evaluated: (!closed & drawCaps)
TRUEFALSE
yes
Evaluation Count:25424
yes
Evaluation Count:2800
2800-25424
587 if (closed) {
evaluated: closed
TRUEFALSE
yes
Evaluation Count:2800
yes
Evaluation Count:25424
2800-25424
588 QPointF p2 = QPointF(end[-2], end[-1]) * state->matrix;
executed (the execution status of this line is deduced): QPointF p2 = QPointF(end[-2], end[-1]) * state->matrix;
-
589 calculateLastPoint(p2.x(), p2.y(), p.x(), p.y());
executed (the execution status of this line is deduced): calculateLastPoint(p2.x(), p2.y(), p.x(), p.y());
-
590 }
executed: }
Execution Count:2800
2800
591 -
592 points += 2;
executed (the execution status of this line is deduced): points += 2;
-
593 while (points < end) {
evaluated: points < end
TRUEFALSE
yes
Evaluation Count:60428
yes
Evaluation Count:28224
28224-60428
594 QPointF p2 = QPointF(points[0], points[1]) * state->matrix;
executed (the execution status of this line is deduced): QPointF p2 = QPointF(points[0], points[1]) * state->matrix;
-
595 -
596 if (!closed && drawCaps && points == end - 2)
evaluated: !closed
TRUEFALSE
yes
Evaluation Count:51648
yes
Evaluation Count:8780
partially evaluated: drawCaps
TRUEFALSE
yes
Evaluation Count:51648
no
Evaluation Count:0
evaluated: points == end - 2
TRUEFALSE
yes
Evaluation Count:25424
yes
Evaluation Count:26224
0-51648
597 caps |= CapEnd;
executed: caps |= CapEnd;
Execution Count:25424
25424
598 -
599 stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps);
executed (the execution status of this line is deduced): stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps);
-
600 -
601 p = p2;
executed (the execution status of this line is deduced): p = p2;
-
602 points += 2;
executed (the execution status of this line is deduced): points += 2;
-
603 caps = NoCaps;
executed (the execution status of this line is deduced): caps = NoCaps;
-
604 }
executed: }
Execution Count:60428
60428
605 if (path.hasImplicitClose())
evaluated: path.hasImplicitClose()
TRUEFALSE
yes
Evaluation Count:2795
yes
Evaluation Count:25429
2795-25429
606 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
607 }
executed: }
Execution Count:28224
28224
608 -
609 -
610 blend(current_span, spans, &state->penData);
executed (the execution status of this line is deduced): blend(current_span, spans, &state->penData);
-
611 current_span = 0;
executed (the execution status of this line is deduced): current_span = 0;
-
612}
executed: }
Execution Count:28565
28565
613 -
614void QCosmeticStroker::renderCubic(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4, int caps) -
615{ -
616// qDebug() << ">>>> renderCubic" << p1 << p2 << p3 << p4 << capString(caps); -
617 const int maxSubDivisions = 6;
executed (the execution status of this line is deduced): const int maxSubDivisions = 6;
-
618 PointF points[3*maxSubDivisions + 4];
executed (the execution status of this line is deduced): PointF points[3*maxSubDivisions + 4];
-
619 -
620 points[3].x = p1.x();
executed (the execution status of this line is deduced): points[3].x = p1.x();
-
621 points[3].y = p1.y();
executed (the execution status of this line is deduced): points[3].y = p1.y();
-
622 points[2].x = p2.x();
executed (the execution status of this line is deduced): points[2].x = p2.x();
-
623 points[2].y = p2.y();
executed (the execution status of this line is deduced): points[2].y = p2.y();
-
624 points[1].x = p3.x();
executed (the execution status of this line is deduced): points[1].x = p3.x();
-
625 points[1].y = p3.y();
executed (the execution status of this line is deduced): points[1].y = p3.y();
-
626 points[0].x = p4.x();
executed (the execution status of this line is deduced): points[0].x = p4.x();
-
627 points[0].y = p4.y();
executed (the execution status of this line is deduced): points[0].y = p4.y();
-
628 -
629 PointF *p = points;
executed (the execution status of this line is deduced): PointF *p = points;
-
630 int level = maxSubDivisions;
executed (the execution status of this line is deduced): int level = maxSubDivisions;
-
631 -
632 renderCubicSubdivision(p, level, caps);
executed (the execution status of this line is deduced): renderCubicSubdivision(p, level, caps);
-
633}
executed: }
Execution Count:1194
1194
634 -
635static void splitCubic(QCosmeticStroker::PointF *points) -
636{ -
637 const qreal half = .5;
executed (the execution status of this line is deduced): const qreal half = .5;
-
638 qreal a, b, c, d;
executed (the execution status of this line is deduced): qreal a, b, c, d;
-
639 -
640 points[6].x = points[3].x;
executed (the execution status of this line is deduced): points[6].x = points[3].x;
-
641 c = points[1].x;
executed (the execution status of this line is deduced): c = points[1].x;
-
642 d = points[2].x;
executed (the execution status of this line is deduced): d = points[2].x;
-
643 points[1].x = a = ( points[0].x + c ) * half;
executed (the execution status of this line is deduced): points[1].x = a = ( points[0].x + c ) * half;
-
644 points[5].x = b = ( points[3].x + d ) * half;
executed (the execution status of this line is deduced): points[5].x = b = ( points[3].x + d ) * half;
-
645 c = ( c + d ) * half;
executed (the execution status of this line is deduced): c = ( c + d ) * half;
-
646 points[2].x = a = ( a + c ) * half;
executed (the execution status of this line is deduced): points[2].x = a = ( a + c ) * half;
-
647 points[4].x = b = ( b + c ) * half;
executed (the execution status of this line is deduced): points[4].x = b = ( b + c ) * half;
-
648 points[3].x = ( a + b ) * half;
executed (the execution status of this line is deduced): points[3].x = ( a + b ) * half;
-
649 -
650 points[6].y = points[3].y;
executed (the execution status of this line is deduced): points[6].y = points[3].y;
-
651 c = points[1].y;
executed (the execution status of this line is deduced): c = points[1].y;
-
652 d = points[2].y;
executed (the execution status of this line is deduced): d = points[2].y;
-
653 points[1].y = a = ( points[0].y + c ) * half;
executed (the execution status of this line is deduced): points[1].y = a = ( points[0].y + c ) * half;
-
654 points[5].y = b = ( points[3].y + d ) * half;
executed (the execution status of this line is deduced): points[5].y = b = ( points[3].y + d ) * half;
-
655 c = ( c + d ) * half;
executed (the execution status of this line is deduced): c = ( c + d ) * half;
-
656 points[2].y = a = ( a + c ) * half;
executed (the execution status of this line is deduced): points[2].y = a = ( a + c ) * half;
-
657 points[4].y = b = ( b + c ) * half;
executed (the execution status of this line is deduced): points[4].y = b = ( b + c ) * half;
-
658 points[3].y = ( a + b ) * half;
executed (the execution status of this line is deduced): points[3].y = ( a + b ) * half;
-
659}
executed: }
Execution Count:2654
2654
660 -
661void QCosmeticStroker::renderCubicSubdivision(QCosmeticStroker::PointF *points, int level, int caps) -
662{ -
663 if (level) {
partially evaluated: level
TRUEFALSE
yes
Evaluation Count:6502
no
Evaluation Count:0
0-6502
664 qreal dx = points[3].x - points[0].x;
executed (the execution status of this line is deduced): qreal dx = points[3].x - points[0].x;
-
665 qreal dy = points[3].y - points[0].y;
executed (the execution status of this line is deduced): qreal dy = points[3].y - points[0].y;
-
666 qreal len = ((qreal).25) * (qAbs(dx) + qAbs(dy));
executed (the execution status of this line is deduced): qreal len = ((qreal).25) * (qAbs(dx) + qAbs(dy));
-
667 -
668 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:2584
yes
Evaluation Count:3918
2584-3918
669 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:70
yes
Evaluation Count:3848
70-3848
670 splitCubic(points);
executed (the execution status of this line is deduced): splitCubic(points);
-
671 -
672 --level;
executed (the execution status of this line is deduced): --level;
-
673 renderCubicSubdivision(points + 3, level, caps & CapBegin);
executed (the execution status of this line is deduced): renderCubicSubdivision(points + 3, level, caps & CapBegin);
-
674 renderCubicSubdivision(points, level, caps & CapEnd);
executed (the execution status of this line is deduced): renderCubicSubdivision(points, level, caps & CapEnd);
-
675 return;
executed: return;
Execution Count:2654
2654
676 } -
677 }
executed: }
Execution Count:3848
3848
678 -
679 stroke(this, points[3].x, points[3].y, points[0].x, points[0].y, caps);
executed (the execution status of this line is deduced): stroke(this, points[3].x, points[3].y, points[0].x, points[0].y, caps);
-
680}
executed: }
Execution Count:3848
3848
681 -
682static inline int swapCaps(int caps) -
683{ -
684 return ((caps & QCosmeticStroker::CapBegin) << 1) |
executed: return ((caps & QCosmeticStroker::CapBegin) << 1) | ((caps & QCosmeticStroker::CapEnd) >> 1);
Execution Count:32122
32122
685 ((caps & QCosmeticStroker::CapEnd) >> 1);
executed: return ((caps & QCosmeticStroker::CapBegin) << 1) | ((caps & QCosmeticStroker::CapEnd) >> 1);
Execution Count:32122
32122
686} -
687 -
688// adjust line by half a pixel -
689static inline void capAdjust(int caps, int &x1, int &x2, int &y, int yinc) -
690{ -
691 if (caps & QCosmeticStroker::CapBegin) {
evaluated: caps & QCosmeticStroker::CapBegin
TRUEFALSE
yes
Evaluation Count:28452
yes
Evaluation Count:40523
28452-40523
692 x1 -= 32;
executed (the execution status of this line is deduced): x1 -= 32;
-
693 y -= yinc >> 1;
executed (the execution status of this line is deduced): y -= yinc >> 1;
-
694 }
executed: }
Execution Count:28452
28452
695 if (caps & QCosmeticStroker::CapEnd) {
evaluated: caps & QCosmeticStroker::CapEnd
TRUEFALSE
yes
Evaluation Count:29376
yes
Evaluation Count:39599
29376-39599
696 x2 += 32;
executed (the execution status of this line is deduced): x2 += 32;
-
697 }
executed: }
Execution Count:29376
29376
698}
executed: }
Execution Count:68975
68975
699 -
700/* -
701 The hard part about this is dropout control and avoiding douple drawing of points when -
702 the drawing shifts from horizontal to vertical or back. -
703 */ -
704template<DrawPixel drawPixel, class Dasher> -
705static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) -
706{ -
707 if (stroker->clipLine(rx1, ry1, rx2, ry2))
evaluated: stroker->clipLine(rx1, ry1, rx2, ry2)
TRUEFALSE
yes
Evaluation Count:3395
yes
Evaluation Count:66922
3395-66922
708 return;
executed: return;
Execution Count:3395
3395
709 -
710 const int half = stroker->legacyRounding ? 31 : 0;
evaluated: stroker->legacyRounding
TRUEFALSE
yes
Evaluation Count:3421
yes
Evaluation Count:63501
3421-63501
711 int x1 = toF26Dot6(rx1) + half;
executed (the execution status of this line is deduced): int x1 = ((int)((rx1)*64.)) + half;
-
712 int y1 = toF26Dot6(ry1) + half;
executed (the execution status of this line is deduced): int y1 = ((int)((ry1)*64.)) + half;
-
713 int x2 = toF26Dot6(rx2) + half;
executed (the execution status of this line is deduced): int x2 = ((int)((rx2)*64.)) + half;
-
714 int y2 = toF26Dot6(ry2) + half;
executed (the execution status of this line is deduced): int y2 = ((int)((ry2)*64.)) + half;
-
715 -
716 int dx = qAbs(x2 - x1);
executed (the execution status of this line is deduced): int dx = qAbs(x2 - x1);
-
717 int dy = qAbs(y2 - y1);
executed (the execution status of this line is deduced): int dy = qAbs(y2 - y1);
-
718 -
719 QCosmeticStroker::Point last = stroker->lastPixel;
executed (the execution status of this line is deduced): QCosmeticStroker::Point last = stroker->lastPixel;
-
720 -
721// qDebug() << "stroke" << x1/64. << y1/64. << x2/64. << y2/64.; -
722 -
723 if (dx < dy) {
evaluated: dx < dy
TRUEFALSE
yes
Evaluation Count:31673
yes
Evaluation Count:35249
31673-35249
724 // vertical -
725 QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom;
executed (the execution status of this line is deduced): QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom;
-
726 -
727 bool swapped = false;
executed (the execution status of this line is deduced): bool swapped = false;
-
728 if (y1 > y2) {
evaluated: y1 > y2
TRUEFALSE
yes
Evaluation Count:27218
yes
Evaluation Count:4455
4455-27218
729 swapped = true;
executed (the execution status of this line is deduced): swapped = true;
-
730 qSwap(y1, y2);
executed (the execution status of this line is deduced): qSwap(y1, y2);
-
731 qSwap(x1, x2);
executed (the execution status of this line is deduced): qSwap(x1, x2);
-
732 caps = swapCaps(caps);
executed (the execution status of this line is deduced): caps = swapCaps(caps);
-
733 dir = QCosmeticStroker::BottomToTop;
executed (the execution status of this line is deduced): dir = QCosmeticStroker::BottomToTop;
-
734 }
executed: }
Execution Count:27218
27218
735 int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
executed (the execution status of this line is deduced): int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
-
736 int x = x1 << 10;
executed (the execution status of this line is deduced): int x = x1 << 10;
-
737 -
738 if ((stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir)
evaluated: (stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir
TRUEFALSE
yes
Evaluation Count:211
yes
Evaluation Count:31462
211-31462
739 caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
executed: caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
Execution Count:211
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:112
yes
Evaluation Count:99
99-211
740 -
741 capAdjust(caps, y1, y2, x, xinc);
executed (the execution status of this line is deduced): capAdjust(caps, y1, y2, x, xinc);
-
742 -
743 int y = (y1 + 32) >> 6;
executed (the execution status of this line is deduced): int y = (y1 + 32) >> 6;
-
744 int ys = (y2 + 32) >> 6;
executed (the execution status of this line is deduced): int ys = (y2 + 32) >> 6;
-
745 -
746 if (y != ys) {
evaluated: y != ys
TRUEFALSE
yes
Evaluation Count:31663
yes
Evaluation Count:10
10-31663
747 x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6;
executed (the execution status of this line is deduced): x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6;
-
748 -
749 // calculate first and last pixel and perform dropout control -
750 QCosmeticStroker::Point first;
executed (the execution status of this line is deduced): QCosmeticStroker::Point first;
-
751 first.x = x >> 16;
executed (the execution status of this line is deduced): first.x = x >> 16;
-
752 first.y = y;
executed (the execution status of this line is deduced): first.y = y;
-
753 last.x = (x + (ys - y - 1)*xinc) >> 16;
executed (the execution status of this line is deduced): last.x = (x + (ys - y - 1)*xinc) >> 16;
-
754 last.y = ys - 1;
executed (the execution status of this line is deduced): last.y = ys - 1;
-
755 if (swapped)
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:27213
yes
Evaluation Count:4450
4450-27213
756 qSwap(first, last);
executed: qSwap(first, last);
Execution Count:27213
27213
757 -
758 bool axisAligned = qAbs(xinc) < (1 << 14);
executed (the execution status of this line is deduced): bool axisAligned = qAbs(xinc) < (1 << 14);
-
759 if (stroker->lastPixel.x >= 0) {
evaluated: stroker->lastPixel.x >= 0
TRUEFALSE
yes
Evaluation Count:17254
yes
Evaluation Count:14409
14409-17254
760 if (first.x == stroker->lastPixel.x &&
evaluated: first.x == stroker->lastPixel.x
TRUEFALSE
yes
Evaluation Count:3161
yes
Evaluation Count:14093
3161-14093
761 first.y == stroker->lastPixel.y) {
evaluated: first.y == stroker->lastPixel.y
TRUEFALSE
yes
Evaluation Count:554
yes
Evaluation Count:2607
554-2607
762 // remove duplicated pixel -
763 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:257
yes
Evaluation Count:297
257-297
764 --ys;
executed (the execution status of this line is deduced): --ys;
-
765 } else {
executed: }
Execution Count:257
257
766 ++y;
executed (the execution status of this line is deduced): ++y;
-
767 x += xinc;
executed (the execution status of this line is deduced): x += xinc;
-
768 }
executed: }
Execution Count:297
297
769 } else if (stroker->lastDir != dir &&
evaluated: stroker->lastDir != dir
TRUEFALSE
yes
Evaluation Count:15314
yes
Evaluation Count:1386
1386-15314
770 (((axisAligned && stroker->lastAxisAligned) &&
evaluated: axisAligned
TRUEFALSE
yes
Evaluation Count:14918
yes
Evaluation Count:396
evaluated: stroker->lastAxisAligned
TRUEFALSE
yes
Evaluation Count:14517
yes
Evaluation Count:401
396-14918
771 stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
evaluated: stroker->lastPixel.x != first.x
TRUEFALSE
yes
Evaluation Count:12964
yes
Evaluation Count:1553
evaluated: stroker->lastPixel.y != first.y
TRUEFALSE
yes
Evaluation Count:11404
yes
Evaluation Count:1560
1553-12964
772 (qAbs(stroker->lastPixel.x - first.x) > 1 ||
partially evaluated: qAbs(stroker->lastPixel.x - first.x) > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3910
0-3910
773 qAbs(stroker->lastPixel.y - first.y) > 1))) {
evaluated: qAbs(stroker->lastPixel.y - first.y) > 1
TRUEFALSE
yes
Evaluation Count:125
yes
Evaluation Count:3785
125-3785
774 // have a missing pixel, insert it -
775 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:11515
yes
Evaluation Count:14
14-11515
776 ++ys;
executed (the execution status of this line is deduced): ++ys;
-
777 } else {
executed: }
Execution Count:11515
11515
778 --y;
executed (the execution status of this line is deduced): --y;
-
779 x -= xinc;
executed (the execution status of this line is deduced): x -= xinc;
-
780 }
executed: }
Execution Count:14
14
781 } -
782 } -
783 stroker->lastDir = dir;
executed (the execution status of this line is deduced): stroker->lastDir = dir;
-
784 stroker->lastAxisAligned = axisAligned;
executed (the execution status of this line is deduced): stroker->lastAxisAligned = axisAligned;
-
785 -
786 Dasher dasher(stroker, swapped, y << 6, ys << 6);
executed (the execution status of this line is deduced): Dasher dasher(stroker, swapped, y << 6, ys << 6);
-
787 -
788 do { -
789 if (dasher.on())
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:1343386
no
Evaluation Count:0
0-1343386
790 drawPixel(stroker, x >> 16, y, 255);
executed: drawPixel(stroker, x >> 16, y, 255);
Execution Count:1343386
1343386
791 dasher.adjust();
executed (the execution status of this line is deduced): dasher.adjust();
-
792 x += xinc;
executed (the execution status of this line is deduced): x += xinc;
-
793 } while (++y < ys);
executed: }
Execution Count:1343386
evaluated: ++y < ys
TRUEFALSE
yes
Evaluation Count:1311723
yes
Evaluation Count:31663
31663-1343386
794 }
executed: }
Execution Count:31663
31663
795 } else {
executed: }
Execution Count:31673
31673
796 // horizontal -
797 if (!dx)
evaluated: !dx
TRUEFALSE
yes
Evaluation Count:226
yes
Evaluation Count:35023
226-35023
798 return;
executed: return;
Execution Count:226
226
799 -
800 QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight;
executed (the execution status of this line is deduced): QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight;
-
801 -
802 bool swapped = false;
executed (the execution status of this line is deduced): bool swapped = false;
-
803 if (x1 > x2) {
evaluated: x1 > x2
TRUEFALSE
yes
Evaluation Count:3960
yes
Evaluation Count:31063
3960-31063
804 swapped = true;
executed (the execution status of this line is deduced): swapped = true;
-
805 qSwap(x1, x2);
executed (the execution status of this line is deduced): qSwap(x1, x2);
-
806 qSwap(y1, y2);
executed (the execution status of this line is deduced): qSwap(y1, y2);
-
807 caps = swapCaps(caps);
executed (the execution status of this line is deduced): caps = swapCaps(caps);
-
808 dir = QCosmeticStroker::RightToLeft;
executed (the execution status of this line is deduced): dir = QCosmeticStroker::RightToLeft;
-
809 }
executed: }
Execution Count:3960
3960
810 int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
executed (the execution status of this line is deduced): int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
-
811 int y = y1 << 10;
executed (the execution status of this line is deduced): int y = y1 << 10;
-
812 -
813 if ((stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir)
evaluated: (stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir
TRUEFALSE
yes
Evaluation Count:1346
yes
Evaluation Count:33677
1346-33677
814 caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
executed: caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
Execution Count:1346
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:708
yes
Evaluation Count:638
638-1346
815 -
816 capAdjust(caps, x1, x2, y, yinc);
executed (the execution status of this line is deduced): capAdjust(caps, x1, x2, y, yinc);
-
817 -
818 int x = (x1 + 32) >> 6;
executed (the execution status of this line is deduced): int x = (x1 + 32) >> 6;
-
819 int xs = (x2 + 32) >> 6;
executed (the execution status of this line is deduced): int xs = (x2 + 32) >> 6;
-
820 -
821 if (x != xs) {
evaluated: x != xs
TRUEFALSE
yes
Evaluation Count:35019
yes
Evaluation Count:4
4-35019
822 y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6;
executed (the execution status of this line is deduced): y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6;
-
823 -
824 // calculate first and last pixel to perform dropout control -
825 QCosmeticStroker::Point first;
executed (the execution status of this line is deduced): QCosmeticStroker::Point first;
-
826 first.x = x;
executed (the execution status of this line is deduced): first.x = x;
-
827 first.y = y >> 16;
executed (the execution status of this line is deduced): first.y = y >> 16;
-
828 last.x = xs - 1;
executed (the execution status of this line is deduced): last.x = xs - 1;
-
829 last.y = (y + (xs - x - 1)*yinc) >> 16;
executed (the execution status of this line is deduced): last.y = (y + (xs - x - 1)*yinc) >> 16;
-
830 if (swapped)
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:3958
yes
Evaluation Count:31061
3958-31061
831 qSwap(first, last);
executed: qSwap(first, last);
Execution Count:3958
3958
832 -
833 bool axisAligned = qAbs(yinc) < (1 << 14);
executed (the execution status of this line is deduced): bool axisAligned = qAbs(yinc) < (1 << 14);
-
834 if (stroker->lastPixel.x >= 0) {
evaluated: stroker->lastPixel.x >= 0
TRUEFALSE
yes
Evaluation Count:19806
yes
Evaluation Count:15213
15213-19806
835 if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) {
evaluated: first.x == stroker->lastPixel.x
TRUEFALSE
yes
Evaluation Count:14688
yes
Evaluation Count:5118
evaluated: first.y == stroker->lastPixel.y
TRUEFALSE
yes
Evaluation Count:14452
yes
Evaluation Count:236
236-14688
836 // remove duplicated pixel -
837 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:256
yes
Evaluation Count:14196
256-14196
838 --xs;
executed (the execution status of this line is deduced): --xs;
-
839 } else {
executed: }
Execution Count:256
256
840 ++x;
executed (the execution status of this line is deduced): ++x;
-
841 y += yinc;
executed (the execution status of this line is deduced): y += yinc;
-
842 }
executed: }
Execution Count:14196
14196
843 } else if (stroker->lastDir != dir &&
evaluated: stroker->lastDir != dir
TRUEFALSE
yes
Evaluation Count:2849
yes
Evaluation Count:2505
2505-2849
844 (((axisAligned && stroker->lastAxisAligned) &&
evaluated: axisAligned
TRUEFALSE
yes
Evaluation Count:1880
yes
Evaluation Count:969
evaluated: stroker->lastAxisAligned
TRUEFALSE
yes
Evaluation Count:1633
yes
Evaluation Count:247
247-1880
845 stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
evaluated: stroker->lastPixel.x != first.x
TRUEFALSE
yes
Evaluation Count:1589
yes
Evaluation Count:44
evaluated: stroker->lastPixel.y != first.y
TRUEFALSE
yes
Evaluation Count:1549
yes
Evaluation Count:40
40-1589
846 (qAbs(stroker->lastPixel.x - first.x) > 1 ||
partially evaluated: qAbs(stroker->lastPixel.x - first.x) > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1300
0-1300
847 qAbs(stroker->lastPixel.y - first.y) > 1))) {
evaluated: qAbs(stroker->lastPixel.y - first.y) > 1
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:1275
25-1275
848 // have a missing pixel, insert it -
849 if (swapped) {
evaluated: swapped
TRUEFALSE
yes
Evaluation Count:1573
yes
Evaluation Count:1
1-1573
850 ++xs;
executed (the execution status of this line is deduced): ++xs;
-
851 } else {
executed: }
Execution Count:1573
1573
852 --x;
executed (the execution status of this line is deduced): --x;
-
853 y -= yinc;
executed (the execution status of this line is deduced): y -= yinc;
-
854 }
executed: }
Execution Count:1
1
855 } -
856 } -
857 stroker->lastDir = dir;
executed (the execution status of this line is deduced): stroker->lastDir = dir;
-
858 stroker->lastAxisAligned = axisAligned;
executed (the execution status of this line is deduced): stroker->lastAxisAligned = axisAligned;
-
859 -
860 Dasher dasher(stroker, swapped, x << 6, xs << 6);
executed (the execution status of this line is deduced): Dasher dasher(stroker, swapped, x << 6, xs << 6);
-
861 -
862 do { -
863 if (dasher.on())
evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:2737049
yes
Evaluation Count:32
32-2737049
864 drawPixel(stroker, x, y >> 16, 255);
executed: drawPixel(stroker, x, y >> 16, 255);
Execution Count:2737049
2737049
865 dasher.adjust();
executed (the execution status of this line is deduced): dasher.adjust();
-
866 y += yinc;
executed (the execution status of this line is deduced): y += yinc;
-
867 } while (++x < xs);
executed: }
Execution Count:2737081
evaluated: ++x < xs
TRUEFALSE
yes
Evaluation Count:2702062
yes
Evaluation Count:35019
35019-2737081
868 }
executed: }
Execution Count:35019
35019
869 }
executed: }
Execution Count:35023
35023
870 stroker->lastPixel = last;
executed (the execution status of this line is deduced): stroker->lastPixel = last;
-
871}
executed: }
Execution Count:66696
66696
872 -
873 -
874template<DrawPixel drawPixel, class Dasher> -
875static void drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) -
876{ -
877 if (stroker->clipLine(rx1, ry1, rx2, ry2))
evaluated: stroker->clipLine(rx1, ry1, rx2, ry2)
TRUEFALSE
yes
Evaluation Count:482
yes
Evaluation Count:2325
482-2325
878 return;
executed: return;
Execution Count:482
482
879 -
880 int x1 = toF26Dot6(rx1);
executed (the execution status of this line is deduced): int x1 = ((int)((rx1)*64.));
-
881 int y1 = toF26Dot6(ry1);
executed (the execution status of this line is deduced): int y1 = ((int)((ry1)*64.));
-
882 int x2 = toF26Dot6(rx2);
executed (the execution status of this line is deduced): int x2 = ((int)((rx2)*64.));
-
883 int y2 = toF26Dot6(ry2);
executed (the execution status of this line is deduced): int y2 = ((int)((ry2)*64.));
-
884 -
885 int dx = x2 - x1;
executed (the execution status of this line is deduced): int dx = x2 - x1;
-
886 int dy = y2 - y1;
executed (the execution status of this line is deduced): int dy = y2 - y1;
-
887 -
888 if (qAbs(dx) < qAbs(dy)) {
evaluated: qAbs(dx) < qAbs(dy)
TRUEFALSE
yes
Evaluation Count:1030
yes
Evaluation Count:1295
1030-1295
889 // vertical -
890 -
891 int xinc = F16Dot16FixedDiv(dx, dy);
executed (the execution status of this line is deduced): int xinc = F16Dot16FixedDiv(dx, dy);
-
892 -
893 bool swapped = false;
executed (the execution status of this line is deduced): bool swapped = false;
-
894 if (y1 > y2) {
evaluated: y1 > y2
TRUEFALSE
yes
Evaluation Count:463
yes
Evaluation Count:567
463-567
895 qSwap(y1, y2);
executed (the execution status of this line is deduced): qSwap(y1, y2);
-
896 qSwap(x1, x2);
executed (the execution status of this line is deduced): qSwap(x1, x2);
-
897 swapped = true;
executed (the execution status of this line is deduced): swapped = true;
-
898 caps = swapCaps(caps);
executed (the execution status of this line is deduced): caps = swapCaps(caps);
-
899 }
executed: }
Execution Count:463
463
900 -
901 int x = (x1 - 32) << 10;
executed (the execution status of this line is deduced): int x = (x1 - 32) << 10;
-
902 x -= ( ((y1 & 63) - 32) * xinc ) >> 6;
executed (the execution status of this line is deduced): x -= ( ((y1 & 63) - 32) * xinc ) >> 6;
-
903 -
904 capAdjust(caps, y1, y2, x, xinc);
executed (the execution status of this line is deduced): capAdjust(caps, y1, y2, x, xinc);
-
905 -
906 Dasher dasher(stroker, swapped, y1, y2);
executed (the execution status of this line is deduced): Dasher dasher(stroker, swapped, y1, y2);
-
907 -
908 int y = y1 >> 6;
executed (the execution status of this line is deduced): int y = y1 >> 6;
-
909 int ys = y2 >> 6;
executed (the execution status of this line is deduced): int ys = y2 >> 6;
-
910 -
911 int alphaStart, alphaEnd;
executed (the execution status of this line is deduced): int alphaStart, alphaEnd;
-
912 if (y == ys) {
partially evaluated: y == ys
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1030
0-1030
913 alphaStart = y2 - y1;
never executed (the execution status of this line is deduced): alphaStart = y2 - y1;
-
914 Q_ASSERT(alphaStart >= 0 && alphaStart < 64);
never executed (the execution status of this line is deduced): qt_noop();
-
915 alphaEnd = 0;
never executed (the execution status of this line is deduced): alphaEnd = 0;
-
916 } else {
never executed: }
0
917 alphaStart = 64 - (y1 & 63);
executed (the execution status of this line is deduced): alphaStart = 64 - (y1 & 63);
-
918 alphaEnd = (y2 & 63);
executed (the execution status of this line is deduced): alphaEnd = (y2 & 63);
-
919 }
executed: }
Execution Count:1030
1030
920// qDebug() << "vertical" << x1/64. << y1/64. << x2/64. << y2/64.; -
921// qDebug() << " x=" << x << "dx=" << dx << "xi=" << (x>>16) << "xsi=" << ((x+(ys-y)*dx)>>16) << "y=" << y << "ys=" << ys; -
922 -
923 // draw first pixel -
924 if (dasher.on()) {
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:1030
no
Evaluation Count:0
0-1030
925 uint alpha = (quint8)(x >> 8);
executed (the execution status of this line is deduced): uint alpha = (quint8)(x >> 8);
-
926 drawPixel(stroker, x>>16, y, (255-alpha) * alphaStart >> 6);
executed (the execution status of this line is deduced): drawPixel(stroker, x>>16, y, (255-alpha) * alphaStart >> 6);
-
927 drawPixel(stroker, (x>>16) + 1, y, alpha * alphaStart >> 6);
executed (the execution status of this line is deduced): drawPixel(stroker, (x>>16) + 1, y, alpha * alphaStart >> 6);
-
928 }
executed: }
Execution Count:1030
1030
929 dasher.adjust();
executed (the execution status of this line is deduced): dasher.adjust();
-
930 x += xinc;
executed (the execution status of this line is deduced): x += xinc;
-
931 ++y;
executed (the execution status of this line is deduced): ++y;
-
932 if (y < ys) {
evaluated: y < ys
TRUEFALSE
yes
Evaluation Count:805
yes
Evaluation Count:225
225-805
933 do { -
934 if (dasher.on()) {
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:14943
no
Evaluation Count:0
0-14943
935 uint alpha = (quint8)(x >> 8);
executed (the execution status of this line is deduced): uint alpha = (quint8)(x >> 8);
-
936 drawPixel(stroker, x>>16, y, (255-alpha));
executed (the execution status of this line is deduced): drawPixel(stroker, x>>16, y, (255-alpha));
-
937 drawPixel(stroker, (x>>16) + 1, y, alpha);
executed (the execution status of this line is deduced): drawPixel(stroker, (x>>16) + 1, y, alpha);
-
938 }
executed: }
Execution Count:14943
14943
939 dasher.adjust();
executed (the execution status of this line is deduced): dasher.adjust();
-
940 x += xinc;
executed (the execution status of this line is deduced): x += xinc;
-
941 } while (++y < ys);
executed: }
Execution Count:14943
evaluated: ++y < ys
TRUEFALSE
yes
Evaluation Count:14138
yes
Evaluation Count:805
805-14943
942 }
executed: }
Execution Count:805
805
943 // draw last pixel -
944 if (alphaEnd && dasher.on()) {
evaluated: alphaEnd
TRUEFALSE
yes
Evaluation Count:683
yes
Evaluation Count:347
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:683
no
Evaluation Count:0
0-683
945 uint alpha = (quint8)(x >> 8);
executed (the execution status of this line is deduced): uint alpha = (quint8)(x >> 8);
-
946 drawPixel(stroker, x>>16, y, (255-alpha) * alphaEnd >> 6);
executed (the execution status of this line is deduced): drawPixel(stroker, x>>16, y, (255-alpha) * alphaEnd >> 6);
-
947 drawPixel(stroker, (x>>16) + 1, y, alpha * alphaEnd >> 6);
executed (the execution status of this line is deduced): drawPixel(stroker, (x>>16) + 1, y, alpha * alphaEnd >> 6);
-
948 }
executed: }
Execution Count:683
683
949 } else {
executed: }
Execution Count:1030
1030
950 // horizontal -
951 if (!dx)
evaluated: !dx
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:1249
46-1249
952 return;
executed: return;
Execution Count:46
46
953 -
954 int yinc = F16Dot16FixedDiv(dy, dx);
executed (the execution status of this line is deduced): int yinc = F16Dot16FixedDiv(dy, dx);
-
955 -
956 bool swapped = false;
executed (the execution status of this line is deduced): bool swapped = false;
-
957 if (x1 > x2) {
evaluated: x1 > x2
TRUEFALSE
yes
Evaluation Count:481
yes
Evaluation Count:768
481-768
958 qSwap(x1, x2);
executed (the execution status of this line is deduced): qSwap(x1, x2);
-
959 qSwap(y1, y2);
executed (the execution status of this line is deduced): qSwap(y1, y2);
-
960 swapped = true;
executed (the execution status of this line is deduced): swapped = true;
-
961 caps = swapCaps(caps);
executed (the execution status of this line is deduced): caps = swapCaps(caps);
-
962 }
executed: }
Execution Count:481
481
963 -
964 int y = (y1 - 32) << 10;
executed (the execution status of this line is deduced): int y = (y1 - 32) << 10;
-
965 y -= ( ((x1 & 63) - 32) * yinc ) >> 6;
executed (the execution status of this line is deduced): y -= ( ((x1 & 63) - 32) * yinc ) >> 6;
-
966 -
967 capAdjust(caps, x1, x2, y, yinc);
executed (the execution status of this line is deduced): capAdjust(caps, x1, x2, y, yinc);
-
968 -
969 Dasher dasher(stroker, swapped, x1, x2);
executed (the execution status of this line is deduced): Dasher dasher(stroker, swapped, x1, x2);
-
970 -
971 int x = x1 >> 6;
executed (the execution status of this line is deduced): int x = x1 >> 6;
-
972 int xs = x2 >> 6;
executed (the execution status of this line is deduced): int xs = x2 >> 6;
-
973 -
974// qDebug() << "horizontal" << x1/64. << y1/64. << x2/64. << y2/64.; -
975// qDebug() << " y=" << y << "dy=" << dy << "x=" << x << "xs=" << xs << "yi=" << (y>>16) << "ysi=" << ((y+(xs-x)*dy)>>16); -
976 int alphaStart, alphaEnd;
executed (the execution status of this line is deduced): int alphaStart, alphaEnd;
-
977 if (x == xs) {
partially evaluated: x == xs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1249
0-1249
978 alphaStart = x2 - x1;
never executed (the execution status of this line is deduced): alphaStart = x2 - x1;
-
979 Q_ASSERT(alphaStart >= 0 && alphaStart < 64);
never executed (the execution status of this line is deduced): qt_noop();
-
980 alphaEnd = 0;
never executed (the execution status of this line is deduced): alphaEnd = 0;
-
981 } else {
never executed: }
0
982 alphaStart = 64 - (x1 & 63);
executed (the execution status of this line is deduced): alphaStart = 64 - (x1 & 63);
-
983 alphaEnd = (x2 & 63);
executed (the execution status of this line is deduced): alphaEnd = (x2 & 63);
-
984 }
executed: }
Execution Count:1249
1249
985 -
986 // draw first pixel -
987 if (dasher.on()) {
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:1249
no
Evaluation Count:0
0-1249
988 uint alpha = (quint8)(y >> 8);
executed (the execution status of this line is deduced): uint alpha = (quint8)(y >> 8);
-
989 drawPixel(stroker, x, y>>16, (255-alpha) * alphaStart >> 6);
executed (the execution status of this line is deduced): drawPixel(stroker, x, y>>16, (255-alpha) * alphaStart >> 6);
-
990 drawPixel(stroker, x, (y>>16) + 1, alpha * alphaStart >> 6);
executed (the execution status of this line is deduced): drawPixel(stroker, x, (y>>16) + 1, alpha * alphaStart >> 6);
-
991 }
executed: }
Execution Count:1249
1249
992 dasher.adjust();
executed (the execution status of this line is deduced): dasher.adjust();
-
993 y += yinc;
executed (the execution status of this line is deduced): y += yinc;
-
994 ++x;
executed (the execution status of this line is deduced): ++x;
-
995 // draw line -
996 if (x < xs) {
evaluated: x < xs
TRUEFALSE
yes
Evaluation Count:1024
yes
Evaluation Count:225
225-1024
997 do { -
998 if (dasher.on()) {
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:27637
no
Evaluation Count:0
0-27637
999 uint alpha = (quint8)(y >> 8);
executed (the execution status of this line is deduced): uint alpha = (quint8)(y >> 8);
-
1000 drawPixel(stroker, x, y>>16, (255-alpha));
executed (the execution status of this line is deduced): drawPixel(stroker, x, y>>16, (255-alpha));
-
1001 drawPixel(stroker, x, (y>>16) + 1, alpha);
executed (the execution status of this line is deduced): drawPixel(stroker, x, (y>>16) + 1, alpha);
-
1002 }
executed: }
Execution Count:27637
27637
1003 dasher.adjust();
executed (the execution status of this line is deduced): dasher.adjust();
-
1004 y += yinc;
executed (the execution status of this line is deduced): y += yinc;
-
1005 } while (++x < xs);
executed: }
Execution Count:27637
evaluated: ++x < xs
TRUEFALSE
yes
Evaluation Count:26613
yes
Evaluation Count:1024
1024-27637
1006 }
executed: }
Execution Count:1024
1024
1007 // draw last pixel -
1008 if (alphaEnd && dasher.on()) {
evaluated: alphaEnd
TRUEFALSE
yes
Evaluation Count:867
yes
Evaluation Count:382
partially evaluated: dasher.on()
TRUEFALSE
yes
Evaluation Count:867
no
Evaluation Count:0
0-867
1009 uint alpha = (quint8)(y >> 8);
executed (the execution status of this line is deduced): uint alpha = (quint8)(y >> 8);
-
1010 drawPixel(stroker, x, y>>16, (255-alpha) * alphaEnd >> 6);
executed (the execution status of this line is deduced): drawPixel(stroker, x, y>>16, (255-alpha) * alphaEnd >> 6);
-
1011 drawPixel(stroker, x, (y>>16) + 1, alpha * alphaEnd >> 6);
executed (the execution status of this line is deduced): drawPixel(stroker, x, (y>>16) + 1, alpha * alphaEnd >> 6);
-
1012 }
executed: }
Execution Count:867
867
1013 }
executed: }
Execution Count:1249
1249
1014} -
1015 -
1016QT_END_NAMESPACE -
1017 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial