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

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