Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | QVectorPath::~QVectorPath() | - |
6 | { | - |
7 | if (m_hints & ShouldUseCacheHint) { partially evaluated: m_hints & ShouldUseCacheHint no Evaluation Count:0 | yes Evaluation Count:178001 |
| 0-178001 |
8 | CacheEntry *e = m_cache; | - |
9 | while (e) { | 0 |
10 | if (e->data) | 0 |
11 | e->cleanup(e->engine, e->data); never executed: e->cleanup(e->engine, e->data); | 0 |
12 | CacheEntry *n = e->next; | - |
13 | delete e; | - |
14 | e = n; | - |
15 | } | 0 |
16 | } | 0 |
17 | } executed: } Execution Count:178001 | 178001 |
18 | | - |
19 | | - |
20 | QRectF QVectorPath::controlPointRect() const | - |
21 | { | - |
22 | if (m_hints & ControlPointRect) evaluated: m_hints & ControlPointRect yes Evaluation Count:32797 | yes Evaluation Count:102314 |
| 32797-102314 |
23 | return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2)); executed: return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2)); Execution Count:32797 | 32797 |
24 | | - |
25 | if (m_count == 0) { partially evaluated: m_count == 0 no Evaluation Count:0 | yes Evaluation Count:102314 |
| 0-102314 |
26 | m_cp_rect.x1 = m_cp_rect.x2 = m_cp_rect.y1 = m_cp_rect.y2 = 0; | - |
27 | m_hints |= ControlPointRect; | - |
28 | return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2)); never executed: return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2)); | 0 |
29 | } | - |
30 | qt_noop(); | - |
31 | | - |
32 | const qreal *pts = m_points; | - |
33 | m_cp_rect.x1 = m_cp_rect.x2 = *pts; | - |
34 | ++pts; | - |
35 | m_cp_rect.y1 = m_cp_rect.y2 = *pts; | - |
36 | ++pts; | - |
37 | | - |
38 | const qreal *epts = m_points + (m_count << 1); | - |
39 | while (pts < epts) { evaluated: pts < epts yes Evaluation Count:315219 | yes Evaluation Count:102314 |
| 102314-315219 |
40 | qreal x = *pts; | - |
41 | if (x < m_cp_rect.x1) m_cp_rect.x1 = x; evaluated: x < m_cp_rect.x1 yes Evaluation Count:106992 | yes Evaluation Count:208227 |
executed: m_cp_rect.x1 = x; Execution Count:106992 | 106992-208227 |
42 | else if (x > m_cp_rect.x2) m_cp_rect.x2 = x; evaluated: x > m_cp_rect.x2 yes Evaluation Count:102162 | yes Evaluation Count:106065 |
executed: m_cp_rect.x2 = x; Execution Count:102162 | 102162-106065 |
43 | ++pts; | - |
44 | | - |
45 | qreal y = *pts; | - |
46 | if (y < m_cp_rect.y1) m_cp_rect.y1 = y; evaluated: y < m_cp_rect.y1 yes Evaluation Count:87034 | yes Evaluation Count:228185 |
executed: m_cp_rect.y1 = y; Execution Count:87034 | 87034-228185 |
47 | else if (y > m_cp_rect.y2) m_cp_rect.y2 = y; evaluated: y > m_cp_rect.y2 yes Evaluation Count:88538 | yes Evaluation Count:139647 |
executed: m_cp_rect.y2 = y; Execution Count:88538 | 88538-139647 |
48 | ++pts; | - |
49 | } executed: } Execution Count:315219 | 315219 |
50 | | - |
51 | m_hints |= ControlPointRect; | - |
52 | return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2)); executed: return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2)); Execution Count:102314 | 102314 |
53 | } | - |
54 | | - |
55 | | - |
56 | QVectorPath::CacheEntry *QVectorPath::addCacheData(QPaintEngineEx *engine, void *data, | - |
57 | qvectorpath_cache_cleanup cleanup) const{ | - |
58 | qt_noop(); | - |
59 | if ((m_hints & IsCachedHint) == 0) { never evaluated: (m_hints & IsCachedHint) == 0 | 0 |
60 | m_cache = 0; | - |
61 | m_hints |= IsCachedHint; | - |
62 | } | 0 |
63 | CacheEntry *e = new CacheEntry; | - |
64 | e->engine = engine; | - |
65 | e->data = data; | - |
66 | e->cleanup = cleanup; | - |
67 | e->next = m_cache; | - |
68 | m_cache = e; | - |
69 | return m_cache; never executed: return m_cache; | 0 |
70 | } | - |
71 | | - |
72 | | - |
73 | const QVectorPath &qtVectorPathForPath(const QPainterPath &path) | - |
74 | { | - |
75 | qt_noop(); | - |
76 | return path.d_func()->vectorPath(); executed: return path.d_func()->vectorPath(); Execution Count:133669 | 133669 |
77 | } | - |
78 | | - |
79 | | - |
80 | QDebug __attribute__((visibility("default"))) &operator<<(QDebug &s, const QVectorPath &path) | - |
81 | { | - |
82 | QRectF rf = path.controlPointRect(); | - |
83 | s << "QVectorPath(size:" << path.elementCount() | - |
84 | << " hints:" << hex << path.hints() | - |
85 | << rf << ')'; | - |
86 | return s; never executed: return s; | 0 |
87 | } | - |
88 | struct StrokeHandler { | - |
89 | StrokeHandler(int reserve) : pts(reserve), types(reserve) {} executed: } Execution Count:39 | 39 |
90 | QDataBuffer<qreal> pts; | - |
91 | QDataBuffer<QPainterPath::ElementType> types; | - |
92 | }; | - |
93 | | - |
94 | | - |
95 | QPaintEngineExPrivate::QPaintEngineExPrivate() | - |
96 | : dasher(&stroker), | - |
97 | strokeHandler(0), | - |
98 | activeStroker(0), | - |
99 | strokerPen(Qt::NoPen) | - |
100 | { | - |
101 | } executed: } Execution Count:8557 | 8557 |
102 | | - |
103 | | - |
104 | QPaintEngineExPrivate::~QPaintEngineExPrivate() | - |
105 | { | - |
106 | delete strokeHandler; | - |
107 | } executed: } Execution Count:8546 | 8546 |
108 | | - |
109 | | - |
110 | void QPaintEngineExPrivate::replayClipOperations() | - |
111 | { | - |
112 | QPaintEngineEx * const q = q_func(); | - |
113 | | - |
114 | QPainter *p = q->painter(); | - |
115 | if (!p || !p->d_ptr) never evaluated: !p->d_ptr | 0 |
116 | return; | 0 |
117 | | - |
118 | QList<QPainterClipInfo> clipInfo = p->d_ptr->state->clipInfo; | - |
119 | | - |
120 | QTransform transform = q->state()->matrix; | - |
121 | | - |
122 | for (int i = 0; i < clipInfo.size(); ++i) { never evaluated: i < clipInfo.size() | 0 |
123 | const QPainterClipInfo &info = clipInfo.at(i); | - |
124 | | - |
125 | if (info.matrix != q->state()->matrix) { never evaluated: info.matrix != q->state()->matrix | 0 |
126 | q->state()->matrix = info.matrix; | - |
127 | q->transformChanged(); | - |
128 | } | 0 |
129 | | - |
130 | switch (info.clipType) { | - |
131 | case QPainterClipInfo::RegionClip: | - |
132 | q->clip(info.region, info.operation); | - |
133 | break; | 0 |
134 | case QPainterClipInfo::PathClip: | - |
135 | q->clip(info.path, info.operation); | - |
136 | break; | 0 |
137 | case QPainterClipInfo::RectClip: | - |
138 | q->clip(info.rect, info.operation); | - |
139 | break; | 0 |
140 | case QPainterClipInfo::RectFClip: { | - |
141 | qreal right = info.rectf.x() + info.rectf.width(); | - |
142 | qreal bottom = info.rectf.y() + info.rectf.height(); | - |
143 | qreal pts[] = { info.rectf.x(), info.rectf.y(), | - |
144 | right, info.rectf.y(), | - |
145 | right, bottom, | - |
146 | info.rectf.x(), bottom }; | - |
147 | QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint); | - |
148 | q->clip(vp, info.operation); | - |
149 | break; | 0 |
150 | } | - |
151 | } | - |
152 | } | 0 |
153 | | - |
154 | if (transform != q->state()->matrix) { never evaluated: transform != q->state()->matrix | 0 |
155 | q->state()->matrix = transform; | - |
156 | q->transformChanged(); | - |
157 | } | 0 |
158 | } | 0 |
159 | | - |
160 | | - |
161 | bool QPaintEngineExPrivate::hasClipOperations() const | - |
162 | { | - |
163 | const QPaintEngineEx * const q = q_func(); | - |
164 | | - |
165 | QPainter *p = q->painter(); | - |
166 | if (!p || !p->d_ptr) never evaluated: !p->d_ptr | 0 |
167 | return false; never executed: return false; | 0 |
168 | | - |
169 | QList<QPainterClipInfo> clipInfo = p->d_ptr->state->clipInfo; | - |
170 | | - |
171 | return !clipInfo.isEmpty(); never executed: return !clipInfo.isEmpty(); | 0 |
172 | } | - |
173 | | - |
174 | | - |
175 | | - |
176 | | - |
177 | | - |
178 | | - |
179 | | - |
180 | static QPainterPath::ElementType qpaintengineex_ellipse_types[] = { | - |
181 | QPainterPath::MoveToElement, | - |
182 | QPainterPath::CurveToElement, | - |
183 | QPainterPath::CurveToDataElement, | - |
184 | QPainterPath::CurveToDataElement, | - |
185 | | - |
186 | QPainterPath::CurveToElement, | - |
187 | QPainterPath::CurveToDataElement, | - |
188 | QPainterPath::CurveToDataElement, | - |
189 | | - |
190 | QPainterPath::CurveToElement, | - |
191 | QPainterPath::CurveToDataElement, | - |
192 | QPainterPath::CurveToDataElement, | - |
193 | | - |
194 | QPainterPath::CurveToElement, | - |
195 | QPainterPath::CurveToDataElement, | - |
196 | QPainterPath::CurveToDataElement | - |
197 | }; | - |
198 | | - |
199 | static QPainterPath::ElementType qpaintengineex_line_types_16[] = { | - |
200 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
201 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
202 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
203 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
204 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
205 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
206 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
207 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
208 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
209 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
210 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
211 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
212 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
213 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
214 | QPainterPath::MoveToElement, QPainterPath::LineToElement, | - |
215 | QPainterPath::MoveToElement, QPainterPath::LineToElement | - |
216 | }; | - |
217 | | - |
218 | static QPainterPath::ElementType qpaintengineex_rect4_types_32[] = { | - |
219 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
220 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
221 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
222 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
223 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
224 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
225 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
226 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
227 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
228 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
229 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
230 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
231 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
232 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
233 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
234 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
235 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
236 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
237 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
238 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
239 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
240 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
241 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
242 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
243 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
244 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
245 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
246 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
247 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
248 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
249 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
250 | QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, | - |
251 | }; | - |
252 | | - |
253 | | - |
254 | static QPainterPath::ElementType qpaintengineex_roundedrect_types[] = { | - |
255 | QPainterPath::MoveToElement, | - |
256 | QPainterPath::LineToElement, | - |
257 | QPainterPath::CurveToElement, | - |
258 | QPainterPath::CurveToDataElement, | - |
259 | QPainterPath::CurveToDataElement, | - |
260 | QPainterPath::LineToElement, | - |
261 | QPainterPath::CurveToElement, | - |
262 | QPainterPath::CurveToDataElement, | - |
263 | QPainterPath::CurveToDataElement, | - |
264 | QPainterPath::LineToElement, | - |
265 | QPainterPath::CurveToElement, | - |
266 | QPainterPath::CurveToDataElement, | - |
267 | QPainterPath::CurveToDataElement, | - |
268 | QPainterPath::LineToElement, | - |
269 | QPainterPath::CurveToElement, | - |
270 | QPainterPath::CurveToDataElement, | - |
271 | QPainterPath::CurveToDataElement | - |
272 | }; | - |
273 | | - |
274 | | - |
275 | | - |
276 | static void qpaintengineex_moveTo(qreal x, qreal y, void *data) { | - |
277 | ((StrokeHandler *) data)->pts.add(x); | - |
278 | ((StrokeHandler *) data)->pts.add(y); | - |
279 | ((StrokeHandler *) data)->types.add(QPainterPath::MoveToElement); | - |
280 | } executed: } Execution Count:1876 | 1876 |
281 | | - |
282 | static void qpaintengineex_lineTo(qreal x, qreal y, void *data) { | - |
283 | ((StrokeHandler *) data)->pts.add(x); | - |
284 | ((StrokeHandler *) data)->pts.add(y); | - |
285 | ((StrokeHandler *) data)->types.add(QPainterPath::LineToElement); | - |
286 | } executed: } Execution Count:3304 | 3304 |
287 | | - |
288 | static void qpaintengineex_cubicTo(qreal c1x, qreal c1y, qreal c2x, qreal c2y, qreal ex, qreal ey, void *data) { | - |
289 | ((StrokeHandler *) data)->pts.add(c1x); | - |
290 | ((StrokeHandler *) data)->pts.add(c1y); | - |
291 | ((StrokeHandler *) data)->types.add(QPainterPath::CurveToElement); | - |
292 | | - |
293 | ((StrokeHandler *) data)->pts.add(c2x); | - |
294 | ((StrokeHandler *) data)->pts.add(c2y); | - |
295 | ((StrokeHandler *) data)->types.add(QPainterPath::CurveToDataElement); | - |
296 | | - |
297 | ((StrokeHandler *) data)->pts.add(ex); | - |
298 | ((StrokeHandler *) data)->pts.add(ey); | - |
299 | ((StrokeHandler *) data)->types.add(QPainterPath::CurveToDataElement); | - |
300 | } executed: } Execution Count:6960 | 6960 |
301 | | - |
302 | QPaintEngineEx::QPaintEngineEx() | - |
303 | : QPaintEngine(*new QPaintEngineExPrivate, AllFeatures) | - |
304 | { | - |
305 | extended = true; | - |
306 | } executed: } Execution Count:2942 | 2942 |
307 | | - |
308 | QPaintEngineEx::QPaintEngineEx(QPaintEngineExPrivate &data) | - |
309 | : QPaintEngine(data, AllFeatures) | - |
310 | { | - |
311 | extended = true; | - |
312 | } executed: } Execution Count:5615 | 5615 |
313 | | - |
314 | QPainterState *QPaintEngineEx::createState(QPainterState *orig) const | - |
315 | { | - |
316 | if (!orig) | 0 |
317 | return new QPainterState; never executed: return new QPainterState; | 0 |
318 | return new QPainterState(orig); never executed: return new QPainterState(orig); | 0 |
319 | } | - |
320 | | - |
321 | __attribute__((visibility("default"))) extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); | - |
322 | | - |
323 | void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) | - |
324 | { | - |
325 | | - |
326 | | - |
327 | | - |
328 | | - |
329 | QPaintEngineExPrivate * const d = d_func(); | - |
330 | | - |
331 | if (path.isEmpty()) partially evaluated: path.isEmpty() no Evaluation Count:0 | yes Evaluation Count:938 |
| 0-938 |
332 | return; | 0 |
333 | | - |
334 | if (!d->strokeHandler) { evaluated: !d->strokeHandler yes Evaluation Count:39 | yes Evaluation Count:899 |
| 39-899 |
335 | d->strokeHandler = new StrokeHandler(path.elementCount()+4); | - |
336 | d->stroker.setMoveToHook(qpaintengineex_moveTo); | - |
337 | d->stroker.setLineToHook(qpaintengineex_lineTo); | - |
338 | d->stroker.setCubicToHook(qpaintengineex_cubicTo); | - |
339 | } executed: } Execution Count:39 | 39 |
340 | | - |
341 | if (!qpen_fast_equals(pen, d->strokerPen)) { evaluated: !qpen_fast_equals(pen, d->strokerPen) yes Evaluation Count:39 | yes Evaluation Count:899 |
| 39-899 |
342 | d->strokerPen = pen; | - |
343 | d->stroker.setJoinStyle(pen.joinStyle()); | - |
344 | d->stroker.setCapStyle(pen.capStyle()); | - |
345 | d->stroker.setMiterLimit(pen.miterLimit()); | - |
346 | qreal penWidth = pen.widthF(); | - |
347 | if (penWidth == 0) partially evaluated: penWidth == 0 no Evaluation Count:0 | yes Evaluation Count:39 |
| 0-39 |
348 | d->stroker.setStrokeWidth(1); never executed: d->stroker.setStrokeWidth(1); | 0 |
349 | else | - |
350 | d->stroker.setStrokeWidth(penWidth); executed: d->stroker.setStrokeWidth(penWidth); Execution Count:39 | 39 |
351 | | - |
352 | Qt::PenStyle style = pen.style(); | - |
353 | if (style == Qt::SolidLine) { partially evaluated: style == Qt::SolidLine yes Evaluation Count:39 | no Evaluation Count:0 |
| 0-39 |
354 | d->activeStroker = &d->stroker; | - |
355 | } else if (style == Qt::NoPen) { never evaluated: style == Qt::NoPen executed: } Execution Count:39 | 0-39 |
356 | d->activeStroker = 0; | - |
357 | } else { | 0 |
358 | d->dasher.setDashPattern(pen.dashPattern()); | - |
359 | d->dasher.setDashOffset(pen.dashOffset()); | - |
360 | d->activeStroker = &d->dasher; | - |
361 | } | 0 |
362 | } | - |
363 | | - |
364 | if (!d->activeStroker) { partially evaluated: !d->activeStroker no Evaluation Count:0 | yes Evaluation Count:938 |
| 0-938 |
365 | return; | 0 |
366 | } | - |
367 | | - |
368 | if (pen.style() > Qt::SolidLine) { partially evaluated: pen.style() > Qt::SolidLine no Evaluation Count:0 | yes Evaluation Count:938 |
| 0-938 |
369 | if (qt_pen_is_cosmetic(pen, state()->renderHints)){ never evaluated: qt_pen_is_cosmetic(pen, state()->renderHints) | 0 |
370 | d->activeStroker->setClipRect(d->exDeviceRect); | - |
371 | } else { | 0 |
372 | QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect)); | - |
373 | d->activeStroker->setClipRect(clipRect); | - |
374 | } | 0 |
375 | } | - |
376 | | - |
377 | const QPainterPath::ElementType *types = path.elements(); | - |
378 | const qreal *points = path.points(); | - |
379 | int pointCount = path.elementCount(); | - |
380 | | - |
381 | const qreal *lastPoint = points + (pointCount<<1); | - |
382 | | - |
383 | d->strokeHandler->types.reset(); | - |
384 | d->strokeHandler->pts.reset(); | - |
385 | | - |
386 | | - |
387 | uint flags = QVectorPath::WindingFill; | - |
388 | | - |
389 | if (path.elementCount() > 2) partially evaluated: path.elementCount() > 2 yes Evaluation Count:938 | no Evaluation Count:0 |
| 0-938 |
390 | flags |= QVectorPath::NonConvexShapeMask; executed: flags |= QVectorPath::NonConvexShapeMask; Execution Count:938 | 938 |
391 | | - |
392 | if (d->stroker.capStyle() == Qt::RoundCap || d->stroker.joinStyle() == Qt::RoundJoin) partially evaluated: d->stroker.capStyle() == Qt::RoundCap no Evaluation Count:0 | yes Evaluation Count:938 |
partially evaluated: d->stroker.joinStyle() == Qt::RoundJoin no Evaluation Count:0 | yes Evaluation Count:938 |
| 0-938 |
393 | flags |= QVectorPath::CurvedShapeMask; never executed: flags |= QVectorPath::CurvedShapeMask; | 0 |
394 | | - |
395 | | - |
396 | if (!qt_pen_is_cosmetic(pen, state()->renderHints)) { partially evaluated: !qt_pen_is_cosmetic(pen, state()->renderHints) yes Evaluation Count:938 | no Evaluation Count:0 |
| 0-938 |
397 | | - |
398 | | - |
399 | | - |
400 | | - |
401 | d->activeStroker->setCurveThresholdFromTransform(state()->matrix); | - |
402 | d->activeStroker->begin(d->strokeHandler); | - |
403 | if (types) { evaluated: types yes Evaluation Count:876 | yes Evaluation Count:62 |
| 62-876 |
404 | while (points < lastPoint) { evaluated: points < lastPoint yes Evaluation Count:4388 | yes Evaluation Count:876 |
| 876-4388 |
405 | switch (*types) { | - |
406 | case QPainterPath::MoveToElement: | - |
407 | d->activeStroker->moveTo(points[0], points[1]); | - |
408 | points += 2; | - |
409 | ++types; | - |
410 | break; executed: break; Execution Count:876 | 876 |
411 | case QPainterPath::LineToElement: | - |
412 | d->activeStroker->lineTo(points[0], points[1]); | - |
413 | points += 2; | - |
414 | ++types; | - |
415 | break; executed: break; Execution Count:36 | 36 |
416 | case QPainterPath::CurveToElement: | - |
417 | d->activeStroker->cubicTo(points[0], points[1], | - |
418 | points[2], points[3], | - |
419 | points[4], points[5]); | - |
420 | points += 6; | - |
421 | types += 3; | - |
422 | flags |= QVectorPath::CurvedShapeMask; | - |
423 | break; executed: break; Execution Count:3476 | 3476 |
424 | default: | - |
425 | break; | 0 |
426 | } | - |
427 | } executed: } Execution Count:4388 | 4388 |
428 | if (path.hasImplicitClose()) partially evaluated: path.hasImplicitClose() no Evaluation Count:0 | yes Evaluation Count:876 |
| 0-876 |
429 | d->activeStroker->lineTo(path.points()[0], path.points()[1]); never executed: d->activeStroker->lineTo(path.points()[0], path.points()[1]); | 0 |
430 | | - |
431 | } else { executed: } Execution Count:876 | 876 |
432 | d->activeStroker->moveTo(points[0], points[1]); | - |
433 | points += 2; | - |
434 | while (points < lastPoint) { evaluated: points < lastPoint yes Evaluation Count:642 | yes Evaluation Count:62 |
| 62-642 |
435 | d->activeStroker->lineTo(points[0], points[1]); | - |
436 | points += 2; | - |
437 | } executed: } Execution Count:642 | 642 |
438 | if (path.hasImplicitClose()) evaluated: path.hasImplicitClose() yes Evaluation Count:54 | yes Evaluation Count:8 |
| 8-54 |
439 | d->activeStroker->lineTo(path.points()[0], path.points()[1]); executed: d->activeStroker->lineTo(path.points()[0], path.points()[1]); Execution Count:54 | 54 |
440 | } executed: } Execution Count:62 | 62 |
441 | d->activeStroker->end(); | - |
442 | | - |
443 | if (!d->strokeHandler->types.size()) partially evaluated: !d->strokeHandler->types.size() no Evaluation Count:0 | yes Evaluation Count:938 |
| 0-938 |
444 | return; | 0 |
445 | | - |
446 | QVectorPath strokePath(d->strokeHandler->pts.data(), | - |
447 | d->strokeHandler->types.size(), | - |
448 | d->strokeHandler->types.data(), | - |
449 | flags); | - |
450 | fill(strokePath, pen.brush()); | - |
451 | } else { executed: } Execution Count:938 | 938 |
452 | | - |
453 | if (state()->matrix.type() >= QTransform::TxProject) { never evaluated: state()->matrix.type() >= QTransform::TxProject | 0 |
454 | QPainterPath painterPath = state()->matrix.map(path.convertToPainterPath()); | - |
455 | d->activeStroker->strokePath(painterPath, d->strokeHandler, QTransform()); | - |
456 | } else { | 0 |
457 | d->activeStroker->setCurveThresholdFromTransform(QTransform()); | - |
458 | d->activeStroker->begin(d->strokeHandler); | - |
459 | if (types) { | 0 |
460 | while (points < lastPoint) { never evaluated: points < lastPoint | 0 |
461 | switch (*types) { | - |
462 | case QPainterPath::MoveToElement: { | - |
463 | QPointF pt = (*(QPointF *) points) * state()->matrix; | - |
464 | d->activeStroker->moveTo(pt.x(), pt.y()); | - |
465 | points += 2; | - |
466 | ++types; | - |
467 | break; | 0 |
468 | } | - |
469 | case QPainterPath::LineToElement: { | - |
470 | QPointF pt = (*(QPointF *) points) * state()->matrix; | - |
471 | d->activeStroker->lineTo(pt.x(), pt.y()); | - |
472 | points += 2; | - |
473 | ++types; | - |
474 | break; | 0 |
475 | } | - |
476 | case QPainterPath::CurveToElement: { | - |
477 | QPointF c1 = ((QPointF *) points)[0] * state()->matrix; | - |
478 | QPointF c2 = ((QPointF *) points)[1] * state()->matrix; | - |
479 | QPointF e = ((QPointF *) points)[2] * state()->matrix; | - |
480 | d->activeStroker->cubicTo(c1.x(), c1.y(), c2.x(), c2.y(), e.x(), e.y()); | - |
481 | points += 6; | - |
482 | types += 3; | - |
483 | flags |= QVectorPath::CurvedShapeMask; | - |
484 | break; | 0 |
485 | } | - |
486 | default: | - |
487 | break; | 0 |
488 | } | - |
489 | } | 0 |
490 | if (path.hasImplicitClose()) { never evaluated: path.hasImplicitClose() | 0 |
491 | QPointF pt = * ((QPointF *) path.points()) * state()->matrix; | - |
492 | d->activeStroker->lineTo(pt.x(), pt.y()); | - |
493 | } | 0 |
494 | | - |
495 | } else { | 0 |
496 | QPointF p = ((QPointF *)points)[0] * state()->matrix; | - |
497 | d->activeStroker->moveTo(p.x(), p.y()); | - |
498 | points += 2; | - |
499 | while (points < lastPoint) { never evaluated: points < lastPoint | 0 |
500 | QPointF p = ((QPointF *)points)[0] * state()->matrix; | - |
501 | d->activeStroker->lineTo(p.x(), p.y()); | - |
502 | points += 2; | - |
503 | } | 0 |
504 | if (path.hasImplicitClose()) never evaluated: path.hasImplicitClose() | 0 |
505 | d->activeStroker->lineTo(p.x(), p.y()); never executed: d->activeStroker->lineTo(p.x(), p.y()); | 0 |
506 | } | 0 |
507 | d->activeStroker->end(); | - |
508 | } | 0 |
509 | | - |
510 | QVectorPath strokePath(d->strokeHandler->pts.data(), | - |
511 | d->strokeHandler->types.size(), | - |
512 | d->strokeHandler->types.data(), | - |
513 | flags); | - |
514 | | - |
515 | QTransform xform = state()->matrix; | - |
516 | state()->matrix = QTransform(); | - |
517 | transformChanged(); | - |
518 | | - |
519 | QBrush brush = pen.brush(); | - |
520 | if (qbrush_style(brush) != Qt::SolidPattern) never evaluated: qbrush_style(brush) != Qt::SolidPattern | 0 |
521 | brush.setTransform(brush.transform() * xform); never executed: brush.setTransform(brush.transform() * xform); | 0 |
522 | | - |
523 | fill(strokePath, brush); | - |
524 | | - |
525 | state()->matrix = xform; | - |
526 | transformChanged(); | - |
527 | } | 0 |
528 | } | - |
529 | | - |
530 | void QPaintEngineEx::draw(const QVectorPath &path) | - |
531 | { | - |
532 | const QBrush &brush = state()->brush; | - |
533 | if (qbrush_style(brush) != Qt::NoBrush) evaluated: qbrush_style(brush) != Qt::NoBrush yes Evaluation Count:39319 | yes Evaluation Count:345 |
| 345-39319 |
534 | fill(path, brush); executed: fill(path, brush); Execution Count:39319 | 39319 |
535 | | - |
536 | const QPen &pen = state()->pen; | - |
537 | if (qpen_style(pen) != Qt::NoPen && qbrush_style(qpen_brush(pen)) != Qt::NoBrush) evaluated: qpen_style(pen) != Qt::NoPen yes Evaluation Count:1212 | yes Evaluation Count:38452 |
partially evaluated: qbrush_style(qpen_brush(pen)) != Qt::NoBrush yes Evaluation Count:1212 | no Evaluation Count:0 |
| 0-38452 |
538 | stroke(path, pen); executed: stroke(path, pen); Execution Count:1212 | 1212 |
539 | } executed: } Execution Count:39664 | 39664 |
540 | | - |
541 | | - |
542 | void QPaintEngineEx::clip(const QRect &r, Qt::ClipOperation op) | - |
543 | { | - |
544 | qreal right = r.x() + r.width(); | - |
545 | qreal bottom = r.y() + r.height(); | - |
546 | qreal pts[] = { qreal(r.x()), qreal(r.y()), | - |
547 | right, qreal(r.y()), | - |
548 | right, bottom, | - |
549 | qreal(r.x()), bottom, | - |
550 | qreal(r.x()), qreal(r.y()) }; | - |
551 | QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); | - |
552 | clip(vp, op); | - |
553 | } executed: } Execution Count:364 | 364 |
554 | | - |
555 | void QPaintEngineEx::clip(const QRegion ®ion, Qt::ClipOperation op) | - |
556 | { | - |
557 | if (region.rectCount() == 1) evaluated: region.rectCount() == 1 yes Evaluation Count:3 | yes Evaluation Count:16 |
| 3-16 |
558 | clip(region.boundingRect(), op); executed: clip(region.boundingRect(), op); Execution Count:3 | 3 |
559 | | - |
560 | QVector<QRect> rects = region.rects(); | - |
561 | if (rects.size() <= 32) { evaluated: rects.size() <= 32 yes Evaluation Count:15 | yes Evaluation Count:4 |
| 4-15 |
562 | qreal pts[2*32*4]; | - |
563 | int pos = 0; | - |
564 | for (QVector<QRect>::const_iterator i = rects.constBegin(); i != rects.constEnd(); ++i) { evaluated: i != rects.constEnd() yes Evaluation Count:23 | yes Evaluation Count:15 |
| 15-23 |
565 | qreal x1 = i->x(); | - |
566 | qreal y1 = i->y(); | - |
567 | qreal x2 = i->x() + i->width(); | - |
568 | qreal y2 = i->y() + i->height(); | - |
569 | | - |
570 | pts[pos++] = x1; | - |
571 | pts[pos++] = y1; | - |
572 | | - |
573 | pts[pos++] = x2; | - |
574 | pts[pos++] = y1; | - |
575 | | - |
576 | pts[pos++] = x2; | - |
577 | pts[pos++] = y2; | - |
578 | | - |
579 | pts[pos++] = x1; | - |
580 | pts[pos++] = y2; | - |
581 | } executed: } Execution Count:23 | 23 |
582 | QVectorPath vp(pts, rects.size() * 4, qpaintengineex_rect4_types_32); | - |
583 | clip(vp, op); | - |
584 | } else { executed: } Execution Count:15 | 15 |
585 | QVarLengthArray<qreal> pts(rects.size() * 2 * 4); | - |
586 | QVarLengthArray<QPainterPath::ElementType> types(rects.size() * 4); | - |
587 | int ppos = 0; | - |
588 | int tpos = 0; | - |
589 | | - |
590 | for (QVector<QRect>::const_iterator i = rects.constBegin(); i != rects.constEnd(); ++i) { evaluated: i != rects.constEnd() yes Evaluation Count:582 | yes Evaluation Count:4 |
| 4-582 |
591 | qreal x1 = i->x(); | - |
592 | qreal y1 = i->y(); | - |
593 | qreal x2 = i->x() + i->width(); | - |
594 | qreal y2 = i->y() + i->height(); | - |
595 | | - |
596 | pts[ppos++] = x1; | - |
597 | pts[ppos++] = y1; | - |
598 | | - |
599 | pts[ppos++] = x2; | - |
600 | pts[ppos++] = y1; | - |
601 | | - |
602 | pts[ppos++] = x2; | - |
603 | pts[ppos++] = y2; | - |
604 | | - |
605 | pts[ppos++] = x1; | - |
606 | pts[ppos++] = y2; | - |
607 | | - |
608 | types[tpos++] = QPainterPath::MoveToElement; | - |
609 | types[tpos++] = QPainterPath::LineToElement; | - |
610 | types[tpos++] = QPainterPath::LineToElement; | - |
611 | types[tpos++] = QPainterPath::LineToElement; | - |
612 | } executed: } Execution Count:582 | 582 |
613 | | - |
614 | QVectorPath vp(pts.data(), rects.size() * 4, types.data()); | - |
615 | clip(vp, op); | - |
616 | } executed: } Execution Count:4 | 4 |
617 | | - |
618 | } | - |
619 | | - |
620 | void QPaintEngineEx::clip(const QPainterPath &path, Qt::ClipOperation op) | - |
621 | { | - |
622 | if (path.isEmpty()) { evaluated: path.isEmpty() yes Evaluation Count:7 | yes Evaluation Count:328 |
| 7-328 |
623 | QVectorPath vp(0, 0); | - |
624 | clip(vp, op); | - |
625 | } else { executed: } Execution Count:7 | 7 |
626 | clip(qtVectorPathForPath(path), op); | - |
627 | } executed: } Execution Count:328 | 328 |
628 | } | - |
629 | | - |
630 | void QPaintEngineEx::fillRect(const QRectF &r, const QBrush &brush) | - |
631 | { | - |
632 | qreal pts[] = { r.x(), r.y(), r.x() + r.width(), r.y(), | - |
633 | r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() }; | - |
634 | QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint); | - |
635 | fill(vp, brush); | - |
636 | } executed: } Execution Count:2792 | 2792 |
637 | | - |
638 | void QPaintEngineEx::fillRect(const QRectF &r, const QColor &color) | - |
639 | { | - |
640 | fillRect(r, QBrush(color)); | - |
641 | } | 0 |
642 | | - |
643 | void QPaintEngineEx::drawRects(const QRect *rects, int rectCount) | - |
644 | { | - |
645 | for (int i=0; i<rectCount; ++i) { evaluated: i<rectCount yes Evaluation Count:5167 | yes Evaluation Count:5167 |
| 5167 |
646 | const QRect &r = rects[i]; | - |
647 | | - |
648 | qreal right = r.x() + r.width(); | - |
649 | qreal bottom = r.y() + r.height(); | - |
650 | qreal pts[] = { qreal(r.x()), qreal(r.y()), | - |
651 | right, qreal(r.y()), | - |
652 | right, bottom, | - |
653 | qreal(r.x()), bottom, | - |
654 | qreal(r.x()), qreal(r.y()) }; | - |
655 | QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); | - |
656 | draw(vp); | - |
657 | } executed: } Execution Count:5167 | 5167 |
658 | } executed: } Execution Count:5167 | 5167 |
659 | | - |
660 | void QPaintEngineEx::drawRects(const QRectF *rects, int rectCount) | - |
661 | { | - |
662 | for (int i=0; i<rectCount; ++i) { evaluated: i<rectCount yes Evaluation Count:8 | yes Evaluation Count:8 |
| 8 |
663 | const QRectF &r = rects[i]; | - |
664 | qreal right = r.x() + r.width(); | - |
665 | qreal bottom = r.y() + r.height(); | - |
666 | qreal pts[] = { r.x(), r.y(), | - |
667 | right, r.y(), | - |
668 | right, bottom, | - |
669 | r.x(), bottom, | - |
670 | r.x(), r.y() }; | - |
671 | QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); | - |
672 | draw(vp); | - |
673 | } executed: } Execution Count:8 | 8 |
674 | } executed: } Execution Count:8 | 8 |
675 | | - |
676 | | - |
677 | void QPaintEngineEx::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, | - |
678 | Qt::SizeMode mode) | - |
679 | { | - |
680 | qreal x1 = rect.left(); | - |
681 | qreal x2 = rect.right(); | - |
682 | qreal y1 = rect.top(); | - |
683 | qreal y2 = rect.bottom(); | - |
684 | | - |
685 | if (mode == Qt::RelativeSize) { evaluated: mode == Qt::RelativeSize yes Evaluation Count:223 | yes Evaluation Count:82 |
| 82-223 |
686 | xRadius = xRadius * rect.width() / 200.; | - |
687 | yRadius = yRadius * rect.height() / 200.; | - |
688 | } executed: } Execution Count:223 | 223 |
689 | | - |
690 | xRadius = qMin(xRadius, rect.width() / 2); | - |
691 | yRadius = qMin(yRadius, rect.height() / 2); | - |
692 | | - |
693 | qreal pts[] = { | - |
694 | x1 + xRadius, y1, | - |
695 | x2 - xRadius, y1, | - |
696 | x2 - (1 - qreal(0.5522847498)) * xRadius, y1, | - |
697 | x2, y1 + (1 - qreal(0.5522847498)) * yRadius, | - |
698 | x2, y1 + yRadius, | - |
699 | x2, y2 - yRadius, | - |
700 | x2, y2 - (1 - qreal(0.5522847498)) * yRadius, | - |
701 | x2 - (1 - qreal(0.5522847498)) * xRadius, y2, | - |
702 | x2 - xRadius, y2, | - |
703 | x1 + xRadius, y2, | - |
704 | x1 + (1 - qreal(0.5522847498)) * xRadius, y2, | - |
705 | x1, y2 - (1 - qreal(0.5522847498)) * yRadius, | - |
706 | x1, y2 - yRadius, | - |
707 | x1, y1 + yRadius, | - |
708 | x1, y1 + (1 - qreal(0.5522847498)) * yRadius, | - |
709 | x1 + (1 - qreal(0.5522847498)) * xRadius, y1, | - |
710 | x1 + xRadius, y1 | - |
711 | }; | - |
712 | | - |
713 | QVectorPath path(pts, 17, qpaintengineex_roundedrect_types, QVectorPath::RoundedRectHint); | - |
714 | draw(path); | - |
715 | } executed: } Execution Count:305 | 305 |
716 | | - |
717 | | - |
718 | | - |
719 | void QPaintEngineEx::drawLines(const QLine *lines, int lineCount) | - |
720 | { | - |
721 | int elementCount = lineCount << 1; | - |
722 | while (elementCount > 0) { evaluated: elementCount > 0 yes Evaluation Count:58 | yes Evaluation Count:58 |
| 58 |
723 | int count = qMin(elementCount, 32); | - |
724 | | - |
725 | qreal pts[64]; | - |
726 | int count2 = count<<1; | - |
727 | for (int i=0; i<count2; ++i) evaluated: i<count2 yes Evaluation Count:232 | yes Evaluation Count:58 |
| 58-232 |
728 | pts[i] = ((int *) lines)[i]; executed: pts[i] = ((int *) lines)[i]; Execution Count:232 | 232 |
729 | | - |
730 | QVectorPath path(pts, count, qpaintengineex_line_types_16, QVectorPath::LinesHint); | - |
731 | stroke(path, state()->pen); | - |
732 | | - |
733 | elementCount -= 32; | - |
734 | lines += 16; | - |
735 | } executed: } Execution Count:58 | 58 |
736 | } executed: } Execution Count:58 | 58 |
737 | | - |
738 | void QPaintEngineEx::drawLines(const QLineF *lines, int lineCount) | - |
739 | { | - |
740 | int elementCount = lineCount << 1; | - |
741 | while (elementCount > 0) { evaluated: elementCount > 0 yes Evaluation Count:834 | yes Evaluation Count:834 |
| 834 |
742 | int count = qMin(elementCount, 32); | - |
743 | | - |
744 | QVectorPath path((qreal *) lines, count, qpaintengineex_line_types_16, | - |
745 | QVectorPath::LinesHint); | - |
746 | stroke(path, state()->pen); | - |
747 | | - |
748 | elementCount -= 32; | - |
749 | lines += 16; | - |
750 | } executed: } Execution Count:834 | 834 |
751 | } executed: } Execution Count:834 | 834 |
752 | | - |
753 | void QPaintEngineEx::drawEllipse(const QRectF &r) | - |
754 | { | - |
755 | qreal pts[26]; | - |
756 | union { | - |
757 | qreal *ptr; | - |
758 | QPointF *points; | - |
759 | } x; | - |
760 | x.ptr = pts; | - |
761 | | - |
762 | int point_count = 0; | - |
763 | x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count); | - |
764 | QVectorPath vp((qreal *) pts, point_count + 1, qpaintengineex_ellipse_types, QVectorPath::EllipseHint); | - |
765 | draw(vp); | - |
766 | } executed: } Execution Count:872 | 872 |
767 | | - |
768 | void QPaintEngineEx::drawEllipse(const QRect &r) | - |
769 | { | - |
770 | drawEllipse(QRectF(r)); | - |
771 | } executed: } Execution Count:985 | 985 |
772 | | - |
773 | void QPaintEngineEx::drawPath(const QPainterPath &path) | - |
774 | { | - |
775 | if (!path.isEmpty()) partially evaluated: !path.isEmpty() yes Evaluation Count:33309 | no Evaluation Count:0 |
| 0-33309 |
776 | draw(qtVectorPathForPath(path)); executed: draw(qtVectorPathForPath(path)); Execution Count:33309 | 33309 |
777 | } executed: } Execution Count:33309 | 33309 |
778 | | - |
779 | | - |
780 | void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount) | - |
781 | { | - |
782 | QPen pen = state()->pen; | - |
783 | if (pen.capStyle() == Qt::FlatCap) never evaluated: pen.capStyle() == Qt::FlatCap | 0 |
784 | pen.setCapStyle(Qt::SquareCap); never executed: pen.setCapStyle(Qt::SquareCap); | 0 |
785 | | - |
786 | if (pen.brush().isOpaque()) { never evaluated: pen.brush().isOpaque() | 0 |
787 | while (pointCount > 0) { never evaluated: pointCount > 0 | 0 |
788 | int count = qMin(pointCount, 16); | - |
789 | qreal pts[64]; | - |
790 | int oset = -1; | - |
791 | for (int i=0; i<count; ++i) { | 0 |
792 | pts[++oset] = points[i].x(); | - |
793 | pts[++oset] = points[i].y(); | - |
794 | pts[++oset] = points[i].x() + 1/63.; | - |
795 | pts[++oset] = points[i].y(); | - |
796 | } | 0 |
797 | QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); | - |
798 | stroke(path, pen); | - |
799 | pointCount -= 16; | - |
800 | points += 16; | - |
801 | } | 0 |
802 | } else { | 0 |
803 | for (int i=0; i<pointCount; ++i) { never evaluated: i<pointCount | 0 |
804 | qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + qreal(1/63.), points[i].y() }; | - |
805 | QVectorPath path(pts, 2, 0); | - |
806 | stroke(path, pen); | - |
807 | } | 0 |
808 | } | 0 |
809 | } | - |
810 | | - |
811 | void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount) | - |
812 | { | - |
813 | QPen pen = state()->pen; | - |
814 | if (pen.capStyle() == Qt::FlatCap) partially evaluated: pen.capStyle() == Qt::FlatCap no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
815 | pen.setCapStyle(Qt::SquareCap); never executed: pen.setCapStyle(Qt::SquareCap); | 0 |
816 | | - |
817 | if (pen.brush().isOpaque()) { partially evaluated: pen.brush().isOpaque() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
818 | while (pointCount > 0) { evaluated: pointCount > 0 yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
819 | int count = qMin(pointCount, 16); | - |
820 | qreal pts[64]; | - |
821 | int oset = -1; | - |
822 | for (int i=0; i<count; ++i) { evaluated: i<count yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
823 | pts[++oset] = points[i].x(); | - |
824 | pts[++oset] = points[i].y(); | - |
825 | pts[++oset] = points[i].x() + 1/63.; | - |
826 | pts[++oset] = points[i].y(); | - |
827 | } executed: } Execution Count:1 | 1 |
828 | QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); | - |
829 | stroke(path, pen); | - |
830 | pointCount -= 16; | - |
831 | points += 16; | - |
832 | } executed: } Execution Count:1 | 1 |
833 | } else { executed: } Execution Count:1 | 1 |
834 | for (int i=0; i<pointCount; ++i) { never evaluated: i<pointCount | 0 |
835 | qreal pts[] = { qreal(points[i].x()), qreal(points[i].y()), | - |
836 | qreal(points[i].x() +1/63.), qreal(points[i].y()) }; | - |
837 | QVectorPath path(pts, 2, 0); | - |
838 | stroke(path, pen); | - |
839 | } | 0 |
840 | } | 0 |
841 | } | - |
842 | | - |
843 | | - |
844 | void QPaintEngineEx::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - |
845 | { | - |
846 | QVectorPath path((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); | - |
847 | | - |
848 | if (mode == PolylineMode) partially evaluated: mode == PolylineMode no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
849 | stroke(path, state()->pen); never executed: stroke(path, state()->pen); | 0 |
850 | else | - |
851 | draw(path); executed: draw(path); Execution Count:3 | 3 |
852 | } | - |
853 | | - |
854 | void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) | - |
855 | { | - |
856 | int count = pointCount<<1; | - |
857 | QVarLengthArray<qreal> pts(count); | - |
858 | | - |
859 | for (int i=0; i<count; ++i) evaluated: i<count yes Evaluation Count:66972 | yes Evaluation Count:11162 |
| 11162-66972 |
860 | pts[i] = ((int *) points)[i]; executed: pts[i] = ((int *) points)[i]; Execution Count:66972 | 66972 |
861 | | - |
862 | QVectorPath path(pts.data(), pointCount, 0, QVectorPath::polygonFlags(mode)); | - |
863 | | - |
864 | if (mode == PolylineMode) partially evaluated: mode == PolylineMode yes Evaluation Count:11162 | no Evaluation Count:0 |
| 0-11162 |
865 | stroke(path, state()->pen); executed: stroke(path, state()->pen); Execution Count:11162 | 11162 |
866 | else | - |
867 | draw(path); never executed: draw(path); | 0 |
868 | | - |
869 | } | - |
870 | | - |
871 | void QPaintEngineEx::drawPixmap(const QPointF &pos, const QPixmap &pm) | - |
872 | { | - |
873 | drawPixmap(QRectF(pos, pm.size() / pm.devicePixelRatio()), pm, pm.rect()); | - |
874 | } executed: } Execution Count:3 | 3 |
875 | | - |
876 | void QPaintEngineEx::drawImage(const QPointF &pos, const QImage &image) | - |
877 | { | - |
878 | drawImage(QRectF(pos, image.size() / image.devicePixelRatio()), image, image.rect()); | - |
879 | } | 0 |
880 | | - |
881 | void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) | - |
882 | { | - |
883 | QBrush brush(state()->pen.color(), pixmap); | - |
884 | QTransform xform = QTransform::fromTranslate(r.x() - s.x(), r.y() - s.y()); | - |
885 | brush.setTransform(xform); | - |
886 | | - |
887 | qreal pts[] = { r.x(), r.y(), | - |
888 | r.x() + r.width(), r.y(), | - |
889 | r.x() + r.width(), r.y() + r.height(), | - |
890 | r.x(), r.y() + r.height() }; | - |
891 | | - |
892 | QVectorPath path(pts, 4, 0, QVectorPath::RectangleHint); | - |
893 | fill(path, brush); | - |
894 | } | 0 |
895 | | - |
896 | void QPaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, | - |
897 | const QPixmap &pixmap, QPainter::PixmapFragmentHints ) | - |
898 | { | - |
899 | if (pixmap.isNull()) partially evaluated: pixmap.isNull() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
900 | return; | 0 |
901 | | - |
902 | qreal oldOpacity = state()->opacity; | - |
903 | QTransform oldTransform = state()->matrix; | - |
904 | | - |
905 | for (int i = 0; i < fragmentCount; ++i) { evaluated: i < fragmentCount yes Evaluation Count:19 | yes Evaluation Count:3 |
| 3-19 |
906 | QTransform transform = oldTransform; | - |
907 | transform.translate(fragments[i].x, fragments[i].y); | - |
908 | transform.rotate(fragments[i].rotation); | - |
909 | state()->opacity = oldOpacity * fragments[i].opacity; | - |
910 | state()->matrix = transform; | - |
911 | opacityChanged(); | - |
912 | transformChanged(); | - |
913 | | - |
914 | qreal w = fragments[i].scaleX * fragments[i].width; | - |
915 | qreal h = fragments[i].scaleY * fragments[i].height; | - |
916 | QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, | - |
917 | fragments[i].width, fragments[i].height); | - |
918 | drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect); | - |
919 | } executed: } Execution Count:19 | 19 |
920 | | - |
921 | state()->opacity = oldOpacity; | - |
922 | state()->matrix = oldTransform; | - |
923 | opacityChanged(); | - |
924 | transformChanged(); | - |
925 | } executed: } Execution Count:3 | 3 |
926 | | - |
927 | void QPaintEngineEx::setState(QPainterState *s) | - |
928 | { | - |
929 | QPaintEngine::state = s; | - |
930 | } executed: } Execution Count:93235 | 93235 |
931 | | - |
932 | | - |
933 | void QPaintEngineEx::updateState(const QPaintEngineState &) | - |
934 | { | - |
935 | | - |
936 | } | - |
937 | | - |
938 | __attribute__((visibility("default"))) QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path) | - |
939 | { | - |
940 | const qreal *points = path.points(); | - |
941 | const QPainterPath::ElementType *types = path.elements(); | - |
942 | | - |
943 | QPainterPath p; | - |
944 | if (types) { | 0 |
945 | int id = 0; | - |
946 | for (int i=0; i<path.elementCount(); ++i) { never evaluated: i<path.elementCount() | 0 |
947 | switch(types[i]) { | - |
948 | case QPainterPath::MoveToElement: | - |
949 | p.moveTo(QPointF(points[id], points[id+1])); | - |
950 | id+=2; | - |
951 | break; | 0 |
952 | case QPainterPath::LineToElement: | - |
953 | p.lineTo(QPointF(points[id], points[id+1])); | - |
954 | id+=2; | - |
955 | break; | 0 |
956 | case QPainterPath::CurveToElement: { | - |
957 | QPointF p1(points[id], points[id+1]); | - |
958 | QPointF p2(points[id+2], points[id+3]); | - |
959 | QPointF p3(points[id+4], points[id+5]); | - |
960 | p.cubicTo(p1, p2, p3); | - |
961 | id+=6; | - |
962 | break; | 0 |
963 | } | - |
964 | case QPainterPath::CurveToDataElement: | - |
965 | ; | - |
966 | break; | 0 |
967 | } | - |
968 | } | 0 |
969 | } else { | 0 |
970 | p.moveTo(QPointF(points[0], points[1])); | - |
971 | int id = 2; | - |
972 | for (int i=1; i<path.elementCount(); ++i) { never evaluated: i<path.elementCount() | 0 |
973 | p.lineTo(QPointF(points[id], points[id+1])); | - |
974 | id+=2; | - |
975 | } | 0 |
976 | } | 0 |
977 | if (path.hints() & QVectorPath::WindingFill) never evaluated: path.hints() & QVectorPath::WindingFill | 0 |
978 | p.setFillRule(Qt::WindingFill); never executed: p.setFillRule(Qt::WindingFill); | 0 |
979 | | - |
980 | return p; never executed: return p; | 0 |
981 | } | - |
982 | | - |
983 | void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem) | - |
984 | { | - |
985 | QPainterPath path; | - |
986 | path.setFillRule(Qt::WindingFill); | - |
987 | | - |
988 | if (staticTextItem->numGlyphs == 0) partially evaluated: staticTextItem->numGlyphs == 0 no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
989 | return; | 0 |
990 | | - |
991 | QFontEngine *fontEngine = staticTextItem->fontEngine(); | - |
992 | fontEngine->addGlyphsToPath(staticTextItem->glyphs, staticTextItem->glyphPositions, | - |
993 | staticTextItem->numGlyphs, &path, 0); | - |
994 | if (!path.isEmpty()) { partially evaluated: !path.isEmpty() yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-19 |
995 | QPainterState *s = state(); | - |
996 | QPainter::RenderHints oldHints = s->renderHints; | - |
997 | bool changedHints = false; | - |
998 | if (bool(oldHints & QPainter::TextAntialiasing) partially evaluated: bool(oldHints & QPainter::TextAntialiasing) yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-19 |
999 | && !bool(fontEngine->fontDef.styleStrategy & QFont::NoAntialias) partially evaluated: !bool(fontEngine->fontDef.styleStrategy & QFont::NoAntialias) yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-19 |
1000 | && !bool(oldHints & QPainter::Antialiasing)) { partially evaluated: !bool(oldHints & QPainter::Antialiasing) yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-19 |
1001 | s->renderHints |= QPainter::Antialiasing; | - |
1002 | renderHintsChanged(); | - |
1003 | changedHints = true; | - |
1004 | } executed: } Execution Count:19 | 19 |
1005 | | - |
1006 | fill(qtVectorPathForPath(path), s->pen.brush()); | - |
1007 | | - |
1008 | if (changedHints) { partially evaluated: changedHints yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-19 |
1009 | s->renderHints = oldHints; | - |
1010 | renderHintsChanged(); | - |
1011 | } executed: } Execution Count:19 | 19 |
1012 | } executed: } Execution Count:19 | 19 |
1013 | } executed: } Execution Count:19 | 19 |
1014 | | - |
1015 | bool QPaintEngineEx::supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const | - |
1016 | { | - |
1017 | (void)fontEngine;; | - |
1018 | | - |
1019 | if (!m.isAffine()) never evaluated: !m.isAffine() | 0 |
1020 | return true; never executed: return true; | 0 |
1021 | | - |
1022 | return false; never executed: return false; | 0 |
1023 | } | - |
1024 | | - |
1025 | bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const | - |
1026 | { | - |
1027 | qreal pixelSize = fontEngine->fontDef.pixelSize; | - |
1028 | return (pixelSize * pixelSize * qAbs(m.determinant())) < | 23041 |
1029 | 64 * 64; executed: return (pixelSize * pixelSize * qAbs(m.determinant())) < 64 * 64; Execution Count:23041 | 23041 |
1030 | } | - |
1031 | | - |
1032 | | - |
1033 | | - |
| | |