qpaintengineex.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qpaintengineex.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qpaintengineex_p.h"-
41#include "qpainter_p.h"-
42#include "qstroker_p.h"-
43#include "qbezier_p.h"-
44#include <private/qpainterpath_p.h>-
45#include <private/qfontengine_p.h>-
46#include <private/qstatictext_p.h>-
47-
48#include <qvarlengtharray.h>-
49#include <qdebug.h>-
50-
51-
52QT_BEGIN_NAMESPACE-
53-
54#if !defined(QT_MAX_CACHED_GLYPH_SIZE)-
55# define QT_MAX_CACHED_GLYPH_SIZE 64-
56#endif-
57-
58/*******************************************************************************-
59 *-
60 * class QVectorPath-
61 *-
62 */-
63QVectorPath::~QVectorPath()-
64{-
65 if (m_hints & ShouldUseCacheHint) {
m_hints & ShouldUseCacheHintDescription
TRUEnever evaluated
FALSEnever evaluated
0
66 CacheEntry *e = m_cache;-
67 while (e) {
eDescription
TRUEnever evaluated
FALSEnever evaluated
0
68 if (e->data)
e->dataDescription
TRUEnever evaluated
FALSEnever evaluated
0
69 e->cleanup(e->engine, e->data);
never executed: e->cleanup(e->engine, e->data);
0
70 CacheEntry *n = e->next;-
71 delete e;-
72 e = n;-
73 }
never executed: end of block
0
74 }
never executed: end of block
0
75}
never executed: end of block
0
76-
77-
78QRectF QVectorPath::controlPointRect() const-
79{-
80 if (m_hints & ControlPointRect)
m_hints & ControlPointRectDescription
TRUEnever evaluated
FALSEnever evaluated
0
81 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
82-
83 if (m_count == 0) {
m_count == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
84 m_cp_rect.x1 = m_cp_rect.x2 = m_cp_rect.y1 = m_cp_rect.y2 = 0;-
85 m_hints |= ControlPointRect;-
86 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
87 }-
88 Q_ASSERT(m_points && m_count > 0);-
89-
90 const qreal *pts = m_points;-
91 m_cp_rect.x1 = m_cp_rect.x2 = *pts;-
92 ++pts;-
93 m_cp_rect.y1 = m_cp_rect.y2 = *pts;-
94 ++pts;-
95-
96 const qreal *epts = m_points + (m_count << 1);-
97 while (pts < epts) {
pts < eptsDescription
TRUEnever evaluated
FALSEnever evaluated
0
98 qreal x = *pts;-
99 if (x < m_cp_rect.x1) m_cp_rect.x1 = x;
never executed: m_cp_rect.x1 = x;
x < m_cp_rect.x1Description
TRUEnever evaluated
FALSEnever evaluated
0
100 else if (x > m_cp_rect.x2) m_cp_rect.x2 = x;
never executed: m_cp_rect.x2 = x;
x > m_cp_rect.x2Description
TRUEnever evaluated
FALSEnever evaluated
0
101 ++pts;-
102-
103 qreal y = *pts;-
104 if (y < m_cp_rect.y1) m_cp_rect.y1 = y;
never executed: m_cp_rect.y1 = y;
y < m_cp_rect.y1Description
TRUEnever evaluated
FALSEnever evaluated
0
105 else if (y > m_cp_rect.y2) m_cp_rect.y2 = y;
never executed: m_cp_rect.y2 = y;
y > m_cp_rect.y2Description
TRUEnever evaluated
FALSEnever evaluated
0
106 ++pts;-
107 }
never executed: end of block
0
108-
109 m_hints |= ControlPointRect;-
110 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
111}-
112-
113-
114QVectorPath::CacheEntry *QVectorPath::addCacheData(QPaintEngineEx *engine, void *data,-
115 qvectorpath_cache_cleanup cleanup) const{-
116 Q_ASSERT(!lookupCacheData(engine));-
117 if ((m_hints & IsCachedHint) == 0) {
(m_hints & IsCachedHint) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
118 m_cache = 0;-
119 m_hints |= IsCachedHint;-
120 }
never executed: end of block
0
121 CacheEntry *e = new CacheEntry;-
122 e->engine = engine;-
123 e->data = data;-
124 e->cleanup = cleanup;-
125 e->next = m_cache;-
126 m_cache = e;-
127 return m_cache;
never executed: return m_cache;
0
128}-
129-
130-
131const QVectorPath &qtVectorPathForPath(const QPainterPath &path)-
132{-
133 Q_ASSERT(path.d_func());-
134 return path.d_func()->vectorPath();
never executed: return path.d_func()->vectorPath();
0
135}-
136-
137#ifndef QT_NO_DEBUG_STREAM-
138QDebug Q_GUI_EXPORT &operator<<(QDebug &s, const QVectorPath &path)-
139{-
140 QRectF rf = path.controlPointRect();-
141 s << "QVectorPath(size:" << path.elementCount()-
142 << " hints:" << hex << path.hints()-
143 << rf << ')';-
144 return s;
never executed: return s;
0
145}-
146#endif-
147-
148/*******************************************************************************-
149 *-
150 * class QPaintEngineExPrivate:-
151 *-
152 */-
153-
154-
155struct StrokeHandler {-
156 StrokeHandler(int reserve) : pts(reserve), types(reserve) {}
never executed: end of block
0
157 QDataBuffer<qreal> pts;-
158 QDataBuffer<QPainterPath::ElementType> types;-
159};-
160-
161-
162QPaintEngineExPrivate::QPaintEngineExPrivate()-
163 : dasher(&stroker),-
164 strokeHandler(0),-
165 activeStroker(0),-
166 strokerPen(Qt::NoPen)-
167{-
168}
never executed: end of block
0
169-
170-
171QPaintEngineExPrivate::~QPaintEngineExPrivate()-
172{-
173 delete strokeHandler;-
174}
never executed: end of block
0
175-
176-
177void QPaintEngineExPrivate::replayClipOperations()-
178{-
179 Q_Q(QPaintEngineEx);-
180-
181 QPainter *p = q->painter();-
182 if (!p || !p->d_ptr)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!p->d_ptrDescription
TRUEnever evaluated
FALSEnever evaluated
0
183 return;
never executed: return;
0
184-
185 const QVector<QPainterClipInfo> &clipInfo = p->d_ptr->state->clipInfo;-
186-
187 QTransform transform = q->state()->matrix;-
188-
189 for (const QPainterClipInfo &info : clipInfo) {-
190-
191 if (info.matrix != q->state()->matrix) {
info.matrix !=...tate()->matrixDescription
TRUEnever evaluated
FALSEnever evaluated
0
192 q->state()->matrix = info.matrix;-
193 q->transformChanged();-
194 }
never executed: end of block
0
195-
196 switch (info.clipType) {-
197 case QPainterClipInfo::RegionClip:
never executed: case QPainterClipInfo::RegionClip:
0
198 q->clip(info.region, info.operation);-
199 break;
never executed: break;
0
200 case QPainterClipInfo::PathClip:
never executed: case QPainterClipInfo::PathClip:
0
201 q->clip(info.path, info.operation);-
202 break;
never executed: break;
0
203 case QPainterClipInfo::RectClip:
never executed: case QPainterClipInfo::RectClip:
0
204 q->clip(info.rect, info.operation);-
205 break;
never executed: break;
0
206 case QPainterClipInfo::RectFClip: {
never executed: case QPainterClipInfo::RectFClip:
0
207 qreal right = info.rectf.x() + info.rectf.width();-
208 qreal bottom = info.rectf.y() + info.rectf.height();-
209 qreal pts[] = { info.rectf.x(), info.rectf.y(),-
210 right, info.rectf.y(),-
211 right, bottom,-
212 info.rectf.x(), bottom };-
213 QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint);-
214 q->clip(vp, info.operation);-
215 break;
never executed: break;
0
216 }-
217 }-
218 }
never executed: end of block
0
219-
220 if (transform != q->state()->matrix) {
transform != q...tate()->matrixDescription
TRUEnever evaluated
FALSEnever evaluated
0
221 q->state()->matrix = transform;-
222 q->transformChanged();-
223 }
never executed: end of block
0
224}
never executed: end of block
0
225-
226-
227bool QPaintEngineExPrivate::hasClipOperations() const-
228{-
229 Q_Q(const QPaintEngineEx);-
230-
231 QPainter *p = q->painter();-
232 if (!p || !p->d_ptr)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
!p->d_ptrDescription
TRUEnever evaluated
FALSEnever evaluated
0
233 return false;
never executed: return false;
0
234-
235 return !p->d_ptr->state->clipInfo.isEmpty();
never executed: return !p->d_ptr->state->clipInfo.isEmpty();
0
236}-
237-
238/*******************************************************************************-
239 *-
240 * class QPaintEngineEx:-
241 *-
242 */-
243-
244static const QPainterPath::ElementType qpaintengineex_ellipse_types[] = {-
245 QPainterPath::MoveToElement,-
246 QPainterPath::CurveToElement,-
247 QPainterPath::CurveToDataElement,-
248 QPainterPath::CurveToDataElement,-
249-
250 QPainterPath::CurveToElement,-
251 QPainterPath::CurveToDataElement,-
252 QPainterPath::CurveToDataElement,-
253-
254 QPainterPath::CurveToElement,-
255 QPainterPath::CurveToDataElement,-
256 QPainterPath::CurveToDataElement,-
257-
258 QPainterPath::CurveToElement,-
259 QPainterPath::CurveToDataElement,-
260 QPainterPath::CurveToDataElement-
261};-
262-
263static const QPainterPath::ElementType qpaintengineex_line_types_16[] = {-
264 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
265 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
266 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
267 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
268 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
269 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
270 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
271 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
272 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
273 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
274 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
275 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
276 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
277 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
278 QPainterPath::MoveToElement, QPainterPath::LineToElement,-
279 QPainterPath::MoveToElement, QPainterPath::LineToElement-
280};-
281-
282static const QPainterPath::ElementType qpaintengineex_rect4_types_32[] = {-
283 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 1-
284 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 2-
285 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 3-
286 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 4-
287 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 5-
288 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 6-
289 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 7-
290 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 8-
291 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 9-
292 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 10-
293 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 11-
294 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 12-
295 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 13-
296 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 14-
297 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 15-
298 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 16-
299 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 17-
300 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 18-
301 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 19-
302 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 20-
303 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 21-
304 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 22-
305 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 23-
306 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 24-
307 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 25-
308 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 26-
309 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 27-
310 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 28-
311 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 29-
312 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 30-
313 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 31-
314 QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 32-
315};-
316-
317-
318static const QPainterPath::ElementType qpaintengineex_roundedrect_types[] = {-
319 QPainterPath::MoveToElement,-
320 QPainterPath::LineToElement,-
321 QPainterPath::CurveToElement,-
322 QPainterPath::CurveToDataElement,-
323 QPainterPath::CurveToDataElement,-
324 QPainterPath::LineToElement,-
325 QPainterPath::CurveToElement,-
326 QPainterPath::CurveToDataElement,-
327 QPainterPath::CurveToDataElement,-
328 QPainterPath::LineToElement,-
329 QPainterPath::CurveToElement,-
330 QPainterPath::CurveToDataElement,-
331 QPainterPath::CurveToDataElement,-
332 QPainterPath::LineToElement,-
333 QPainterPath::CurveToElement,-
334 QPainterPath::CurveToDataElement,-
335 QPainterPath::CurveToDataElement-
336};-
337-
338-
339-
340static void qpaintengineex_moveTo(qreal x, qreal y, void *data) {-
341 ((StrokeHandler *) data)->pts.add(x);-
342 ((StrokeHandler *) data)->pts.add(y);-
343 ((StrokeHandler *) data)->types.add(QPainterPath::MoveToElement);-
344}
never executed: end of block
0
345-
346static void qpaintengineex_lineTo(qreal x, qreal y, void *data) {-
347 ((StrokeHandler *) data)->pts.add(x);-
348 ((StrokeHandler *) data)->pts.add(y);-
349 ((StrokeHandler *) data)->types.add(QPainterPath::LineToElement);-
350}
never executed: end of block
0
351-
352static void qpaintengineex_cubicTo(qreal c1x, qreal c1y, qreal c2x, qreal c2y, qreal ex, qreal ey, void *data) {-
353 ((StrokeHandler *) data)->pts.add(c1x);-
354 ((StrokeHandler *) data)->pts.add(c1y);-
355 ((StrokeHandler *) data)->types.add(QPainterPath::CurveToElement);-
356-
357 ((StrokeHandler *) data)->pts.add(c2x);-
358 ((StrokeHandler *) data)->pts.add(c2y);-
359 ((StrokeHandler *) data)->types.add(QPainterPath::CurveToDataElement);-
360-
361 ((StrokeHandler *) data)->pts.add(ex);-
362 ((StrokeHandler *) data)->pts.add(ey);-
363 ((StrokeHandler *) data)->types.add(QPainterPath::CurveToDataElement);-
364}
never executed: end of block
0
365-
366QPaintEngineEx::QPaintEngineEx()-
367 : QPaintEngine(*new QPaintEngineExPrivate, AllFeatures)-
368{-
369 extended = true;-
370}
never executed: end of block
0
371-
372QPaintEngineEx::QPaintEngineEx(QPaintEngineExPrivate &data)-
373 : QPaintEngine(data, AllFeatures)-
374{-
375 extended = true;-
376}
never executed: end of block
0
377-
378QPainterState *QPaintEngineEx::createState(QPainterState *orig) const-
379{-
380 if (!orig)
!origDescription
TRUEnever evaluated
FALSEnever evaluated
0
381 return new QPainterState;
never executed: return new QPainterState;
0
382 return new QPainterState(orig);
never executed: return new QPainterState(orig);
0
383}-
384-
385Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp-
386-
387void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)-
388{-
389#ifdef QT_DEBUG_DRAW-
390 qDebug() << "QPaintEngineEx::stroke()" << pen;-
391#endif-
392-
393 Q_D(QPaintEngineEx);-
394-
395 if (path.isEmpty())
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
396 return;
never executed: return;
0
397-
398 if (!d->strokeHandler) {
!d->strokeHandlerDescription
TRUEnever evaluated
FALSEnever evaluated
0
399 d->strokeHandler = new StrokeHandler(path.elementCount()+4);-
400 d->stroker.setMoveToHook(qpaintengineex_moveTo);-
401 d->stroker.setLineToHook(qpaintengineex_lineTo);-
402 d->stroker.setCubicToHook(qpaintengineex_cubicTo);-
403 }
never executed: end of block
0
404-
405 if (!qpen_fast_equals(pen, d->strokerPen)) {
!qpen_fast_equ...d->strokerPen)Description
TRUEnever evaluated
FALSEnever evaluated
0
406 d->strokerPen = pen;-
407 d->stroker.setJoinStyle(pen.joinStyle());-
408 d->stroker.setCapStyle(pen.capStyle());-
409 d->stroker.setMiterLimit(pen.miterLimit());-
410 qreal penWidth = pen.widthF();-
411 if (penWidth == 0)
penWidth == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
412 d->stroker.setStrokeWidth(1);
never executed: d->stroker.setStrokeWidth(1);
0
413 else-
414 d->stroker.setStrokeWidth(penWidth);
never executed: d->stroker.setStrokeWidth(penWidth);
0
415-
416 Qt::PenStyle style = pen.style();-
417 if (style == Qt::SolidLine) {
style == Qt::SolidLineDescription
TRUEnever evaluated
FALSEnever evaluated
0
418 d->activeStroker = &d->stroker;-
419 } else if (style == Qt::NoPen) {
never executed: end of block
style == Qt::NoPenDescription
TRUEnever evaluated
FALSEnever evaluated
0
420 d->activeStroker = 0;-
421 } else {
never executed: end of block
0
422 d->dasher.setDashPattern(pen.dashPattern());-
423 d->dasher.setDashOffset(pen.dashOffset());-
424 d->activeStroker = &d->dasher;-
425 }
never executed: end of block
0
426 }-
427-
428 if (!d->activeStroker) {
!d->activeStrokerDescription
TRUEnever evaluated
FALSEnever evaluated
0
429 return;
never executed: return;
0
430 }-
431-
432 if (pen.style() > Qt::SolidLine) {
pen.style() > Qt::SolidLineDescription
TRUEnever evaluated
FALSEnever evaluated
0
433 if (qt_pen_is_cosmetic(pen, state()->renderHints)){
qt_pen_is_cosm...->renderHints)Description
TRUEnever evaluated
FALSEnever evaluated
0
434 d->activeStroker->setClipRect(d->exDeviceRect);-
435 } else {
never executed: end of block
0
436 QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect));-
437 d->activeStroker->setClipRect(clipRect);-
438 }
never executed: end of block
0
439 }-
440-
441 const QPainterPath::ElementType *types = path.elements();-
442 const qreal *points = path.points();-
443 int pointCount = path.elementCount();-
444-
445 const qreal *lastPoint = points + (pointCount<<1);-
446-
447 d->strokeHandler->types.reset();-
448 d->strokeHandler->pts.reset();-
449-
450 // Some engines might decide to optimize for the non-shape hint later on...-
451 uint flags = QVectorPath::WindingFill;-
452-
453 if (path.elementCount() > 2)
path.elementCount() > 2Description
TRUEnever evaluated
FALSEnever evaluated
0
454 flags |= QVectorPath::NonConvexShapeMask;
never executed: flags |= QVectorPath::NonConvexShapeMask;
0
455-
456 if (d->stroker.capStyle() == Qt::RoundCap || d->stroker.joinStyle() == Qt::RoundJoin)
d->stroker.cap...= Qt::RoundCapDescription
TRUEnever evaluated
FALSEnever evaluated
d->stroker.joi... Qt::RoundJoinDescription
TRUEnever evaluated
FALSEnever evaluated
0
457 flags |= QVectorPath::CurvedShapeMask;
never executed: flags |= QVectorPath::CurvedShapeMask;
0
458-
459 // ### Perspective Xforms are currently not supported...-
460 if (!qt_pen_is_cosmetic(pen, state()->renderHints)) {
!qt_pen_is_cos...->renderHints)Description
TRUEnever evaluated
FALSEnever evaluated
0
461 // We include cosmetic pens in this case to avoid having to-
462 // change the current transform. Normal transformed,-
463 // non-cosmetic pens will be transformed as part of fill-
464 // later, so they are also covered here..-
465 d->activeStroker->setCurveThresholdFromTransform(state()->matrix);-
466 d->activeStroker->begin(d->strokeHandler);-
467 if (types) {
typesDescription
TRUEnever evaluated
FALSEnever evaluated
0
468 while (points < lastPoint) {
points < lastPointDescription
TRUEnever evaluated
FALSEnever evaluated
0
469 switch (*types) {-
470 case QPainterPath::MoveToElement:
never executed: case QPainterPath::MoveToElement:
0
471 d->activeStroker->moveTo(points[0], points[1]);-
472 points += 2;-
473 ++types;-
474 break;
never executed: break;
0
475 case QPainterPath::LineToElement:
never executed: case QPainterPath::LineToElement:
0
476 d->activeStroker->lineTo(points[0], points[1]);-
477 points += 2;-
478 ++types;-
479 break;
never executed: break;
0
480 case QPainterPath::CurveToElement:
never executed: case QPainterPath::CurveToElement:
0
481 d->activeStroker->cubicTo(points[0], points[1],-
482 points[2], points[3],-
483 points[4], points[5]);-
484 points += 6;-
485 types += 3;-
486 flags |= QVectorPath::CurvedShapeMask;-
487 break;
never executed: break;
0
488 default:
never executed: default:
0
489 break;
never executed: break;
0
490 }-
491 }-
492 if (path.hasImplicitClose())
path.hasImplicitClose()Description
TRUEnever evaluated
FALSEnever evaluated
0
493 d->activeStroker->lineTo(path.points()[0], path.points()[1]);
never executed: d->activeStroker->lineTo(path.points()[0], path.points()[1]);
0
494-
495 } else {
never executed: end of block
0
496 d->activeStroker->moveTo(points[0], points[1]);-
497 points += 2;-
498 while (points < lastPoint) {
points < lastPointDescription
TRUEnever evaluated
FALSEnever evaluated
0
499 d->activeStroker->lineTo(points[0], points[1]);-
500 points += 2;-
501 }
never executed: end of block
0
502 if (path.hasImplicitClose())
path.hasImplicitClose()Description
TRUEnever evaluated
FALSEnever evaluated
0
503 d->activeStroker->lineTo(path.points()[0], path.points()[1]);
never executed: d->activeStroker->lineTo(path.points()[0], path.points()[1]);
0
504 }
never executed: end of block
0
505 d->activeStroker->end();-
506-
507 if (!d->strokeHandler->types.size()) // an empty path...
!d->strokeHand...->types.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
508 return;
never executed: return;
0
509-
510 QVectorPath strokePath(d->strokeHandler->pts.data(),-
511 d->strokeHandler->types.size(),-
512 d->strokeHandler->types.data(),-
513 flags);-
514 fill(strokePath, pen.brush());-
515 } else {
never executed: end of block
0
516 // For cosmetic pens we need a bit of trickery... We to process xform the input points-
517 if (state()->matrix.type() >= QTransform::TxProject) {
state()->matri...orm::TxProjectDescription
TRUEnever evaluated
FALSEnever evaluated
0
518 QPainterPath painterPath = state()->matrix.map(path.convertToPainterPath());-
519 d->activeStroker->strokePath(painterPath, d->strokeHandler, QTransform());-
520 } else {
never executed: end of block
0
521 d->activeStroker->setCurveThresholdFromTransform(QTransform());-
522 d->activeStroker->begin(d->strokeHandler);-
523 if (types) {
typesDescription
TRUEnever evaluated
FALSEnever evaluated
0
524 while (points < lastPoint) {
points < lastPointDescription
TRUEnever evaluated
FALSEnever evaluated
0
525 switch (*types) {-
526 case QPainterPath::MoveToElement: {
never executed: case QPainterPath::MoveToElement:
0
527 QPointF pt = (*(const QPointF *) points) * state()->matrix;-
528 d->activeStroker->moveTo(pt.x(), pt.y());-
529 points += 2;-
530 ++types;-
531 break;
never executed: break;
0
532 }-
533 case QPainterPath::LineToElement: {
never executed: case QPainterPath::LineToElement:
0
534 QPointF pt = (*(const QPointF *) points) * state()->matrix;-
535 d->activeStroker->lineTo(pt.x(), pt.y());-
536 points += 2;-
537 ++types;-
538 break;
never executed: break;
0
539 }-
540 case QPainterPath::CurveToElement: {
never executed: case QPainterPath::CurveToElement:
0
541 QPointF c1 = ((const QPointF *) points)[0] * state()->matrix;-
542 QPointF c2 = ((const QPointF *) points)[1] * state()->matrix;-
543 QPointF e = ((const QPointF *) points)[2] * state()->matrix;-
544 d->activeStroker->cubicTo(c1.x(), c1.y(), c2.x(), c2.y(), e.x(), e.y());-
545 points += 6;-
546 types += 3;-
547 flags |= QVectorPath::CurvedShapeMask;-
548 break;
never executed: break;
0
549 }-
550 default:
never executed: default:
0
551 break;
never executed: break;
0
552 }-
553 }-
554 if (path.hasImplicitClose()) {
path.hasImplicitClose()Description
TRUEnever evaluated
FALSEnever evaluated
0
555 QPointF pt = * ((const QPointF *) path.points()) * state()->matrix;-
556 d->activeStroker->lineTo(pt.x(), pt.y());-
557 }
never executed: end of block
0
558-
559 } else {
never executed: end of block
0
560 QPointF p = ((const QPointF *)points)[0] * state()->matrix;-
561 d->activeStroker->moveTo(p.x(), p.y());-
562 points += 2;-
563 while (points < lastPoint) {
points < lastPointDescription
TRUEnever evaluated
FALSEnever evaluated
0
564 QPointF p = ((const QPointF *)points)[0] * state()->matrix;-
565 d->activeStroker->lineTo(p.x(), p.y());-
566 points += 2;-
567 }
never executed: end of block
0
568 if (path.hasImplicitClose())
path.hasImplicitClose()Description
TRUEnever evaluated
FALSEnever evaluated
0
569 d->activeStroker->lineTo(p.x(), p.y());
never executed: d->activeStroker->lineTo(p.x(), p.y());
0
570 }
never executed: end of block
0
571 d->activeStroker->end();-
572 }
never executed: end of block
0
573-
574 QVectorPath strokePath(d->strokeHandler->pts.data(),-
575 d->strokeHandler->types.size(),-
576 d->strokeHandler->types.data(),-
577 flags);-
578-
579 QTransform xform = state()->matrix;-
580 state()->matrix = QTransform();-
581 transformChanged();-
582-
583 QBrush brush = pen.brush();-
584 if (qbrush_style(brush) != Qt::SolidPattern)
qbrush_style(b...::SolidPatternDescription
TRUEnever evaluated
FALSEnever evaluated
0
585 brush.setTransform(brush.transform() * xform);
never executed: brush.setTransform(brush.transform() * xform);
0
586-
587 fill(strokePath, brush);-
588-
589 state()->matrix = xform;-
590 transformChanged();-
591 }
never executed: end of block
0
592}-
593-
594void QPaintEngineEx::draw(const QVectorPath &path)-
595{-
596 const QBrush &brush = state()->brush;-
597 if (qbrush_style(brush) != Qt::NoBrush)
qbrush_style(b...!= Qt::NoBrushDescription
TRUEnever evaluated
FALSEnever evaluated
0
598 fill(path, brush);
never executed: fill(path, brush);
0
599-
600 const QPen &pen = state()->pen;-
601 if (qpen_style(pen) != Qt::NoPen && qbrush_style(qpen_brush(pen)) != Qt::NoBrush)
qpen_style(pen) != Qt::NoPenDescription
TRUEnever evaluated
FALSEnever evaluated
qbrush_style(q...!= Qt::NoBrushDescription
TRUEnever evaluated
FALSEnever evaluated
0
602 stroke(path, pen);
never executed: stroke(path, pen);
0
603}
never executed: end of block
0
604-
605-
606void QPaintEngineEx::clip(const QRect &r, Qt::ClipOperation op)-
607{-
608 qreal right = r.x() + r.width();-
609 qreal bottom = r.y() + r.height();-
610 qreal pts[] = { qreal(r.x()), qreal(r.y()),-
611 right, qreal(r.y()),-
612 right, bottom,-
613 qreal(r.x()), bottom,-
614 qreal(r.x()), qreal(r.y()) };-
615 QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);-
616 clip(vp, op);-
617}
never executed: end of block
0
618-
619void QPaintEngineEx::clip(const QRegion &region, Qt::ClipOperation op)-
620{-
621 if (region.rectCount() == 1)
region.rectCount() == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
622 clip(region.boundingRect(), op);
never executed: clip(region.boundingRect(), op);
0
623-
624 QVector<QRect> rects = region.rects();-
625 if (rects.size() <= 32) {
rects.size() <= 32Description
TRUEnever evaluated
FALSEnever evaluated
0
626 qreal pts[2*32*4];-
627 int pos = 0;-
628 for (QVector<QRect>::const_iterator i = rects.constBegin(); i != rects.constEnd(); ++i) {
i != rects.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
629 qreal x1 = i->x();-
630 qreal y1 = i->y();-
631 qreal x2 = i->x() + i->width();-
632 qreal y2 = i->y() + i->height();-
633-
634 pts[pos++] = x1;-
635 pts[pos++] = y1;-
636-
637 pts[pos++] = x2;-
638 pts[pos++] = y1;-
639-
640 pts[pos++] = x2;-
641 pts[pos++] = y2;-
642-
643 pts[pos++] = x1;-
644 pts[pos++] = y2;-
645 }
never executed: end of block
0
646 QVectorPath vp(pts, rects.size() * 4, qpaintengineex_rect4_types_32);-
647 clip(vp, op);-
648 } else {
never executed: end of block
0
649 QVarLengthArray<qreal> pts(rects.size() * 2 * 4);-
650 QVarLengthArray<QPainterPath::ElementType> types(rects.size() * 4);-
651 int ppos = 0;-
652 int tpos = 0;-
653-
654 for (QVector<QRect>::const_iterator i = rects.constBegin(); i != rects.constEnd(); ++i) {
i != rects.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
655 qreal x1 = i->x();-
656 qreal y1 = i->y();-
657 qreal x2 = i->x() + i->width();-
658 qreal y2 = i->y() + i->height();-
659-
660 pts[ppos++] = x1;-
661 pts[ppos++] = y1;-
662-
663 pts[ppos++] = x2;-
664 pts[ppos++] = y1;-
665-
666 pts[ppos++] = x2;-
667 pts[ppos++] = y2;-
668-
669 pts[ppos++] = x1;-
670 pts[ppos++] = y2;-
671-
672 types[tpos++] = QPainterPath::MoveToElement;-
673 types[tpos++] = QPainterPath::LineToElement;-
674 types[tpos++] = QPainterPath::LineToElement;-
675 types[tpos++] = QPainterPath::LineToElement;-
676 }
never executed: end of block
0
677-
678 QVectorPath vp(pts.data(), rects.size() * 4, types.data());-
679 clip(vp, op);-
680 }
never executed: end of block
0
681-
682}-
683-
684void QPaintEngineEx::clip(const QPainterPath &path, Qt::ClipOperation op)-
685{-
686 if (path.isEmpty()) {
path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
687 QVectorPath vp(0, 0);-
688 clip(vp, op);-
689 } else {
never executed: end of block
0
690 clip(qtVectorPathForPath(path), op);-
691 }
never executed: end of block
0
692}-
693-
694void QPaintEngineEx::fillRect(const QRectF &r, const QBrush &brush)-
695{-
696 qreal pts[] = { r.x(), r.y(), r.x() + r.width(), r.y(),-
697 r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() };-
698 QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint);-
699 fill(vp, brush);-
700}
never executed: end of block
0
701-
702void QPaintEngineEx::fillRect(const QRectF &r, const QColor &color)-
703{-
704 fillRect(r, QBrush(color));-
705}
never executed: end of block
0
706-
707void QPaintEngineEx::drawRects(const QRect *rects, int rectCount)-
708{-
709 for (int i=0; i<rectCount; ++i) {
i<rectCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
710 const QRect &r = rects[i];-
711 // ### Is there a one off here?-
712 qreal right = r.x() + r.width();-
713 qreal bottom = r.y() + r.height();-
714 qreal pts[] = { qreal(r.x()), qreal(r.y()),-
715 right, qreal(r.y()),-
716 right, bottom,-
717 qreal(r.x()), bottom,-
718 qreal(r.x()), qreal(r.y()) };-
719 QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);-
720 draw(vp);-
721 }
never executed: end of block
0
722}
never executed: end of block
0
723-
724void QPaintEngineEx::drawRects(const QRectF *rects, int rectCount)-
725{-
726 for (int i=0; i<rectCount; ++i) {
i<rectCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
727 const QRectF &r = rects[i];-
728 qreal right = r.x() + r.width();-
729 qreal bottom = r.y() + r.height();-
730 qreal pts[] = { r.x(), r.y(),-
731 right, r.y(),-
732 right, bottom,-
733 r.x(), bottom,-
734 r.x(), r.y() };-
735 QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);-
736 draw(vp);-
737 }
never executed: end of block
0
738}
never executed: end of block
0
739-
740-
741void QPaintEngineEx::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,-
742 Qt::SizeMode mode)-
743{-
744 qreal x1 = rect.left();-
745 qreal x2 = rect.right();-
746 qreal y1 = rect.top();-
747 qreal y2 = rect.bottom();-
748-
749 if (mode == Qt::RelativeSize) {
mode == Qt::RelativeSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
750 xRadius = xRadius * rect.width() / 200.;-
751 yRadius = yRadius * rect.height() / 200.;-
752 }
never executed: end of block
0
753-
754 xRadius = qMin(xRadius, rect.width() / 2);-
755 yRadius = qMin(yRadius, rect.height() / 2);-
756-
757 qreal pts[] = {-
758 x1 + xRadius, y1, // MoveTo-
759 x2 - xRadius, y1, // LineTo-
760 x2 - (1 - KAPPA) * xRadius, y1, // CurveTo-
761 x2, y1 + (1 - KAPPA) * yRadius,-
762 x2, y1 + yRadius,-
763 x2, y2 - yRadius, // LineTo-
764 x2, y2 - (1 - KAPPA) * yRadius, // CurveTo-
765 x2 - (1 - KAPPA) * xRadius, y2,-
766 x2 - xRadius, y2,-
767 x1 + xRadius, y2, // LineTo-
768 x1 + (1 - KAPPA) * xRadius, y2, // CurveTo-
769 x1, y2 - (1 - KAPPA) * yRadius,-
770 x1, y2 - yRadius,-
771 x1, y1 + yRadius, // LineTo-
772 x1, y1 + (1 - KAPPA) * yRadius, // CurveTo-
773 x1 + (1 - KAPPA) * xRadius, y1,-
774 x1 + xRadius, y1-
775 };-
776-
777 QVectorPath path(pts, 17, qpaintengineex_roundedrect_types, QVectorPath::RoundedRectHint);-
778 draw(path);-
779}
never executed: end of block
0
780-
781-
782-
783void QPaintEngineEx::drawLines(const QLine *lines, int lineCount)-
784{-
785 int elementCount = lineCount << 1;-
786 while (elementCount > 0) {
elementCount > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
787 int count = qMin(elementCount, 32);-
788-
789 qreal pts[64];-
790 int count2 = count<<1;-
791 for (int i=0; i<count2; ++i)
i<count2Description
TRUEnever evaluated
FALSEnever evaluated
0
792 pts[i] = ((const int *) lines)[i];
never executed: pts[i] = ((const int *) lines)[i];
0
793-
794 QVectorPath path(pts, count, qpaintengineex_line_types_16, QVectorPath::LinesHint);-
795 stroke(path, state()->pen);-
796-
797 elementCount -= 32;-
798 lines += 16;-
799 }
never executed: end of block
0
800}
never executed: end of block
0
801-
802void QPaintEngineEx::drawLines(const QLineF *lines, int lineCount)-
803{-
804 int elementCount = lineCount << 1;-
805 while (elementCount > 0) {
elementCount > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
806 int count = qMin(elementCount, 32);-
807-
808 QVectorPath path((const qreal *) lines, count, qpaintengineex_line_types_16,-
809 QVectorPath::LinesHint);-
810 stroke(path, state()->pen);-
811-
812 elementCount -= 32;-
813 lines += 16;-
814 }
never executed: end of block
0
815}
never executed: end of block
0
816-
817void QPaintEngineEx::drawEllipse(const QRectF &r)-
818{-
819 qreal pts[26]; // QPointF[13] without constructors...-
820 union {-
821 qreal *ptr;-
822 QPointF *points;-
823 } x;-
824 x.ptr = pts;-
825-
826 int point_count = 0;-
827 x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count);-
828 if (point_count == 0)
point_count == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
829 return;
never executed: return;
0
830 QVectorPath vp((qreal *) pts, point_count + 1, qpaintengineex_ellipse_types, QVectorPath::EllipseHint);-
831 draw(vp);-
832}
never executed: end of block
0
833-
834void QPaintEngineEx::drawEllipse(const QRect &r)-
835{-
836 drawEllipse(QRectF(r));-
837}
never executed: end of block
0
838-
839void QPaintEngineEx::drawPath(const QPainterPath &path)-
840{-
841 if (!path.isEmpty())
!path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
842 draw(qtVectorPathForPath(path));
never executed: draw(qtVectorPathForPath(path));
0
843}
never executed: end of block
0
844-
845-
846void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount)-
847{-
848 QPen pen = state()->pen;-
849 if (pen.capStyle() == Qt::FlatCap)
pen.capStyle() == Qt::FlatCapDescription
TRUEnever evaluated
FALSEnever evaluated
0
850 pen.setCapStyle(Qt::SquareCap);
never executed: pen.setCapStyle(Qt::SquareCap);
0
851-
852 if (pen.brush().isOpaque()) {
pen.brush().isOpaque()Description
TRUEnever evaluated
FALSEnever evaluated
0
853 while (pointCount > 0) {
pointCount > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
854 int count = qMin(pointCount, 16);-
855 qreal pts[64];-
856 int oset = -1;-
857 for (int i=0; i<count; ++i) {
i<countDescription
TRUEnever evaluated
FALSEnever evaluated
0
858 pts[++oset] = points[i].x();-
859 pts[++oset] = points[i].y();-
860 pts[++oset] = points[i].x() + 1/63.;-
861 pts[++oset] = points[i].y();-
862 }
never executed: end of block
0
863 QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint);-
864 stroke(path, pen);-
865 pointCount -= 16;-
866 points += 16;-
867 }
never executed: end of block
0
868 } else {
never executed: end of block
0
869 for (int i=0; i<pointCount; ++i) {
i<pointCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
870 qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + qreal(1/63.), points[i].y() };-
871 QVectorPath path(pts, 2, 0);-
872 stroke(path, pen);-
873 }
never executed: end of block
0
874 }
never executed: end of block
0
875}-
876-
877void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)-
878{-
879 QPen pen = state()->pen;-
880 if (pen.capStyle() == Qt::FlatCap)
pen.capStyle() == Qt::FlatCapDescription
TRUEnever evaluated
FALSEnever evaluated
0
881 pen.setCapStyle(Qt::SquareCap);
never executed: pen.setCapStyle(Qt::SquareCap);
0
882-
883 if (pen.brush().isOpaque()) {
pen.brush().isOpaque()Description
TRUEnever evaluated
FALSEnever evaluated
0
884 while (pointCount > 0) {
pointCount > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
885 int count = qMin(pointCount, 16);-
886 qreal pts[64];-
887 int oset = -1;-
888 for (int i=0; i<count; ++i) {
i<countDescription
TRUEnever evaluated
FALSEnever evaluated
0
889 pts[++oset] = points[i].x();-
890 pts[++oset] = points[i].y();-
891 pts[++oset] = points[i].x() + 1/63.;-
892 pts[++oset] = points[i].y();-
893 }
never executed: end of block
0
894 QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint);-
895 stroke(path, pen);-
896 pointCount -= 16;-
897 points += 16;-
898 }
never executed: end of block
0
899 } else {
never executed: end of block
0
900 for (int i=0; i<pointCount; ++i) {
i<pointCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
901 qreal pts[] = { qreal(points[i].x()), qreal(points[i].y()),-
902 qreal(points[i].x() +1/63.), qreal(points[i].y()) };-
903 QVectorPath path(pts, 2, 0);-
904 stroke(path, pen);-
905 }
never executed: end of block
0
906 }
never executed: end of block
0
907}-
908-
909-
910void QPaintEngineEx::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)-
911{-
912 QVectorPath path((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode));-
913-
914 if (mode == PolylineMode)
mode == PolylineModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
915 stroke(path, state()->pen);
never executed: stroke(path, state()->pen);
0
916 else-
917 draw(path);
never executed: draw(path);
0
918}-
919-
920void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)-
921{-
922 int count = pointCount<<1;-
923 QVarLengthArray<qreal> pts(count);-
924-
925 for (int i=0; i<count; ++i)
i<countDescription
TRUEnever evaluated
FALSEnever evaluated
0
926 pts[i] = ((const int *) points)[i];
never executed: pts[i] = ((const int *) points)[i];
0
927-
928 QVectorPath path(pts.data(), pointCount, 0, QVectorPath::polygonFlags(mode));-
929-
930 if (mode == PolylineMode)
mode == PolylineModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
931 stroke(path, state()->pen);
never executed: stroke(path, state()->pen);
0
932 else-
933 draw(path);
never executed: draw(path);
0
934-
935}-
936-
937void QPaintEngineEx::drawPixmap(const QPointF &pos, const QPixmap &pm)-
938{-
939 drawPixmap(QRectF(pos, pm.size() / pm.devicePixelRatio()), pm, pm.rect());-
940}
never executed: end of block
0
941-
942void QPaintEngineEx::drawImage(const QPointF &pos, const QImage &image)-
943{-
944 drawImage(QRectF(pos, image.size() / image.devicePixelRatio()), image, image.rect());-
945}
never executed: end of block
0
946-
947void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)-
948{-
949 QBrush brush(state()->pen.color(), pixmap);-
950 QTransform xform = QTransform::fromTranslate(r.x() - s.x(), r.y() - s.y());-
951 brush.setTransform(xform);-
952-
953 qreal pts[] = { r.x(), r.y(),-
954 r.x() + r.width(), r.y(),-
955 r.x() + r.width(), r.y() + r.height(),-
956 r.x(), r.y() + r.height() };-
957-
958 QVectorPath path(pts, 4, 0, QVectorPath::RectangleHint);-
959 fill(path, brush);-
960}
never executed: end of block
0
961-
962void QPaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount,-
963 const QPixmap &pixmap, QPainter::PixmapFragmentHints /*hints*/)-
964{-
965 if (pixmap.isNull())
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
966 return;
never executed: return;
0
967-
968 qreal oldOpacity = state()->opacity;-
969 QTransform oldTransform = state()->matrix;-
970-
971 for (int i = 0; i < fragmentCount; ++i) {
i < fragmentCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
972 QTransform transform = oldTransform;-
973 transform.translate(fragments[i].x, fragments[i].y);-
974 transform.rotate(fragments[i].rotation);-
975 state()->opacity = oldOpacity * fragments[i].opacity;-
976 state()->matrix = transform;-
977 opacityChanged();-
978 transformChanged();-
979-
980 qreal w = fragments[i].scaleX * fragments[i].width;-
981 qreal h = fragments[i].scaleY * fragments[i].height;-
982 QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,-
983 fragments[i].width, fragments[i].height);-
984 drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect);-
985 }
never executed: end of block
0
986-
987 state()->opacity = oldOpacity;-
988 state()->matrix = oldTransform;-
989 opacityChanged();-
990 transformChanged();-
991}
never executed: end of block
0
992-
993void QPaintEngineEx::setState(QPainterState *s)-
994{-
995 QPaintEngine::state = s;-
996}
never executed: end of block
0
997-
998-
999void QPaintEngineEx::updateState(const QPaintEngineState &)-
1000{-
1001 // do nothing...-
1002}-
1003-
1004Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path)-
1005{-
1006 const qreal *points = path.points();-
1007 const QPainterPath::ElementType *types = path.elements();-
1008-
1009 QPainterPath p;-
1010 if (types) {
typesDescription
TRUEnever evaluated
FALSEnever evaluated
0
1011 int id = 0;-
1012 for (int i=0; i<path.elementCount(); ++i) {
i<path.elementCount()Description
TRUEnever evaluated
FALSEnever evaluated
0
1013 switch(types[i]) {-
1014 case QPainterPath::MoveToElement:
never executed: case QPainterPath::MoveToElement:
0
1015 p.moveTo(QPointF(points[id], points[id+1]));-
1016 id+=2;-
1017 break;
never executed: break;
0
1018 case QPainterPath::LineToElement:
never executed: case QPainterPath::LineToElement:
0
1019 p.lineTo(QPointF(points[id], points[id+1]));-
1020 id+=2;-
1021 break;
never executed: break;
0
1022 case QPainterPath::CurveToElement: {
never executed: case QPainterPath::CurveToElement:
0
1023 QPointF p1(points[id], points[id+1]);-
1024 QPointF p2(points[id+2], points[id+3]);-
1025 QPointF p3(points[id+4], points[id+5]);-
1026 p.cubicTo(p1, p2, p3);-
1027 id+=6;-
1028 break;
never executed: break;
0
1029 }-
1030 case QPainterPath::CurveToDataElement:
never executed: case QPainterPath::CurveToDataElement:
0
1031 ;-
1032 break;
never executed: break;
0
1033 }-
1034 }
never executed: end of block
0
1035 } else {
never executed: end of block
0
1036 p.moveTo(QPointF(points[0], points[1]));-
1037 int id = 2;-
1038 for (int i=1; i<path.elementCount(); ++i) {
i<path.elementCount()Description
TRUEnever evaluated
FALSEnever evaluated
0
1039 p.lineTo(QPointF(points[id], points[id+1]));-
1040 id+=2;-
1041 }
never executed: end of block
0
1042 }
never executed: end of block
0
1043 if (path.hints() & QVectorPath::WindingFill)
path.hints() &...h::WindingFillDescription
TRUEnever evaluated
FALSEnever evaluated
0
1044 p.setFillRule(Qt::WindingFill);
never executed: p.setFillRule(Qt::WindingFill);
0
1045-
1046 return p;
never executed: return p;
0
1047}-
1048-
1049void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)-
1050{-
1051 QPainterPath path;-
1052 path.setFillRule(Qt::WindingFill);-
1053-
1054 if (staticTextItem->numGlyphs == 0)
staticTextItem->numGlyphs == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1055 return;
never executed: return;
0
1056-
1057 QFontEngine *fontEngine = staticTextItem->fontEngine();-
1058 fontEngine->addGlyphsToPath(staticTextItem->glyphs, staticTextItem->glyphPositions,-
1059 staticTextItem->numGlyphs, &path, 0);-
1060 if (!path.isEmpty()) {
!path.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1061 QPainterState *s = state();-
1062 QPainter::RenderHints oldHints = s->renderHints;-
1063 bool changedHints = false;-
1064 if (bool(oldHints & QPainter::TextAntialiasing)
bool(oldHints ...tAntialiasing)Description
TRUEnever evaluated
FALSEnever evaluated
0
1065 && !bool(fontEngine->fontDef.styleStrategy & QFont::NoAntialias)
!bool(fontEngi...::NoAntialias)Description
TRUEnever evaluated
FALSEnever evaluated
0
1066 && !bool(oldHints & QPainter::Antialiasing)) {
!bool(oldHints...:Antialiasing)Description
TRUEnever evaluated
FALSEnever evaluated
0
1067 s->renderHints |= QPainter::Antialiasing;-
1068 renderHintsChanged();-
1069 changedHints = true;-
1070 }
never executed: end of block
0
1071-
1072 fill(qtVectorPathForPath(path), s->pen.brush());-
1073-
1074 if (changedHints) {
changedHintsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1075 s->renderHints = oldHints;-
1076 renderHintsChanged();-
1077 }
never executed: end of block
0
1078 }
never executed: end of block
0
1079}
never executed: end of block
0
1080-
1081bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const-
1082{-
1083 return false;
never executed: return false;
0
1084}-
1085-
1086bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const-
1087{-
1088 if (fontEngine->glyphFormat == QFontEngine::Format_ARGB)
fontEngine->gl...e::Format_ARGBDescription
TRUEnever evaluated
FALSEnever evaluated
0
1089 return true;
never executed: return true;
0
1090-
1091 qreal pixelSize = fontEngine->fontDef.pixelSize;-
1092 return (pixelSize * pixelSize * qAbs(m.determinant())) <
never executed: return (pixelSize * pixelSize * qAbs(m.determinant())) < 64 * 64;
0
1093 QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE;
never executed: return (pixelSize * pixelSize * qAbs(m.determinant())) < 64 * 64;
0
1094}-
1095-
1096QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9