text/qdistancefield.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 QtDeclarative 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 "qdistancefield_p.h" -
43#include <qmath.h> -
44#include <private/qdatabuffer_p.h> -
45#include <private/qpathsimplifier_p.h> -
46 -
47QT_BEGIN_NAMESPACE -
48 -
49namespace -
50{ -
51 enum FillHDir -
52 { -
53 LeftToRight, -
54 RightToLeft -
55 }; -
56 -
57 enum FillVDir -
58 { -
59 TopDown, -
60 BottomUp -
61 }; -
62 -
63 enum FillClip -
64 { -
65 NoClip, -
66 Clip -
67 }; -
68} -
69 -
70template <FillClip clip, FillHDir dir> -
71inline void fillLine(qint32 *, int, int, int, qint32, qint32) -
72{ -
73} -
74 -
75template <> -
76inline void fillLine<Clip, LeftToRight>(qint32 *line, int width, int lx, int rx, qint32 d, qint32 dd) -
77{ -
78 int fromX = qMax(0, lx >> 8);
never executed (the execution status of this line is deduced): int fromX = qMax(0, lx >> 8);
-
79 int toX = qMin(width, rx >> 8);
never executed (the execution status of this line is deduced): int toX = qMin(width, rx >> 8);
-
80 int x = toX - fromX;
never executed (the execution status of this line is deduced): int x = toX - fromX;
-
81 if (x <= 0)
never evaluated: x <= 0
0
82 return;
never executed: return;
0
83 qint32 val = d + (((fromX << 8) + 0xff - lx) * dd >> 8);
never executed (the execution status of this line is deduced): qint32 val = d + (((fromX << 8) + 0xff - lx) * dd >> 8);
-
84 line += fromX;
never executed (the execution status of this line is deduced): line += fromX;
-
85 do { -
86 *line = abs(val) < abs(*line) ? val : *line;
never evaluated: abs(val) < abs(*line)
0
87 val += dd;
never executed (the execution status of this line is deduced): val += dd;
-
88 ++line;
never executed (the execution status of this line is deduced): ++line;
-
89 } while (--x);
never executed: }
never evaluated: --x
0
90}
never executed: }
0
91 -
92template <> -
93inline void fillLine<Clip, RightToLeft>(qint32 *line, int width, int lx, int rx, qint32 d, qint32 dd) -
94{ -
95 int fromX = qMax(0, lx >> 8);
never executed (the execution status of this line is deduced): int fromX = qMax(0, lx >> 8);
-
96 int toX = qMin(width, rx >> 8);
never executed (the execution status of this line is deduced): int toX = qMin(width, rx >> 8);
-
97 int x = toX - fromX;
never executed (the execution status of this line is deduced): int x = toX - fromX;
-
98 if (x <= 0)
never evaluated: x <= 0
0
99 return;
never executed: return;
0
100 qint32 val = d + (((toX << 8) + 0xff - rx) * dd >> 8);
never executed (the execution status of this line is deduced): qint32 val = d + (((toX << 8) + 0xff - rx) * dd >> 8);
-
101 line += toX;
never executed (the execution status of this line is deduced): line += toX;
-
102 do { -
103 val -= dd;
never executed (the execution status of this line is deduced): val -= dd;
-
104 --line;
never executed (the execution status of this line is deduced): --line;
-
105 *line = abs(val) < abs(*line) ? val : *line;
never evaluated: abs(val) < abs(*line)
0
106 } while (--x);
never executed: }
never evaluated: --x
0
107}
never executed: }
0
108 -
109template <> -
110inline void fillLine<NoClip, LeftToRight>(qint32 *line, int, int lx, int rx, qint32 d, qint32 dd) -
111{ -
112 int fromX = lx >> 8;
never executed (the execution status of this line is deduced): int fromX = lx >> 8;
-
113 int toX = rx >> 8;
never executed (the execution status of this line is deduced): int toX = rx >> 8;
-
114 int x = toX - fromX;
never executed (the execution status of this line is deduced): int x = toX - fromX;
-
115 if (x <= 0)
never evaluated: x <= 0
0
116 return;
never executed: return;
0
117 qint32 val = d + ((~lx & 0xff) * dd >> 8);
never executed (the execution status of this line is deduced): qint32 val = d + ((~lx & 0xff) * dd >> 8);
-
118 line += fromX;
never executed (the execution status of this line is deduced): line += fromX;
-
119 do { -
120 *line = abs(val) < abs(*line) ? val : *line;
never evaluated: abs(val) < abs(*line)
0
121 val += dd;
never executed (the execution status of this line is deduced): val += dd;
-
122 ++line;
never executed (the execution status of this line is deduced): ++line;
-
123 } while (--x);
never executed: }
never evaluated: --x
0
124}
never executed: }
0
125 -
126template <> -
127inline void fillLine<NoClip, RightToLeft>(qint32 *line, int, int lx, int rx, qint32 d, qint32 dd) -
128{ -
129 int fromX = lx >> 8;
never executed (the execution status of this line is deduced): int fromX = lx >> 8;
-
130 int toX = rx >> 8;
never executed (the execution status of this line is deduced): int toX = rx >> 8;
-
131 int x = toX - fromX;
never executed (the execution status of this line is deduced): int x = toX - fromX;
-
132 if (x <= 0)
never evaluated: x <= 0
0
133 return;
never executed: return;
0
134 qint32 val = d + ((~rx & 0xff) * dd >> 8);
never executed (the execution status of this line is deduced): qint32 val = d + ((~rx & 0xff) * dd >> 8);
-
135 line += toX;
never executed (the execution status of this line is deduced): line += toX;
-
136 do { -
137 val -= dd;
never executed (the execution status of this line is deduced): val -= dd;
-
138 --line;
never executed (the execution status of this line is deduced): --line;
-
139 *line = abs(val) < abs(*line) ? val : *line;
never evaluated: abs(val) < abs(*line)
0
140 } while (--x);
never executed: }
never evaluated: --x
0
141}
never executed: }
0
142 -
143template <FillClip clip, FillVDir vDir, FillHDir hDir> -
144inline void fillLines(qint32 *bits, int width, int height, int upperY, int lowerY, -
145 int &lx, int ldx, int &rx, int rdx, qint32 &d, qint32 ddy, qint32 ddx) -
146{ -
147 Q_UNUSED(height);
never executed (the execution status of this line is deduced): (void)height;;
-
148 Q_ASSERT(upperY < lowerY);
never executed (the execution status of this line is deduced): qt_noop();
-
149 int y = lowerY - upperY;
never executed (the execution status of this line is deduced): int y = lowerY - upperY;
-
150 if (vDir == TopDown) {
never evaluated: vDir == TopDown
0
151 qint32 *line = bits + upperY * width;
never executed (the execution status of this line is deduced): qint32 *line = bits + upperY * width;
-
152 do { -
153 fillLine<clip, hDir>(line, width, lx, rx, d, ddx);
never executed (the execution status of this line is deduced): fillLine<clip, hDir>(line, width, lx, rx, d, ddx);
-
154 lx += ldx;
never executed (the execution status of this line is deduced): lx += ldx;
-
155 d += ddy;
never executed (the execution status of this line is deduced): d += ddy;
-
156 rx += rdx;
never executed (the execution status of this line is deduced): rx += rdx;
-
157 line += width;
never executed (the execution status of this line is deduced): line += width;
-
158 } while (--y);
never executed: }
never evaluated: --y
0
159 } else {
never executed: }
0
160 qint32 *line = bits + lowerY * width;
never executed (the execution status of this line is deduced): qint32 *line = bits + lowerY * width;
-
161 do { -
162 lx -= ldx;
never executed (the execution status of this line is deduced): lx -= ldx;
-
163 d -= ddy;
never executed (the execution status of this line is deduced): d -= ddy;
-
164 rx -= rdx;
never executed (the execution status of this line is deduced): rx -= rdx;
-
165 line -= width;
never executed (the execution status of this line is deduced): line -= width;
-
166 fillLine<clip, hDir>(line, width, lx, rx, d, ddx);
never executed (the execution status of this line is deduced): fillLine<clip, hDir>(line, width, lx, rx, d, ddx);
-
167 } while (--y);
never executed: }
never evaluated: --y
0
168 }
never executed: }
0
169} -
170 -
171template <FillClip clip> -
172void drawTriangle(qint32 *bits, int width, int height, const QPoint *center, -
173 const QPoint *v1, const QPoint *v2, qint32 value) -
174{ -
175 const int y1 = clip == Clip ? qBound(0, v1->y() >> 8, height) : v1->y() >> 8;
never evaluated: clip == Clip
0
176 const int y2 = clip == Clip ? qBound(0, v2->y() >> 8, height) : v2->y() >> 8;
never evaluated: clip == Clip
0
177 const int yC = clip == Clip ? qBound(0, center->y() >> 8, height) : center->y() >> 8;
never evaluated: clip == Clip
0
178 -
179 const int v1Frac = clip == Clip ? (y1 << 8) + 0xff - v1->y() : ~v2->y() & 0xff;
never evaluated: clip == Clip
0
180 const int v2Frac = clip == Clip ? (y2 << 8) + 0xff - v2->y() : ~v1->y() & 0xff;
never evaluated: clip == Clip
0
181 const int centerFrac = clip == Clip ? (yC << 8) + 0xff - center->y() : ~center->y() & 0xff;
never evaluated: clip == Clip
0
182 -
183 int dx1 = 0, x1 = 0, dx2 = 0, x2 = 0;
never executed (the execution status of this line is deduced): int dx1 = 0, x1 = 0, dx2 = 0, x2 = 0;
-
184 qint32 dd1, d1, dd2, d2;
never executed (the execution status of this line is deduced): qint32 dd1, d1, dd2, d2;
-
185 if (v1->y() != center->y()) {
never evaluated: v1->y() != center->y()
0
186 dx1 = ((v1->x() - center->x()) << 8) / (v1->y() - center->y());
never executed (the execution status of this line is deduced): dx1 = ((v1->x() - center->x()) << 8) / (v1->y() - center->y());
-
187 x1 = center->x() + centerFrac * (v1->x() - center->x()) / (v1->y() - center->y());
never executed (the execution status of this line is deduced): x1 = center->x() + centerFrac * (v1->x() - center->x()) / (v1->y() - center->y());
-
188 }
never executed: }
0
189 if (v2->y() != center->y()) {
never evaluated: v2->y() != center->y()
0
190 dx2 = ((v2->x() - center->x()) << 8) / (v2->y() - center->y());
never executed (the execution status of this line is deduced): dx2 = ((v2->x() - center->x()) << 8) / (v2->y() - center->y());
-
191 x2 = center->x() + centerFrac * (v2->x() - center->x()) / (v2->y() - center->y());
never executed (the execution status of this line is deduced): x2 = center->x() + centerFrac * (v2->x() - center->x()) / (v2->y() - center->y());
-
192 }
never executed: }
0
193 -
194 const qint32 div = (v2->x() - center->x()) * (v1->y() - center->y())
never executed (the execution status of this line is deduced): const qint32 div = (v2->x() - center->x()) * (v1->y() - center->y())
-
195 - (v2->y() - center->y()) * (v1->x() - center->x());
never executed (the execution status of this line is deduced): - (v2->y() - center->y()) * (v1->x() - center->x());
-
196 const qint32 dd = div ? qint32((qint64(value * (v1->y() - v2->y())) << 8) / div) : 0;
never evaluated: div
0
197 -
198 if (y2 < yC) {
never evaluated: y2 < yC
0
199 if (y1 < yC) {
never evaluated: y1 < yC
0
200 // Center at the bottom. -
201 if (y2 < y1) {
never evaluated: y2 < y1
0
202 // y2 < y1 < yC -
203 // Long right edge. -
204 d1 = centerFrac * value / (v1->y() - center->y());
never executed (the execution status of this line is deduced): d1 = centerFrac * value / (v1->y() - center->y());
-
205 dd1 = ((value << 8) / (v1->y() - center->y()));
never executed (the execution status of this line is deduced): dd1 = ((value << 8) / (v1->y() - center->y()));
-
206 fillLines<clip, BottomUp, LeftToRight>(bits, width, height, y1, yC, x1, dx1,
never executed (the execution status of this line is deduced): fillLines<clip, BottomUp, LeftToRight>(bits, width, height, y1, yC, x1, dx1,
-
207 x2, dx2, d1, dd1, dd);
never executed (the execution status of this line is deduced): x2, dx2, d1, dd1, dd);
-
208 dx1 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): dx1 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
-
209 x1 = v1->x() + v1Frac * (v1->x() - v2->x()) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): x1 = v1->x() + v1Frac * (v1->x() - v2->x()) / (v1->y() - v2->y());
-
210 fillLines<clip, BottomUp, LeftToRight>(bits, width, height, y2, y1, x1, dx1,
never executed (the execution status of this line is deduced): fillLines<clip, BottomUp, LeftToRight>(bits, width, height, y2, y1, x1, dx1,
-
211 x2, dx2, value, 0, dd);
never executed (the execution status of this line is deduced): x2, dx2, value, 0, dd);
-
212 } else {
never executed: }
0
213 // y1 <= y2 < yC -
214 // Long left edge. -
215 d2 = centerFrac * value / (v2->y() - center->y());
never executed (the execution status of this line is deduced): d2 = centerFrac * value / (v2->y() - center->y());
-
216 dd2 = ((value << 8) / (v2->y() - center->y()));
never executed (the execution status of this line is deduced): dd2 = ((value << 8) / (v2->y() - center->y()));
-
217 fillLines<clip, BottomUp, RightToLeft>(bits, width, height, y2, yC, x1, dx1,
never executed (the execution status of this line is deduced): fillLines<clip, BottomUp, RightToLeft>(bits, width, height, y2, yC, x1, dx1,
-
218 x2, dx2, d2, dd2, dd);
never executed (the execution status of this line is deduced): x2, dx2, d2, dd2, dd);
-
219 if (y1 != y2) {
never evaluated: y1 != y2
0
220 dx2 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): dx2 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
-
221 x2 = v2->x() + v2Frac * (v1->x() - v2->x()) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): x2 = v2->x() + v2Frac * (v1->x() - v2->x()) / (v1->y() - v2->y());
-
222 fillLines<clip, BottomUp, RightToLeft>(bits, width, height, y1, y2, x1, dx1,
never executed (the execution status of this line is deduced): fillLines<clip, BottomUp, RightToLeft>(bits, width, height, y1, y2, x1, dx1,
-
223 x2, dx2, value, 0, dd);
never executed (the execution status of this line is deduced): x2, dx2, value, 0, dd);
-
224 }
never executed: }
0
225 }
never executed: }
0
226 } else { -
227 // y2 < yC <= y1 -
228 // Center to the right. -
229 int dx = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): int dx = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
-
230 int xUp, xDn;
never executed (the execution status of this line is deduced): int xUp, xDn;
-
231 xUp = xDn = v2->x() + (clip == Clip ? (yC << 8) + 0xff - v2->y()
never evaluated: clip == Clip
0
232 : (center->y() | 0xff) - v2->y())
never executed (the execution status of this line is deduced): : (center->y() | 0xff) - v2->y())
-
233 * (v1->x() - v2->x()) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): * (v1->x() - v2->x()) / (v1->y() - v2->y());
-
234 fillLines<clip, BottomUp, LeftToRight>(bits, width, height, y2, yC, xUp, dx,
never executed (the execution status of this line is deduced): fillLines<clip, BottomUp, LeftToRight>(bits, width, height, y2, yC, xUp, dx,
-
235 x2, dx2, value, 0, dd);
never executed (the execution status of this line is deduced): x2, dx2, value, 0, dd);
-
236 if (yC != y1)
never evaluated: yC != y1
0
237 fillLines<clip, TopDown, LeftToRight>(bits, width, height, yC, y1, xDn, dx,
never executed: fillLines<clip, TopDown, LeftToRight>(bits, width, height, yC, y1, xDn, dx, x1, dx1, value, 0, dd);
0
238 x1, dx1, value, 0, dd);
never executed: fillLines<clip, TopDown, LeftToRight>(bits, width, height, yC, y1, xDn, dx, x1, dx1, value, 0, dd);
0
239 }
never executed: }
0
240 } else { -
241 if (y1 < yC) {
never evaluated: y1 < yC
0
242 // y1 < yC <= y2 -
243 // Center to the left. -
244 int dx = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): int dx = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
-
245 int xUp, xDn;
never executed (the execution status of this line is deduced): int xUp, xDn;
-
246 xUp = xDn = v1->x() + (clip == Clip ? (yC << 8) + 0xff - v1->y()
never evaluated: clip == Clip
0
247 : (center->y() | 0xff) - v1->y())
never executed (the execution status of this line is deduced): : (center->y() | 0xff) - v1->y())
-
248 * (v1->x() - v2->x()) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): * (v1->x() - v2->x()) / (v1->y() - v2->y());
-
249 fillLines<clip, BottomUp, RightToLeft>(bits, width, height, y1, yC, x1, dx1,
never executed (the execution status of this line is deduced): fillLines<clip, BottomUp, RightToLeft>(bits, width, height, y1, yC, x1, dx1,
-
250 xUp, dx, value, 0, dd);
never executed (the execution status of this line is deduced): xUp, dx, value, 0, dd);
-
251 if (yC != y2)
never evaluated: yC != y2
0
252 fillLines<clip, TopDown, RightToLeft>(bits, width, height, yC, y2, x2, dx2,
never executed: fillLines<clip, TopDown, RightToLeft>(bits, width, height, yC, y2, x2, dx2, xDn, dx, value, 0, dd);
0
253 xDn, dx, value, 0, dd);
never executed: fillLines<clip, TopDown, RightToLeft>(bits, width, height, yC, y2, x2, dx2, xDn, dx, value, 0, dd);
0
254 } else {
never executed: }
0
255 // Center at the top. -
256 if (y2 < y1) {
never evaluated: y2 < y1
0
257 // yC <= y2 < y1 -
258 // Long right edge. -
259 if (yC != y2) {
never evaluated: yC != y2
0
260 d2 = centerFrac * value / (v2->y() - center->y());
never executed (the execution status of this line is deduced): d2 = centerFrac * value / (v2->y() - center->y());
-
261 dd2 = ((value << 8) / (v2->y() - center->y()));
never executed (the execution status of this line is deduced): dd2 = ((value << 8) / (v2->y() - center->y()));
-
262 fillLines<clip, TopDown, LeftToRight>(bits, width, height, yC, y2, x2, dx2,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, LeftToRight>(bits, width, height, yC, y2, x2, dx2,
-
263 x1, dx1, d2, dd2, dd);
never executed (the execution status of this line is deduced): x1, dx1, d2, dd2, dd);
-
264 }
never executed: }
0
265 dx2 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): dx2 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
-
266 x2 = v2->x() + v2Frac * (v1->x() - v2->x()) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): x2 = v2->x() + v2Frac * (v1->x() - v2->x()) / (v1->y() - v2->y());
-
267 fillLines<clip, TopDown, LeftToRight>(bits, width, height, y2, y1, x2, dx2,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, LeftToRight>(bits, width, height, y2, y1, x2, dx2,
-
268 x1, dx1, value, 0, dd);
never executed (the execution status of this line is deduced): x1, dx1, value, 0, dd);
-
269 } else {
never executed: }
0
270 // Long left edge. -
271 // yC <= y1 <= y2 -
272 if (yC != y1) {
never evaluated: yC != y1
0
273 d1 = centerFrac * value / (v1->y() - center->y());
never executed (the execution status of this line is deduced): d1 = centerFrac * value / (v1->y() - center->y());
-
274 dd1 = ((value << 8) / (v1->y() - center->y()));
never executed (the execution status of this line is deduced): dd1 = ((value << 8) / (v1->y() - center->y()));
-
275 fillLines<clip, TopDown, RightToLeft>(bits, width, height, yC, y1, x2, dx2,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, RightToLeft>(bits, width, height, yC, y1, x2, dx2,
-
276 x1, dx1, d1, dd1, dd);
never executed (the execution status of this line is deduced): x1, dx1, d1, dd1, dd);
-
277 }
never executed: }
0
278 if (y1 != y2) {
never evaluated: y1 != y2
0
279 dx1 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): dx1 = ((v1->x() - v2->x()) << 8) / (v1->y() - v2->y());
-
280 x1 = v1->x() + v1Frac * (v1->x() - v2->x()) / (v1->y() - v2->y());
never executed (the execution status of this line is deduced): x1 = v1->x() + v1Frac * (v1->x() - v2->x()) / (v1->y() - v2->y());
-
281 fillLines<clip, TopDown, RightToLeft>(bits, width, height, y1, y2, x2, dx2,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, RightToLeft>(bits, width, height, y1, y2, x2, dx2,
-
282 x1, dx1, value, 0, dd);
never executed (the execution status of this line is deduced): x1, dx1, value, 0, dd);
-
283 }
never executed: }
0
284 }
never executed: }
0
285 } -
286 } -
287} -
288 -
289template <FillClip clip> -
290void drawRectangle(qint32 *bits, int width, int height, -
291 const QPoint *int1, const QPoint *center1, const QPoint *ext1, -
292 const QPoint *int2, const QPoint *center2, const QPoint *ext2, -
293 qint32 extValue) -
294{ -
295 if (center1->y() > center2->y()) {
never evaluated: center1->y() > center2->y()
0
296 qSwap(center1, center2);
never executed (the execution status of this line is deduced): qSwap(center1, center2);
-
297 qSwap(int1, ext2);
never executed (the execution status of this line is deduced): qSwap(int1, ext2);
-
298 qSwap(ext1, int2);
never executed (the execution status of this line is deduced): qSwap(ext1, int2);
-
299 extValue = -extValue;
never executed (the execution status of this line is deduced): extValue = -extValue;
-
300 }
never executed: }
0
301 -
302 Q_ASSERT(ext1->x() - center1->x() == center1->x() - int1->x());
never executed (the execution status of this line is deduced): qt_noop();
-
303 Q_ASSERT(ext1->y() - center1->y() == center1->y() - int1->y());
never executed (the execution status of this line is deduced): qt_noop();
-
304 Q_ASSERT(ext2->x() - center2->x() == center2->x() - int2->x());
never executed (the execution status of this line is deduced): qt_noop();
-
305 Q_ASSERT(ext2->y() - center2->y() == center2->y() - int2->y());
never executed (the execution status of this line is deduced): qt_noop();
-
306 -
307 const int yc1 = clip == Clip ? qBound(0, center1->y() >> 8, height) : center1->y() >> 8;
never evaluated: clip == Clip
0
308 const int yc2 = clip == Clip ? qBound(0, center2->y() >> 8, height) : center2->y() >> 8;
never evaluated: clip == Clip
0
309 const int yi1 = clip == Clip ? qBound(0, int1->y() >> 8, height) : int1->y() >> 8;
never evaluated: clip == Clip
0
310 const int yi2 = clip == Clip ? qBound(0, int2->y() >> 8, height) : int2->y() >> 8;
never evaluated: clip == Clip
0
311 const int ye1 = clip == Clip ? qBound(0, ext1->y() >> 8, height) : ext1->y() >> 8;
never evaluated: clip == Clip
0
312 const int ye2 = clip == Clip ? qBound(0, ext2->y() >> 8, height) : ext2->y() >> 8;
never evaluated: clip == Clip
0
313 -
314 const int center1Frac = clip == Clip ? (yc1 << 8) + 0xff - center1->y() : ~center1->y() & 0xff;
never evaluated: clip == Clip
0
315 const int center2Frac = clip == Clip ? (yc2 << 8) + 0xff - center2->y() : ~center2->y() & 0xff;
never evaluated: clip == Clip
0
316 const int int1Frac = clip == Clip ? (yi1 << 8) + 0xff - int1->y() : ~int1->y() & 0xff;
never evaluated: clip == Clip
0
317 const int ext1Frac = clip == Clip ? (ye1 << 8) + 0xff - ext1->y() : ~ext1->y() & 0xff;
never evaluated: clip == Clip
0
318 -
319 int dxC = 0, dxE = 0; // cap slope, edge slope
never executed (the execution status of this line is deduced): int dxC = 0, dxE = 0;
-
320 qint32 ddC = 0;
never executed (the execution status of this line is deduced): qint32 ddC = 0;
-
321 if (ext1->y() != int1->y()) {
never evaluated: ext1->y() != int1->y()
0
322 dxC = ((ext1->x() - int1->x()) << 8) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): dxC = ((ext1->x() - int1->x()) << 8) / (ext1->y() - int1->y());
-
323 ddC = (extValue << 9) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): ddC = (extValue << 9) / (ext1->y() - int1->y());
-
324 }
never executed: }
0
325 if (ext1->y() != ext2->y())
never evaluated: ext1->y() != ext2->y()
0
326 dxE = ((ext1->x() - ext2->x()) << 8) / (ext1->y() - ext2->y());
never executed: dxE = ((ext1->x() - ext2->x()) << 8) / (ext1->y() - ext2->y());
0
327 -
328 const qint32 div = (ext1->x() - int1->x()) * (ext2->y() - int1->y())
never executed (the execution status of this line is deduced): const qint32 div = (ext1->x() - int1->x()) * (ext2->y() - int1->y())
-
329 - (ext1->y() - int1->y()) * (ext2->x() - int1->x());
never executed (the execution status of this line is deduced): - (ext1->y() - int1->y()) * (ext2->x() - int1->x());
-
330 const qint32 dd = div ? qint32((qint64(extValue * (ext2->y() - ext1->y())) << 9) / div) : 0;
never evaluated: div
0
331 -
332 int xe1, xe2, xc1, xc2;
never executed (the execution status of this line is deduced): int xe1, xe2, xc1, xc2;
-
333 qint32 d;
never executed (the execution status of this line is deduced): qint32 d;
-
334 -
335 qint32 intValue = -extValue;
never executed (the execution status of this line is deduced): qint32 intValue = -extValue;
-
336 -
337 if (center2->x() < center1->x()) {
never evaluated: center2->x() < center1->x()
0
338 // Leaning to the right. '/' -
339 if (int1->y() < ext2->y()) {
never evaluated: int1->y() < ext2->y()
0
340 // Mostly vertical. -
341 Q_ASSERT(ext1->y() != ext2->y());
never executed (the execution status of this line is deduced): qt_noop();
-
342 xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
never executed (the execution status of this line is deduced): xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
-
343 xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
never executed (the execution status of this line is deduced): xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
-
344 if (ye1 != yi1) {
never evaluated: ye1 != yi1
0
345 xc2 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): xc2 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
-
346 xc2 += (ye1 - yc1) * dxC;
never executed (the execution status of this line is deduced): xc2 += (ye1 - yc1) * dxC;
-
347 fillLines<clip, TopDown, LeftToRight>(bits, width, height, ye1, yi1, xe1, dxE,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, LeftToRight>(bits, width, height, ye1, yi1, xe1, dxE,
-
348 xc2, dxC, extValue, 0, dd);
never executed (the execution status of this line is deduced): xc2, dxC, extValue, 0, dd);
-
349 }
never executed: }
0
350 if (yi1 != ye2)
never evaluated: yi1 != ye2
0
351 fillLines<clip, TopDown, LeftToRight>(bits, width, height, yi1, ye2, xe1, dxE,
never executed: fillLines<clip, TopDown, LeftToRight>(bits, width, height, yi1, ye2, xe1, dxE, xe2, dxE, extValue, 0, dd);
0
352 xe2, dxE, extValue, 0, dd);
never executed: fillLines<clip, TopDown, LeftToRight>(bits, width, height, yi1, ye2, xe1, dxE, xe2, dxE, extValue, 0, dd);
0
353 if (ye2 != yi2) {
never evaluated: ye2 != yi2
0
354 xc1 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): xc1 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
-
355 xc1 += (ye2 - yc2) * dxC;
never executed (the execution status of this line is deduced): xc1 += (ye2 - yc2) * dxC;
-
356 fillLines<clip, TopDown, RightToLeft>(bits, width, height, ye2, yi2, xc1, dxC,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, RightToLeft>(bits, width, height, ye2, yi2, xc1, dxC,
-
357 xe2, dxE, intValue, 0, dd);
never executed (the execution status of this line is deduced): xe2, dxE, intValue, 0, dd);
-
358 }
never executed: }
0
359 } else {
never executed: }
0
360 // Mostly horizontal. -
361 Q_ASSERT(ext1->y() != int1->y());
never executed (the execution status of this line is deduced): qt_noop();
-
362 xc1 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): xc1 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
-
363 xc2 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): xc2 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
-
364 xc1 += (ye2 - yc2) * dxC;
never executed (the execution status of this line is deduced): xc1 += (ye2 - yc2) * dxC;
-
365 xc2 += (ye1 - yc1) * dxC;
never executed (the execution status of this line is deduced): xc2 += (ye1 - yc1) * dxC;
-
366 if (ye1 != ye2) {
never evaluated: ye1 != ye2
0
367 xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
never executed (the execution status of this line is deduced): xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
-
368 fillLines<clip, TopDown, LeftToRight>(bits, width, height, ye1, ye2, xe1, dxE,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, LeftToRight>(bits, width, height, ye1, ye2, xe1, dxE,
-
369 xc2, dxC, extValue, 0, dd);
never executed (the execution status of this line is deduced): xc2, dxC, extValue, 0, dd);
-
370 }
never executed: }
0
371 if (ye2 != yi1) {
never evaluated: ye2 != yi1
0
372 d = (clip == Clip ? (ye2 << 8) + 0xff - center2->y()
never evaluated: clip == Clip
0
373 : (ext2->y() | 0xff) - center2->y())
never executed (the execution status of this line is deduced): : (ext2->y() | 0xff) - center2->y())
-
374 * 2 * extValue / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): * 2 * extValue / (ext1->y() - int1->y());
-
375 fillLines<clip, TopDown, LeftToRight>(bits, width, height, ye2, yi1, xc1, dxC,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, LeftToRight>(bits, width, height, ye2, yi1, xc1, dxC,
-
376 xc2, dxC, d, ddC, dd);
never executed (the execution status of this line is deduced): xc2, dxC, d, ddC, dd);
-
377 }
never executed: }
0
378 if (yi1 != yi2) {
never evaluated: yi1 != yi2
0
379 xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
never executed (the execution status of this line is deduced): xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
-
380 fillLines<clip, TopDown, RightToLeft>(bits, width, height, yi1, yi2, xc1, dxC,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, RightToLeft>(bits, width, height, yi1, yi2, xc1, dxC,
-
381 xe2, dxE, intValue, 0, dd);
never executed (the execution status of this line is deduced): xe2, dxE, intValue, 0, dd);
-
382 }
never executed: }
0
383 }
never executed: }
0
384 } else { -
385 // Leaning to the left. '\' -
386 if (ext1->y() < int2->y()) {
never evaluated: ext1->y() < int2->y()
0
387 // Mostly vertical. -
388 Q_ASSERT(ext1->y() != ext2->y());
never executed (the execution status of this line is deduced): qt_noop();
-
389 xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
never executed (the execution status of this line is deduced): xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
-
390 xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
never executed (the execution status of this line is deduced): xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
-
391 if (yi1 != ye1) {
never evaluated: yi1 != ye1
0
392 xc1 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): xc1 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
-
393 xc1 += (yi1 - yc1) * dxC;
never executed (the execution status of this line is deduced): xc1 += (yi1 - yc1) * dxC;
-
394 fillLines<clip, TopDown, RightToLeft>(bits, width, height, yi1, ye1, xc1, dxC,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, RightToLeft>(bits, width, height, yi1, ye1, xc1, dxC,
-
395 xe2, dxE, intValue, 0, dd);
never executed (the execution status of this line is deduced): xe2, dxE, intValue, 0, dd);
-
396 }
never executed: }
0
397 if (ye1 != yi2)
never evaluated: ye1 != yi2
0
398 fillLines<clip, TopDown, RightToLeft>(bits, width, height, ye1, yi2, xe1, dxE,
never executed: fillLines<clip, TopDown, RightToLeft>(bits, width, height, ye1, yi2, xe1, dxE, xe2, dxE, intValue, 0, dd);
0
399 xe2, dxE, intValue, 0, dd);
never executed: fillLines<clip, TopDown, RightToLeft>(bits, width, height, ye1, yi2, xe1, dxE, xe2, dxE, intValue, 0, dd);
0
400 if (yi2 != ye2) {
never evaluated: yi2 != ye2
0
401 xc2 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): xc2 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
-
402 xc2 += (yi2 - yc2) * dxC;
never executed (the execution status of this line is deduced): xc2 += (yi2 - yc2) * dxC;
-
403 fillLines<clip, TopDown, LeftToRight>(bits, width, height, yi2, ye2, xe1, dxE,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, LeftToRight>(bits, width, height, yi2, ye2, xe1, dxE,
-
404 xc2, dxC, extValue, 0, dd);
never executed (the execution status of this line is deduced): xc2, dxC, extValue, 0, dd);
-
405 }
never executed: }
0
406 } else {
never executed: }
0
407 // Mostly horizontal. -
408 Q_ASSERT(ext1->y() != int1->y());
never executed (the execution status of this line is deduced): qt_noop();
-
409 xc1 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): xc1 = center1->x() + center1Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
-
410 xc2 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): xc2 = center2->x() + center2Frac * (ext1->x() - int1->x()) / (ext1->y() - int1->y());
-
411 xc1 += (yi1 - yc1) * dxC;
never executed (the execution status of this line is deduced): xc1 += (yi1 - yc1) * dxC;
-
412 xc2 += (yi2 - yc2) * dxC;
never executed (the execution status of this line is deduced): xc2 += (yi2 - yc2) * dxC;
-
413 if (yi1 != yi2) {
never evaluated: yi1 != yi2
0
414 xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
never executed (the execution status of this line is deduced): xe2 = int1->x() + int1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
-
415 fillLines<clip, TopDown, RightToLeft>(bits, width, height, yi1, yi2, xc1, dxC,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, RightToLeft>(bits, width, height, yi1, yi2, xc1, dxC,
-
416 xe2, dxE, intValue, 0, dd);
never executed (the execution status of this line is deduced): xe2, dxE, intValue, 0, dd);
-
417 }
never executed: }
0
418 if (yi2 != ye1) {
never evaluated: yi2 != ye1
0
419 d = (clip == Clip ? (yi2 << 8) + 0xff - center2->y()
never evaluated: clip == Clip
0
420 : (int2->y() | 0xff) - center2->y())
never executed (the execution status of this line is deduced): : (int2->y() | 0xff) - center2->y())
-
421 * 2 * extValue / (ext1->y() - int1->y());
never executed (the execution status of this line is deduced): * 2 * extValue / (ext1->y() - int1->y());
-
422 fillLines<clip, TopDown, RightToLeft>(bits, width, height, yi2, ye1, xc1, dxC,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, RightToLeft>(bits, width, height, yi2, ye1, xc1, dxC,
-
423 xc2, dxC, d, ddC, dd);
never executed (the execution status of this line is deduced): xc2, dxC, d, ddC, dd);
-
424 }
never executed: }
0
425 if (ye1 != ye2) {
never evaluated: ye1 != ye2
0
426 xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
never executed (the execution status of this line is deduced): xe1 = ext1->x() + ext1Frac * (ext1->x() - ext2->x()) / (ext1->y() - ext2->y());
-
427 fillLines<clip, TopDown, LeftToRight>(bits, width, height, ye1, ye2, xe1, dxE,
never executed (the execution status of this line is deduced): fillLines<clip, TopDown, LeftToRight>(bits, width, height, ye1, ye2, xe1, dxE,
-
428 xc2, dxC, extValue, 0, dd);
never executed (the execution status of this line is deduced): xc2, dxC, extValue, 0, dd);
-
429 }
never executed: }
0
430 }
never executed: }
0
431 } -
432} -
433 -
434static void drawPolygons(qint32 *bits, int width, int height, const QPoint *vertices, -
435 const quint32 *indices, int indexCount, qint32 value) -
436{ -
437 Q_ASSERT(indexCount != 0);
never executed (the execution status of this line is deduced): qt_noop();
-
438 Q_ASSERT(height <= 128);
never executed (the execution status of this line is deduced): qt_noop();
-
439 QVarLengthArray<quint8, 16> scans[128];
never executed (the execution status of this line is deduced): QVarLengthArray<quint8, 16> scans[128];
-
440 int first = 0;
never executed (the execution status of this line is deduced): int first = 0;
-
441 for (int i = 1; i < indexCount; ++i) {
never evaluated: i < indexCount
0
442 quint32 idx1 = indices[i - 1];
never executed (the execution status of this line is deduced): quint32 idx1 = indices[i - 1];
-
443 quint32 idx2 = indices[i];
never executed (the execution status of this line is deduced): quint32 idx2 = indices[i];
-
444 Q_ASSERT(idx1 != quint32(-1));
never executed (the execution status of this line is deduced): qt_noop();
-
445 if (idx2 == quint32(-1)) {
never evaluated: idx2 == quint32(-1)
0
446 idx2 = indices[first];
never executed (the execution status of this line is deduced): idx2 = indices[first];
-
447 Q_ASSERT(idx2 != quint32(-1));
never executed (the execution status of this line is deduced): qt_noop();
-
448 first = ++i;
never executed (the execution status of this line is deduced): first = ++i;
-
449 }
never executed: }
0
450 const QPoint *v1 = &vertices[idx1];
never executed (the execution status of this line is deduced): const QPoint *v1 = &vertices[idx1];
-
451 const QPoint *v2 = &vertices[idx2];
never executed (the execution status of this line is deduced): const QPoint *v2 = &vertices[idx2];
-
452 if (v2->y() < v1->y())
never evaluated: v2->y() < v1->y()
0
453 qSwap(v1, v2);
never executed: qSwap(v1, v2);
0
454 int fromY = qMax(0, v1->y() >> 8);
never executed (the execution status of this line is deduced): int fromY = qMax(0, v1->y() >> 8);
-
455 int toY = qMin(height, v2->y() >> 8);
never executed (the execution status of this line is deduced): int toY = qMin(height, v2->y() >> 8);
-
456 if (fromY >= toY)
never evaluated: fromY >= toY
0
457 continue;
never executed: continue;
0
458 int dx = ((v2->x() - v1->x()) << 8) / (v2->y() - v1->y());
never executed (the execution status of this line is deduced): int dx = ((v2->x() - v1->x()) << 8) / (v2->y() - v1->y());
-
459 int x = v1->x() + ((fromY << 8) + 0xff - v1->y()) * (v2->x() - v1->x()) / (v2->y() - v1->y());
never executed (the execution status of this line is deduced): int x = v1->x() + ((fromY << 8) + 0xff - v1->y()) * (v2->x() - v1->x()) / (v2->y() - v1->y());
-
460 for (int y = fromY; y < toY; ++y) {
never evaluated: y < toY
0
461 quint32 c = quint32(x >> 8);
never executed (the execution status of this line is deduced): quint32 c = quint32(x >> 8);
-
462 if (c < quint32(width))
never evaluated: c < quint32(width)
0
463 scans[y].append(quint8(c));
never executed: scans[y].append(quint8(c));
0
464 x += dx;
never executed (the execution status of this line is deduced): x += dx;
-
465 }
never executed: }
0
466 }
never executed: }
0
467 for (int i = 0; i < height; ++i) {
never evaluated: i < height
0
468 quint8 *scanline = scans[i].data();
never executed (the execution status of this line is deduced): quint8 *scanline = scans[i].data();
-
469 int size = scans[i].size();
never executed (the execution status of this line is deduced): int size = scans[i].size();
-
470 for (int j = 1; j < size; ++j) {
never evaluated: j < size
0
471 int k = j;
never executed (the execution status of this line is deduced): int k = j;
-
472 quint8 value = scanline[k];
never executed (the execution status of this line is deduced): quint8 value = scanline[k];
-
473 for (; k != 0 && value < scanline[k - 1]; --k)
never evaluated: k != 0
never evaluated: value < scanline[k - 1]
0
474 scanline[k] = scanline[k - 1];
never executed: scanline[k] = scanline[k - 1];
0
475 scanline[k] = value;
never executed (the execution status of this line is deduced): scanline[k] = value;
-
476 }
never executed: }
0
477 qint32 *line = bits + i * width;
never executed (the execution status of this line is deduced): qint32 *line = bits + i * width;
-
478 int j = 0;
never executed (the execution status of this line is deduced): int j = 0;
-
479 for (; j + 1 < size; j += 2) {
never evaluated: j + 1 < size
0
480 for (quint8 x = scanline[j]; x < scanline[j + 1]; ++x)
never evaluated: x < scanline[j + 1]
0
481 line[x] = value;
never executed: line[x] = value;
0
482 }
never executed: }
0
483 if (j < size) {
never evaluated: j < size
0
484 for (int x = scanline[j]; x < width; ++x)
never evaluated: x < width
0
485 line[x] = value;
never executed: line[x] = value;
0
486 }
never executed: }
0
487 }
never executed: }
0
488}
never executed: }
0
489 -
490static QImage makeDistanceField(int imgWidth, int imgHeight, const QPainterPath &path, int dfScale, int offs) -
491{ -
492 QImage image(imgWidth, imgHeight, QImage::Format_Indexed8);
never executed (the execution status of this line is deduced): QImage image(imgWidth, imgHeight, QImage::Format_Indexed8);
-
493 -
494 if (path.isEmpty()) {
never evaluated: path.isEmpty()
0
495 image.fill(0);
never executed (the execution status of this line is deduced): image.fill(0);
-
496 return image;
never executed: return image;
0
497 } -
498 -
499 QTransform transform;
never executed (the execution status of this line is deduced): QTransform transform;
-
500 transform.translate(offs, offs);
never executed (the execution status of this line is deduced): transform.translate(offs, offs);
-
501 transform.scale(qreal(1) / dfScale, qreal(1) / dfScale);
never executed (the execution status of this line is deduced): transform.scale(qreal(1) / dfScale, qreal(1) / dfScale);
-
502 -
503 QDataBuffer<quint32> pathIndices(0);
never executed (the execution status of this line is deduced): QDataBuffer<quint32> pathIndices(0);
-
504 QDataBuffer<QPoint> pathVertices(0);
never executed (the execution status of this line is deduced): QDataBuffer<QPoint> pathVertices(0);
-
505 qSimplifyPath(path, pathVertices, pathIndices, transform);
never executed (the execution status of this line is deduced): qSimplifyPath(path, pathVertices, pathIndices, transform);
-
506 -
507 const qint32 interiorColor = -0x7f80; // 8:8 signed format, -127.5
never executed (the execution status of this line is deduced): const qint32 interiorColor = -0x7f80;
-
508 const qint32 exteriorColor = 0x7f80; // 8:8 signed format, 127.5
never executed (the execution status of this line is deduced): const qint32 exteriorColor = 0x7f80;
-
509 -
510 QScopedArrayPointer<qint32> bits(new qint32[imgWidth * imgHeight]);
never executed (the execution status of this line is deduced): QScopedArrayPointer<qint32> bits(new qint32[imgWidth * imgHeight]);
-
511 for (int i = 0; i < imgWidth * imgHeight; ++i)
never evaluated: i < imgWidth * imgHeight
0
512 bits[i] = exteriorColor;
never executed: bits[i] = exteriorColor;
0
513 -
514 const qreal angleStep = qreal(15 * 3.141592653589793238 / 180);
never executed (the execution status of this line is deduced): const qreal angleStep = qreal(15 * 3.141592653589793238 / 180);
-
515 const QPoint rotation(qRound(cos(angleStep) * 0x4000),
never executed (the execution status of this line is deduced): const QPoint rotation(qRound(cos(angleStep) * 0x4000),
-
516 qRound(sin(angleStep) * 0x4000)); // 2:14 signed
never executed (the execution status of this line is deduced): qRound(sin(angleStep) * 0x4000));
-
517 -
518 const quint32 *indices = pathIndices.data();
never executed (the execution status of this line is deduced): const quint32 *indices = pathIndices.data();
-
519 QVarLengthArray<QPoint> normals;
never executed (the execution status of this line is deduced): QVarLengthArray<QPoint> normals;
-
520 QVarLengthArray<QPoint> vertices;
never executed (the execution status of this line is deduced): QVarLengthArray<QPoint> vertices;
-
521 QVarLengthArray<bool> isConvex;
never executed (the execution status of this line is deduced): QVarLengthArray<bool> isConvex;
-
522 QVarLengthArray<bool> needsClipping;
never executed (the execution status of this line is deduced): QVarLengthArray<bool> needsClipping;
-
523 -
524 drawPolygons(bits.data(), imgWidth, imgHeight, pathVertices.data(), indices, pathIndices.size(),
never executed (the execution status of this line is deduced): drawPolygons(bits.data(), imgWidth, imgHeight, pathVertices.data(), indices, pathIndices.size(),
-
525 interiorColor);
never executed (the execution status of this line is deduced): interiorColor);
-
526 -
527 int index = 0;
never executed (the execution status of this line is deduced): int index = 0;
-
528 -
529 while (index < pathIndices.size()) {
never evaluated: index < pathIndices.size()
0
530 normals.clear();
never executed (the execution status of this line is deduced): normals.clear();
-
531 vertices.clear();
never executed (the execution status of this line is deduced): vertices.clear();
-
532 needsClipping.clear();
never executed (the execution status of this line is deduced): needsClipping.clear();
-
533 -
534 // Find end of polygon. -
535 int end = index;
never executed (the execution status of this line is deduced): int end = index;
-
536 while (indices[end] != quint32(-1))
never evaluated: indices[end] != quint32(-1)
0
537 ++end;
never executed: ++end;
0
538 -
539 // Calculate vertex normals. -
540 for (int next = index, prev = end - 1; next < end; prev = next++) {
never evaluated: next < end
0
541 quint32 fromVertexIndex = indices[prev];
never executed (the execution status of this line is deduced): quint32 fromVertexIndex = indices[prev];
-
542 quint32 toVertexIndex = indices[next];
never executed (the execution status of this line is deduced): quint32 toVertexIndex = indices[next];
-
543 -
544 const QPoint &from = pathVertices.at(fromVertexIndex);
never executed (the execution status of this line is deduced): const QPoint &from = pathVertices.at(fromVertexIndex);
-
545 const QPoint &to = pathVertices.at(toVertexIndex);
never executed (the execution status of this line is deduced): const QPoint &to = pathVertices.at(toVertexIndex);
-
546 -
547 QPoint n(to.y() - from.y(), from.x() - to.x());
never executed (the execution status of this line is deduced): QPoint n(to.y() - from.y(), from.x() - to.x());
-
548 if (n.x() == 0 && n.y() == 0)
never evaluated: n.x() == 0
never evaluated: n.y() == 0
0
549 continue;
never executed: continue;
0
550 int scale = qRound((offs << 16) / sqrt(qreal(n.x() * n.x() + n.y() * n.y()))); // 8:16
never executed (the execution status of this line is deduced): int scale = qRound((offs << 16) / sqrt(qreal(n.x() * n.x() + n.y() * n.y())));
-
551 n.rx() = n.x() * scale >> 8;
never executed (the execution status of this line is deduced): n.rx() = n.x() * scale >> 8;
-
552 n.ry() = n.y() * scale >> 8;
never executed (the execution status of this line is deduced): n.ry() = n.y() * scale >> 8;
-
553 normals.append(n);
never executed (the execution status of this line is deduced): normals.append(n);
-
554 QPoint v(to.x() + 0x7f, to.y() + 0x7f);
never executed (the execution status of this line is deduced): QPoint v(to.x() + 0x7f, to.y() + 0x7f);
-
555 vertices.append(v);
never executed (the execution status of this line is deduced): vertices.append(v);
-
556 needsClipping.append((to.x() < offs << 8) || (to.x() >= (imgWidth - offs) << 8)
never executed (the execution status of this line is deduced): needsClipping.append((to.x() < offs << 8) || (to.x() >= (imgWidth - offs) << 8)
-
557 || (to.y() < offs << 8) || (to.y() >= (imgHeight - offs) << 8));
never executed (the execution status of this line is deduced): || (to.y() < offs << 8) || (to.y() >= (imgHeight - offs) << 8));
-
558 }
never executed: }
0
559 -
560 isConvex.resize(normals.count());
never executed (the execution status of this line is deduced): isConvex.resize(normals.count());
-
561 for (int next = 0, prev = normals.count() - 1; next < normals.count(); prev = next++) {
never evaluated: next < normals.count()
0
562 isConvex[prev] = normals.at(prev).x() * normals.at(next).y()
never executed (the execution status of this line is deduced): isConvex[prev] = normals.at(prev).x() * normals.at(next).y()
-
563 - normals.at(prev).y() * normals.at(next).x() < 0;
never executed (the execution status of this line is deduced): - normals.at(prev).y() * normals.at(next).x() < 0;
-
564 }
never executed: }
0
565 -
566 // Draw quads. -
567 for (int next = 0, prev = normals.count() - 1; next < normals.count(); prev = next++) {
never evaluated: next < normals.count()
0
568 QPoint n = normals.at(next);
never executed (the execution status of this line is deduced): QPoint n = normals.at(next);
-
569 QPoint intPrev = vertices.at(prev);
never executed (the execution status of this line is deduced): QPoint intPrev = vertices.at(prev);
-
570 QPoint extPrev = vertices.at(prev);
never executed (the execution status of this line is deduced): QPoint extPrev = vertices.at(prev);
-
571 QPoint intNext = vertices.at(next);
never executed (the execution status of this line is deduced): QPoint intNext = vertices.at(next);
-
572 QPoint extNext = vertices.at(next);
never executed (the execution status of this line is deduced): QPoint extNext = vertices.at(next);
-
573 -
574 extPrev.rx() -= n.x();
never executed (the execution status of this line is deduced): extPrev.rx() -= n.x();
-
575 extPrev.ry() -= n.y();
never executed (the execution status of this line is deduced): extPrev.ry() -= n.y();
-
576 intPrev.rx() += n.x();
never executed (the execution status of this line is deduced): intPrev.rx() += n.x();
-
577 intPrev.ry() += n.y();
never executed (the execution status of this line is deduced): intPrev.ry() += n.y();
-
578 extNext.rx() -= n.x();
never executed (the execution status of this line is deduced): extNext.rx() -= n.x();
-
579 extNext.ry() -= n.y();
never executed (the execution status of this line is deduced): extNext.ry() -= n.y();
-
580 intNext.rx() += n.x();
never executed (the execution status of this line is deduced): intNext.rx() += n.x();
-
581 intNext.ry() += n.y();
never executed (the execution status of this line is deduced): intNext.ry() += n.y();
-
582 -
583 if (needsClipping[prev] || needsClipping[next]) {
never evaluated: needsClipping[prev]
never evaluated: needsClipping[next]
0
584 drawRectangle<Clip>(bits.data(), imgWidth, imgHeight,
never executed (the execution status of this line is deduced): drawRectangle<Clip>(bits.data(), imgWidth, imgHeight,
-
585 &intPrev, &vertices.at(prev), &extPrev,
never executed (the execution status of this line is deduced): &intPrev, &vertices.at(prev), &extPrev,
-
586 &intNext, &vertices.at(next), &extNext,
never executed (the execution status of this line is deduced): &intNext, &vertices.at(next), &extNext,
-
587 exteriorColor);
never executed (the execution status of this line is deduced): exteriorColor);
-
588 } else {
never executed: }
0
589 drawRectangle<NoClip>(bits.data(), imgWidth, imgHeight,
never executed (the execution status of this line is deduced): drawRectangle<NoClip>(bits.data(), imgWidth, imgHeight,
-
590 &intPrev, &vertices.at(prev), &extPrev,
never executed (the execution status of this line is deduced): &intPrev, &vertices.at(prev), &extPrev,
-
591 &intNext, &vertices.at(next), &extNext,
never executed (the execution status of this line is deduced): &intNext, &vertices.at(next), &extNext,
-
592 exteriorColor);
never executed (the execution status of this line is deduced): exteriorColor);
-
593 }
never executed: }
0
594 -
595 if (isConvex.at(prev)) {
never evaluated: isConvex.at(prev)
0
596 QPoint p = extPrev;
never executed (the execution status of this line is deduced): QPoint p = extPrev;
-
597 if (needsClipping[prev]) {
never evaluated: needsClipping[prev]
0
598 for (;;) {
never executed (the execution status of this line is deduced): for (;;) {
-
599 QPoint rn((n.x() * rotation.x() - n.y() * rotation.y()) >> 14,
never executed (the execution status of this line is deduced): QPoint rn((n.x() * rotation.x() - n.y() * rotation.y()) >> 14,
-
600 (n.y() * rotation.x() + n.x() * rotation.y()) >> 14);
never executed (the execution status of this line is deduced): (n.y() * rotation.x() + n.x() * rotation.y()) >> 14);
-
601 n = rn;
never executed (the execution status of this line is deduced): n = rn;
-
602 if (n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() <= 0) {
never evaluated: n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() <= 0
0
603 p.rx() = vertices.at(prev).x() - normals.at(prev).x();
never executed (the execution status of this line is deduced): p.rx() = vertices.at(prev).x() - normals.at(prev).x();
-
604 p.ry() = vertices.at(prev).y() - normals.at(prev).y();
never executed (the execution status of this line is deduced): p.ry() = vertices.at(prev).y() - normals.at(prev).y();
-
605 drawTriangle<Clip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
never executed (the execution status of this line is deduced): drawTriangle<Clip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
-
606 &extPrev, &p, exteriorColor);
never executed (the execution status of this line is deduced): &extPrev, &p, exteriorColor);
-
607 break;
never executed: break;
0
608 } -
609 -
610 p.rx() = vertices.at(prev).x() - n.x();
never executed (the execution status of this line is deduced): p.rx() = vertices.at(prev).x() - n.x();
-
611 p.ry() = vertices.at(prev).y() - n.y();
never executed (the execution status of this line is deduced): p.ry() = vertices.at(prev).y() - n.y();
-
612 drawTriangle<Clip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
never executed (the execution status of this line is deduced): drawTriangle<Clip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
-
613 &extPrev, &p, exteriorColor);
never executed (the execution status of this line is deduced): &extPrev, &p, exteriorColor);
-
614 extPrev = p;
never executed (the execution status of this line is deduced): extPrev = p;
-
615 }
never executed: }
0
616 } else {
never executed: }
0
617 for (;;) {
never executed (the execution status of this line is deduced): for (;;) {
-
618 QPoint rn((n.x() * rotation.x() - n.y() * rotation.y()) >> 14,
never executed (the execution status of this line is deduced): QPoint rn((n.x() * rotation.x() - n.y() * rotation.y()) >> 14,
-
619 (n.y() * rotation.x() + n.x() * rotation.y()) >> 14);
never executed (the execution status of this line is deduced): (n.y() * rotation.x() + n.x() * rotation.y()) >> 14);
-
620 n = rn;
never executed (the execution status of this line is deduced): n = rn;
-
621 if (n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() <= 0) {
never evaluated: n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() <= 0
0
622 p.rx() = vertices.at(prev).x() - normals.at(prev).x();
never executed (the execution status of this line is deduced): p.rx() = vertices.at(prev).x() - normals.at(prev).x();
-
623 p.ry() = vertices.at(prev).y() - normals.at(prev).y();
never executed (the execution status of this line is deduced): p.ry() = vertices.at(prev).y() - normals.at(prev).y();
-
624 drawTriangle<NoClip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
never executed (the execution status of this line is deduced): drawTriangle<NoClip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
-
625 &extPrev, &p, exteriorColor);
never executed (the execution status of this line is deduced): &extPrev, &p, exteriorColor);
-
626 break;
never executed: break;
0
627 } -
628 -
629 p.rx() = vertices.at(prev).x() - n.x();
never executed (the execution status of this line is deduced): p.rx() = vertices.at(prev).x() - n.x();
-
630 p.ry() = vertices.at(prev).y() - n.y();
never executed (the execution status of this line is deduced): p.ry() = vertices.at(prev).y() - n.y();
-
631 drawTriangle<NoClip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
never executed (the execution status of this line is deduced): drawTriangle<NoClip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
-
632 &extPrev, &p, exteriorColor);
never executed (the execution status of this line is deduced): &extPrev, &p, exteriorColor);
-
633 extPrev = p;
never executed (the execution status of this line is deduced): extPrev = p;
-
634 }
never executed: }
0
635 }
never executed: }
0
636 } else { -
637 QPoint p = intPrev;
never executed (the execution status of this line is deduced): QPoint p = intPrev;
-
638 if (needsClipping[prev]) {
never evaluated: needsClipping[prev]
0
639 for (;;) {
never executed (the execution status of this line is deduced): for (;;) {
-
640 QPoint rn((n.x() * rotation.x() + n.y() * rotation.y()) >> 14,
never executed (the execution status of this line is deduced): QPoint rn((n.x() * rotation.x() + n.y() * rotation.y()) >> 14,
-
641 (n.y() * rotation.x() - n.x() * rotation.y()) >> 14);
never executed (the execution status of this line is deduced): (n.y() * rotation.x() - n.x() * rotation.y()) >> 14);
-
642 n = rn;
never executed (the execution status of this line is deduced): n = rn;
-
643 if (n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() >= 0) {
never evaluated: n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() >= 0
0
644 p.rx() = vertices.at(prev).x() + normals.at(prev).x();
never executed (the execution status of this line is deduced): p.rx() = vertices.at(prev).x() + normals.at(prev).x();
-
645 p.ry() = vertices.at(prev).y() + normals.at(prev).y();
never executed (the execution status of this line is deduced): p.ry() = vertices.at(prev).y() + normals.at(prev).y();
-
646 drawTriangle<Clip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
never executed (the execution status of this line is deduced): drawTriangle<Clip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
-
647 &p, &intPrev, interiorColor);
never executed (the execution status of this line is deduced): &p, &intPrev, interiorColor);
-
648 break;
never executed: break;
0
649 } -
650 -
651 p.rx() = vertices.at(prev).x() + n.x();
never executed (the execution status of this line is deduced): p.rx() = vertices.at(prev).x() + n.x();
-
652 p.ry() = vertices.at(prev).y() + n.y();
never executed (the execution status of this line is deduced): p.ry() = vertices.at(prev).y() + n.y();
-
653 drawTriangle<Clip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
never executed (the execution status of this line is deduced): drawTriangle<Clip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
-
654 &p, &intPrev, interiorColor);
never executed (the execution status of this line is deduced): &p, &intPrev, interiorColor);
-
655 intPrev = p;
never executed (the execution status of this line is deduced): intPrev = p;
-
656 }
never executed: }
0
657 } else {
never executed: }
0
658 for (;;) {
never executed (the execution status of this line is deduced): for (;;) {
-
659 QPoint rn((n.x() * rotation.x() + n.y() * rotation.y()) >> 14,
never executed (the execution status of this line is deduced): QPoint rn((n.x() * rotation.x() + n.y() * rotation.y()) >> 14,
-
660 (n.y() * rotation.x() - n.x() * rotation.y()) >> 14);
never executed (the execution status of this line is deduced): (n.y() * rotation.x() - n.x() * rotation.y()) >> 14);
-
661 n = rn;
never executed (the execution status of this line is deduced): n = rn;
-
662 if (n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() >= 0) {
never evaluated: n.x() * normals.at(prev).y() - n.y() * normals.at(prev).x() >= 0
0
663 p.rx() = vertices.at(prev).x() + normals.at(prev).x();
never executed (the execution status of this line is deduced): p.rx() = vertices.at(prev).x() + normals.at(prev).x();
-
664 p.ry() = vertices.at(prev).y() + normals.at(prev).y();
never executed (the execution status of this line is deduced): p.ry() = vertices.at(prev).y() + normals.at(prev).y();
-
665 drawTriangle<NoClip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
never executed (the execution status of this line is deduced): drawTriangle<NoClip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
-
666 &p, &intPrev, interiorColor);
never executed (the execution status of this line is deduced): &p, &intPrev, interiorColor);
-
667 break;
never executed: break;
0
668 } -
669 -
670 p.rx() = vertices.at(prev).x() + n.x();
never executed (the execution status of this line is deduced): p.rx() = vertices.at(prev).x() + n.x();
-
671 p.ry() = vertices.at(prev).y() + n.y();
never executed (the execution status of this line is deduced): p.ry() = vertices.at(prev).y() + n.y();
-
672 drawTriangle<NoClip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
never executed (the execution status of this line is deduced): drawTriangle<NoClip>(bits.data(), imgWidth, imgHeight, &vertices.at(prev),
-
673 &p, &intPrev, interiorColor);
never executed (the execution status of this line is deduced): &p, &intPrev, interiorColor);
-
674 intPrev = p;
never executed (the execution status of this line is deduced): intPrev = p;
-
675 }
never executed: }
0
676 }
never executed: }
0
677 } -
678 } -
679 -
680 index = end + 1;
never executed (the execution status of this line is deduced): index = end + 1;
-
681 }
never executed: }
0
682 -
683 const qint32 *inLine = bits.data();
never executed (the execution status of this line is deduced): const qint32 *inLine = bits.data();
-
684 uchar *outLine = image.bits();
never executed (the execution status of this line is deduced): uchar *outLine = image.bits();
-
685 int padding = image.bytesPerLine() - image.width();
never executed (the execution status of this line is deduced): int padding = image.bytesPerLine() - image.width();
-
686 for (int y = 0; y < imgHeight; ++y) {
never evaluated: y < imgHeight
0
687 for (int x = 0; x < imgWidth; ++x, ++inLine, ++outLine)
never evaluated: x < imgWidth
0
688 *outLine = uchar((0x7f80 - *inLine) >> 8);
never executed: *outLine = uchar((0x7f80 - *inLine) >> 8);
0
689 outLine += padding;
never executed (the execution status of this line is deduced): outLine += padding;
-
690 }
never executed: }
0
691 -
692 return image;
never executed: return image;
0
693} -
694 -
695static bool imageHasNarrowOutlines(const QImage &im) -
696{ -
697 if (im.isNull())
never evaluated: im.isNull()
0
698 return false;
never executed: return false;
0
699 -
700 int minHThick = 999;
never executed (the execution status of this line is deduced): int minHThick = 999;
-
701 int minVThick = 999;
never executed (the execution status of this line is deduced): int minVThick = 999;
-
702 -
703 int thick = 0;
never executed (the execution status of this line is deduced): int thick = 0;
-
704 bool in = false;
never executed (the execution status of this line is deduced): bool in = false;
-
705 int y = (im.height() + 1) / 2;
never executed (the execution status of this line is deduced): int y = (im.height() + 1) / 2;
-
706 for (int x = 0; x < im.width(); ++x) {
never evaluated: x < im.width()
0
707 int a = qAlpha(im.pixel(x, y));
never executed (the execution status of this line is deduced): int a = qAlpha(im.pixel(x, y));
-
708 if (a > 127) {
never evaluated: a > 127
0
709 in = true;
never executed (the execution status of this line is deduced): in = true;
-
710 ++thick;
never executed (the execution status of this line is deduced): ++thick;
-
711 } else if (in) {
never executed: }
never evaluated: in
0
712 in = false;
never executed (the execution status of this line is deduced): in = false;
-
713 minHThick = qMin(minHThick, thick);
never executed (the execution status of this line is deduced): minHThick = qMin(minHThick, thick);
-
714 thick = 0;
never executed (the execution status of this line is deduced): thick = 0;
-
715 }
never executed: }
0
716 } -
717 -
718 thick = 0;
never executed (the execution status of this line is deduced): thick = 0;
-
719 in = false;
never executed (the execution status of this line is deduced): in = false;
-
720 int x = (im.width() + 1) / 2;
never executed (the execution status of this line is deduced): int x = (im.width() + 1) / 2;
-
721 for (int y = 0; y < im.height(); ++y) {
never evaluated: y < im.height()
0
722 int a = qAlpha(im.pixel(x, y));
never executed (the execution status of this line is deduced): int a = qAlpha(im.pixel(x, y));
-
723 if (a > 127) {
never evaluated: a > 127
0
724 in = true;
never executed (the execution status of this line is deduced): in = true;
-
725 ++thick;
never executed (the execution status of this line is deduced): ++thick;
-
726 } else if (in) {
never executed: }
never evaluated: in
0
727 in = false;
never executed (the execution status of this line is deduced): in = false;
-
728 minVThick = qMin(minVThick, thick);
never executed (the execution status of this line is deduced): minVThick = qMin(minVThick, thick);
-
729 thick = 0;
never executed (the execution status of this line is deduced): thick = 0;
-
730 }
never executed: }
0
731 } -
732 -
733 return minHThick == 1 || minVThick == 1;
never executed: return minHThick == 1 || minVThick == 1;
0
734} -
735 -
736bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine) -
737{ -
738 QFontEngine *fe = fontEngine->cloneWithSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE);
never executed (the execution status of this line is deduced): QFontEngine *fe = fontEngine->cloneWithSize(54);
-
739 if (!fe)
never evaluated: !fe
0
740 return false;
never executed: return false;
0
741 -
742 QGlyphLayout glyphs;
never executed (the execution status of this line is deduced): QGlyphLayout glyphs;
-
743 glyph_t glyph;
never executed (the execution status of this line is deduced): glyph_t glyph;
-
744 glyphs.glyphs = &glyph;
never executed (the execution status of this line is deduced): glyphs.glyphs = &glyph;
-
745 glyphs.numGlyphs = 1;
never executed (the execution status of this line is deduced): glyphs.numGlyphs = 1;
-
746 int numGlyphs = 1;
never executed (the execution status of this line is deduced): int numGlyphs = 1;
-
747 QChar uc = QLatin1Char('O');
never executed (the execution status of this line is deduced): QChar uc = QLatin1Char('O');
-
748 fe->stringToCMap(&uc, 1, &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly);
never executed (the execution status of this line is deduced): fe->stringToCMap(&uc, 1, &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly);
-
749 QImage im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform());
never executed (the execution status of this line is deduced): QImage im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform());
-
750 -
751 Q_ASSERT(fe->ref.load() == 0);
never executed (the execution status of this line is deduced): qt_noop();
-
752 delete fe;
never executed (the execution status of this line is deduced): delete fe;
-
753 -
754 return imageHasNarrowOutlines(im);
never executed: return imageHasNarrowOutlines(im);
0
755} -
756 -
757bool qt_fontHasNarrowOutlines(const QRawFont &f) -
758{ -
759 QRawFont font = f;
never executed (the execution status of this line is deduced): QRawFont font = f;
-
760 font.setPixelSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE);
never executed (the execution status of this line is deduced): font.setPixelSize(54);
-
761 if (!font.isValid())
never evaluated: !font.isValid()
0
762 return false;
never executed: return false;
0
763 -
764 QVector<quint32> glyphIndices = font.glyphIndexesForString(QLatin1String("O"));
never executed (the execution status of this line is deduced): QVector<quint32> glyphIndices = font.glyphIndexesForString(QLatin1String("O"));
-
765 if (glyphIndices.size() < 1)
never evaluated: glyphIndices.size() < 1
0
766 return false;
never executed: return false;
0
767 -
768 return imageHasNarrowOutlines(font.alphaMapForGlyph(glyphIndices.at(0),
never executed: return imageHasNarrowOutlines(font.alphaMapForGlyph(glyphIndices.at(0), QRawFont::PixelAntialiasing));
0
769 QRawFont::PixelAntialiasing));
never executed: return imageHasNarrowOutlines(font.alphaMapForGlyph(glyphIndices.at(0), QRawFont::PixelAntialiasing));
0
770} -
771 -
772static QImage renderDistanceFieldPath(const QPainterPath &path, bool doubleResolution) -
773{ -
774 int dfMargin = QT_DISTANCEFIELD_RADIUS(doubleResolution) / QT_DISTANCEFIELD_SCALE(doubleResolution);
never evaluated: doubleResolution
never evaluated: doubleResolution
0
775 int glyphWidth = qCeil(path.boundingRect().width() / QT_DISTANCEFIELD_SCALE(doubleResolution)) + dfMargin * 2;
never executed (the execution status of this line is deduced): int glyphWidth = qCeil(path.boundingRect().width() / (doubleResolution ? 16 / 2 : 16)) + dfMargin * 2;
-
776 -
777 QImage im = makeDistanceField(glyphWidth,
never executed (the execution status of this line is deduced): QImage im = makeDistanceField(glyphWidth,
-
778 QT_DISTANCEFIELD_TILESIZE(doubleResolution),
never executed (the execution status of this line is deduced): (doubleResolution ? 64 * 2 : 64),
-
779 path,
never executed (the execution status of this line is deduced): path,
-
780 QT_DISTANCEFIELD_SCALE(doubleResolution),
never executed (the execution status of this line is deduced): (doubleResolution ? 16 / 2 : 16),
-
781 QT_DISTANCEFIELD_RADIUS(doubleResolution) / QT_DISTANCEFIELD_SCALE(doubleResolution));
never executed (the execution status of this line is deduced): (doubleResolution ? 80 / 2 : 80) / (doubleResolution ? 16 / 2 : 16));
-
782 return im;
never executed: return im;
0
783} -
784 -
785QImage qt_renderDistanceFieldGlyph(QFontEngine *fe, glyph_t glyph, bool doubleResolution) -
786{ -
787 QFixedPoint position;
never executed (the execution status of this line is deduced): QFixedPoint position;
-
788 QPainterPath path;
never executed (the execution status of this line is deduced): QPainterPath path;
-
789 fe->addGlyphsToPath(&glyph, &position, 1, &path, 0);
never executed (the execution status of this line is deduced): fe->addGlyphsToPath(&glyph, &position, 1, &path, 0);
-
790 path.translate(-path.boundingRect().topLeft());
never executed (the execution status of this line is deduced): path.translate(-path.boundingRect().topLeft());
-
791 path.setFillRule(Qt::WindingFill);
never executed (the execution status of this line is deduced): path.setFillRule(Qt::WindingFill);
-
792 -
793 return renderDistanceFieldPath(path, doubleResolution);
never executed: return renderDistanceFieldPath(path, doubleResolution);
0
794} -
795 -
796QImage qt_renderDistanceFieldGlyph(const QRawFont &font, glyph_t glyph, bool doubleResolution) -
797{ -
798 QRawFont renderFont = font;
never executed (the execution status of this line is deduced): QRawFont renderFont = font;
-
799 renderFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(doubleResolution) * QT_DISTANCEFIELD_SCALE(doubleResolution));
never executed (the execution status of this line is deduced): renderFont.setPixelSize((doubleResolution ? 54 * 2 : 54) * (doubleResolution ? 16 / 2 : 16));
-
800 -
801 QPainterPath path = renderFont.pathForGlyph(glyph);
never executed (the execution status of this line is deduced): QPainterPath path = renderFont.pathForGlyph(glyph);
-
802 path.translate(-path.boundingRect().topLeft());
never executed (the execution status of this line is deduced): path.translate(-path.boundingRect().topLeft());
-
803 path.setFillRule(Qt::WindingFill);
never executed (the execution status of this line is deduced): path.setFillRule(Qt::WindingFill);
-
804 -
805 return renderDistanceFieldPath(path, doubleResolution);
never executed: return renderDistanceFieldPath(path, doubleResolution);
0
806} -
807 -
808QT_END_NAMESPACE -
809 -
810 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial