Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | struct QPainterPathPrivateDeleter | - |
7 | { | - |
8 | static inline void cleanup(QPainterPathPrivate *d) | - |
9 | { | - |
10 | | - |
11 | | - |
12 | if (d && !d->ref.deref()) evaluated: d yes Evaluation Count:115756 | yes Evaluation Count:337690 |
evaluated: !d->ref.deref() yes Evaluation Count:108917 | yes Evaluation Count:6839 |
| 6839-337690 |
13 | delete static_cast<QPainterPathData *>(d); executed: delete static_cast<QPainterPathData *>(d); Execution Count:108917 | 108917 |
14 | } executed: } Execution Count:453446 | 453446 |
15 | }; | - |
16 | QPainterPath qt_stroke_dash(const QPainterPath &path, qreal *dashes, int dashCount); | - |
17 | | - |
18 | void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length, | - |
19 | QPointF* startPoint, QPointF *endPoint) | - |
20 | { | - |
21 | if (r.isNull()) { partially evaluated: r.isNull() no Evaluation Count:0 | yes Evaluation Count:8733 |
| 0-8733 |
22 | if (startPoint) never evaluated: startPoint | 0 |
23 | *startPoint = QPointF(); never executed: *startPoint = QPointF(); | 0 |
24 | if (endPoint) never evaluated: endPoint | 0 |
25 | *endPoint = QPointF(); never executed: *endPoint = QPointF(); | 0 |
26 | return; | 0 |
27 | } | - |
28 | | - |
29 | qreal w2 = r.width() / 2; | - |
30 | qreal h2 = r.height() / 2; | - |
31 | | - |
32 | qreal angles[2] = { angle, angle + length }; | - |
33 | QPointF *points[2] = { startPoint, endPoint }; | - |
34 | | - |
35 | for (int i = 0; i < 2; ++i) { evaluated: i < 2 yes Evaluation Count:17466 | yes Evaluation Count:8733 |
| 8733-17466 |
36 | if (!points[i]) evaluated: !points[i] yes Evaluation Count:2910 | yes Evaluation Count:14556 |
| 2910-14556 |
37 | continue; executed: continue; Execution Count:2910 | 2910 |
38 | | - |
39 | qreal theta = angles[i] - 360 * qFloor(angles[i] / 360); | - |
40 | qreal t = theta / 90; | - |
41 | | - |
42 | int quadrant = int(t); | - |
43 | t -= quadrant; | - |
44 | | - |
45 | t = qt_t_for_arc_angle(90 * t); | - |
46 | | - |
47 | | - |
48 | if (quadrant & 1) evaluated: quadrant & 1 yes Evaluation Count:7232 | yes Evaluation Count:7324 |
| 7232-7324 |
49 | t = 1 - t; executed: t = 1 - t; Execution Count:7232 | 7232 |
50 | | - |
51 | qreal a, b, c, d; | - |
52 | QBezier::coefficients(t, a, b, c, d); | - |
53 | QPointF p(a + b + c*0.5522847498, d + c + b*0.5522847498); | - |
54 | | - |
55 | | - |
56 | if (quadrant == 1 || quadrant == 2) evaluated: quadrant == 1 yes Evaluation Count:3612 | yes Evaluation Count:10944 |
evaluated: quadrant == 2 yes Evaluation Count:3632 | yes Evaluation Count:7312 |
| 3612-10944 |
57 | p.rx() = -p.x(); executed: p.rx() = -p.x(); Execution Count:7244 | 7244 |
58 | | - |
59 | | - |
60 | if (quadrant == 0 || quadrant == 1) evaluated: quadrant == 0 yes Evaluation Count:3692 | yes Evaluation Count:10864 |
evaluated: quadrant == 1 yes Evaluation Count:3612 | yes Evaluation Count:7252 |
| 3612-10864 |
61 | p.ry() = -p.y(); executed: p.ry() = -p.y(); Execution Count:7304 | 7304 |
62 | | - |
63 | *points[i] = r.center() + QPointF(w2 * p.x(), h2 * p.y()); | - |
64 | } executed: } Execution Count:14556 | 14556 |
65 | } executed: } Execution Count:8733 | 8733 |
66 | int QPainterPath::elementCount() const | - |
67 | { | - |
68 | return d_ptr ? d_ptr->elements.size() : 0; executed: return d_ptr ? d_ptr->elements.size() : 0; Execution Count:18351 | 18351 |
69 | } | - |
70 | QPainterPath::Element QPainterPath::elementAt(int i) const | - |
71 | { | - |
72 | qt_noop(); | - |
73 | qt_noop(); | - |
74 | return d_ptr->elements.at(i); executed: return d_ptr->elements.at(i); Execution Count:38946 | 38946 |
75 | } | - |
76 | void QPainterPath::setElementPositionAt(int i, qreal x, qreal y) | - |
77 | { | - |
78 | qt_noop(); | - |
79 | qt_noop(); | - |
80 | detach(); | - |
81 | QPainterPath::Element &e = d_ptr->elements[i]; | - |
82 | e.x = x; | - |
83 | e.y = y; | - |
84 | } executed: } Execution Count:7 | 7 |
85 | QPainterPath::QPainterPath() | - |
86 | : d_ptr(0) | - |
87 | { | - |
88 | } executed: } Execution Count:214377 | 214377 |
89 | QPainterPath::QPainterPath(const QPainterPath &other) | - |
90 | : d_ptr(other.d_ptr.data()) | - |
91 | { | - |
92 | if (d_ptr) evaluated: d_ptr yes Evaluation Count:6810 | yes Evaluation Count:123341 |
| 6810-123341 |
93 | d_ptr->ref.ref(); executed: d_ptr->ref.ref(); Execution Count:6810 | 6810 |
94 | } executed: } Execution Count:130151 | 130151 |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
99 | | - |
100 | | - |
101 | QPainterPath::QPainterPath(const QPointF &startPoint) | - |
102 | : d_ptr(new QPainterPathData) | - |
103 | { | - |
104 | Element e = { startPoint.x(), startPoint.y(), MoveToElement }; | - |
105 | d_func()->elements << e; | - |
106 | } executed: } Execution Count:9 | 9 |
107 | | - |
108 | void QPainterPath::detach() | - |
109 | { | - |
110 | if (d_ptr->ref.load() != 1) evaluated: d_ptr->ref.load() != 1 yes Evaluation Count:88 | yes Evaluation Count:366745 |
| 88-366745 |
111 | detach_helper(); executed: detach_helper(); Execution Count:88 | 88 |
112 | setDirty(true); | - |
113 | } executed: } Execution Count:366833 | 366833 |
114 | | - |
115 | | - |
116 | | - |
117 | | - |
118 | void QPainterPath::detach_helper() | - |
119 | { | - |
120 | QPainterPathPrivate *data = new QPainterPathData(*d_func()); | - |
121 | d_ptr.reset(data); | - |
122 | } executed: } Execution Count:88 | 88 |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | void QPainterPath::ensureData_helper() | - |
128 | { | - |
129 | QPainterPathPrivate *data = new QPainterPathData; | - |
130 | data->elements.reserve(16); | - |
131 | QPainterPath::Element e = { 0, 0, QPainterPath::MoveToElement }; | - |
132 | data->elements << e; | - |
133 | d_ptr.reset(data); | - |
134 | qt_noop(); | - |
135 | } executed: } Execution Count:108820 | 108820 |
136 | QPainterPath &QPainterPath::operator=(const QPainterPath &other) | - |
137 | { | - |
138 | if (other.d_func() != d_func()) { evaluated: other.d_func() != d_func() yes Evaluation Count:45 | yes Evaluation Count:18142 |
| 45-18142 |
139 | QPainterPathPrivate *data = other.d_func(); | - |
140 | if (data) evaluated: data yes Evaluation Count:29 | yes Evaluation Count:16 |
| 16-29 |
141 | data->ref.ref(); executed: data->ref.ref(); Execution Count:29 | 29 |
142 | d_ptr.reset(data); | - |
143 | } executed: } Execution Count:45 | 45 |
144 | return *this; executed: return *this; Execution Count:18187 | 18187 |
145 | } | - |
146 | QPainterPath::~QPainterPath() | - |
147 | { | - |
148 | } | - |
149 | void QPainterPath::closeSubpath() | - |
150 | { | - |
151 | | - |
152 | | - |
153 | | - |
154 | if (isEmpty()) partially evaluated: isEmpty() no Evaluation Count:0 | yes Evaluation Count:138 |
| 0-138 |
155 | return; | 0 |
156 | detach(); | - |
157 | | - |
158 | d_func()->close(); | - |
159 | } executed: } Execution Count:138 | 138 |
160 | void QPainterPath::moveTo(const QPointF &p) | - |
161 | { | - |
162 | | - |
163 | | - |
164 | | - |
165 | | - |
166 | if (!qt_is_finite(p.x()) || !qt_is_finite(p.y())) { evaluated: !qt_is_finite(p.x()) yes Evaluation Count:3 | yes Evaluation Count:114216 |
partially evaluated: !qt_is_finite(p.y()) no Evaluation Count:0 | yes Evaluation Count:114216 |
| 0-114216 |
167 | | - |
168 | | - |
169 | | - |
170 | return; executed: return; Execution Count:3 | 3 |
171 | } | - |
172 | | - |
173 | ensureData(); | - |
174 | detach(); | - |
175 | | - |
176 | QPainterPathData *d = d_func(); | - |
177 | qt_noop(); | - |
178 | | - |
179 | d->require_moveTo = false; | - |
180 | | - |
181 | if (d->elements.last().type == MoveToElement) { evaluated: d->elements.last().type == MoveToElement yes Evaluation Count:108402 | yes Evaluation Count:5814 |
| 5814-108402 |
182 | d->elements.last().x = p.x(); | - |
183 | d->elements.last().y = p.y(); | - |
184 | } else { executed: } Execution Count:108402 | 108402 |
185 | Element elm = { p.x(), p.y(), MoveToElement }; | - |
186 | d->elements.append(elm); | - |
187 | } executed: } Execution Count:5814 | 5814 |
188 | d->cStart = d->elements.size() - 1; | - |
189 | } executed: } Execution Count:114216 | 114216 |
190 | void QPainterPath::lineTo(const QPointF &p) | - |
191 | { | - |
192 | | - |
193 | | - |
194 | | - |
195 | | - |
196 | if (!qt_is_finite(p.x()) || !qt_is_finite(p.y())) { evaluated: !qt_is_finite(p.x()) yes Evaluation Count:3 | yes Evaluation Count:226462 |
partially evaluated: !qt_is_finite(p.y()) no Evaluation Count:0 | yes Evaluation Count:226462 |
| 0-226462 |
197 | | - |
198 | | - |
199 | | - |
200 | return; executed: return; Execution Count:3 | 3 |
201 | } | - |
202 | | - |
203 | ensureData(); | - |
204 | detach(); | - |
205 | | - |
206 | QPainterPathData *d = d_func(); | - |
207 | qt_noop(); | - |
208 | d->maybeMoveTo(); | - |
209 | if (p == QPointF(d->elements.last())) evaluated: p == QPointF(d->elements.last()) yes Evaluation Count:5908 | yes Evaluation Count:220554 |
| 5908-220554 |
210 | return; executed: return; Execution Count:5908 | 5908 |
211 | Element elm = { p.x(), p.y(), LineToElement }; | - |
212 | d->elements.append(elm); | - |
213 | | - |
214 | d->convex = d->elements.size() == 3 || (d->elements.size() == 4 && d->isClosed()); evaluated: d->elements.size() == 3 yes Evaluation Count:102409 | yes Evaluation Count:118145 |
evaluated: d->elements.size() == 4 yes Evaluation Count:2014 | yes Evaluation Count:116131 |
partially evaluated: d->isClosed() no Evaluation Count:0 | yes Evaluation Count:2014 |
| 0-118145 |
215 | } executed: } Execution Count:220554 | 220554 |
216 | void QPainterPath::cubicTo(const QPointF &c1, const QPointF &c2, const QPointF &e) | - |
217 | { | - |
218 | | - |
219 | | - |
220 | | - |
221 | | - |
222 | | - |
223 | if (!qt_is_finite(c1.x()) || !qt_is_finite(c1.y()) || !qt_is_finite(c2.x()) || !qt_is_finite(c2.y()) evaluated: !qt_is_finite(c1.x()) yes Evaluation Count:3 | yes Evaluation Count:9302 |
partially evaluated: !qt_is_finite(c1.y()) no Evaluation Count:0 | yes Evaluation Count:9302 |
partially evaluated: !qt_is_finite(c2.x()) no Evaluation Count:0 | yes Evaluation Count:9302 |
partially evaluated: !qt_is_finite(c2.y()) no Evaluation Count:0 | yes Evaluation Count:9302 |
| 0-9302 |
224 | || !qt_is_finite(e.x()) || !qt_is_finite(e.y())) { partially evaluated: !qt_is_finite(e.x()) no Evaluation Count:0 | yes Evaluation Count:9302 |
partially evaluated: !qt_is_finite(e.y()) no Evaluation Count:0 | yes Evaluation Count:9302 |
| 0-9302 |
225 | | - |
226 | | - |
227 | | - |
228 | return; executed: return; Execution Count:3 | 3 |
229 | } | - |
230 | | - |
231 | ensureData(); | - |
232 | detach(); | - |
233 | | - |
234 | QPainterPathData *d = d_func(); | - |
235 | qt_noop(); | - |
236 | | - |
237 | | - |
238 | | - |
239 | | - |
240 | if (d->elements.last() == c1 && c1 == c2 && c2 == e) partially evaluated: d->elements.last() == c1 no Evaluation Count:0 | yes Evaluation Count:9302 |
never evaluated: c1 == c2 | 0-9302 |
241 | return; | 0 |
242 | | - |
243 | d->maybeMoveTo(); | - |
244 | | - |
245 | Element ce1 = { c1.x(), c1.y(), CurveToElement }; | - |
246 | Element ce2 = { c2.x(), c2.y(), CurveToDataElement }; | - |
247 | Element ee = { e.x(), e.y(), CurveToDataElement }; | - |
248 | d->elements << ce1 << ce2 << ee; | - |
249 | } executed: } Execution Count:9302 | 9302 |
250 | void QPainterPath::quadTo(const QPointF &c, const QPointF &e) | - |
251 | { | - |
252 | | - |
253 | | - |
254 | | - |
255 | | - |
256 | | - |
257 | if (!qt_is_finite(c.x()) || !qt_is_finite(c.y()) || !qt_is_finite(e.x()) || !qt_is_finite(e.y())) { evaluated: !qt_is_finite(c.x()) yes Evaluation Count:1 | yes Evaluation Count:4 |
partially evaluated: !qt_is_finite(c.y()) no Evaluation Count:0 | yes Evaluation Count:4 |
evaluated: !qt_is_finite(e.x()) yes Evaluation Count:2 | yes Evaluation Count:2 |
partially evaluated: !qt_is_finite(e.y()) no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-4 |
258 | | - |
259 | | - |
260 | | - |
261 | return; executed: return; Execution Count:3 | 3 |
262 | } | - |
263 | | - |
264 | ensureData(); | - |
265 | detach(); | - |
266 | | - |
267 | QPainterPathPrivate * const d = d_func(); | - |
268 | qt_noop(); | - |
269 | const QPainterPath::Element &elm = d->elements.at(elementCount()-1); | - |
270 | QPointF prev(elm.x, elm.y); | - |
271 | | - |
272 | | - |
273 | | - |
274 | if (prev == c && c == e) partially evaluated: prev == c no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
275 | return; | 0 |
276 | | - |
277 | QPointF c1((prev.x() + 2*c.x()) / 3, (prev.y() + 2*c.y()) / 3); | - |
278 | QPointF c2((e.x() + 2*c.x()) / 3, (e.y() + 2*c.y()) / 3); | - |
279 | cubicTo(c1, c2, e); | - |
280 | } executed: } Execution Count:2 | 2 |
281 | void QPainterPath::arcTo(const QRectF &rect, qreal startAngle, qreal sweepLength) | - |
282 | { | - |
283 | | - |
284 | | - |
285 | | - |
286 | | - |
287 | | - |
288 | if ((!qt_is_finite(rect.x()) && !qt_is_finite(rect.y())) || !qt_is_finite(rect.width()) || !qt_is_finite(rect.height()) evaluated: !qt_is_finite(rect.x()) yes Evaluation Count:2 | yes Evaluation Count:5825 |
partially evaluated: !qt_is_finite(rect.y()) no Evaluation Count:0 | yes Evaluation Count:2 |
evaluated: !qt_is_finite(rect.width()) yes Evaluation Count:2 | yes Evaluation Count:5825 |
partially evaluated: !qt_is_finite(rect.height()) no Evaluation Count:0 | yes Evaluation Count:5825 |
| 0-5825 |
289 | || !qt_is_finite(startAngle) || !qt_is_finite(sweepLength)) { partially evaluated: !qt_is_finite(startAngle) no Evaluation Count:0 | yes Evaluation Count:5825 |
partially evaluated: !qt_is_finite(sweepLength) no Evaluation Count:0 | yes Evaluation Count:5825 |
| 0-5825 |
290 | | - |
291 | | - |
292 | | - |
293 | return; executed: return; Execution Count:2 | 2 |
294 | } | - |
295 | | - |
296 | if (rect.isNull()) partially evaluated: rect.isNull() no Evaluation Count:0 | yes Evaluation Count:5825 |
| 0-5825 |
297 | return; | 0 |
298 | | - |
299 | ensureData(); | - |
300 | detach(); | - |
301 | | - |
302 | int point_count; | - |
303 | QPointF pts[15]; | - |
304 | QPointF curve_start = qt_curves_for_arc(rect, startAngle, sweepLength, pts, &point_count); | - |
305 | | - |
306 | lineTo(curve_start); | - |
307 | for (int i=0; i<point_count; i+=3) { evaluated: i<point_count yes Evaluation Count:7723 | yes Evaluation Count:5825 |
| 5825-7723 |
308 | cubicTo(pts[i].x(), pts[i].y(), | - |
309 | pts[i+1].x(), pts[i+1].y(), | - |
310 | pts[i+2].x(), pts[i+2].y()); | - |
311 | } executed: } Execution Count:7723 | 7723 |
312 | | - |
313 | } executed: } Execution Count:5825 | 5825 |
314 | void QPainterPath::arcMoveTo(const QRectF &rect, qreal angle) | - |
315 | { | - |
316 | if (rect.isNull()) partially evaluated: rect.isNull() no Evaluation Count:0 | yes Evaluation Count:2910 |
| 0-2910 |
317 | return; | 0 |
318 | | - |
319 | QPointF pt; | - |
320 | qt_find_ellipse_coords(rect, angle, 0, &pt, 0); | - |
321 | moveTo(pt); | - |
322 | } executed: } Execution Count:2910 | 2910 |
323 | QPointF QPainterPath::currentPosition() const | - |
324 | { | - |
325 | return !d_ptr || d_func()->elements.isEmpty() | 12 |
326 | ? QPointF() | 12 |
327 | : QPointF(d_func()->elements.last().x, d_func()->elements.last().y); executed: return !d_ptr || d_func()->elements.isEmpty() ? QPointF() : QPointF(d_func()->elements.last().x, d_func()->elements.last().y); Execution Count:12 | 12 |
328 | } | - |
329 | void QPainterPath::addRect(const QRectF &r) | - |
330 | { | - |
331 | if (!qt_is_finite(r.x()) || !qt_is_finite(r.y()) || !qt_is_finite(r.width()) || !qt_is_finite(r.height())) { evaluated: !qt_is_finite(r.x()) yes Evaluation Count:2 | yes Evaluation Count:6772 |
partially evaluated: !qt_is_finite(r.y()) no Evaluation Count:0 | yes Evaluation Count:6772 |
partially evaluated: !qt_is_finite(r.width()) no Evaluation Count:0 | yes Evaluation Count:6772 |
partially evaluated: !qt_is_finite(r.height()) no Evaluation Count:0 | yes Evaluation Count:6772 |
| 0-6772 |
332 | | - |
333 | | - |
334 | | - |
335 | return; executed: return; Execution Count:2 | 2 |
336 | } | - |
337 | | - |
338 | if (r.isNull()) evaluated: r.isNull() yes Evaluation Count:23 | yes Evaluation Count:6749 |
| 23-6749 |
339 | return; executed: return; Execution Count:23 | 23 |
340 | | - |
341 | ensureData(); | - |
342 | detach(); | - |
343 | | - |
344 | bool first = d_func()->elements.size() < 2; | - |
345 | | - |
346 | d_func()->elements.reserve(d_func()->elements.size() + 5); | - |
347 | moveTo(r.x(), r.y()); | - |
348 | | - |
349 | Element l1 = { r.x() + r.width(), r.y(), LineToElement }; | - |
350 | Element l2 = { r.x() + r.width(), r.y() + r.height(), LineToElement }; | - |
351 | Element l3 = { r.x(), r.y() + r.height(), LineToElement }; | - |
352 | Element l4 = { r.x(), r.y(), LineToElement }; | - |
353 | | - |
354 | d_func()->elements << l1 << l2 << l3 << l4; | - |
355 | d_func()->require_moveTo = true; | - |
356 | d_func()->convex = first; | - |
357 | } executed: } Execution Count:6749 | 6749 |
358 | void QPainterPath::addPolygon(const QPolygonF &polygon) | - |
359 | { | - |
360 | if (polygon.isEmpty()) evaluated: polygon.isEmpty() yes Evaluation Count:5 | yes Evaluation Count:24 |
| 5-24 |
361 | return; executed: return; Execution Count:5 | 5 |
362 | | - |
363 | ensureData(); | - |
364 | detach(); | - |
365 | | - |
366 | d_func()->elements.reserve(d_func()->elements.size() + polygon.size()); | - |
367 | | - |
368 | moveTo(polygon.first()); | - |
369 | for (int i=1; i<polygon.size(); ++i) { evaluated: i<polygon.size() yes Evaluation Count:80 | yes Evaluation Count:24 |
| 24-80 |
370 | Element elm = { polygon.at(i).x(), polygon.at(i).y(), LineToElement }; | - |
371 | d_func()->elements << elm; | - |
372 | } executed: } Execution Count:80 | 80 |
373 | } executed: } Execution Count:24 | 24 |
374 | void QPainterPath::addEllipse(const QRectF &boundingRect) | - |
375 | { | - |
376 | if (!qt_is_finite(boundingRect.x()) || !qt_is_finite(boundingRect.y()) evaluated: !qt_is_finite(boundingRect.x()) yes Evaluation Count:2 | yes Evaluation Count:107 |
partially evaluated: !qt_is_finite(boundingRect.y()) no Evaluation Count:0 | yes Evaluation Count:107 |
| 0-107 |
377 | || !qt_is_finite(boundingRect.width()) || !qt_is_finite(boundingRect.height())) { partially evaluated: !qt_is_finite(boundingRect.width()) no Evaluation Count:0 | yes Evaluation Count:107 |
partially evaluated: !qt_is_finite(boundingRect.height()) no Evaluation Count:0 | yes Evaluation Count:107 |
| 0-107 |
378 | | - |
379 | | - |
380 | | - |
381 | return; executed: return; Execution Count:2 | 2 |
382 | } | - |
383 | | - |
384 | if (boundingRect.isNull()) partially evaluated: boundingRect.isNull() no Evaluation Count:0 | yes Evaluation Count:107 |
| 0-107 |
385 | return; | 0 |
386 | | - |
387 | ensureData(); | - |
388 | detach(); | - |
389 | | - |
390 | QPainterPathPrivate * const d = d_func(); | - |
391 | bool first = d_func()->elements.size() < 2; | - |
392 | d->elements.reserve(d->elements.size() + 13); | - |
393 | | - |
394 | QPointF pts[12]; | - |
395 | int point_count; | - |
396 | QPointF start = qt_curves_for_arc(boundingRect, 0, -360, pts, &point_count); | - |
397 | | - |
398 | moveTo(start); | - |
399 | cubicTo(pts[0], pts[1], pts[2]); | - |
400 | cubicTo(pts[3], pts[4], pts[5]); | - |
401 | cubicTo(pts[6], pts[7], pts[8]); | - |
402 | cubicTo(pts[9], pts[10], pts[11]); | - |
403 | d_func()->require_moveTo = true; | - |
404 | | - |
405 | d_func()->convex = first; | - |
406 | } executed: } Execution Count:107 | 107 |
407 | void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &text) | - |
408 | { | - |
409 | if (text.isEmpty()) never evaluated: text.isEmpty() | 0 |
410 | return; | 0 |
411 | | - |
412 | ensureData(); | - |
413 | detach(); | - |
414 | | - |
415 | QTextLayout layout(text, f); | - |
416 | layout.setCacheEnabled(true); | - |
417 | QTextEngine *eng = layout.engine(); | - |
418 | layout.beginLayout(); | - |
419 | QTextLine line = layout.createLine(); | - |
420 | (void)line;; | - |
421 | layout.endLayout(); | - |
422 | const QScriptLine &sl = eng->lines[0]; | - |
423 | if (!sl.length || !eng->layoutData) never evaluated: !sl.length never evaluated: !eng->layoutData | 0 |
424 | return; | 0 |
425 | | - |
426 | int nItems = eng->layoutData->items.size(); | - |
427 | | - |
428 | qreal x(point.x()); | - |
429 | qreal y(point.y()); | - |
430 | | - |
431 | QVarLengthArray<int> visualOrder(nItems); | - |
432 | QVarLengthArray<uchar> levels(nItems); | - |
433 | for (int i = 0; i < nItems; ++i) never evaluated: i < nItems | 0 |
434 | levels[i] = eng->layoutData->items[i].analysis.bidiLevel; never executed: levels[i] = eng->layoutData->items[i].analysis.bidiLevel; | 0 |
435 | QTextEngine::bidiReorder(nItems, levels.data(), visualOrder.data()); | - |
436 | | - |
437 | for (int i = 0; i < nItems; ++i) { never evaluated: i < nItems | 0 |
438 | int item = visualOrder[i]; | - |
439 | QScriptItem &si = eng->layoutData->items[item]; | - |
440 | | - |
441 | if (si.analysis.flags < QScriptAnalysis::TabOrObject) { never evaluated: si.analysis.flags < QScriptAnalysis::TabOrObject | 0 |
442 | QGlyphLayout glyphs = eng->shapedGlyphs(&si); | - |
443 | QFontEngine *fe = f.d->engineForScript(si.analysis.script); | - |
444 | qt_noop(); | - |
445 | fe->addOutlineToPath(x, y, glyphs, this, | - |
446 | si.analysis.bidiLevel % 2 | - |
447 | ? QTextItem::RenderFlags(QTextItem::RightToLeft) | - |
448 | : QTextItem::RenderFlags(0)); | - |
449 | | - |
450 | const qreal lw = fe->lineThickness().toReal(); | - |
451 | if (f.d->underline) { never evaluated: f.d->underline | 0 |
452 | qreal pos = fe->underlinePosition().toReal(); | - |
453 | addRect(x, y + pos, si.width.toReal(), lw); | - |
454 | } | 0 |
455 | if (f.d->overline) { never evaluated: f.d->overline | 0 |
456 | qreal pos = fe->ascent().toReal() + 1; | - |
457 | addRect(x, y - pos, si.width.toReal(), lw); | - |
458 | } | 0 |
459 | if (f.d->strikeOut) { never evaluated: f.d->strikeOut | 0 |
460 | qreal pos = fe->ascent().toReal() / 3; | - |
461 | addRect(x, y - pos, si.width.toReal(), lw); | - |
462 | } | 0 |
463 | } | 0 |
464 | x += si.width.toReal(); | - |
465 | } | 0 |
466 | } | 0 |
467 | void QPainterPath::addPath(const QPainterPath &other) | - |
468 | { | - |
469 | if (other.isEmpty()) partially evaluated: other.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1914 |
| 0-1914 |
470 | return; | 0 |
471 | | - |
472 | ensureData(); | - |
473 | detach(); | - |
474 | | - |
475 | QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func()); | - |
476 | | - |
477 | if (d->elements.last().type == MoveToElement) evaluated: d->elements.last().type == MoveToElement yes Evaluation Count:8 | yes Evaluation Count:1906 |
| 8-1906 |
478 | d->elements.remove(d->elements.size()-1); executed: d->elements.remove(d->elements.size()-1); Execution Count:8 | 8 |
479 | | - |
480 | | - |
481 | int cStart = d->elements.size() + other.d_func()->cStart; | - |
482 | d->elements += other.d_func()->elements; | - |
483 | d->cStart = cStart; | - |
484 | | - |
485 | d->require_moveTo = other.d_func()->isClosed(); | - |
486 | } executed: } Execution Count:1914 | 1914 |
487 | void QPainterPath::connectPath(const QPainterPath &other) | - |
488 | { | - |
489 | if (other.isEmpty()) partially evaluated: other.isEmpty() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
490 | return; | 0 |
491 | | - |
492 | ensureData(); | - |
493 | detach(); | - |
494 | | - |
495 | QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func()); | - |
496 | | - |
497 | if (d->elements.last().type == MoveToElement) evaluated: d->elements.last().type == MoveToElement yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
498 | d->elements.remove(d->elements.size()-1); executed: d->elements.remove(d->elements.size()-1); Execution Count:2 | 2 |
499 | | - |
500 | | - |
501 | int cStart = d->elements.size() + other.d_func()->cStart; | - |
502 | int first = d->elements.size(); | - |
503 | d->elements += other.d_func()->elements; | - |
504 | | - |
505 | if (first != 0) evaluated: first != 0 yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
506 | d->elements[first].type = LineToElement; executed: d->elements[first].type = LineToElement; Execution Count:1 | 1 |
507 | | - |
508 | | - |
509 | if (first > 0 && QPointF(d->elements[first]) == QPointF(d->elements[first - 1])) { evaluated: first > 0 yes Evaluation Count:1 | yes Evaluation Count:2 |
partially evaluated: QPointF(d->elements[first]) == QPointF(d->elements[first - 1]) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-2 |
510 | d->elements.remove(first--); | - |
511 | --cStart; | - |
512 | } executed: } Execution Count:1 | 1 |
513 | | - |
514 | if (cStart != first) partially evaluated: cStart != first no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
515 | d->cStart = cStart; never executed: d->cStart = cStart; | 0 |
516 | } executed: } Execution Count:3 | 3 |
517 | void QPainterPath::addRegion(const QRegion ®ion) | - |
518 | { | - |
519 | ensureData(); | - |
520 | detach(); | - |
521 | | - |
522 | QVector<QRect> rects = region.rects(); | - |
523 | d_func()->elements.reserve(rects.size() * 5); | - |
524 | for (int i=0; i<rects.size(); ++i) evaluated: i<rects.size() yes Evaluation Count:477 | yes Evaluation Count:10 |
| 10-477 |
525 | addRect(rects.at(i)); executed: addRect(rects.at(i)); Execution Count:477 | 477 |
526 | } executed: } Execution Count:10 | 10 |
527 | | - |
528 | | - |
529 | | - |
530 | | - |
531 | | - |
532 | | - |
533 | | - |
534 | Qt::FillRule QPainterPath::fillRule() const | - |
535 | { | - |
536 | return isEmpty() ? Qt::OddEvenFill : d_func()->fillRule; executed: return isEmpty() ? Qt::OddEvenFill : d_func()->fillRule; Execution Count:1424 | 1424 |
537 | } | - |
538 | void QPainterPath::setFillRule(Qt::FillRule fillRule) | - |
539 | { | - |
540 | ensureData(); | - |
541 | if (d_func()->fillRule == fillRule) evaluated: d_func()->fillRule == fillRule yes Evaluation Count:26 | yes Evaluation Count:1990 |
| 26-1990 |
542 | return; executed: return; Execution Count:26 | 26 |
543 | detach(); | - |
544 | | - |
545 | d_func()->fillRule = fillRule; | - |
546 | } executed: } Execution Count:1990 | 1990 |
547 | static QRectF qt_painterpath_bezier_extrema(const QBezier &b) | - |
548 | { | - |
549 | qreal minx, miny, maxx, maxy; | - |
550 | | - |
551 | | - |
552 | if (b.x1 < b.x4) { evaluated: b.x1 < b.x4 yes Evaluation Count:54 | yes Evaluation Count:57 |
| 54-57 |
553 | minx = b.x1; | - |
554 | maxx = b.x4; | - |
555 | } else { executed: } Execution Count:54 | 54 |
556 | minx = b.x4; | - |
557 | maxx = b.x1; | - |
558 | } executed: } Execution Count:57 | 57 |
559 | if (b.y1 < b.y4) { evaluated: b.y1 < b.y4 yes Evaluation Count:55 | yes Evaluation Count:56 |
| 55-56 |
560 | miny = b.y1; | - |
561 | maxy = b.y4; | - |
562 | } else { executed: } Execution Count:55 | 55 |
563 | miny = b.y4; | - |
564 | maxy = b.y1; | - |
565 | } executed: } Execution Count:56 | 56 |
566 | | - |
567 | | - |
568 | { | - |
569 | qreal ax = 3 * (-b.x1 + 3*b.x2 - 3*b.x3 +b.x4); | - |
570 | qreal bx = 6 * (b.x1 - 2*b.x2 + b.x3); | - |
571 | qreal cx = 3 * (- b.x1 + b.x2); | - |
572 | | - |
573 | if (qFuzzyIsNull(ax)) { evaluated: qFuzzyIsNull(ax) yes Evaluation Count:3 | yes Evaluation Count:108 |
| 3-108 |
574 | | - |
575 | | - |
576 | if (!qFuzzyIsNull(bx)) { partially evaluated: !qFuzzyIsNull(bx) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
577 | qreal t = -cx / bx; | - |
578 | if (t >= 0 && t <= 1) { QPointF p(b.pointAt(t)); if (p.x() < minx) minx = p.x(); else if (p.x() > maxx) maxx = p.x(); if (p.y() < miny) miny = p.y(); else if (p.y() > maxy) maxy = p.y(); }; partially evaluated: p.x() > maxx yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: p.y() > maxy evaluated: p.x() < minx yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: p.y() < miny yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: t >= 0 yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: t <= 1 yes Evaluation Count:3 | no Evaluation Count:0 |
executed: minx = p.x(); Execution Count:2 executed: maxx = p.x(); Execution Count:1 executed: miny = p.y(); Execution Count:3 never executed: maxy = p.y(); | 0-3 |
579 | } executed: } Execution Count:3 | 3 |
580 | | - |
581 | } else { executed: } Execution Count:3 | 3 |
582 | const qreal tx = bx * bx - 4 * ax * cx; | - |
583 | | - |
584 | if (tx >= 0) { partially evaluated: tx >= 0 yes Evaluation Count:108 | no Evaluation Count:0 |
| 0-108 |
585 | qreal temp = qSqrt(tx); | - |
586 | qreal rcp = 1 / (2 * ax); | - |
587 | qreal t1 = (-bx + temp) * rcp; | - |
588 | if (t1 >= 0 && t1 <= 1) { QPointF p(b.pointAt(t1)); if (p.x() < minx) minx = p.x(); else if (p.x() > maxx) maxx = p.x(); if (p.y() < miny) miny = p.y(); else if (p.y() > maxy) maxy = p.y(); }; partially evaluated: p.x() > maxx no Evaluation Count:0 | yes Evaluation Count:18 |
partially evaluated: p.y() > maxy no Evaluation Count:0 | yes Evaluation Count:29 |
evaluated: p.x() < minx yes Evaluation Count:11 | yes Evaluation Count:18 |
partially evaluated: p.y() < miny no Evaluation Count:0 | yes Evaluation Count:29 |
evaluated: t1 >= 0 yes Evaluation Count:70 | yes Evaluation Count:38 |
evaluated: t1 <= 1 yes Evaluation Count:29 | yes Evaluation Count:41 |
executed: minx = p.x(); Execution Count:11 never executed: maxx = p.x(); never executed: miny = p.y(); never executed: maxy = p.y(); | 0-70 |
589 | | - |
590 | qreal t2 = (-bx - temp) * rcp; | - |
591 | if (t2 >= 0 && t2 <= 1) { QPointF p(b.pointAt(t2)); if (p.x() < minx) minx = p.x(); else if (p.x() > maxx) maxx = p.x(); if (p.y() < miny) miny = p.y(); else if (p.y() > maxy) maxy = p.y(); }; evaluated: p.x() > maxx yes Evaluation Count:9 | yes Evaluation Count:22 |
partially evaluated: p.y() > maxy no Evaluation Count:0 | yes Evaluation Count:31 |
partially evaluated: p.x() < minx no Evaluation Count:0 | yes Evaluation Count:31 |
partially evaluated: p.y() < miny no Evaluation Count:0 | yes Evaluation Count:31 |
evaluated: t2 >= 0 yes Evaluation Count:68 | yes Evaluation Count:40 |
evaluated: t2 <= 1 yes Evaluation Count:31 | yes Evaluation Count:37 |
never executed: minx = p.x(); executed: maxx = p.x(); Execution Count:9 never executed: miny = p.y(); never executed: maxy = p.y(); | 0-68 |
592 | } executed: } Execution Count:108 | 108 |
593 | } executed: } Execution Count:108 | 108 |
594 | } | - |
595 | | - |
596 | | - |
597 | { | - |
598 | qreal ay = 3 * (-b.y1 + 3*b.y2 - 3*b.y3 +b.y4); | - |
599 | qreal by = 6 * (b.y1 - 2*b.y2 + b.y3); | - |
600 | qreal cy = 3 * (- b.y1 + b.y2); | - |
601 | | - |
602 | | - |
603 | if (qFuzzyIsNull(ay)) { evaluated: qFuzzyIsNull(ay) yes Evaluation Count:3 | yes Evaluation Count:108 |
| 3-108 |
604 | | - |
605 | | - |
606 | if (!qFuzzyIsNull(by)) { partially evaluated: !qFuzzyIsNull(by) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
607 | qreal t = -cy / by; | - |
608 | if (t >= 0 && t <= 1) { QPointF p(b.pointAt(t)); if (p.x() < minx) minx = p.x(); else if (p.x() > maxx) maxx = p.x(); if (p.y() < miny) miny = p.y(); else if (p.y() > maxy) maxy = p.y(); }; never executed: maxx = p.x(); executed: miny = p.y(); Execution Count:3 never executed: maxy = p.y(); partially evaluated: p.x() > maxx no Evaluation Count:0 | yes Evaluation Count:3 |
never evaluated: p.y() > maxy partially evaluated: p.x() < minx no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: p.y() < miny yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: t >= 0 yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: t <= 1 yes Evaluation Count:3 | no Evaluation Count:0 |
never executed: minx = p.x(); | 0-3 |
609 | } executed: } Execution Count:3 | 3 |
610 | | - |
611 | } else { executed: } Execution Count:3 | 3 |
612 | const qreal ty = by * by - 4 * ay * cy; | - |
613 | | - |
614 | if (ty > 0) { partially evaluated: ty > 0 yes Evaluation Count:108 | no Evaluation Count:0 |
| 0-108 |
615 | qreal temp = qSqrt(ty); | - |
616 | qreal rcp = 1 / (2 * ay); | - |
617 | qreal t1 = (-by + temp) * rcp; | - |
618 | if (t1 >= 0 && t1 <= 1) { QPointF p(b.pointAt(t1)); if (p.x() < minx) minx = p.x(); else if (p.x() > maxx) maxx = p.x(); if (p.y() < miny) miny = p.y(); else if (p.y() > maxy) maxy = p.y(); }; never executed: minx = p.x(); never executed: maxx = p.x(); executed: miny = p.y(); Execution Count:9 never executed: maxy = p.y(); partially evaluated: p.x() > maxx no Evaluation Count:0 | yes Evaluation Count:27 |
partially evaluated: p.y() > maxy no Evaluation Count:0 | yes Evaluation Count:18 |
partially evaluated: p.x() < minx no Evaluation Count:0 | yes Evaluation Count:27 |
evaluated: p.y() < miny yes Evaluation Count:9 | yes Evaluation Count:18 |
evaluated: t1 >= 0 yes Evaluation Count:73 | yes Evaluation Count:35 |
evaluated: t1 <= 1 yes Evaluation Count:27 | yes Evaluation Count:46 |
| 0-73 |
619 | | - |
620 | qreal t2 = (-by - temp) * rcp; | - |
621 | if (t2 >= 0 && t2 <= 1) { QPointF p(b.pointAt(t2)); if (p.x() < minx) minx = p.x(); else if (p.x() > maxx) maxx = p.x(); if (p.y() < miny) miny = p.y(); else if (p.y() > maxy) maxy = p.y(); }; never executed: minx = p.x(); never executed: maxx = p.x(); never executed: miny = p.y(); executed: maxy = p.y(); Execution Count:9 partially evaluated: p.x() > maxx no Evaluation Count:0 | yes Evaluation Count:31 |
evaluated: p.y() > maxy yes Evaluation Count:9 | yes Evaluation Count:22 |
partially evaluated: p.x() < minx no Evaluation Count:0 | yes Evaluation Count:31 |
partially evaluated: p.y() < miny no Evaluation Count:0 | yes Evaluation Count:31 |
evaluated: t2 >= 0 yes Evaluation Count:71 | yes Evaluation Count:37 |
evaluated: t2 <= 1 yes Evaluation Count:31 | yes Evaluation Count:40 |
| 0-71 |
622 | } executed: } Execution Count:108 | 108 |
623 | } executed: } Execution Count:108 | 108 |
624 | } | - |
625 | return QRectF(minx, miny, maxx - minx, maxy - miny); executed: return QRectF(minx, miny, maxx - minx, maxy - miny); Execution Count:111 | 111 |
626 | } | - |
627 | | - |
628 | | - |
629 | | - |
630 | | - |
631 | | - |
632 | | - |
633 | | - |
634 | QRectF QPainterPath::boundingRect() const | - |
635 | { | - |
636 | if (!d_ptr) partially evaluated: !d_ptr no Evaluation Count:0 | yes Evaluation Count:541 |
| 0-541 |
637 | return QRectF(); never executed: return QRectF(); | 0 |
638 | QPainterPathData *d = d_func(); | - |
639 | | - |
640 | if (d->dirtyBounds) evaluated: d->dirtyBounds yes Evaluation Count:457 | yes Evaluation Count:84 |
| 84-457 |
641 | computeBoundingRect(); executed: computeBoundingRect(); Execution Count:457 | 457 |
642 | return d->bounds; executed: return d->bounds; Execution Count:541 | 541 |
643 | } | - |
644 | QRectF QPainterPath::controlPointRect() const | - |
645 | { | - |
646 | if (!d_ptr) evaluated: !d_ptr yes Evaluation Count:1 | yes Evaluation Count:3649 |
| 1-3649 |
647 | return QRectF(); executed: return QRectF(); Execution Count:1 | 1 |
648 | QPainterPathData *d = d_func(); | - |
649 | | - |
650 | if (d->dirtyControlBounds) evaluated: d->dirtyControlBounds yes Evaluation Count:2727 | yes Evaluation Count:922 |
| 922-2727 |
651 | computeControlPointRect(); executed: computeControlPointRect(); Execution Count:2727 | 2727 |
652 | return d->controlBounds; executed: return d->controlBounds; Execution Count:3649 | 3649 |
653 | } | - |
654 | bool QPainterPath::isEmpty() const | - |
655 | { | - |
656 | return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement); executed: return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement); Execution Count:167913 | 167913 |
657 | } | - |
658 | QPainterPath QPainterPath::toReversed() const | - |
659 | { | - |
660 | const QPainterPathPrivate * const d = d_func(); | - |
661 | QPainterPath rev; | - |
662 | | - |
663 | if (isEmpty()) { never evaluated: isEmpty() | 0 |
664 | rev = *this; | - |
665 | return rev; never executed: return rev; | 0 |
666 | } | - |
667 | | - |
668 | rev.moveTo(d->elements.at(d->elements.size()-1).x, d->elements.at(d->elements.size()-1).y); | - |
669 | | - |
670 | for (int i=d->elements.size()-1; i>=1; --i) { | 0 |
671 | const QPainterPath::Element &elm = d->elements.at(i); | - |
672 | const QPainterPath::Element &prev = d->elements.at(i-1); | - |
673 | switch (elm.type) { | - |
674 | case LineToElement: | - |
675 | rev.lineTo(prev.x, prev.y); | - |
676 | break; | 0 |
677 | case MoveToElement: | - |
678 | rev.moveTo(prev.x, prev.y); | - |
679 | break; | 0 |
680 | case CurveToDataElement: | - |
681 | { | - |
682 | qt_noop(); | - |
683 | const QPainterPath::Element &cp1 = d->elements.at(i-2); | - |
684 | const QPainterPath::Element &sp = d->elements.at(i-3); | - |
685 | qt_noop(); | - |
686 | qt_noop(); | - |
687 | rev.cubicTo(prev.x, prev.y, cp1.x, cp1.y, sp.x, sp.y); | - |
688 | i -= 2; | - |
689 | break; | 0 |
690 | } | - |
691 | default: | - |
692 | qt_noop(); | - |
693 | break; | 0 |
694 | } | - |
695 | } | 0 |
696 | | - |
697 | return rev; never executed: return rev; | 0 |
698 | } | - |
699 | QList<QPolygonF> QPainterPath::toSubpathPolygons(const QTransform &matrix) const | - |
700 | { | - |
701 | | - |
702 | const QPainterPathPrivate * const d = d_func(); | - |
703 | QList<QPolygonF> flatCurves; | - |
704 | if (isEmpty()) partially evaluated: isEmpty() no Evaluation Count:0 | yes Evaluation Count:49 |
| 0-49 |
705 | return flatCurves; never executed: return flatCurves; | 0 |
706 | | - |
707 | QPolygonF current; | - |
708 | for (int i=0; i<elementCount(); ++i) { evaluated: i<elementCount() yes Evaluation Count:269 | yes Evaluation Count:49 |
| 49-269 |
709 | const QPainterPath::Element &e = d->elements.at(i); | - |
710 | switch (e.type) { | - |
711 | case QPainterPath::MoveToElement: | - |
712 | if (current.size() > 1) evaluated: current.size() > 1 yes Evaluation Count:3 | yes Evaluation Count:49 |
| 3-49 |
713 | flatCurves += current; executed: flatCurves += current; Execution Count:3 | 3 |
714 | current.clear(); | - |
715 | current.reserve(16); | - |
716 | current += QPointF(e.x, e.y) * matrix; | - |
717 | break; executed: break; Execution Count:52 | 52 |
718 | case QPainterPath::LineToElement: | - |
719 | current += QPointF(e.x, e.y) * matrix; | - |
720 | break; executed: break; Execution Count:112 | 112 |
721 | case QPainterPath::CurveToElement: { | - |
722 | qt_noop(); | - |
723 | qt_noop(); | - |
724 | QBezier bezier = QBezier::fromPoints(QPointF(d->elements.at(i-1).x, d->elements.at(i-1).y) * matrix, | - |
725 | QPointF(e.x, e.y) * matrix, | - |
726 | QPointF(d->elements.at(i+1).x, d->elements.at(i+1).y) * matrix, | - |
727 | QPointF(d->elements.at(i+2).x, d->elements.at(i+2).y) * matrix); | - |
728 | bezier.addToPolygon(¤t); | - |
729 | i+=2; | - |
730 | break; executed: break; Execution Count:105 | 105 |
731 | } | - |
732 | case QPainterPath::CurveToDataElement: | - |
733 | qt_noop(); | - |
734 | break; | 0 |
735 | } | - |
736 | } executed: } Execution Count:269 | 269 |
737 | | - |
738 | if (current.size()>1) partially evaluated: current.size()>1 yes Evaluation Count:49 | no Evaluation Count:0 |
| 0-49 |
739 | flatCurves += current; executed: flatCurves += current; Execution Count:49 | 49 |
740 | | - |
741 | return flatCurves; executed: return flatCurves; Execution Count:49 | 49 |
742 | } | - |
743 | | - |
744 | | - |
745 | | - |
746 | | - |
747 | QList<QPolygonF> QPainterPath::toSubpathPolygons(const QMatrix &matrix) const | - |
748 | { | - |
749 | return toSubpathPolygons(QTransform(matrix)); executed: return toSubpathPolygons(QTransform(matrix)); Execution Count:13 | 13 |
750 | } | - |
751 | QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const | - |
752 | { | - |
753 | | - |
754 | QList<QPolygonF> polys; | - |
755 | | - |
756 | QList<QPolygonF> subpaths = toSubpathPolygons(matrix); | - |
757 | int count = subpaths.size(); | - |
758 | | - |
759 | if (count == 0) partially evaluated: count == 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
760 | return polys; never executed: return polys; | 0 |
761 | | - |
762 | QList<QRectF> bounds; | - |
763 | for (int i=0; i<count; ++i) evaluated: i<count yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
764 | bounds += subpaths.at(i).boundingRect(); executed: bounds += subpaths.at(i).boundingRect(); Execution Count:2 | 2 |
765 | | - |
766 | | - |
767 | | - |
768 | | - |
769 | | - |
770 | | - |
771 | | - |
772 | QVector< QList<int> > isects; | - |
773 | isects.resize(count); | - |
774 | | - |
775 | | - |
776 | for (int j=0; j<count; ++j) { evaluated: j<count yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
777 | if (subpaths.at(j).size() <= 2) partially evaluated: subpaths.at(j).size() <= 2 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
778 | continue; never executed: continue; | 0 |
779 | QRectF cbounds = bounds.at(j); | - |
780 | for (int i=0; i<count; ++i) { evaluated: i<count yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
781 | if (cbounds.intersects(bounds.at(i))) { evaluated: cbounds.intersects(bounds.at(i)) yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
782 | isects[j] << i; | - |
783 | } executed: } Execution Count:2 | 2 |
784 | } executed: } Execution Count:4 | 4 |
785 | } executed: } Execution Count:2 | 2 |
786 | for (int i=0; i<count; ++i) { evaluated: i<count yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
787 | const QList<int> ¤t_isects = isects.at(i); | - |
788 | for (int j=0; j<current_isects.size(); ++j) { evaluated: j<current_isects.size() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
789 | int isect_j = current_isects.at(j); | - |
790 | if (isect_j == i) partially evaluated: isect_j == i yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
791 | continue; executed: continue; Execution Count:2 | 2 |
792 | for (int k=0; k<isects[isect_j].size(); ++k) { never evaluated: k<isects[isect_j].size() | 0 |
793 | int isect_k = isects[isect_j][k]; | - |
794 | if (isect_k != i && !isects.at(i).contains(isect_k)) { never evaluated: isect_k != i never evaluated: !isects.at(i).contains(isect_k) | 0 |
795 | isects[i] += isect_k; | - |
796 | } | 0 |
797 | } | 0 |
798 | isects[isect_j].clear(); | - |
799 | } | 0 |
800 | } executed: } Execution Count:2 | 2 |
801 | for (int i=0; i<count; ++i) { evaluated: i<count yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
802 | const QList<int> &subpath_list = isects[i]; | - |
803 | if (!subpath_list.isEmpty()) { partially evaluated: !subpath_list.isEmpty() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
804 | QPolygonF buildUp; | - |
805 | for (int j=0; j<subpath_list.size(); ++j) { evaluated: j<subpath_list.size() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
806 | const QPolygonF &subpath = subpaths.at(subpath_list.at(j)); | - |
807 | buildUp += subpath; | - |
808 | if (!subpath.isClosed()) partially evaluated: !subpath.isClosed() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
809 | buildUp += subpath.first(); executed: buildUp += subpath.first(); Execution Count:2 | 2 |
810 | if (!buildUp.isClosed()) partially evaluated: !buildUp.isClosed() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
811 | buildUp += buildUp.first(); never executed: buildUp += buildUp.first(); | 0 |
812 | } executed: } Execution Count:2 | 2 |
813 | polys += buildUp; | - |
814 | } executed: } Execution Count:2 | 2 |
815 | } executed: } Execution Count:2 | 2 |
816 | | - |
817 | return polys; executed: return polys; Execution Count:1 | 1 |
818 | } | - |
819 | | - |
820 | | - |
821 | | - |
822 | | - |
823 | QList<QPolygonF> QPainterPath::toFillPolygons(const QMatrix &matrix) const | - |
824 | { | - |
825 | return toFillPolygons(QTransform(matrix)); executed: return toFillPolygons(QTransform(matrix)); Execution Count:1 | 1 |
826 | } | - |
827 | | - |
828 | | - |
829 | static void qt_painterpath_isect_line(const QPointF &p1, | - |
830 | const QPointF &p2, | - |
831 | const QPointF &pos, | - |
832 | int *winding) | - |
833 | { | - |
834 | qreal x1 = p1.x(); | - |
835 | qreal y1 = p1.y(); | - |
836 | qreal x2 = p2.x(); | - |
837 | qreal y2 = p2.y(); | - |
838 | qreal y = pos.y(); | - |
839 | | - |
840 | int dir = 1; | - |
841 | | - |
842 | if (qFuzzyCompare(y1, y2)) { evaluated: qFuzzyCompare(y1, y2) yes Evaluation Count:1386 | yes Evaluation Count:1386 |
| 1386 |
843 | | - |
844 | return; executed: return; Execution Count:1386 | 1386 |
845 | } else if (y2 < y1) { evaluated: y2 < y1 yes Evaluation Count:696 | yes Evaluation Count:690 |
| 690-696 |
846 | qreal x_tmp = x2; x2 = x1; x1 = x_tmp; | - |
847 | qreal y_tmp = y2; y2 = y1; y1 = y_tmp; | - |
848 | dir = -1; | - |
849 | } executed: } Execution Count:696 | 696 |
850 | | - |
851 | if (y >= y1 && y < y2) { evaluated: y >= y1 yes Evaluation Count:1142 | yes Evaluation Count:244 |
evaluated: y < y2 yes Evaluation Count:906 | yes Evaluation Count:236 |
| 236-1142 |
852 | qreal x = x1 + ((x2 - x1) / (y2 - y1)) * (y - y1); | - |
853 | | - |
854 | | - |
855 | if (x<=pos.x()) { evaluated: x<=pos.x() yes Evaluation Count:458 | yes Evaluation Count:448 |
| 448-458 |
856 | (*winding) += dir; | - |
857 | } executed: } Execution Count:458 | 458 |
858 | } executed: } Execution Count:906 | 906 |
859 | } executed: } Execution Count:1386 | 1386 |
860 | | - |
861 | static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt, | - |
862 | int *winding, int depth = 0) | - |
863 | { | - |
864 | qreal y = pt.y(); | - |
865 | qreal x = pt.x(); | - |
866 | QRectF bounds = bezier.bounds(); | - |
867 | | - |
868 | | - |
869 | | - |
870 | | - |
871 | | - |
872 | if (y >= bounds.y() && y < bounds.y() + bounds.height()) { evaluated: y >= bounds.y() yes Evaluation Count:5573 | yes Evaluation Count:2368 |
evaluated: y < bounds.y() + bounds.height() yes Evaluation Count:3874 | yes Evaluation Count:1699 |
| 1699-5573 |
873 | | - |
874 | | - |
875 | | - |
876 | const qreal lower_bound = qreal(.001); | - |
877 | if (depth == 32 || (bounds.width() < lower_bound && bounds.height() < lower_bound)) { partially evaluated: depth == 32 no Evaluation Count:0 | yes Evaluation Count:3874 |
evaluated: bounds.width() < lower_bound yes Evaluation Count:792 | yes Evaluation Count:3082 |
evaluated: bounds.height() < lower_bound yes Evaluation Count:238 | yes Evaluation Count:554 |
| 0-3874 |
878 | | - |
879 | | - |
880 | | - |
881 | if (bezier.pt1().x() <= x) { evaluated: bezier.pt1().x() <= x yes Evaluation Count:121 | yes Evaluation Count:117 |
| 117-121 |
882 | (*winding) += (bezier.pt4().y() > bezier.pt1().y() ? 1 : -1); | - |
883 | } executed: } Execution Count:121 | 121 |
884 | return; executed: return; Execution Count:238 | 238 |
885 | } | - |
886 | | - |
887 | | - |
888 | QBezier first_half, second_half; | - |
889 | bezier.split(&first_half, &second_half); | - |
890 | qt_painterpath_isect_curve(first_half, pt, winding, depth + 1); | - |
891 | qt_painterpath_isect_curve(second_half, pt, winding, depth + 1); | - |
892 | } executed: } Execution Count:3636 | 3636 |
893 | } executed: } Execution Count:7703 | 7703 |
894 | bool QPainterPath::contains(const QPointF &pt) const | - |
895 | { | - |
896 | if (isEmpty() || !controlPointRect().contains(pt)) evaluated: isEmpty() yes Evaluation Count:21 | yes Evaluation Count:453 |
evaluated: !controlPointRect().contains(pt) yes Evaluation Count:75 | yes Evaluation Count:378 |
| 21-453 |
897 | return false; executed: return false; Execution Count:96 | 96 |
898 | | - |
899 | QPainterPathData *d = d_func(); | - |
900 | | - |
901 | int winding_number = 0; | - |
902 | | - |
903 | QPointF last_pt; | - |
904 | QPointF last_start; | - |
905 | for (int i=0; i<d->elements.size(); ++i) { evaluated: i<d->elements.size() yes Evaluation Count:3794 | yes Evaluation Count:378 |
| 378-3794 |
906 | const Element &e = d->elements.at(i); | - |
907 | | - |
908 | switch (e.type) { | - |
909 | | - |
910 | case MoveToElement: | - |
911 | if (i > 0) evaluated: i > 0 yes Evaluation Count:232 | yes Evaluation Count:378 |
| 232-378 |
912 | qt_painterpath_isect_line(last_pt, last_start, pt, &winding_number); executed: qt_painterpath_isect_line(last_pt, last_start, pt, &winding_number); Execution Count:232 | 232 |
913 | last_start = last_pt = e; | - |
914 | break; executed: break; Execution Count:610 | 610 |
915 | | - |
916 | case LineToElement: | - |
917 | qt_painterpath_isect_line(last_pt, e, pt, &winding_number); | - |
918 | last_pt = e; | - |
919 | break; executed: break; Execution Count:2515 | 2515 |
920 | | - |
921 | case CurveToElement: | - |
922 | { | - |
923 | const QPainterPath::Element &cp2 = d->elements.at(++i); | - |
924 | const QPainterPath::Element &ep = d->elements.at(++i); | - |
925 | qt_painterpath_isect_curve(QBezier::fromPoints(last_pt, e, cp2, ep), | - |
926 | pt, &winding_number); | - |
927 | last_pt = ep; | - |
928 | | - |
929 | } | - |
930 | break; executed: break; Execution Count:669 | 669 |
931 | | - |
932 | default: | - |
933 | break; | 0 |
934 | } | - |
935 | } executed: } Execution Count:3794 | 3794 |
936 | | - |
937 | | - |
938 | if (last_pt != last_start) evaluated: last_pt != last_start yes Evaluation Count:25 | yes Evaluation Count:353 |
| 25-353 |
939 | qt_painterpath_isect_line(last_pt, last_start, pt, &winding_number); executed: qt_painterpath_isect_line(last_pt, last_start, pt, &winding_number); Execution Count:25 | 25 |
940 | | - |
941 | return (d->fillRule == Qt::WindingFill | 378 |
942 | ? (winding_number != 0) | 378 |
943 | : ((winding_number % 2) != 0)); executed: return (d->fillRule == Qt::WindingFill ? (winding_number != 0) : ((winding_number % 2) != 0)); Execution Count:378 | 378 |
944 | } | - |
945 | | - |
946 | static bool qt_painterpath_isect_line_rect(qreal x1, qreal y1, qreal x2, qreal y2, | - |
947 | const QRectF &rect) | - |
948 | { | - |
949 | qreal left = rect.left(); | - |
950 | qreal right = rect.right(); | - |
951 | qreal top = rect.top(); | - |
952 | qreal bottom = rect.bottom(); | - |
953 | | - |
954 | enum { Left, Right, Top, Bottom }; | - |
955 | | - |
956 | int p1 = ((x1 < left) << Left) | - |
957 | | ((x1 > right) << Right) | - |
958 | | ((y1 < top) << Top) | - |
959 | | ((y1 > bottom) << Bottom); | - |
960 | int p2 = ((x2 < left) << Left) | - |
961 | | ((x2 > right) << Right) | - |
962 | | ((y2 < top) << Top) | - |
963 | | ((y2 > bottom) << Bottom); | - |
964 | | - |
965 | if (p1 & p2) evaluated: p1 & p2 yes Evaluation Count:1555 | yes Evaluation Count:148 |
| 148-1555 |
966 | | - |
967 | return false; executed: return false; Execution Count:1555 | 1555 |
968 | | - |
969 | if (p1 | p2) { evaluated: p1 | p2 yes Evaluation Count:72 | yes Evaluation Count:76 |
| 72-76 |
970 | qreal dx = x2 - x1; | - |
971 | qreal dy = y2 - y1; | - |
972 | | - |
973 | | - |
974 | if (x1 < left) { evaluated: x1 < left yes Evaluation Count:14 | yes Evaluation Count:58 |
| 14-58 |
975 | y1 += dy/dx * (left - x1); | - |
976 | x1 = left; | - |
977 | } else if (x1 > right) { executed: } Execution Count:14 evaluated: x1 > right yes Evaluation Count:9 | yes Evaluation Count:49 |
| 9-49 |
978 | y1 -= dy/dx * (x1 - right); | - |
979 | x1 = right; | - |
980 | } executed: } Execution Count:9 | 9 |
981 | if (x2 < left) { evaluated: x2 < left yes Evaluation Count:2 | yes Evaluation Count:70 |
| 2-70 |
982 | y2 += dy/dx * (left - x2); | - |
983 | x2 = left; | - |
984 | } else if (x2 > right) { executed: } Execution Count:2 evaluated: x2 > right yes Evaluation Count:35 | yes Evaluation Count:35 |
| 2-35 |
985 | y2 -= dy/dx * (x2 - right); | - |
986 | x2 = right; | - |
987 | } executed: } Execution Count:35 | 35 |
988 | | - |
989 | p1 = ((y1 < top) << Top) | - |
990 | | ((y1 > bottom) << Bottom); | - |
991 | p2 = ((y2 < top) << Top) | - |
992 | | ((y2 > bottom) << Bottom); | - |
993 | | - |
994 | if (p1 & p2) partially evaluated: p1 & p2 no Evaluation Count:0 | yes Evaluation Count:72 |
| 0-72 |
995 | return false; never executed: return false; | 0 |
996 | | - |
997 | | - |
998 | if (y1 < top) { evaluated: y1 < top yes Evaluation Count:18 | yes Evaluation Count:54 |
| 18-54 |
999 | x1 += dx/dy * (top - y1); | - |
1000 | y1 = top; | - |
1001 | } else if (y1 > bottom) { executed: } Execution Count:18 partially evaluated: y1 > bottom no Evaluation Count:0 | yes Evaluation Count:54 |
| 0-54 |
1002 | x1 -= dx/dy * (y1 - bottom); | - |
1003 | y1 = bottom; | - |
1004 | } | 0 |
1005 | if (y2 < top) { partially evaluated: y2 < top no Evaluation Count:0 | yes Evaluation Count:72 |
| 0-72 |
1006 | x2 += dx/dy * (top - y2); | - |
1007 | y2 = top; | - |
1008 | } else if (y2 > bottom) { evaluated: y2 > bottom yes Evaluation Count:6 | yes Evaluation Count:66 |
| 0-66 |
1009 | x2 -= dx/dy * (y2 - bottom); | - |
1010 | y2 = bottom; | - |
1011 | } executed: } Execution Count:6 | 6 |
1012 | | - |
1013 | p1 = ((x1 < left) << Left) | - |
1014 | | ((x1 > right) << Right); | - |
1015 | p2 = ((x2 < left) << Left) | - |
1016 | | ((x2 > right) << Right); | - |
1017 | | - |
1018 | if (p1 & p2) partially evaluated: p1 & p2 no Evaluation Count:0 | yes Evaluation Count:72 |
| 0-72 |
1019 | return false; never executed: return false; | 0 |
1020 | | - |
1021 | return true; executed: return true; Execution Count:72 | 72 |
1022 | } | - |
1023 | return false; executed: return false; Execution Count:76 | 76 |
1024 | } | - |
1025 | | - |
1026 | static bool qt_isect_curve_horizontal(const QBezier &bezier, qreal y, qreal x1, qreal x2, int depth = 0) | - |
1027 | { | - |
1028 | QRectF bounds = bezier.bounds(); | - |
1029 | | - |
1030 | if (y >= bounds.top() && y < bounds.bottom() evaluated: y >= bounds.top() yes Evaluation Count:182 | yes Evaluation Count:93 |
evaluated: y < bounds.bottom() yes Evaluation Count:104 | yes Evaluation Count:78 |
| 78-182 |
1031 | && bounds.right() >= x1 && bounds.left() < x2) { evaluated: bounds.right() >= x1 yes Evaluation Count:88 | yes Evaluation Count:16 |
evaluated: bounds.left() < x2 yes Evaluation Count:76 | yes Evaluation Count:12 |
| 12-88 |
1032 | const qreal lower_bound = qreal(.01); | - |
1033 | if (depth == 32 || (bounds.width() < lower_bound && bounds.height() < lower_bound)) partially evaluated: depth == 32 no Evaluation Count:0 | yes Evaluation Count:76 |
evaluated: bounds.width() < lower_bound yes Evaluation Count:4 | yes Evaluation Count:72 |
evaluated: bounds.height() < lower_bound yes Evaluation Count:3 | yes Evaluation Count:1 |
| 0-76 |
1034 | return true; executed: return true; Execution Count:3 | 3 |
1035 | | - |
1036 | QBezier first_half, second_half; | - |
1037 | bezier.split(&first_half, &second_half); | - |
1038 | if (qt_isect_curve_horizontal(first_half, y, x1, x2, depth + 1) evaluated: qt_isect_curve_horizontal(first_half, y, x1, x2, depth + 1) yes Evaluation Count:19 | yes Evaluation Count:54 |
| 19-54 |
1039 | || qt_isect_curve_horizontal(second_half, y, x1, x2, depth + 1)) evaluated: qt_isect_curve_horizontal(second_half, y, x1, x2, depth + 1) yes Evaluation Count:34 | yes Evaluation Count:20 |
| 20-34 |
1040 | return true; executed: return true; Execution Count:53 | 53 |
1041 | } executed: } Execution Count:20 | 20 |
1042 | return false; executed: return false; Execution Count:219 | 219 |
1043 | } | - |
1044 | | - |
1045 | static bool qt_isect_curve_vertical(const QBezier &bezier, qreal x, qreal y1, qreal y2, int depth = 0) | - |
1046 | { | - |
1047 | QRectF bounds = bezier.bounds(); | - |
1048 | | - |
1049 | if (x >= bounds.left() && x < bounds.right() evaluated: x >= bounds.left() yes Evaluation Count:291 | yes Evaluation Count:151 |
evaluated: x < bounds.right() yes Evaluation Count:236 | yes Evaluation Count:55 |
| 55-291 |
1050 | && bounds.bottom() >= y1 && bounds.top() < y2) { evaluated: bounds.bottom() >= y1 yes Evaluation Count:224 | yes Evaluation Count:12 |
evaluated: bounds.top() < y2 yes Evaluation Count:200 | yes Evaluation Count:24 |
| 12-224 |
1051 | const qreal lower_bound = qreal(.01); | - |
1052 | if (depth == 32 || (bounds.width() < lower_bound && bounds.height() < lower_bound)) partially evaluated: depth == 32 no Evaluation Count:0 | yes Evaluation Count:200 |
evaluated: bounds.width() < lower_bound yes Evaluation Count:47 | yes Evaluation Count:153 |
evaluated: bounds.height() < lower_bound yes Evaluation Count:14 | yes Evaluation Count:33 |
| 0-200 |
1053 | return true; executed: return true; Execution Count:14 | 14 |
1054 | | - |
1055 | QBezier first_half, second_half; | - |
1056 | bezier.split(&first_half, &second_half); | - |
1057 | if (qt_isect_curve_vertical(first_half, x, y1, y2, depth + 1) evaluated: qt_isect_curve_vertical(first_half, x, y1, y2, depth + 1) yes Evaluation Count:70 | yes Evaluation Count:116 |
| 70-116 |
1058 | || qt_isect_curve_vertical(second_half, x, y1, y2, depth + 1)) evaluated: qt_isect_curve_vertical(second_half, x, y1, y2, depth + 1) yes Evaluation Count:94 | yes Evaluation Count:22 |
| 22-94 |
1059 | return true; executed: return true; Execution Count:164 | 164 |
1060 | } executed: } Execution Count:22 | 22 |
1061 | return false; executed: return false; Execution Count:264 | 264 |
1062 | } | - |
1063 | | - |
1064 | | - |
1065 | | - |
1066 | | - |
1067 | static bool qt_painterpath_check_crossing(const QPainterPath *path, const QRectF &rect) | - |
1068 | { | - |
1069 | QPointF last_pt; | - |
1070 | QPointF last_start; | - |
1071 | for (int i=0; i<path->elementCount(); ++i) { evaluated: i<path->elementCount() yes Evaluation Count:1946 | yes Evaluation Count:100 |
| 100-1946 |
1072 | const QPainterPath::Element &e = path->elementAt(i); | - |
1073 | | - |
1074 | switch (e.type) { | - |
1075 | | - |
1076 | case QPainterPath::MoveToElement: | - |
1077 | if (i > 0 evaluated: i > 0 yes Evaluation Count:126 | yes Evaluation Count:189 |
| 126-189 |
1078 | && qFuzzyCompare(last_pt.x(), last_start.x()) partially evaluated: qFuzzyCompare(last_pt.x(), last_start.x()) yes Evaluation Count:126 | no Evaluation Count:0 |
| 0-126 |
1079 | && qFuzzyCompare(last_pt.y(), last_start.y()) partially evaluated: qFuzzyCompare(last_pt.y(), last_start.y()) yes Evaluation Count:126 | no Evaluation Count:0 |
| 0-126 |
1080 | && qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(), | 0-126 |
1081 | last_start.x(), last_start.y(), rect)) partially evaluated: qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(), last_start.x(), last_start.y(), rect) no Evaluation Count:0 | yes Evaluation Count:126 |
| 0-126 |
1082 | return true; never executed: return true; | 0 |
1083 | last_start = last_pt = e; | - |
1084 | break; executed: break; Execution Count:315 | 315 |
1085 | | - |
1086 | case QPainterPath::LineToElement: | - |
1087 | if (qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(), e.x, e.y, rect)) evaluated: qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(), e.x, e.y, rect) yes Evaluation Count:72 | yes Evaluation Count:1484 |
| 72-1484 |
1088 | return true; executed: return true; Execution Count:72 | 72 |
1089 | last_pt = e; | - |
1090 | break; executed: break; Execution Count:1484 | 1484 |
1091 | | - |
1092 | case QPainterPath::CurveToElement: | - |
1093 | { | - |
1094 | QPointF cp2 = path->elementAt(++i); | - |
1095 | QPointF ep = path->elementAt(++i); | - |
1096 | QBezier bezier = QBezier::fromPoints(last_pt, e, cp2, ep); | - |
1097 | if (qt_isect_curve_horizontal(bezier, rect.top(), rect.left(), rect.right()) evaluated: qt_isect_curve_horizontal(bezier, rect.top(), rect.left(), rect.right()) yes Evaluation Count:2 | yes Evaluation Count:73 |
| 2-73 |
1098 | || qt_isect_curve_horizontal(bezier, rect.bottom(), rect.left(), rect.right()) evaluated: qt_isect_curve_horizontal(bezier, rect.bottom(), rect.left(), rect.right()) yes Evaluation Count:1 | yes Evaluation Count:72 |
| 1-72 |
1099 | || qt_isect_curve_vertical(bezier, rect.left(), rect.top(), rect.bottom()) evaluated: qt_isect_curve_vertical(bezier, rect.left(), rect.top(), rect.bottom()) yes Evaluation Count:4 | yes Evaluation Count:68 |
| 4-68 |
1100 | || qt_isect_curve_vertical(bezier, rect.right(), rect.top(), rect.bottom())) evaluated: qt_isect_curve_vertical(bezier, rect.right(), rect.top(), rect.bottom()) yes Evaluation Count:10 | yes Evaluation Count:58 |
| 10-58 |
1101 | return true; executed: return true; Execution Count:17 | 17 |
1102 | last_pt = ep; | - |
1103 | } | - |
1104 | break; executed: break; Execution Count:58 | 58 |
1105 | | - |
1106 | default: | - |
1107 | break; | 0 |
1108 | } | - |
1109 | } executed: } Execution Count:1857 | 1857 |
1110 | | - |
1111 | | - |
1112 | if (last_pt != last_start evaluated: last_pt != last_start yes Evaluation Count:21 | yes Evaluation Count:79 |
| 21-79 |
1113 | && qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(), | 0-21 |
1114 | last_start.x(), last_start.y(), rect)) partially evaluated: qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(), last_start.x(), last_start.y(), rect) no Evaluation Count:0 | yes Evaluation Count:21 |
| 0-21 |
1115 | return true; never executed: return true; | 0 |
1116 | | - |
1117 | return false; executed: return false; Execution Count:100 | 100 |
1118 | } | - |
1119 | bool QPainterPath::intersects(const QRectF &rect) const | - |
1120 | { | - |
1121 | if (elementCount() == 1 && rect.contains(elementAt(0))) partially evaluated: elementCount() == 1 no Evaluation Count:0 | yes Evaluation Count:174 |
never evaluated: rect.contains(elementAt(0)) | 0-174 |
1122 | return true; never executed: return true; | 0 |
1123 | | - |
1124 | if (isEmpty()) partially evaluated: isEmpty() no Evaluation Count:0 | yes Evaluation Count:174 |
| 0-174 |
1125 | return false; never executed: return false; | 0 |
1126 | | - |
1127 | QRectF cp = controlPointRect(); | - |
1128 | QRectF rn = rect.normalized(); | - |
1129 | | - |
1130 | | - |
1131 | | - |
1132 | | - |
1133 | if (qMax(rn.left(), cp.left()) > qMin(rn.right(), cp.right()) evaluated: qMax(rn.left(), cp.left()) > qMin(rn.right(), cp.right()) yes Evaluation Count:2 | yes Evaluation Count:172 |
| 2-172 |
1134 | || qMax(rn.top(), cp.top()) > qMin(rn.bottom(), cp.bottom())) evaluated: qMax(rn.top(), cp.top()) > qMin(rn.bottom(), cp.bottom()) yes Evaluation Count:2 | yes Evaluation Count:170 |
| 2-170 |
1135 | return false; executed: return false; Execution Count:4 | 4 |
1136 | | - |
1137 | | - |
1138 | if (qt_painterpath_check_crossing(this, rect)) evaluated: qt_painterpath_check_crossing(this, rect) yes Evaluation Count:83 | yes Evaluation Count:87 |
| 83-87 |
1139 | return true; executed: return true; Execution Count:83 | 83 |
1140 | | - |
1141 | if (contains(rect.center())) evaluated: contains(rect.center()) yes Evaluation Count:75 | yes Evaluation Count:12 |
| 12-75 |
1142 | return true; executed: return true; Execution Count:75 | 75 |
1143 | | - |
1144 | QPainterPathPrivate * const d = d_func(); | - |
1145 | | - |
1146 | | - |
1147 | for (int i=0; i<d->elements.size(); ++i) { evaluated: i<d->elements.size() yes Evaluation Count:77 | yes Evaluation Count:4 |
| 4-77 |
1148 | const Element &e = d->elements.at(i); | - |
1149 | if (e.type == QPainterPath::MoveToElement && rect.contains(e)) evaluated: e.type == QPainterPath::MoveToElement yes Evaluation Count:17 | yes Evaluation Count:60 |
evaluated: rect.contains(e) yes Evaluation Count:8 | yes Evaluation Count:9 |
| 8-60 |
1150 | return true; executed: return true; Execution Count:8 | 8 |
1151 | } executed: } Execution Count:69 | 69 |
1152 | | - |
1153 | return false; executed: return false; Execution Count:4 | 4 |
1154 | } | - |
1155 | | - |
1156 | | - |
1157 | | - |
1158 | | - |
1159 | | - |
1160 | | - |
1161 | | - |
1162 | void QPainterPath::translate(qreal dx, qreal dy) | - |
1163 | { | - |
1164 | if (!d_ptr || (dx == 0 && dy == 0)) evaluated: !d_ptr yes Evaluation Count:2 | yes Evaluation Count:357 |
evaluated: dx == 0 yes Evaluation Count:321 | yes Evaluation Count:36 |
partially evaluated: dy == 0 yes Evaluation Count:321 | no Evaluation Count:0 |
| 0-357 |
1165 | return; executed: return; Execution Count:323 | 323 |
1166 | | - |
1167 | int elementsLeft = d_ptr->elements.size(); | - |
1168 | if (elementsLeft <= 0) partially evaluated: elementsLeft <= 0 no Evaluation Count:0 | yes Evaluation Count:36 |
| 0-36 |
1169 | return; | 0 |
1170 | | - |
1171 | detach(); | - |
1172 | QPainterPath::Element *element = d_func()->elements.data(); | - |
1173 | qt_noop(); | - |
1174 | while (elementsLeft--) { evaluated: elementsLeft-- yes Evaluation Count:1904 | yes Evaluation Count:36 |
| 36-1904 |
1175 | element->x += dx; | - |
1176 | element->y += dy; | - |
1177 | ++element; | - |
1178 | } executed: } Execution Count:1904 | 1904 |
1179 | } executed: } Execution Count:36 | 36 |
1180 | QPainterPath QPainterPath::translated(qreal dx, qreal dy) const | - |
1181 | { | - |
1182 | QPainterPath copy(*this); | - |
1183 | copy.translate(dx, dy); | - |
1184 | return copy; executed: return copy; Execution Count:54 | 54 |
1185 | } | - |
1186 | bool QPainterPath::contains(const QRectF &rect) const | - |
1187 | { | - |
1188 | QPainterPathPrivate * const d = d_func(); | - |
1189 | | - |
1190 | | - |
1191 | | - |
1192 | if (isEmpty() || !controlPointRect().contains(rect)) evaluated: isEmpty() yes Evaluation Count:1 | yes Evaluation Count:28 |
evaluated: !controlPointRect().contains(rect) yes Evaluation Count:9 | yes Evaluation Count:19 |
| 1-28 |
1193 | return false; executed: return false; Execution Count:10 | 10 |
1194 | | - |
1195 | | - |
1196 | | - |
1197 | | - |
1198 | if (qt_painterpath_check_crossing(this, rect)) { evaluated: qt_painterpath_check_crossing(this, rect) yes Evaluation Count:6 | yes Evaluation Count:13 |
| 6-13 |
1199 | if (fillRule() == Qt::OddEvenFill) { evaluated: fillRule() == Qt::OddEvenFill yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3 |
1200 | return false; executed: return false; Execution Count:3 | 3 |
1201 | } else { | - |
1202 | | - |
1203 | | - |
1204 | if (!contains(rect.topLeft()) || partially evaluated: !contains(rect.topLeft()) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1205 | !contains(rect.topRight()) || partially evaluated: !contains(rect.topRight()) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1206 | !contains(rect.bottomRight()) || partially evaluated: !contains(rect.bottomRight()) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1207 | !contains(rect.bottomLeft())) partially evaluated: !contains(rect.bottomLeft()) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1208 | return false; never executed: return false; | 0 |
1209 | } executed: } Execution Count:3 | 3 |
1210 | } | - |
1211 | | - |
1212 | | - |
1213 | | - |
1214 | | - |
1215 | | - |
1216 | if (!contains(rect.center())) evaluated: !contains(rect.center()) yes Evaluation Count:3 | yes Evaluation Count:13 |
| 3-13 |
1217 | return false; executed: return false; Execution Count:3 | 3 |
1218 | | - |
1219 | | - |
1220 | | - |
1221 | | - |
1222 | | - |
1223 | | - |
1224 | | - |
1225 | for (int i=0; i<d->elements.size(); ++i) { evaluated: i<d->elements.size() yes Evaluation Count:127 | yes Evaluation Count:12 |
| 12-127 |
1226 | const Element &e = d->elements.at(i); | - |
1227 | if (e.type == QPainterPath::MoveToElement && rect.contains(e)) { evaluated: e.type == QPainterPath::MoveToElement yes Evaluation Count:23 | yes Evaluation Count:104 |
evaluated: rect.contains(e) yes Evaluation Count:1 | yes Evaluation Count:22 |
| 1-104 |
1228 | if (fillRule() == Qt::OddEvenFill) partially evaluated: fillRule() == Qt::OddEvenFill yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1229 | return false; executed: return false; Execution Count:1 | 1 |
1230 | | - |
1231 | bool stop = false; | - |
1232 | for (; !stop && i<d->elements.size(); ++i) { never evaluated: i<d->elements.size() | 0 |
1233 | const Element &el = d->elements.at(i); | - |
1234 | switch (el.type) { | - |
1235 | case MoveToElement: | - |
1236 | stop = true; | - |
1237 | break; | 0 |
1238 | case LineToElement: | - |
1239 | if (!contains(el)) never evaluated: !contains(el) | 0 |
1240 | return false; never executed: return false; | 0 |
1241 | break; | 0 |
1242 | case CurveToElement: | - |
1243 | if (!contains(d->elements.at(i+2))) never evaluated: !contains(d->elements.at(i+2)) | 0 |
1244 | return false; never executed: return false; | 0 |
1245 | i += 2; | - |
1246 | break; | 0 |
1247 | default: | - |
1248 | break; | 0 |
1249 | } | - |
1250 | } | 0 |
1251 | | - |
1252 | | - |
1253 | --i; | - |
1254 | } | 0 |
1255 | } executed: } Execution Count:126 | 126 |
1256 | | - |
1257 | return true; executed: return true; Execution Count:12 | 12 |
1258 | } | - |
1259 | | - |
1260 | static inline bool epsilonCompare(const QPointF &a, const QPointF &b, const QSizeF &epsilon) | - |
1261 | { | - |
1262 | return qAbs(a.x() - b.x()) <= epsilon.width() | 1303 |
1263 | && qAbs(a.y() - b.y()) <= epsilon.height(); executed: return qAbs(a.x() - b.x()) <= epsilon.width() && qAbs(a.y() - b.y()) <= epsilon.height(); Execution Count:1303 | 1303 |
1264 | } | - |
1265 | bool QPainterPath::operator==(const QPainterPath &path) const | - |
1266 | { | - |
1267 | QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func()); | - |
1268 | if (path.d_func() == d) evaluated: path.d_func() == d yes Evaluation Count:78 | yes Evaluation Count:2816 |
| 78-2816 |
1269 | return true; executed: return true; Execution Count:78 | 78 |
1270 | else if (!d || !path.d_func()) partially evaluated: !d no Evaluation Count:0 | yes Evaluation Count:2816 |
evaluated: !path.d_func() yes Evaluation Count:2255 | yes Evaluation Count:561 |
| 0-2816 |
1271 | return false; executed: return false; Execution Count:2255 | 2255 |
1272 | else if (d->fillRule != path.d_func()->fillRule) evaluated: d->fillRule != path.d_func()->fillRule yes Evaluation Count:226 | yes Evaluation Count:335 |
| 226-335 |
1273 | return false; executed: return false; Execution Count:226 | 226 |
1274 | else if (d->elements.size() != path.d_func()->elements.size()) evaluated: d->elements.size() != path.d_func()->elements.size() yes Evaluation Count:67 | yes Evaluation Count:268 |
| 67-268 |
1275 | return false; executed: return false; Execution Count:67 | 67 |
1276 | | - |
1277 | const qreal qt_epsilon = sizeof(qreal) == sizeof(double) ? 1e-12 : qreal(1e-5); partially evaluated: sizeof(qreal) == sizeof(double) yes Evaluation Count:268 | no Evaluation Count:0 |
| 0-268 |
1278 | | - |
1279 | QSizeF epsilon = boundingRect().size(); | - |
1280 | epsilon.rwidth() *= qt_epsilon; | - |
1281 | epsilon.rheight() *= qt_epsilon; | - |
1282 | | - |
1283 | for (int i = 0; i < d->elements.size(); ++i) evaluated: i < d->elements.size() yes Evaluation Count:1304 | yes Evaluation Count:25 |
| 25-1304 |
1284 | if (d->elements.at(i).type != path.d_func()->elements.at(i).type evaluated: d->elements.at(i).type != path.d_func()->elements.at(i).type yes Evaluation Count:1 | yes Evaluation Count:1303 |
| 1-1303 |
1285 | || !epsilonCompare(d->elements.at(i), path.d_func()->elements.at(i), epsilon)) evaluated: !epsilonCompare(d->elements.at(i), path.d_func()->elements.at(i), epsilon) yes Evaluation Count:242 | yes Evaluation Count:1061 |
| 242-1061 |
1286 | return false; executed: return false; Execution Count:243 | 243 |
1287 | | - |
1288 | return true; executed: return true; Execution Count:25 | 25 |
1289 | } | - |
1290 | bool QPainterPath::operator!=(const QPainterPath &path) const | - |
1291 | { | - |
1292 | return !(*this==path); executed: return !(*this==path); Execution Count:5 | 5 |
1293 | } | - |
1294 | QPainterPath QPainterPath::operator&(const QPainterPath &other) const | - |
1295 | { | - |
1296 | return intersected(other); executed: return intersected(other); Execution Count:2 | 2 |
1297 | } | - |
1298 | QPainterPath QPainterPath::operator|(const QPainterPath &other) const | - |
1299 | { | - |
1300 | return united(other); executed: return united(other); Execution Count:2 | 2 |
1301 | } | - |
1302 | QPainterPath QPainterPath::operator+(const QPainterPath &other) const | - |
1303 | { | - |
1304 | return united(other); executed: return united(other); Execution Count:104 | 104 |
1305 | } | - |
1306 | QPainterPath QPainterPath::operator-(const QPainterPath &other) const | - |
1307 | { | - |
1308 | return subtracted(other); executed: return subtracted(other); Execution Count:5957 | 5957 |
1309 | } | - |
1310 | QPainterPath &QPainterPath::operator&=(const QPainterPath &other) | - |
1311 | { | - |
1312 | return *this = (*this & other); executed: return *this = (*this & other); Execution Count:1 | 1 |
1313 | } | - |
1314 | QPainterPath &QPainterPath::operator|=(const QPainterPath &other) | - |
1315 | { | - |
1316 | return *this = (*this | other); executed: return *this = (*this | other); Execution Count:1 | 1 |
1317 | } | - |
1318 | QPainterPath &QPainterPath::operator+=(const QPainterPath &other) | - |
1319 | { | - |
1320 | return *this = (*this + other); executed: return *this = (*this + other); Execution Count:103 | 103 |
1321 | } | - |
1322 | QPainterPath &QPainterPath::operator-=(const QPainterPath &other) | - |
1323 | { | - |
1324 | return *this = (*this - other); executed: return *this = (*this - other); Execution Count:52 | 52 |
1325 | } | - |
1326 | QDataStream &operator<<(QDataStream &s, const QPainterPath &p) | - |
1327 | { | - |
1328 | if (p.isEmpty()) { partially evaluated: p.isEmpty() no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
1329 | s << 0; | - |
1330 | return s; never executed: return s; | 0 |
1331 | } | - |
1332 | | - |
1333 | s << p.elementCount(); | - |
1334 | for (int i=0; i < p.d_func()->elements.size(); ++i) { evaluated: i < p.d_func()->elements.size() yes Evaluation Count:80 | yes Evaluation Count:12 |
| 12-80 |
1335 | const QPainterPath::Element &e = p.d_func()->elements.at(i); | - |
1336 | s << int(e.type); | - |
1337 | s << double(e.x) << double(e.y); | - |
1338 | } executed: } Execution Count:80 | 80 |
1339 | s << p.d_func()->cStart; | - |
1340 | s << int(p.d_func()->fillRule); | - |
1341 | return s; executed: return s; Execution Count:12 | 12 |
1342 | } | - |
1343 | QDataStream &operator>>(QDataStream &s, QPainterPath &p) | - |
1344 | { | - |
1345 | int size; | - |
1346 | s >> size; | - |
1347 | | - |
1348 | if (size == 0) partially evaluated: size == 0 no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1349 | return s; never executed: return s; | 0 |
1350 | | - |
1351 | p.ensureData(); | - |
1352 | if (p.d_func()->elements.size() == 1) { partially evaluated: p.d_func()->elements.size() == 1 yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
1353 | qt_noop(); | - |
1354 | p.d_func()->elements.clear(); | - |
1355 | } executed: } Execution Count:5 | 5 |
1356 | p.d_func()->elements.reserve(p.d_func()->elements.size() + size); | - |
1357 | for (int i=0; i<size; ++i) { evaluated: i<size yes Evaluation Count:52 | yes Evaluation Count:5 |
| 5-52 |
1358 | int type; | - |
1359 | double x, y; | - |
1360 | s >> type; | - |
1361 | s >> x; | - |
1362 | s >> y; | - |
1363 | qt_noop(); | - |
1364 | if (!qt_is_finite(x) || !qt_is_finite(y)) { partially evaluated: !qt_is_finite(x) no Evaluation Count:0 | yes Evaluation Count:52 |
partially evaluated: !qt_is_finite(y) no Evaluation Count:0 | yes Evaluation Count:52 |
| 0-52 |
1365 | | - |
1366 | | - |
1367 | | - |
1368 | continue; never executed: continue; | 0 |
1369 | } | - |
1370 | QPainterPath::Element elm = { qreal(x), qreal(y), QPainterPath::ElementType(type) }; | - |
1371 | p.d_func()->elements.append(elm); | - |
1372 | } executed: } Execution Count:52 | 52 |
1373 | s >> p.d_func()->cStart; | - |
1374 | int fillRule; | - |
1375 | s >> fillRule; | - |
1376 | qt_noop(); | - |
1377 | p.d_func()->fillRule = Qt::FillRule(fillRule); | - |
1378 | p.d_func()->dirtyBounds = true; | - |
1379 | p.d_func()->dirtyControlBounds = true; | - |
1380 | return s; executed: return s; Execution Count:5 | 5 |
1381 | } | - |
1382 | | - |
1383 | | - |
1384 | | - |
1385 | | - |
1386 | | - |
1387 | | - |
1388 | | - |
1389 | void qt_path_stroke_move_to(qfixed x, qfixed y, void *data) | - |
1390 | { | - |
1391 | ((QPainterPath *) data)->moveTo(x, y); | - |
1392 | } executed: } Execution Count:2082 | 2082 |
1393 | | - |
1394 | void qt_path_stroke_line_to(qfixed x, qfixed y, void *data) | - |
1395 | { | - |
1396 | ((QPainterPath *) data)->lineTo(x, y); | - |
1397 | } executed: } Execution Count:16544 | 16544 |
1398 | | - |
1399 | void qt_path_stroke_cubic_to(qfixed c1x, qfixed c1y, | - |
1400 | qfixed c2x, qfixed c2y, | - |
1401 | qfixed ex, qfixed ey, | - |
1402 | void *data) | - |
1403 | { | - |
1404 | ((QPainterPath *) data)->cubicTo(c1x, c1y, | - |
1405 | c2x, c2y, | - |
1406 | ex, ey); | - |
1407 | } executed: } Execution Count:544 | 544 |
1408 | QPainterPathStrokerPrivate::QPainterPathStrokerPrivate() | - |
1409 | : dashOffset(0) | - |
1410 | { | - |
1411 | stroker.setMoveToHook(qt_path_stroke_move_to); | - |
1412 | stroker.setLineToHook(qt_path_stroke_line_to); | - |
1413 | stroker.setCubicToHook(qt_path_stroke_cubic_to); | - |
1414 | } executed: } Execution Count:1896 | 1896 |
1415 | | - |
1416 | | - |
1417 | | - |
1418 | | - |
1419 | QPainterPathStroker::QPainterPathStroker() | - |
1420 | : d_ptr(new QPainterPathStrokerPrivate) | - |
1421 | { | - |
1422 | } executed: } Execution Count:1896 | 1896 |
1423 | | - |
1424 | | - |
1425 | | - |
1426 | | - |
1427 | QPainterPathStroker::~QPainterPathStroker() | - |
1428 | { | - |
1429 | } | - |
1430 | QPainterPath QPainterPathStroker::createStroke(const QPainterPath &path) const | - |
1431 | { | - |
1432 | QPainterPathStrokerPrivate *d = const_cast<QPainterPathStrokerPrivate *>(d_func()); | - |
1433 | QPainterPath stroke; | - |
1434 | if (path.isEmpty()) evaluated: path.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:1894 |
| 1-1894 |
1435 | return path; executed: return path; Execution Count:1 | 1 |
1436 | if (d->dashPattern.isEmpty()) { evaluated: d->dashPattern.isEmpty() yes Evaluation Count:1893 | yes Evaluation Count:1 |
| 1-1893 |
1437 | d->stroker.strokePath(path, &stroke, QTransform()); | - |
1438 | } else { executed: } Execution Count:1893 | 1893 |
1439 | QDashStroker dashStroker(&d->stroker); | - |
1440 | dashStroker.setDashPattern(d->dashPattern); | - |
1441 | dashStroker.setDashOffset(d->dashOffset); | - |
1442 | dashStroker.setClipRect(d->stroker.clipRect()); | - |
1443 | dashStroker.strokePath(path, &stroke, QTransform()); | - |
1444 | } executed: } Execution Count:1 | 1 |
1445 | stroke.setFillRule(Qt::WindingFill); | - |
1446 | return stroke; executed: return stroke; Execution Count:1894 | 1894 |
1447 | } | - |
1448 | | - |
1449 | | - |
1450 | | - |
1451 | | - |
1452 | | - |
1453 | | - |
1454 | | - |
1455 | void QPainterPathStroker::setWidth(qreal width) | - |
1456 | { | - |
1457 | QPainterPathStrokerPrivate * const d = d_func(); | - |
1458 | if (width <= 0) evaluated: width <= 0 yes Evaluation Count:1 | yes Evaluation Count:1896 |
| 1-1896 |
1459 | width = 1; executed: width = 1; Execution Count:1 | 1 |
1460 | d->stroker.setStrokeWidth(qfixed(width)); | - |
1461 | } executed: } Execution Count:1897 | 1897 |
1462 | | - |
1463 | | - |
1464 | | - |
1465 | | - |
1466 | qreal QPainterPathStroker::width() const | - |
1467 | { | - |
1468 | return d_func()->stroker.strokeWidth(); executed: return d_func()->stroker.strokeWidth(); Execution Count:3 | 3 |
1469 | } | - |
1470 | | - |
1471 | | - |
1472 | | - |
1473 | | - |
1474 | | - |
1475 | | - |
1476 | | - |
1477 | void QPainterPathStroker::setCapStyle(Qt::PenCapStyle style) | - |
1478 | { | - |
1479 | d_func()->stroker.setCapStyle(style); | - |
1480 | } executed: } Execution Count:1893 | 1893 |
1481 | | - |
1482 | | - |
1483 | | - |
1484 | | - |
1485 | | - |
1486 | Qt::PenCapStyle QPainterPathStroker::capStyle() const | - |
1487 | { | - |
1488 | return d_func()->stroker.capStyle(); never executed: return d_func()->stroker.capStyle(); | 0 |
1489 | } | - |
1490 | | - |
1491 | | - |
1492 | | - |
1493 | | - |
1494 | void QPainterPathStroker::setJoinStyle(Qt::PenJoinStyle style) | - |
1495 | { | - |
1496 | d_func()->stroker.setJoinStyle(style); | - |
1497 | } executed: } Execution Count:1893 | 1893 |
1498 | | - |
1499 | | - |
1500 | | - |
1501 | | - |
1502 | Qt::PenJoinStyle QPainterPathStroker::joinStyle() const | - |
1503 | { | - |
1504 | return d_func()->stroker.joinStyle(); never executed: return d_func()->stroker.joinStyle(); | 0 |
1505 | } | - |
1506 | void QPainterPathStroker::setMiterLimit(qreal limit) | - |
1507 | { | - |
1508 | d_func()->stroker.setMiterLimit(qfixed(limit)); | - |
1509 | } executed: } Execution Count:1895 | 1895 |
1510 | | - |
1511 | | - |
1512 | | - |
1513 | | - |
1514 | qreal QPainterPathStroker::miterLimit() const | - |
1515 | { | - |
1516 | return d_func()->stroker.miterLimit(); executed: return d_func()->stroker.miterLimit(); Execution Count:2 | 2 |
1517 | } | - |
1518 | void QPainterPathStroker::setCurveThreshold(qreal threshold) | - |
1519 | { | - |
1520 | d_func()->stroker.setCurveThreshold(qfixed(threshold)); | - |
1521 | } executed: } Execution Count:2 | 2 |
1522 | | - |
1523 | | - |
1524 | | - |
1525 | | - |
1526 | | - |
1527 | qreal QPainterPathStroker::curveThreshold() const | - |
1528 | { | - |
1529 | return d_func()->stroker.curveThreshold(); executed: return d_func()->stroker.curveThreshold(); Execution Count:2 | 2 |
1530 | } | - |
1531 | | - |
1532 | | - |
1533 | | - |
1534 | | - |
1535 | void QPainterPathStroker::setDashPattern(Qt::PenStyle style) | - |
1536 | { | - |
1537 | d_func()->dashPattern = QDashStroker::patternForStyle(style); | - |
1538 | } executed: } Execution Count:4 | 4 |
1539 | void QPainterPathStroker::setDashPattern(const QVector<qreal> &dashPattern) | - |
1540 | { | - |
1541 | d_func()->dashPattern.clear(); | - |
1542 | for (int i=0; i<dashPattern.size(); ++i) never evaluated: i<dashPattern.size() | 0 |
1543 | d_func()->dashPattern << qfixed(dashPattern.at(i)); never executed: d_func()->dashPattern << qfixed(dashPattern.at(i)); | 0 |
1544 | } | 0 |
1545 | | - |
1546 | | - |
1547 | | - |
1548 | | - |
1549 | QVector<qreal> QPainterPathStroker::dashPattern() const | - |
1550 | { | - |
1551 | return d_func()->dashPattern; never executed: return d_func()->dashPattern; | 0 |
1552 | } | - |
1553 | | - |
1554 | | - |
1555 | | - |
1556 | | - |
1557 | qreal QPainterPathStroker::dashOffset() const | - |
1558 | { | - |
1559 | return d_func()->dashOffset; never executed: return d_func()->dashOffset; | 0 |
1560 | } | - |
1561 | | - |
1562 | | - |
1563 | | - |
1564 | | - |
1565 | | - |
1566 | | - |
1567 | | - |
1568 | void QPainterPathStroker::setDashOffset(qreal offset) | - |
1569 | { | - |
1570 | d_func()->dashOffset = offset; | - |
1571 | } executed: } Execution Count:4 | 4 |
1572 | QPolygonF QPainterPath::toFillPolygon(const QTransform &matrix) const | - |
1573 | { | - |
1574 | | - |
1575 | QList<QPolygonF> flats = toSubpathPolygons(matrix); | - |
1576 | QPolygonF polygon; | - |
1577 | if (flats.isEmpty()) partially evaluated: flats.isEmpty() no Evaluation Count:0 | yes Evaluation Count:35 |
| 0-35 |
1578 | return polygon; never executed: return polygon; | 0 |
1579 | QPointF first = flats.first().first(); | - |
1580 | for (int i=0; i<flats.size(); ++i) { evaluated: i<flats.size() yes Evaluation Count:37 | yes Evaluation Count:35 |
| 35-37 |
1581 | polygon += flats.at(i); | - |
1582 | if (!flats.at(i).isClosed()) evaluated: !flats.at(i).isClosed() yes Evaluation Count:2 | yes Evaluation Count:35 |
| 2-35 |
1583 | polygon += flats.at(i).first(); executed: polygon += flats.at(i).first(); Execution Count:2 | 2 |
1584 | if (i > 0) evaluated: i > 0 yes Evaluation Count:2 | yes Evaluation Count:35 |
| 2-35 |
1585 | polygon += first; executed: polygon += first; Execution Count:2 | 2 |
1586 | } executed: } Execution Count:37 | 37 |
1587 | return polygon; executed: return polygon; Execution Count:35 | 35 |
1588 | } | - |
1589 | | - |
1590 | | - |
1591 | | - |
1592 | | - |
1593 | QPolygonF QPainterPath::toFillPolygon(const QMatrix &matrix) const | - |
1594 | { | - |
1595 | return toFillPolygon(QTransform(matrix)); executed: return toFillPolygon(QTransform(matrix)); Execution Count:28 | 28 |
1596 | } | - |
1597 | | - |
1598 | | - |
1599 | | - |
1600 | static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d) | - |
1601 | { | - |
1602 | return 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a); executed: return 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a); Execution Count:744 | 744 |
1603 | } | - |
1604 | | - |
1605 | | - |
1606 | | - |
1607 | | - |
1608 | qreal QPainterPath::length() const | - |
1609 | { | - |
1610 | QPainterPathPrivate * const d = d_func(); | - |
1611 | if (isEmpty()) partially evaluated: isEmpty() no Evaluation Count:0 | yes Evaluation Count:786 |
| 0-786 |
1612 | return 0; never executed: return 0; | 0 |
1613 | | - |
1614 | qreal len = 0; | - |
1615 | for (int i=1; i<d->elements.size(); ++i) { evaluated: i<d->elements.size() yes Evaluation Count:828 | yes Evaluation Count:786 |
| 786-828 |
1616 | const Element &e = d->elements.at(i); | - |
1617 | | - |
1618 | switch (e.type) { | - |
1619 | case MoveToElement: | - |
1620 | break; | 0 |
1621 | case LineToElement: | - |
1622 | { | - |
1623 | len += QLineF(d->elements.at(i-1), e).length(); | - |
1624 | break; executed: break; Execution Count:748 | 748 |
1625 | } | - |
1626 | case CurveToElement: | - |
1627 | { | - |
1628 | QBezier b = QBezier::fromPoints(d->elements.at(i-1), | - |
1629 | e, | - |
1630 | d->elements.at(i+1), | - |
1631 | d->elements.at(i+2)); | - |
1632 | len += b.length(); | - |
1633 | i += 2; | - |
1634 | break; executed: break; Execution Count:80 | 80 |
1635 | } | - |
1636 | default: | - |
1637 | break; | 0 |
1638 | } | - |
1639 | } executed: } Execution Count:828 | 828 |
1640 | return len; executed: return len; Execution Count:786 | 786 |
1641 | } | - |
1642 | qreal QPainterPath::percentAtLength(qreal len) const | - |
1643 | { | - |
1644 | QPainterPathPrivate * const d = d_func(); | - |
1645 | if (isEmpty() || len <= 0) never evaluated: isEmpty() never evaluated: len <= 0 | 0 |
1646 | return 0; never executed: return 0; | 0 |
1647 | | - |
1648 | qreal totalLength = length(); | - |
1649 | if (len > totalLength) never evaluated: len > totalLength | 0 |
1650 | return 1; never executed: return 1; | 0 |
1651 | | - |
1652 | qreal curLen = 0; | - |
1653 | for (int i=1; i<d->elements.size(); ++i) { never evaluated: i<d->elements.size() | 0 |
1654 | const Element &e = d->elements.at(i); | - |
1655 | | - |
1656 | switch (e.type) { | - |
1657 | case MoveToElement: | - |
1658 | break; | 0 |
1659 | case LineToElement: | - |
1660 | { | - |
1661 | QLineF line(d->elements.at(i-1), e); | - |
1662 | qreal llen = line.length(); | - |
1663 | curLen += llen; | - |
1664 | if (curLen >= len) { never evaluated: curLen >= len | 0 |
1665 | return len/totalLength ; never executed: return len/totalLength ; | 0 |
1666 | } | - |
1667 | | - |
1668 | break; | 0 |
1669 | } | - |
1670 | case CurveToElement: | - |
1671 | { | - |
1672 | QBezier b = QBezier::fromPoints(d->elements.at(i-1), | - |
1673 | e, | - |
1674 | d->elements.at(i+1), | - |
1675 | d->elements.at(i+2)); | - |
1676 | qreal blen = b.length(); | - |
1677 | qreal prevLen = curLen; | - |
1678 | curLen += blen; | - |
1679 | | - |
1680 | if (curLen >= len) { never evaluated: curLen >= len | 0 |
1681 | qreal res = b.tAtLength(len - prevLen); | - |
1682 | return (res * blen + prevLen)/totalLength; never executed: return (res * blen + prevLen)/totalLength; | 0 |
1683 | } | - |
1684 | | - |
1685 | i += 2; | - |
1686 | break; | 0 |
1687 | } | - |
1688 | default: | - |
1689 | break; | 0 |
1690 | } | - |
1691 | } | 0 |
1692 | | - |
1693 | return 0; never executed: return 0; | 0 |
1694 | } | - |
1695 | | - |
1696 | static inline QBezier bezierAtT(const QPainterPath &path, qreal t, qreal *startingLength, qreal *bezierLength) | - |
1697 | { | - |
1698 | *startingLength = 0; | - |
1699 | if (t > 1) partially evaluated: t > 1 no Evaluation Count:0 | yes Evaluation Count:393 |
| 0-393 |
1700 | return QBezier(); never executed: return QBezier(); | 0 |
1701 | | - |
1702 | qreal curLen = 0; | - |
1703 | qreal totalLength = path.length(); | - |
1704 | | - |
1705 | const int lastElement = path.elementCount() - 1; | - |
1706 | for (int i=0; i <= lastElement; ++i) { partially evaluated: i <= lastElement yes Evaluation Count:797 | no Evaluation Count:0 |
| 0-797 |
1707 | const QPainterPath::Element &e = path.elementAt(i); | - |
1708 | | - |
1709 | switch (e.type) { | - |
1710 | case QPainterPath::MoveToElement: | - |
1711 | break; executed: break; Execution Count:393 | 393 |
1712 | case QPainterPath::LineToElement: | - |
1713 | { | - |
1714 | QLineF line(path.elementAt(i-1), e); | - |
1715 | qreal llen = line.length(); | - |
1716 | curLen += llen; | - |
1717 | if (i == lastElement || curLen/totalLength >= t) { evaluated: i == lastElement yes Evaluation Count:370 | yes Evaluation Count:3 |
evaluated: curLen/totalLength >= t yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-370 |
1718 | *bezierLength = llen; | - |
1719 | QPointF a = path.elementAt(i-1); | - |
1720 | QPointF delta = e - a; | - |
1721 | return QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e); executed: return QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e); Execution Count:371 | 371 |
1722 | } | - |
1723 | break; executed: break; Execution Count:2 | 2 |
1724 | } | - |
1725 | case QPainterPath::CurveToElement: | - |
1726 | { | - |
1727 | QBezier b = QBezier::fromPoints(path.elementAt(i-1), | - |
1728 | e, | - |
1729 | path.elementAt(i+1), | - |
1730 | path.elementAt(i+2)); | - |
1731 | qreal blen = b.length(); | - |
1732 | curLen += blen; | - |
1733 | | - |
1734 | if (i + 2 == lastElement || curLen/totalLength >= t) { evaluated: i + 2 == lastElement yes Evaluation Count:18 | yes Evaluation Count:13 |
evaluated: curLen/totalLength >= t yes Evaluation Count:4 | yes Evaluation Count:9 |
| 4-18 |
1735 | *bezierLength = blen; | - |
1736 | return b; executed: return b; Execution Count:22 | 22 |
1737 | } | - |
1738 | | - |
1739 | i += 2; | - |
1740 | break; executed: break; Execution Count:9 | 9 |
1741 | } | - |
1742 | default: | - |
1743 | break; | 0 |
1744 | } | - |
1745 | *startingLength = curLen; | - |
1746 | } executed: } Execution Count:404 | 404 |
1747 | return QBezier(); never executed: return QBezier(); | 0 |
1748 | } | - |
1749 | QPointF QPainterPath::pointAtPercent(qreal t) const | - |
1750 | { | - |
1751 | if (t < 0 || t > 1) { partially evaluated: t < 0 no Evaluation Count:0 | yes Evaluation Count:23 |
partially evaluated: t > 1 no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
1752 | QMessageLogger("painting/qpainterpath.cpp", 2961, __PRETTY_FUNCTION__).warning("QPainterPath::pointAtPercent accepts only values between 0 and 1"); | - |
1753 | return QPointF(); never executed: return QPointF(); | 0 |
1754 | } | - |
1755 | | - |
1756 | if (!d_ptr || d_ptr->elements.size() == 0) partially evaluated: !d_ptr no Evaluation Count:0 | yes Evaluation Count:23 |
partially evaluated: d_ptr->elements.size() == 0 no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
1757 | return QPointF(); never executed: return QPointF(); | 0 |
1758 | | - |
1759 | if (d_ptr->elements.size() == 1) evaluated: d_ptr->elements.size() == 1 yes Evaluation Count:2 | yes Evaluation Count:21 |
| 2-21 |
1760 | return d_ptr->elements.at(0); executed: return d_ptr->elements.at(0); Execution Count:2 | 2 |
1761 | | - |
1762 | qreal totalLength = length(); | - |
1763 | qreal curLen = 0; | - |
1764 | qreal bezierLen = 0; | - |
1765 | QBezier b = bezierAtT(*this, t, &curLen, &bezierLen); | - |
1766 | qreal realT = (totalLength * t - curLen) / bezierLen; | - |
1767 | | - |
1768 | return b.pointAt(qBound(qreal(0), realT, qreal(1))); executed: return b.pointAt(qBound(qreal(0), realT, qreal(1))); Execution Count:21 | 21 |
1769 | } | - |
1770 | qreal QPainterPath::angleAtPercent(qreal t) const | - |
1771 | { | - |
1772 | if (t < 0 || t > 1) { partially evaluated: t < 0 no Evaluation Count:0 | yes Evaluation Count:372 |
partially evaluated: t > 1 no Evaluation Count:0 | yes Evaluation Count:372 |
| 0-372 |
1773 | QMessageLogger("painting/qpainterpath.cpp", 2995, __PRETTY_FUNCTION__).warning("QPainterPath::angleAtPercent accepts only values between 0 and 1"); | - |
1774 | return 0; never executed: return 0; | 0 |
1775 | } | - |
1776 | | - |
1777 | qreal totalLength = length(); | - |
1778 | qreal curLen = 0; | - |
1779 | qreal bezierLen = 0; | - |
1780 | QBezier bez = bezierAtT(*this, t, &curLen, &bezierLen); | - |
1781 | qreal realT = (totalLength * t - curLen) / bezierLen; | - |
1782 | | - |
1783 | qreal m1 = slopeAt(realT, bez.x1, bez.x2, bez.x3, bez.x4); | - |
1784 | qreal m2 = slopeAt(realT, bez.y1, bez.y2, bez.y3, bez.y4); | - |
1785 | | - |
1786 | return QLineF(0, 0, m1, m2).angle(); executed: return QLineF(0, 0, m1, m2).angle(); Execution Count:372 | 372 |
1787 | } | - |
1788 | qreal QPainterPath::slopeAtPercent(qreal t) const | - |
1789 | { | - |
1790 | if (t < 0 || t > 1) { | 0 |
1791 | QMessageLogger("painting/qpainterpath.cpp", 3024, __PRETTY_FUNCTION__).warning("QPainterPath::slopeAtPercent accepts only values between 0 and 1"); | - |
1792 | return 0; never executed: return 0; | 0 |
1793 | } | - |
1794 | | - |
1795 | qreal totalLength = length(); | - |
1796 | qreal curLen = 0; | - |
1797 | qreal bezierLen = 0; | - |
1798 | QBezier bez = bezierAtT(*this, t, &curLen, &bezierLen); | - |
1799 | qreal realT = (totalLength * t - curLen) / bezierLen; | - |
1800 | | - |
1801 | qreal m1 = slopeAt(realT, bez.x1, bez.x2, bez.x3, bez.x4); | - |
1802 | qreal m2 = slopeAt(realT, bez.y1, bez.y2, bez.y3, bez.y4); | - |
1803 | | - |
1804 | qreal slope = 0; | - |
1805 | | - |
1806 | | - |
1807 | if (m1) | 0 |
1808 | slope = m2/m1; never executed: slope = m2/m1; | 0 |
1809 | else { | - |
1810 | | - |
1811 | | - |
1812 | slope = (__builtin_inff())*((m2 < 0)?-1:1); | - |
1813 | | - |
1814 | | - |
1815 | | - |
1816 | | - |
1817 | | - |
1818 | | - |
1819 | | - |
1820 | } | 0 |
1821 | | - |
1822 | return slope; never executed: return slope; | 0 |
1823 | } | - |
1824 | void QPainterPath::addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, | - |
1825 | Qt::SizeMode mode) | - |
1826 | { | - |
1827 | QRectF r = rect.normalized(); | - |
1828 | | - |
1829 | if (r.isNull()) never evaluated: r.isNull() | 0 |
1830 | return; | 0 |
1831 | | - |
1832 | if (mode == Qt::AbsoluteSize) { never evaluated: mode == Qt::AbsoluteSize | 0 |
1833 | qreal w = r.width() / 2; | - |
1834 | qreal h = r.height() / 2; | - |
1835 | | - |
1836 | if (w == 0) { | 0 |
1837 | xRadius = 0; | - |
1838 | } else { | 0 |
1839 | xRadius = 100 * qMin(xRadius, w) / w; | - |
1840 | } | 0 |
1841 | if (h == 0) { | 0 |
1842 | yRadius = 0; | - |
1843 | } else { | 0 |
1844 | yRadius = 100 * qMin(yRadius, h) / h; | - |
1845 | } | 0 |
1846 | } else { | - |
1847 | if (xRadius > 100) never evaluated: xRadius > 100 | 0 |
1848 | xRadius = 100; never executed: xRadius = 100; | 0 |
1849 | | - |
1850 | if (yRadius > 100) never evaluated: yRadius > 100 | 0 |
1851 | yRadius = 100; never executed: yRadius = 100; | 0 |
1852 | } | 0 |
1853 | | - |
1854 | if (xRadius <= 0 || yRadius <= 0) { never evaluated: xRadius <= 0 never evaluated: yRadius <= 0 | 0 |
1855 | addRect(r); | - |
1856 | return; | 0 |
1857 | } | - |
1858 | | - |
1859 | qreal x = r.x(); | - |
1860 | qreal y = r.y(); | - |
1861 | qreal w = r.width(); | - |
1862 | qreal h = r.height(); | - |
1863 | qreal rxx2 = w*xRadius/100; | - |
1864 | qreal ryy2 = h*yRadius/100; | - |
1865 | | - |
1866 | ensureData(); | - |
1867 | detach(); | - |
1868 | | - |
1869 | bool first = d_func()->elements.size() < 2; | - |
1870 | | - |
1871 | arcMoveTo(x, y, rxx2, ryy2, 180); | - |
1872 | arcTo(x, y, rxx2, ryy2, 180, -90); | - |
1873 | arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90); | - |
1874 | arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90); | - |
1875 | arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90); | - |
1876 | closeSubpath(); | - |
1877 | | - |
1878 | d_func()->require_moveTo = true; | - |
1879 | d_func()->convex = first; | - |
1880 | } | 0 |
1881 | void QPainterPath::addRoundRect(const QRectF &r, int xRnd, int yRnd) | - |
1882 | { | - |
1883 | if(xRnd >= 100) partially evaluated: xRnd >= 100 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1884 | xRnd = 99; never executed: xRnd = 99; | 0 |
1885 | if(yRnd >= 100) partially evaluated: yRnd >= 100 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1886 | yRnd = 99; never executed: yRnd = 99; | 0 |
1887 | if(xRnd <= 0 || yRnd <= 0) { partially evaluated: xRnd <= 0 no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: yRnd <= 0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1888 | addRect(r); | - |
1889 | return; | 0 |
1890 | } | - |
1891 | | - |
1892 | QRectF rect = r.normalized(); | - |
1893 | | - |
1894 | if (rect.isNull()) partially evaluated: rect.isNull() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1895 | return; | 0 |
1896 | | - |
1897 | qreal x = rect.x(); | - |
1898 | qreal y = rect.y(); | - |
1899 | qreal w = rect.width(); | - |
1900 | qreal h = rect.height(); | - |
1901 | qreal rxx2 = w*xRnd/100; | - |
1902 | qreal ryy2 = h*yRnd/100; | - |
1903 | | - |
1904 | ensureData(); | - |
1905 | detach(); | - |
1906 | | - |
1907 | bool first = d_func()->elements.size() < 2; | - |
1908 | | - |
1909 | arcMoveTo(x, y, rxx2, ryy2, 180); | - |
1910 | arcTo(x, y, rxx2, ryy2, 180, -90); | - |
1911 | arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90); | - |
1912 | arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90); | - |
1913 | arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90); | - |
1914 | closeSubpath(); | - |
1915 | | - |
1916 | d_func()->require_moveTo = true; | - |
1917 | d_func()->convex = first; | - |
1918 | } executed: } Execution Count:2 | 2 |
1919 | QPainterPath QPainterPath::united(const QPainterPath &p) const | - |
1920 | { | - |
1921 | if (isEmpty() || p.isEmpty()) evaluated: isEmpty() yes Evaluation Count:102 | yes Evaluation Count:14 |
partially evaluated: p.isEmpty() no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-102 |
1922 | return isEmpty() ? p : *this; executed: return isEmpty() ? p : *this; Execution Count:102 | 102 |
1923 | QPathClipper clipper(*this, p); | - |
1924 | return clipper.clip(QPathClipper::BoolOr); executed: return clipper.clip(QPathClipper::BoolOr); Execution Count:14 | 14 |
1925 | } | - |
1926 | QPainterPath QPainterPath::intersected(const QPainterPath &p) const | - |
1927 | { | - |
1928 | if (isEmpty() || p.isEmpty()) partially evaluated: isEmpty() no Evaluation Count:0 | yes Evaluation Count:8 |
partially evaluated: p.isEmpty() no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1929 | return QPainterPath(); never executed: return QPainterPath(); | 0 |
1930 | QPathClipper clipper(*this, p); | - |
1931 | return clipper.clip(QPathClipper::BoolAnd); executed: return clipper.clip(QPathClipper::BoolAnd); Execution Count:8 | 8 |
1932 | } | - |
1933 | QPainterPath QPainterPath::subtracted(const QPainterPath &p) const | - |
1934 | { | - |
1935 | if (isEmpty() || p.isEmpty()) evaluated: isEmpty() yes Evaluation Count:5853 | yes Evaluation Count:126 |
partially evaluated: p.isEmpty() no Evaluation Count:0 | yes Evaluation Count:126 |
| 0-5853 |
1936 | return *this; executed: return *this; Execution Count:5853 | 5853 |
1937 | QPathClipper clipper(*this, p); | - |
1938 | return clipper.clip(QPathClipper::BoolSub); executed: return clipper.clip(QPathClipper::BoolSub); Execution Count:126 | 126 |
1939 | } | - |
1940 | QPainterPath QPainterPath::subtractedInverted(const QPainterPath &p) const | - |
1941 | { | - |
1942 | return p.subtracted(*this); never executed: return p.subtracted(*this); | 0 |
1943 | } | - |
1944 | QPainterPath QPainterPath::simplified() const | - |
1945 | { | - |
1946 | if(isEmpty()) partially evaluated: isEmpty() no Evaluation Count:0 | yes Evaluation Count:54 |
| 0-54 |
1947 | return *this; never executed: return *this; | 0 |
1948 | QPathClipper clipper(*this, QPainterPath()); | - |
1949 | return clipper.clip(QPathClipper::Simplify); executed: return clipper.clip(QPathClipper::Simplify); Execution Count:54 | 54 |
1950 | } | - |
1951 | bool QPainterPath::intersects(const QPainterPath &p) const | - |
1952 | { | - |
1953 | if (p.elementCount() == 1) partially evaluated: p.elementCount() == 1 no Evaluation Count:0 | yes Evaluation Count:407 |
| 0-407 |
1954 | return contains(p.elementAt(0)); never executed: return contains(p.elementAt(0)); | 0 |
1955 | if (isEmpty() || p.isEmpty()) partially evaluated: isEmpty() no Evaluation Count:0 | yes Evaluation Count:407 |
partially evaluated: p.isEmpty() no Evaluation Count:0 | yes Evaluation Count:407 |
| 0-407 |
1956 | return false; never executed: return false; | 0 |
1957 | QPathClipper clipper(*this, p); | - |
1958 | return clipper.intersect(); executed: return clipper.intersect(); Execution Count:407 | 407 |
1959 | } | - |
1960 | bool QPainterPath::contains(const QPainterPath &p) const | - |
1961 | { | - |
1962 | if (p.elementCount() == 1) partially evaluated: p.elementCount() == 1 no Evaluation Count:0 | yes Evaluation Count:45 |
| 0-45 |
1963 | return contains(p.elementAt(0)); never executed: return contains(p.elementAt(0)); | 0 |
1964 | if (isEmpty() || p.isEmpty()) partially evaluated: isEmpty() no Evaluation Count:0 | yes Evaluation Count:45 |
partially evaluated: p.isEmpty() no Evaluation Count:0 | yes Evaluation Count:45 |
| 0-45 |
1965 | return false; never executed: return false; | 0 |
1966 | QPathClipper clipper(*this, p); | - |
1967 | return clipper.contains(); executed: return clipper.contains(); Execution Count:45 | 45 |
1968 | } | - |
1969 | | - |
1970 | void QPainterPath::setDirty(bool dirty) | - |
1971 | { | - |
1972 | d_func()->dirtyBounds = dirty; | - |
1973 | d_func()->dirtyControlBounds = dirty; | - |
1974 | delete d_func()->pathConverter; | - |
1975 | d_func()->pathConverter = 0; | - |
1976 | d_func()->convex = false; | - |
1977 | } executed: } Execution Count:366833 | 366833 |
1978 | | - |
1979 | void QPainterPath::computeBoundingRect() const | - |
1980 | { | - |
1981 | QPainterPathData *d = d_func(); | - |
1982 | d->dirtyBounds = false; | - |
1983 | if (!d_ptr) { partially evaluated: !d_ptr no Evaluation Count:0 | yes Evaluation Count:457 |
| 0-457 |
1984 | d->bounds = QRect(); | - |
1985 | return; | 0 |
1986 | } | - |
1987 | | - |
1988 | qreal minx, maxx, miny, maxy; | - |
1989 | minx = maxx = d->elements.at(0).x; | - |
1990 | miny = maxy = d->elements.at(0).y; | - |
1991 | for (int i=1; i<d->elements.size(); ++i) { evaluated: i<d->elements.size() yes Evaluation Count:2984 | yes Evaluation Count:457 |
| 457-2984 |
1992 | const Element &e = d->elements.at(i); | - |
1993 | | - |
1994 | switch (e.type) { | - |
1995 | case MoveToElement: | - |
1996 | case LineToElement: | - |
1997 | if (e.x > maxx) maxx = e.x; executed: maxx = e.x; Execution Count:540 evaluated: e.x > maxx yes Evaluation Count:540 | yes Evaluation Count:2333 |
| 540-2333 |
1998 | else if (e.x < minx) minx = e.x; executed: minx = e.x; Execution Count:90 evaluated: e.x < minx yes Evaluation Count:90 | yes Evaluation Count:2243 |
| 90-2243 |
1999 | if (e.y > maxy) maxy = e.y; executed: maxy = e.y; Execution Count:628 evaluated: e.y > maxy yes Evaluation Count:628 | yes Evaluation Count:2245 |
| 628-2245 |
2000 | else if (e.y < miny) miny = e.y; executed: miny = e.y; Execution Count:21 evaluated: e.y < miny yes Evaluation Count:21 | yes Evaluation Count:2224 |
| 21-2224 |
2001 | break; executed: break; Execution Count:2873 | 2873 |
2002 | case CurveToElement: | - |
2003 | { | - |
2004 | QBezier b = QBezier::fromPoints(d->elements.at(i-1), | - |
2005 | e, | - |
2006 | d->elements.at(i+1), | - |
2007 | d->elements.at(i+2)); | - |
2008 | QRectF r = qt_painterpath_bezier_extrema(b); | - |
2009 | qreal right = r.right(); | - |
2010 | qreal bottom = r.bottom(); | - |
2011 | if (r.x() < minx) minx = r.x(); executed: minx = r.x(); Execution Count:35 evaluated: r.x() < minx yes Evaluation Count:35 | yes Evaluation Count:76 |
| 35-76 |
2012 | if (right > maxx) maxx = right; executed: maxx = right; Execution Count:6 evaluated: right > maxx yes Evaluation Count:6 | yes Evaluation Count:105 |
| 6-105 |
2013 | if (r.y() < miny) miny = r.y(); executed: miny = r.y(); Execution Count:27 evaluated: r.y() < miny yes Evaluation Count:27 | yes Evaluation Count:84 |
| 27-84 |
2014 | if (bottom > maxy) maxy = bottom; executed: maxy = bottom; Execution Count:17 evaluated: bottom > maxy yes Evaluation Count:17 | yes Evaluation Count:94 |
| 17-94 |
2015 | i += 2; | - |
2016 | } | - |
2017 | break; executed: break; Execution Count:111 | 111 |
2018 | default: | - |
2019 | break; | 0 |
2020 | } | - |
2021 | } executed: } Execution Count:2984 | 2984 |
2022 | d->bounds = QRectF(minx, miny, maxx - minx, maxy - miny); | - |
2023 | } executed: } Execution Count:457 | 457 |
2024 | | - |
2025 | | - |
2026 | void QPainterPath::computeControlPointRect() const | - |
2027 | { | - |
2028 | QPainterPathData *d = d_func(); | - |
2029 | d->dirtyControlBounds = false; | - |
2030 | if (!d_ptr) { partially evaluated: !d_ptr no Evaluation Count:0 | yes Evaluation Count:2727 |
| 0-2727 |
2031 | d->controlBounds = QRect(); | - |
2032 | return; | 0 |
2033 | } | - |
2034 | | - |
2035 | qreal minx, maxx, miny, maxy; | - |
2036 | minx = maxx = d->elements.at(0).x; | - |
2037 | miny = maxy = d->elements.at(0).y; | - |
2038 | for (int i=1; i<d->elements.size(); ++i) { evaluated: i<d->elements.size() yes Evaluation Count:26393 | yes Evaluation Count:2727 |
| 2727-26393 |
2039 | const Element &e = d->elements.at(i); | - |
2040 | if (e.x > maxx) maxx = e.x; executed: maxx = e.x; Execution Count:2796 evaluated: e.x > maxx yes Evaluation Count:2796 | yes Evaluation Count:23597 |
| 2796-23597 |
2041 | else if (e.x < minx) minx = e.x; executed: minx = e.x; Execution Count:2300 evaluated: e.x < minx yes Evaluation Count:2300 | yes Evaluation Count:21297 |
| 2300-21297 |
2042 | if (e.y > maxy) maxy = e.y; executed: maxy = e.y; Execution Count:4057 evaluated: e.y > maxy yes Evaluation Count:4057 | yes Evaluation Count:22336 |
| 4057-22336 |
2043 | else if (e.y < miny) miny = e.y; executed: miny = e.y; Execution Count:1131 evaluated: e.y < miny yes Evaluation Count:1131 | yes Evaluation Count:21205 |
| 1131-21205 |
2044 | } | - |
2045 | d->controlBounds = QRectF(minx, miny, maxx - minx, maxy - miny); | - |
2046 | } executed: } Execution Count:2727 | 2727 |
2047 | | - |
2048 | | - |
2049 | QDebug operator<<(QDebug s, const QPainterPath &p) | - |
2050 | { | - |
2051 | s.nospace() << "QPainterPath: Element count=" << p.elementCount() << endl; | - |
2052 | const char *types[] = {"MoveTo", "LineTo", "CurveTo", "CurveToData"}; | - |
2053 | for (int i=0; i<p.elementCount(); ++i) { never evaluated: i<p.elementCount() | 0 |
2054 | s.nospace() << " -> " << types[p.elementAt(i).type] << "(x=" << p.elementAt(i).x << ", y=" << p.elementAt(i).y << ')' << endl; | - |
2055 | | - |
2056 | } | 0 |
2057 | return s; never executed: return s; | 0 |
2058 | } | - |
2059 | | - |
2060 | | - |
2061 | | - |
2062 | | - |
| | |