Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2012 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 | | - |
49 | QT_BEGIN_NAMESPACE | - |
50 | | - |
51 | static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; | - |
52 | | - |
53 | #define qreal_to_fixed_26_6(f) (int(f * 64)) | - |
54 | | - |
55 | | - |
56 | | - |
57 | | - |
58 | static 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 yes Evaluation Count:864080 | yes Evaluation Count:135139 |
| 135139-864080 |
66 | if (e->x() < minx) evaluated: e->x() < minx yes Evaluation Count:104322 | yes Evaluation Count:759758 |
| 104322-759758 |
67 | minx = e->x(); executed: minx = e->x(); Execution Count:104322 | 104322 |
68 | else if (e->x() > maxx) evaluated: e->x() > maxx yes Evaluation Count:204022 | yes Evaluation Count:555736 |
| 204022-555736 |
69 | maxx = e->x(); executed: maxx = e->x(); Execution Count:204022 | 204022 |
70 | if (e->y() < miny) evaluated: e->y() < miny yes Evaluation Count:85227 | yes Evaluation Count:778853 |
| 85227-778853 |
71 | miny = e->y(); executed: miny = e->y(); Execution Count:85227 | 85227 |
72 | else if (e->y() > maxy) evaluated: e->y() > maxy yes Evaluation Count:189515 | yes Evaluation Count:589338 |
| 189515-589338 |
73 | maxy = e->y(); executed: maxy = e->y(); Execution Count:189515 | 189515 |
74 | } | - |
75 | return QRectF(QPointF(minx, miny), QPointF(maxx, maxy)); executed: return QRectF(QPointF(minx, miny), QPointF(maxx, maxy)); Execution Count:135139 | 135139 |
76 | } | - |
77 | | - |
78 | void 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 yes Evaluation Count:6698 | yes Evaluation Count:1228 |
| 1228-6698 |
87 | m_element_types << QPainterPath::LineToElement; executed: m_element_types << QPainterPath::LineToElement; Execution Count:6698 | 6698 |
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:1228 | 1228 |
90 | | - |
91 | | - |
92 | QT_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 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 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; | 0 |
120 | | - |
121 | default: | - |
122 | break; // This will never hit.. | 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 | | - |
130 | QT_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() yes Evaluation Count:133634 | yes Evaluation Count:760 |
| 760-133634 |
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 yes Evaluation Count:885320 | yes Evaluation Count:133634 |
| 133634-885320 |
146 | switch (elements[index]) { | - |
147 | case QPainterPath::MoveToElement: | - |
148 | if (index == count - 1) partially evaluated: index == count - 1 no Evaluation Count:0 | yes Evaluation Count:216626 |
| 0-216626 |
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:216626 | 216626 |
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:667466 | 667466 |
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:1228 | 1228 |
161 | | - |
162 | default: | - |
163 | break; // This will never hit.. | 0 |
164 | } | - |
165 | } executed: } Execution Count:885320 | 885320 |
166 | | - |
167 | } else { executed: } Execution Count:133634 | 133634 |
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 yes Evaluation Count:752 | yes Evaluation Count:8 |
| 8-752 |
172 | memcpy(m_elements.data(), path.points(), count* sizeof(QPointF)); executed: memcpy(m_elements.data(), path.points(), count* sizeof(QPointF)); Execution Count:752 | 752 |
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:760 | 760 |
176 | | - |
177 | endOutline(); executed (the execution status of this line is deduced): endOutline(); | - |
178 | return outline(); executed: return outline(); Execution Count:134394 | 134394 |
179 | } | - |
180 | | - |
181 | | - |
182 | void 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() yes Evaluation Count:10 | yes Evaluation Count:135143 |
| 10-135143 |
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:10 | 10 |
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 yes Evaluation Count:100280 | yes Evaluation Count:34863 |
| 34863-100280 |
195 | // Nothing to do. | - |
196 | } else if (m_txop == QTransform::TxTranslate) { executed: } Execution Count:100280 evaluated: m_txop == QTransform::TxTranslate yes Evaluation Count:34482 | yes Evaluation Count:381 |
| 381-100280 |
197 | for (int i = 0; i < m_elements.size(); ++i) { evaluated: i < m_elements.size() yes Evaluation Count:501910 | yes Evaluation Count:34482 |
| 34482-501910 |
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:501910 | 501910 |
201 | } else if (m_txop == QTransform::TxScale) { executed: } Execution Count:34482 evaluated: m_txop == QTransform::TxScale yes Evaluation Count:3 | yes Evaluation Count:378 |
| 3-34482 |
202 | for (int i = 0; i < m_elements.size(); ++i) { evaluated: i < m_elements.size() yes Evaluation Count:49 | yes Evaluation Count:3 |
| 3-49 |
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:49 | 49 |
206 | } else if (m_txop < QTransform::TxProject) { executed: } Execution Count:3 evaluated: m_txop < QTransform::TxProject yes Evaluation Count:374 | yes Evaluation Count:4 |
| 3-374 |
207 | for (int i = 0; i < m_elements.size(); ++i) { evaluated: i < m_elements.size() yes Evaluation Count:4810 | yes Evaluation Count:374 |
| 374-4810 |
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:4810 | 4810 |
212 | } else { executed: } Execution Count:374 | 374 |
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) 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() 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 yes Evaluation Count:135139 | no Evaluation Count:0 |
partially evaluated: controlPointRect.left() < -QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:135139 |
| 0-135139 |
241 | || controlPointRect.right() > QT_RASTER_COORD_LIMIT partially evaluated: controlPointRect.right() > QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:135139 |
| 0-135139 |
242 | || controlPointRect.top() < -QT_RASTER_COORD_LIMIT partially evaluated: controlPointRect.top() < -QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:135139 |
| 0-135139 |
243 | || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT partially evaluated: controlPointRect.bottom() > QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:135139 |
| 0-135139 |
244 | || controlPointRect.width() > QT_RASTER_COORD_LIMIT partially evaluated: controlPointRect.width() > QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:135139 |
| 0-135139 |
245 | || controlPointRect.height() > QT_RASTER_COORD_LIMIT)); partially evaluated: controlPointRect.height() > QT_RASTER_COORD_LIMIT no Evaluation Count:0 | yes Evaluation Count:135139 |
| 0-135139 |
246 | | - |
247 | if (do_clip) { partially evaluated: do_clip no Evaluation Count:0 | yes Evaluation Count:135139 |
| 0-135139 |
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 { | 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:135139 | 135139 |
252 | } | - |
253 | | - |
254 | void QOutlineMapper::convertElements(const QPointF *elements, | - |
255 | const QPainterPath::ElementType *types, | - |
256 | int element_count) | - |
257 | { | - |
258 | | - |
259 | if (types) { evaluated: types yes Evaluation Count:134387 | yes Evaluation Count:752 |
| 752-134387 |
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 yes Evaluation Count:995382 | yes Evaluation Count:134387 |
| 134387-995382 |
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 yes Evaluation Count:82994 | yes Evaluation Count:134387 |
| 82994-134387 |
269 | m_contours << m_points.size() - 1; executed: m_contours << m_points.size() - 1; Execution Count:82994 | 82994 |
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:217381 | 217381 |
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:778001 | 778001 |
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; | 0 |
304 | default: | - |
305 | 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:995382 | 995382 |
310 | } else { executed: } Execution Count:134387 | 134387 |
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 yes Evaluation Count:3837 | yes Evaluation Count:752 |
| 752-3837 |
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:3837 | 3837 |
321 | } executed: } Execution Count:752 | 752 |
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:135139 | 135139 |
350 | | - |
351 | void 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) { | 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; | 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; | 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; | 0 |
381 | default: | - |
382 | break; | 0 |
383 | } | - |
384 | } | 0 |
385 | } else { | 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 | } | 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 | } | 0 |
404 | | - |
405 | QT_END_NAMESPACE | - |
406 | | - |
| | |