painting/qoutlinemapper.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qoutlinemapper_p.h" -
43#include <private/qpainterpath_p.h> -
44#include "qmath.h" -
45#include <private/qbezier_p.h> -
46 -
47#include <stdlib.h> -
48 -
49QT_BEGIN_NAMESPACE -
50 -
51static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; -
52 -
53#define qreal_to_fixed_26_6(f) (int(f * 64)) -
54 -
55 -
56 -
57 -
58static const QRectF boundingRect(const QPointF *points, int pointCount) -
59{ -
60 const QPointF *e = points;
executed (the execution status of this line is deduced): const QPointF *e = points;
-
61 const QPointF *last = points + pointCount;
executed (the execution status of this line is deduced): const QPointF *last = points + pointCount;
-
62 qreal minx, maxx, miny, maxy;
executed (the execution status of this line is deduced): qreal minx, maxx, miny, maxy;
-
63 minx = maxx = e->x();
executed (the execution status of this line is deduced): minx = maxx = e->x();
-
64 miny = maxy = e->y();
executed (the execution status of this line is deduced): miny = maxy = e->y();
-
65 while (++e < last) {
evaluated: ++e < last
TRUEFALSE
yes
Evaluation Count:1092545
yes
Evaluation Count:136931
136931-1092545
66 if (e->x() < minx)
evaluated: e->x() < minx
TRUEFALSE
yes
Evaluation Count:147928
yes
Evaluation Count:944617
147928-944617
67 minx = e->x();
executed: minx = e->x();
Execution Count:147928
147928
68 else if (e->x() > maxx)
evaluated: e->x() > maxx
TRUEFALSE
yes
Evaluation Count:224539
yes
Evaluation Count:720078
224539-720078
69 maxx = e->x();
executed: maxx = e->x();
Execution Count:224539
224539
70 if (e->y() < miny)
evaluated: e->y() < miny
TRUEFALSE
yes
Evaluation Count:117340
yes
Evaluation Count:975205
117340-975205
71 miny = e->y();
executed: miny = e->y();
Execution Count:117340
117340
72 else if (e->y() > maxy)
evaluated: e->y() > maxy
TRUEFALSE
yes
Evaluation Count:210729
yes
Evaluation Count:764476
210729-764476
73 maxy = e->y();
executed: maxy = e->y();
Execution Count:210729
210729
74 } -
75 return QRectF(QPointF(minx, miny), QPointF(maxx, maxy));
executed: return QRectF(QPointF(minx, miny), QPointF(maxx, maxy));
Execution Count:136931
136931
76} -
77 -
78void QOutlineMapper::curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep) { -
79#ifdef QT_DEBUG_CONVERT -
80 printf("QOutlineMapper::curveTo() (%f, %f)\n", ep.x(), ep.y()); -
81#endif -
82 -
83 QBezier bezier = QBezier::fromPoints(m_elements.last(), cp1, cp2, ep);
executed (the execution status of this line is deduced): QBezier bezier = QBezier::fromPoints(m_elements.last(), cp1, cp2, ep);
-
84 bezier.addToPolygon(m_elements, m_curve_threshold);
executed (the execution status of this line is deduced): bezier.addToPolygon(m_elements, m_curve_threshold);
-
85 m_element_types.reserve(m_elements.size());
executed (the execution status of this line is deduced): m_element_types.reserve(m_elements.size());
-
86 for (int i = m_elements.size() - m_element_types.size(); i; --i)
evaluated: i
TRUEFALSE
yes
Evaluation Count:232172
yes
Evaluation Count:11216
11216-232172
87 m_element_types << QPainterPath::LineToElement;
executed: m_element_types << QPainterPath::LineToElement;
Execution Count:232172
232172
88 Q_ASSERT(m_elements.size() == m_element_types.size());
executed (the execution status of this line is deduced): qt_noop();
-
89}
executed: }
Execution Count:11216
11216
90 -
91 -
92QT_FT_Outline *QOutlineMapper::convertPath(const QPainterPath &path) -
93{ -
94 Q_ASSERT(!path.isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
95 int elmCount = path.elementCount();
executed (the execution status of this line is deduced): int elmCount = path.elementCount();
-
96#ifdef QT_DEBUG_CONVERT -
97 printf("QOutlineMapper::convertPath(), size=%d\n", elmCount); -
98#endif -
99 beginOutline(path.fillRule());
executed (the execution status of this line is deduced): beginOutline(path.fillRule());
-
100 -
101 for (int index=0; index<elmCount; ++index) {
evaluated: index<elmCount
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:8
8-40
102 const QPainterPath::Element &elm = path.elementAt(index);
executed (the execution status of this line is deduced): const QPainterPath::Element &elm = path.elementAt(index);
-
103 -
104 switch (elm.type) { -
105 -
106 case QPainterPath::MoveToElement: -
107 if (index == elmCount - 1)
partially evaluated: index == elmCount - 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
108 continue;
never executed: continue;
0
109 moveTo(elm);
executed (the execution status of this line is deduced): moveTo(elm);
-
110 break;
executed: break;
Execution Count:8
8
111 -
112 case QPainterPath::LineToElement: -
113 lineTo(elm);
executed (the execution status of this line is deduced): lineTo(elm);
-
114 break;
executed: break;
Execution Count:32
32
115 -
116 case QPainterPath::CurveToElement: -
117 curveTo(elm, path.elementAt(index + 1), path.elementAt(index + 2));
never executed (the execution status of this line is deduced): curveTo(elm, path.elementAt(index + 1), path.elementAt(index + 2));
-
118 index += 2;
never executed (the execution status of this line is deduced): index += 2;
-
119 break;
never executed: break;
0
120 -
121 default: -
122 break; // This will never hit..
never executed: break;
0
123 } -
124 }
executed: }
Execution Count:40
40
125 -
126 endOutline();
executed (the execution status of this line is deduced): endOutline();
-
127 return outline();
executed: return outline();
Execution Count:8
8
128} -
129 -
130QT_FT_Outline *QOutlineMapper::convertPath(const QVectorPath &path) -
131{ -
132 int count = path.elementCount();
executed (the execution status of this line is deduced): int count = path.elementCount();
-
133 -
134#ifdef QT_DEBUG_CONVERT -
135 printf("QOutlineMapper::convertPath(VP), size=%d\n", count); -
136#endif -
137 beginOutline(path.hasWindingFill() ? Qt::WindingFill : Qt::OddEvenFill);
executed (the execution status of this line is deduced): beginOutline(path.hasWindingFill() ? Qt::WindingFill : Qt::OddEvenFill);
-
138 -
139 if (path.elements()) {
evaluated: path.elements()
TRUEFALSE
yes
Evaluation Count:135228
yes
Evaluation Count:858
858-135228
140 // TODO: if we do closing of subpaths in convertElements instead we -
141 // could avoid this loop -
142 const QPainterPath::ElementType *elements = path.elements();
executed (the execution status of this line is deduced): const QPainterPath::ElementType *elements = path.elements();
-
143 const QPointF *points = reinterpret_cast<const QPointF *>(path.points());
executed (the execution status of this line is deduced): const QPointF *points = reinterpret_cast<const QPointF *>(path.points());
-
144 -
145 for (int index = 0; index < count; ++index) {
evaluated: index < count
TRUEFALSE
yes
Evaluation Count:899189
yes
Evaluation Count:135228
135228-899189
146 switch (elements[index]) { -
147 case QPainterPath::MoveToElement: -
148 if (index == count - 1)
partially evaluated: index == count - 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:219198
0-219198
149 continue;
never executed: continue;
0
150 moveTo(points[index]);
executed (the execution status of this line is deduced): moveTo(points[index]);
-
151 break;
executed: break;
Execution Count:219198
219198
152 -
153 case QPainterPath::LineToElement: -
154 lineTo(points[index]);
executed (the execution status of this line is deduced): lineTo(points[index]);
-
155 break;
executed: break;
Execution Count:668775
668775
156 -
157 case QPainterPath::CurveToElement: -
158 curveTo(points[index], points[index+1], points[index+2]);
executed (the execution status of this line is deduced): curveTo(points[index], points[index+1], points[index+2]);
-
159 index += 2;
executed (the execution status of this line is deduced): index += 2;
-
160 break;
executed: break;
Execution Count:11216
11216
161 -
162 default: -
163 break; // This will never hit..
never executed: break;
0
164 } -
165 }
executed: }
Execution Count:899189
899189
166 -
167 } else {
executed: }
Execution Count:135228
135228
168 // ### We can kill this copying and just use the buffer straight... -
169 -
170 m_elements.resize(count);
executed (the execution status of this line is deduced): m_elements.resize(count);
-
171 if (count)
evaluated: count
TRUEFALSE
yes
Evaluation Count:851
yes
Evaluation Count:7
7-851
172 memcpy(m_elements.data(), path.points(), count* sizeof(QPointF));
executed: memcpy(m_elements.data(), path.points(), count* sizeof(QPointF));
Execution Count:851
851
173 -
174 m_element_types.resize(0);
executed (the execution status of this line is deduced): m_element_types.resize(0);
-
175 }
executed: }
Execution Count:858
858
176 -
177 endOutline();
executed (the execution status of this line is deduced): endOutline();
-
178 return outline();
executed: return outline();
Execution Count:136086
136086
179} -
180 -
181 -
182void QOutlineMapper::endOutline() -
183{ -
184 closeSubpath();
executed (the execution status of this line is deduced): closeSubpath();
-
185 -
186 if (m_elements.isEmpty()) {
evaluated: m_elements.isEmpty()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:136935
9-136935
187 memset(&m_outline, 0, sizeof(m_outline));
executed (the execution status of this line is deduced): memset(&m_outline, 0, sizeof(m_outline));
-
188 return;
executed: return;
Execution Count:9
9
189 } -
190 -
191 QPointF *elements = m_elements.data();
executed (the execution status of this line is deduced): QPointF *elements = m_elements.data();
-
192 -
193 // Transform the outline -
194 if (m_txop == QTransform::TxNone) {
evaluated: m_txop == QTransform::TxNone
TRUEFALSE
yes
Evaluation Count:100293
yes
Evaluation Count:36642
36642-100293
195 // Nothing to do. -
196 } else if (m_txop == QTransform::TxTranslate) {
executed: }
Execution Count:100293
evaluated: m_txop == QTransform::TxTranslate
TRUEFALSE
yes
Evaluation Count:34630
yes
Evaluation Count:2012
2012-100293
197 for (int i = 0; i < m_elements.size(); ++i) {
evaluated: i < m_elements.size()
TRUEFALSE
yes
Evaluation Count:503156
yes
Evaluation Count:34630
34630-503156
198 QPointF &e = elements[i];
executed (the execution status of this line is deduced): QPointF &e = elements[i];
-
199 e = QPointF(e.x() + m_dx, e.y() + m_dy);
executed (the execution status of this line is deduced): e = QPointF(e.x() + m_dx, e.y() + m_dy);
-
200 }
executed: }
Execution Count:503156
503156
201 } else if (m_txop == QTransform::TxScale) {
executed: }
Execution Count:34630
evaluated: m_txop == QTransform::TxScale
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1983
29-34630
202 for (int i = 0; i < m_elements.size(); ++i) {
evaluated: i < m_elements.size()
TRUEFALSE
yes
Evaluation Count:88091
yes
Evaluation Count:29
29-88091
203 QPointF &e = elements[i];
executed (the execution status of this line is deduced): QPointF &e = elements[i];
-
204 e = QPointF(m_m11 * e.x() + m_dx, m_m22 * e.y() + m_dy);
executed (the execution status of this line is deduced): e = QPointF(m_m11 * e.x() + m_dx, m_m22 * e.y() + m_dy);
-
205 }
executed: }
Execution Count:88091
88091
206 } else if (m_txop < QTransform::TxProject) {
executed: }
Execution Count:29
evaluated: m_txop < QTransform::TxProject
TRUEFALSE
yes
Evaluation Count:1979
yes
Evaluation Count:4
4-1979
207 for (int i = 0; i < m_elements.size(); ++i) {
evaluated: i < m_elements.size()
TRUEFALSE
yes
Evaluation Count:145581
yes
Evaluation Count:1979
1979-145581
208 QPointF &e = elements[i];
executed (the execution status of this line is deduced): QPointF &e = elements[i];
-
209 e = QPointF(m_m11 * e.x() + m_m21 * e.y() + m_dx,
executed (the execution status of this line is deduced): e = QPointF(m_m11 * e.x() + m_m21 * e.y() + m_dx,
-
210 m_m22 * e.y() + m_m12 * e.x() + m_dy);
executed (the execution status of this line is deduced): m_m22 * e.y() + m_m12 * e.x() + m_dy);
-
211 }
executed: }
Execution Count:145581
145581
212 } else {
executed: }
Execution Count:1979
1979
213 const QVectorPath vp((qreal *)elements, m_elements.size(),
executed (the execution status of this line is deduced): const QVectorPath vp((qreal *)elements, m_elements.size(),
-
214 m_element_types.size() ? m_element_types.data() : 0);
executed (the execution status of this line is deduced): m_element_types.size() ? m_element_types.data() : 0);
-
215 QPainterPath path = vp.convertToPainterPath();
executed (the execution status of this line is deduced): QPainterPath path = vp.convertToPainterPath();
-
216 path = QTransform(m_m11, m_m12, m_m13, m_m21, m_m22, m_m23, m_dx, m_dy, m_m33).map(path);
executed (the execution status of this line is deduced): path = QTransform(m_m11, m_m12, m_m13, m_m21, m_m22, m_m23, m_dx, m_dy, m_m33).map(path);
-
217 if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL))
partially evaluated: !(m_outline.flags & 0x2)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
218 path.setFillRule(Qt::WindingFill);
never executed: path.setFillRule(Qt::WindingFill);
0
219 uint old_txop = m_txop;
executed (the execution status of this line is deduced): uint old_txop = m_txop;
-
220 m_txop = QTransform::TxNone;
executed (the execution status of this line is deduced): m_txop = QTransform::TxNone;
-
221 if (path.isEmpty())
partially evaluated: path.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
222 m_valid = false;
never executed: m_valid = false;
0
223 else -
224 convertPath(path);
executed: convertPath(path);
Execution Count:4
4
225 m_txop = old_txop;
executed (the execution status of this line is deduced): m_txop = old_txop;
-
226 return;
executed: return;
Execution Count:4
4
227 } -
228 -
229 controlPointRect = boundingRect(elements, m_elements.size());
executed (the execution status of this line is deduced): controlPointRect = boundingRect(elements, m_elements.size());
-
230 -
231#ifdef QT_DEBUG_CONVERT -
232 printf(" - control point rect (%.2f, %.2f) %.2f x %.2f, clip=(%d,%d, %dx%d)\n", -
233 controlPointRect.x(), controlPointRect.y(), -
234 controlPointRect.width(), controlPointRect.height(), -
235 m_clip_rect.x(), m_clip_rect.y(), m_clip_rect.width(), m_clip_rect.height()); -
236#endif -
237 -
238 -
239 // Check for out of dev bounds... -
240 const bool do_clip = !m_in_clip_elements && ((controlPointRect.left() < -QT_RASTER_COORD_LIMIT
partially evaluated: !m_in_clip_elements
TRUEFALSE
yes
Evaluation Count:136931
no
Evaluation Count:0
partially evaluated: controlPointRect.left() < -QT_RASTER_COORD_LIMIT
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:136931
0-136931
241 || controlPointRect.right() > QT_RASTER_COORD_LIMIT
partially evaluated: controlPointRect.right() > QT_RASTER_COORD_LIMIT
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:136931
0-136931
242 || controlPointRect.top() < -QT_RASTER_COORD_LIMIT
partially evaluated: controlPointRect.top() < -QT_RASTER_COORD_LIMIT
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:136931
0-136931
243 || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT
partially evaluated: controlPointRect.bottom() > QT_RASTER_COORD_LIMIT
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:136931
0-136931
244 || controlPointRect.width() > QT_RASTER_COORD_LIMIT
partially evaluated: controlPointRect.width() > QT_RASTER_COORD_LIMIT
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:136931
0-136931
245 || controlPointRect.height() > QT_RASTER_COORD_LIMIT));
partially evaluated: controlPointRect.height() > QT_RASTER_COORD_LIMIT
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:136931
0-136931
246 -
247 if (do_clip) {
partially evaluated: do_clip
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:136931
0-136931
248 clipElements(elements, elementTypes(), m_elements.size());
never executed (the execution status of this line is deduced): clipElements(elements, elementTypes(), m_elements.size());
-
249 } else {
never executed: }
0
250 convertElements(elements, elementTypes(), m_elements.size());
executed (the execution status of this line is deduced): convertElements(elements, elementTypes(), m_elements.size());
-
251 }
executed: }
Execution Count:136931
136931
252} -
253 -
254void QOutlineMapper::convertElements(const QPointF *elements, -
255 const QPainterPath::ElementType *types, -
256 int element_count) -
257{ -
258 -
259 if (types) {
evaluated: types
TRUEFALSE
yes
Evaluation Count:136080
yes
Evaluation Count:851
851-136080
260 // Translate into FT coords -
261 const QPointF *e = elements;
executed (the execution status of this line is deduced): const QPointF *e = elements;
-
262 for (int i=0; i<element_count; ++i) {
evaluated: i<element_count
TRUEFALSE
yes
Evaluation Count:1225147
yes
Evaluation Count:136080
136080-1225147
263 switch (*types) { -
264 case QPainterPath::MoveToElement: -
265 { -
266 QT_FT_Vector pt_fixed = { qreal_to_fixed_26_6(e->x()),
executed (the execution status of this line is deduced): QT_FT_Vector pt_fixed = { (int(e->x() * 64)),
-
267 qreal_to_fixed_26_6(e->y()) };
executed (the execution status of this line is deduced): (int(e->y() * 64)) };
-
268 if (i != 0)
evaluated: i != 0
TRUEFALSE
yes
Evaluation Count:83972
yes
Evaluation Count:136080
83972-136080
269 m_contours << m_points.size() - 1;
executed: m_contours << m_points.size() - 1;
Execution Count:83972
83972
270 m_points << pt_fixed;
executed (the execution status of this line is deduced): m_points << pt_fixed;
-
271 m_tags << QT_FT_CURVE_TAG_ON;
executed (the execution status of this line is deduced): m_tags << 1;
-
272 } -
273 break;
executed: break;
Execution Count:220052
220052
274 -
275 case QPainterPath::LineToElement: -
276 { -
277 QT_FT_Vector pt_fixed = { qreal_to_fixed_26_6(e->x()),
executed (the execution status of this line is deduced): QT_FT_Vector pt_fixed = { (int(e->x() * 64)),
-
278 qreal_to_fixed_26_6(e->y()) };
executed (the execution status of this line is deduced): (int(e->y() * 64)) };
-
279 m_points << pt_fixed;
executed (the execution status of this line is deduced): m_points << pt_fixed;
-
280 m_tags << QT_FT_CURVE_TAG_ON;
executed (the execution status of this line is deduced): m_tags << 1;
-
281 } -
282 break;
executed: break;
Execution Count:1005095
1005095
283 -
284 case QPainterPath::CurveToElement: -
285 { -
286 QT_FT_Vector cp1_fixed = { qreal_to_fixed_26_6(e->x()),
never executed (the execution status of this line is deduced): QT_FT_Vector cp1_fixed = { (int(e->x() * 64)),
-
287 qreal_to_fixed_26_6(e->y()) };
never executed (the execution status of this line is deduced): (int(e->y() * 64)) };
-
288 ++e;
never executed (the execution status of this line is deduced): ++e;
-
289 QT_FT_Vector cp2_fixed = { qreal_to_fixed_26_6((e)->x()),
never executed (the execution status of this line is deduced): QT_FT_Vector cp2_fixed = { (int((e)->x() * 64)),
-
290 qreal_to_fixed_26_6((e)->y()) };
never executed (the execution status of this line is deduced): (int((e)->y() * 64)) };
-
291 ++e;
never executed (the execution status of this line is deduced): ++e;
-
292 QT_FT_Vector ep_fixed = { qreal_to_fixed_26_6((e)->x()),
never executed (the execution status of this line is deduced): QT_FT_Vector ep_fixed = { (int((e)->x() * 64)),
-
293 qreal_to_fixed_26_6((e)->y()) };
never executed (the execution status of this line is deduced): (int((e)->y() * 64)) };
-
294 -
295 m_points << cp1_fixed << cp2_fixed << ep_fixed;
never executed (the execution status of this line is deduced): m_points << cp1_fixed << cp2_fixed << ep_fixed;
-
296 m_tags << QT_FT_CURVE_TAG_CUBIC
never executed (the execution status of this line is deduced): m_tags << 2
-
297 << QT_FT_CURVE_TAG_CUBIC
never executed (the execution status of this line is deduced): << 2
-
298 << QT_FT_CURVE_TAG_ON;
never executed (the execution status of this line is deduced): << 1;
-
299 -
300 types += 2;
never executed (the execution status of this line is deduced): types += 2;
-
301 i += 2;
never executed (the execution status of this line is deduced): i += 2;
-
302 } -
303 break;
never executed: break;
0
304 default: -
305 break;
never executed: break;
0
306 } -
307 ++types;
executed (the execution status of this line is deduced): ++types;
-
308 ++e;
executed (the execution status of this line is deduced): ++e;
-
309 }
executed: }
Execution Count:1225147
1225147
310 } else {
executed: }
Execution Count:136080
136080
311 // Plain polygon... -
312 const QPointF *last = elements + element_count;
executed (the execution status of this line is deduced): const QPointF *last = elements + element_count;
-
313 const QPointF *e = elements;
executed (the execution status of this line is deduced): const QPointF *e = elements;
-
314 while (e < last) {
evaluated: e < last
TRUEFALSE
yes
Evaluation Count:4329
yes
Evaluation Count:851
851-4329
315 QT_FT_Vector pt_fixed = { qreal_to_fixed_26_6(e->x()),
executed (the execution status of this line is deduced): QT_FT_Vector pt_fixed = { (int(e->x() * 64)),
-
316 qreal_to_fixed_26_6(e->y()) };
executed (the execution status of this line is deduced): (int(e->y() * 64)) };
-
317 m_points << pt_fixed;
executed (the execution status of this line is deduced): m_points << pt_fixed;
-
318 m_tags << QT_FT_CURVE_TAG_ON;
executed (the execution status of this line is deduced): m_tags << 1;
-
319 ++e;
executed (the execution status of this line is deduced): ++e;
-
320 }
executed: }
Execution Count:4329
4329
321 }
executed: }
Execution Count:851
851
322 -
323 // close the very last subpath -
324 m_contours << m_points.size() - 1;
executed (the execution status of this line is deduced): m_contours << m_points.size() - 1;
-
325 -
326 m_outline.n_contours = m_contours.size();
executed (the execution status of this line is deduced): m_outline.n_contours = m_contours.size();
-
327 m_outline.n_points = m_points.size();
executed (the execution status of this line is deduced): m_outline.n_points = m_points.size();
-
328 -
329 m_outline.points = m_points.data();
executed (the execution status of this line is deduced): m_outline.points = m_points.data();
-
330 m_outline.tags = m_tags.data();
executed (the execution status of this line is deduced): m_outline.tags = m_tags.data();
-
331 m_outline.contours = m_contours.data();
executed (the execution status of this line is deduced): m_outline.contours = m_contours.data();
-
332 -
333#ifdef QT_DEBUG_CONVERT -
334 printf("QOutlineMapper::endOutline\n"); -
335 -
336 printf(" - contours: %d\n", m_outline.n_contours); -
337 for (int i=0; i<m_outline.n_contours; ++i) { -
338 printf(" - %d\n", m_outline.contours[i]); -
339 } -
340 -
341 printf(" - points: %d\n", m_outline.n_points); -
342 for (int i=0; i<m_outline.n_points; ++i) { -
343 printf(" - %d -- %.2f, %.2f, (%d, %d)\n", i, -
344 (double) (m_outline.points[i].x / 64.0), -
345 (double) (m_outline.points[i].y / 64.0), -
346 (int) m_outline.points[i].x, (int) m_outline.points[i].y); -
347 } -
348#endif -
349}
executed: }
Execution Count:136931
136931
350 -
351void QOutlineMapper::clipElements(const QPointF *elements, -
352 const QPainterPath::ElementType *types, -
353 int element_count) -
354{ -
355 // We could save a bit of time by actually implementing them fully -
356 // instead of going through convenience functionallity, but since -
357 // this part of code hardly every used, it shouldn't matter. -
358 -
359 m_in_clip_elements = true;
never executed (the execution status of this line is deduced): m_in_clip_elements = true;
-
360 -
361 QPainterPath path;
never executed (the execution status of this line is deduced): QPainterPath path;
-
362 -
363 if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL))
never evaluated: !(m_outline.flags & 0x2)
0
364 path.setFillRule(Qt::WindingFill);
never executed: path.setFillRule(Qt::WindingFill);
0
365 -
366 if (types) {
never evaluated: types
0
367 for (int i=0; i<element_count; ++i) {
never evaluated: i<element_count
0
368 switch (types[i]) { -
369 case QPainterPath::MoveToElement: -
370 path.moveTo(elements[i]);
never executed (the execution status of this line is deduced): path.moveTo(elements[i]);
-
371 break;
never executed: break;
0
372 -
373 case QPainterPath::LineToElement: -
374 path.lineTo(elements[i]);
never executed (the execution status of this line is deduced): path.lineTo(elements[i]);
-
375 break;
never executed: break;
0
376 -
377 case QPainterPath::CurveToElement: -
378 path.cubicTo(elements[i], elements[i+1], elements[i+2]);
never executed (the execution status of this line is deduced): path.cubicTo(elements[i], elements[i+1], elements[i+2]);
-
379 i += 2;
never executed (the execution status of this line is deduced): i += 2;
-
380 break;
never executed: break;
0
381 default: -
382 break;
never executed: break;
0
383 } -
384 }
never executed: }
0
385 } else {
never executed: }
0
386 path.moveTo(elements[0]);
never executed (the execution status of this line is deduced): path.moveTo(elements[0]);
-
387 for (int i=1; i<element_count; ++i)
never evaluated: i<element_count
0
388 path.lineTo(elements[i]);
never executed: path.lineTo(elements[i]);
0
389 }
never executed: }
0
390 -
391 QPainterPath clipPath;
never executed (the execution status of this line is deduced): QPainterPath clipPath;
-
392 clipPath.addRect(m_clip_rect);
never executed (the execution status of this line is deduced): clipPath.addRect(m_clip_rect);
-
393 QPainterPath clippedPath = path.intersected(clipPath);
never executed (the execution status of this line is deduced): QPainterPath clippedPath = path.intersected(clipPath);
-
394 uint old_txop = m_txop;
never executed (the execution status of this line is deduced): uint old_txop = m_txop;
-
395 m_txop = QTransform::TxNone;
never executed (the execution status of this line is deduced): m_txop = QTransform::TxNone;
-
396 if (clippedPath.isEmpty())
never evaluated: clippedPath.isEmpty()
0
397 m_valid = false;
never executed: m_valid = false;
0
398 else -
399 convertPath(clippedPath);
never executed: convertPath(clippedPath);
0
400 m_txop = old_txop;
never executed (the execution status of this line is deduced): m_txop = old_txop;
-
401 -
402 m_in_clip_elements = false;
never executed (the execution status of this line is deduced): m_in_clip_elements = false;
-
403}
never executed: }
0
404 -
405QT_END_NAMESPACE -
406 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial