Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | QGlyphRun::QGlyphRun() : d(new QGlyphRunPrivate) | - |
7 | { | - |
8 | } executed: } Execution Count:59 | 59 |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | QGlyphRun::QGlyphRun(const QGlyphRun &other) | - |
14 | { | - |
15 | d = other.d; | - |
16 | } executed: } Execution Count:109 | 109 |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | QGlyphRun::~QGlyphRun() | - |
22 | { | - |
23 | | - |
24 | } | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | void QGlyphRun::detach() | - |
30 | { | - |
31 | if (d->ref.load() != 1) evaluated: d->ref.load() != 1 yes Evaluation Count:5 | yes Evaluation Count:142 |
| 5-142 |
32 | d.detach(); executed: d.detach(); Execution Count:5 | 5 |
33 | } executed: } Execution Count:147 | 147 |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | QGlyphRun &QGlyphRun::operator=(const QGlyphRun &other) | - |
39 | { | - |
40 | d = other.d; | - |
41 | return *this; executed: return *this; Execution Count:24 | 24 |
42 | } | - |
43 | bool QGlyphRun::operator==(const QGlyphRun &other) const | - |
44 | { | - |
45 | if (d == other.d) partially evaluated: d == other.d no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
46 | return true; never executed: return true; | 0 |
47 | | - |
48 | if ((d->glyphIndexDataSize != other.d->glyphIndexDataSize) partially evaluated: (d->glyphIndexDataSize != other.d->glyphIndexDataSize) no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
49 | || (d->glyphPositionDataSize != other.d->glyphPositionDataSize)) { partially evaluated: (d->glyphPositionDataSize != other.d->glyphPositionDataSize) no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
50 | return false; never executed: return false; | 0 |
51 | } | - |
52 | | - |
53 | if (d->glyphIndexData != other.d->glyphIndexData) { evaluated: d->glyphIndexData != other.d->glyphIndexData yes Evaluation Count:8 | yes Evaluation Count:1 |
| 1-8 |
54 | for (int i = 0; i < d->glyphIndexDataSize; ++i) { evaluated: i < d->glyphIndexDataSize yes Evaluation Count:24 | yes Evaluation Count:6 |
| 6-24 |
55 | if (d->glyphIndexData[i] != other.d->glyphIndexData[i]) evaluated: d->glyphIndexData[i] != other.d->glyphIndexData[i] yes Evaluation Count:2 | yes Evaluation Count:22 |
| 2-22 |
56 | return false; executed: return false; Execution Count:2 | 2 |
57 | } executed: } Execution Count:22 | 22 |
58 | } executed: } Execution Count:6 | 6 |
59 | if (d->glyphPositionData != other.d->glyphPositionData) { evaluated: d->glyphPositionData != other.d->glyphPositionData yes Evaluation Count:6 | yes Evaluation Count:1 |
| 1-6 |
60 | for (int i = 0; i < d->glyphPositionDataSize; ++i) { evaluated: i < d->glyphPositionDataSize yes Evaluation Count:18 | yes Evaluation Count:4 |
| 4-18 |
61 | if (d->glyphPositionData[i] != other.d->glyphPositionData[i]) evaluated: d->glyphPositionData[i] != other.d->glyphPositionData[i] yes Evaluation Count:2 | yes Evaluation Count:16 |
| 2-16 |
62 | return false; executed: return false; Execution Count:2 | 2 |
63 | } executed: } Execution Count:16 | 16 |
64 | } executed: } Execution Count:4 | 4 |
65 | | - |
66 | return (d->flags == other.d->flags && d->rawFont == other.d->rawFont); executed: return (d->flags == other.d->flags && d->rawFont == other.d->rawFont); Execution Count:5 | 5 |
67 | } | - |
68 | QRawFont QGlyphRun::rawFont() const | - |
69 | { | - |
70 | return d->rawFont; executed: return d->rawFont; Execution Count:49 | 49 |
71 | } | - |
72 | | - |
73 | | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | void QGlyphRun::setRawFont(const QRawFont &rawFont) | - |
80 | { | - |
81 | detach(); | - |
82 | d->rawFont = rawFont; | - |
83 | } executed: } Execution Count:32 | 32 |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | | - |
89 | | - |
90 | QVector<quint32> QGlyphRun::glyphIndexes() const | - |
91 | { | - |
92 | if (d->glyphIndexes.constData() == d->glyphIndexData) { evaluated: d->glyphIndexes.constData() == d->glyphIndexData yes Evaluation Count:13 | yes Evaluation Count:1 |
| 1-13 |
93 | return d->glyphIndexes; executed: return d->glyphIndexes; Execution Count:13 | 13 |
94 | } else { | - |
95 | QVector<quint32> indexes(d->glyphIndexDataSize); | - |
96 | memcpy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32)); | - |
97 | return indexes; executed: return indexes; Execution Count:1 | 1 |
98 | } | - |
99 | } | - |
100 | | - |
101 | | - |
102 | | - |
103 | | - |
104 | | - |
105 | void QGlyphRun::setGlyphIndexes(const QVector<quint32> &glyphIndexes) | - |
106 | { | - |
107 | detach(); | - |
108 | d->glyphIndexes = glyphIndexes; | - |
109 | d->glyphIndexData = glyphIndexes.constData(); | - |
110 | d->glyphIndexDataSize = glyphIndexes.size(); | - |
111 | } executed: } Execution Count:37 | 37 |
112 | | - |
113 | | - |
114 | | - |
115 | | - |
116 | QVector<QPointF> QGlyphRun::positions() const | - |
117 | { | - |
118 | if (d->glyphPositions.constData() == d->glyphPositionData) { evaluated: d->glyphPositions.constData() == d->glyphPositionData yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-5 |
119 | return d->glyphPositions; executed: return d->glyphPositions; Execution Count:5 | 5 |
120 | } else { | - |
121 | QVector<QPointF> glyphPositions(d->glyphPositionDataSize); | - |
122 | memcpy(glyphPositions.data(), d->glyphPositionData, | - |
123 | d->glyphPositionDataSize * sizeof(QPointF)); | - |
124 | return glyphPositions; executed: return glyphPositions; Execution Count:1 | 1 |
125 | } | - |
126 | } | - |
127 | | - |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | void QGlyphRun::setPositions(const QVector<QPointF> &positions) | - |
133 | { | - |
134 | detach(); | - |
135 | d->glyphPositions = positions; | - |
136 | d->glyphPositionData = positions.constData(); | - |
137 | d->glyphPositionDataSize = positions.size(); | - |
138 | } executed: } Execution Count:34 | 34 |
139 | | - |
140 | | - |
141 | | - |
142 | | - |
143 | void QGlyphRun::clear() | - |
144 | { | - |
145 | detach(); | - |
146 | d->rawFont = QRawFont(); | - |
147 | d->flags = 0; | - |
148 | | - |
149 | setPositions(QVector<QPointF>()); | - |
150 | setGlyphIndexes(QVector<quint32>()); | - |
151 | } executed: } Execution Count:2 | 2 |
152 | void QGlyphRun::setRawData(const quint32 *glyphIndexArray, const QPointF *glyphPositionArray, | - |
153 | int size) | - |
154 | { | - |
155 | detach(); | - |
156 | d->glyphIndexes.clear(); | - |
157 | d->glyphPositions.clear(); | - |
158 | | - |
159 | d->glyphIndexData = glyphIndexArray; | - |
160 | d->glyphPositionData = glyphPositionArray; | - |
161 | d->glyphIndexDataSize = d->glyphPositionDataSize = size; | - |
162 | } executed: } Execution Count:5 | 5 |
163 | | - |
164 | | - |
165 | | - |
166 | | - |
167 | | - |
168 | | - |
169 | bool QGlyphRun::overline() const | - |
170 | { | - |
171 | return d->flags & Overline; executed: return d->flags & Overline; Execution Count:12 | 12 |
172 | } | - |
173 | | - |
174 | | - |
175 | | - |
176 | | - |
177 | | - |
178 | | - |
179 | | - |
180 | void QGlyphRun::setOverline(bool overline) | - |
181 | { | - |
182 | setFlag(Overline, overline); | - |
183 | } | 0 |
184 | | - |
185 | | - |
186 | | - |
187 | | - |
188 | | - |
189 | | - |
190 | bool QGlyphRun::underline() const | - |
191 | { | - |
192 | return d->flags & Underline; executed: return d->flags & Underline; Execution Count:12 | 12 |
193 | } | - |
194 | | - |
195 | | - |
196 | | - |
197 | | - |
198 | | - |
199 | | - |
200 | | - |
201 | void QGlyphRun::setUnderline(bool underline) | - |
202 | { | - |
203 | setFlag(Underline, underline); | - |
204 | } | 0 |
205 | | - |
206 | | - |
207 | | - |
208 | | - |
209 | | - |
210 | | - |
211 | bool QGlyphRun::strikeOut() const | - |
212 | { | - |
213 | return d->flags & StrikeOut; executed: return d->flags & StrikeOut; Execution Count:12 | 12 |
214 | } | - |
215 | | - |
216 | | - |
217 | | - |
218 | | - |
219 | | - |
220 | | - |
221 | | - |
222 | void QGlyphRun::setStrikeOut(bool strikeOut) | - |
223 | { | - |
224 | setFlag(StrikeOut, strikeOut); | - |
225 | } | 0 |
226 | | - |
227 | | - |
228 | | - |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | bool QGlyphRun::isRightToLeft() const | - |
234 | { | - |
235 | return d->flags & RightToLeft; never executed: return d->flags & RightToLeft; | 0 |
236 | } | - |
237 | void QGlyphRun::setRightToLeft(bool rightToLeft) | - |
238 | { | - |
239 | setFlag(RightToLeft, rightToLeft); | - |
240 | } | 0 |
241 | | - |
242 | | - |
243 | | - |
244 | | - |
245 | | - |
246 | | - |
247 | | - |
248 | QGlyphRun::GlyphRunFlags QGlyphRun::flags() const | - |
249 | { | - |
250 | return d->flags; executed: return d->flags; Execution Count:23 | 23 |
251 | } | - |
252 | | - |
253 | | - |
254 | | - |
255 | | - |
256 | | - |
257 | | - |
258 | | - |
259 | void QGlyphRun::setFlag(GlyphRunFlag flag, bool enabled) | - |
260 | { | - |
261 | if (d->flags.testFlag(flag) == enabled) never evaluated: d->flags.testFlag(flag) == enabled | 0 |
262 | return; | 0 |
263 | | - |
264 | detach(); | - |
265 | if (enabled) | 0 |
266 | d->flags |= flag; never executed: d->flags |= flag; | 0 |
267 | else | - |
268 | d->flags &= ~flag; never executed: d->flags &= ~flag; | 0 |
269 | } | - |
270 | | - |
271 | | - |
272 | | - |
273 | | - |
274 | | - |
275 | | - |
276 | | - |
277 | void QGlyphRun::setFlags(GlyphRunFlags flags) | - |
278 | { | - |
279 | if (d->flags == flags) evaluated: d->flags == flags yes Evaluation Count:10 | yes Evaluation Count:13 |
| 10-13 |
280 | return; executed: return; Execution Count:10 | 10 |
281 | | - |
282 | detach(); | - |
283 | d->flags = flags; | - |
284 | } executed: } Execution Count:13 | 13 |
285 | void QGlyphRun::setBoundingRect(const QRectF &boundingRect) | - |
286 | { | - |
287 | detach(); | - |
288 | d->boundingRect = boundingRect; | - |
289 | } executed: } Execution Count:24 | 24 |
290 | QRectF QGlyphRun::boundingRect() const | - |
291 | { | - |
292 | if (!d->boundingRect.isEmpty() || !d->rawFont.isValid()) evaluated: !d->boundingRect.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:2 |
partially evaluated: !d->rawFont.isValid() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
293 | return d->boundingRect; executed: return d->boundingRect; Execution Count:1 | 1 |
294 | | - |
295 | qreal minX, minY, maxX, maxY; | - |
296 | minX = minY = maxX = maxY = 0; | - |
297 | | - |
298 | for (int i = 0, n = qMin(d->glyphIndexDataSize, d->glyphPositionDataSize); i < n; ++i) { evaluated: i < n yes Evaluation Count:10 | yes Evaluation Count:2 |
| 2-10 |
299 | QRectF glyphRect = d->rawFont.boundingRect(d->glyphIndexData[i]); | - |
300 | glyphRect.translate(d->glyphPositionData[i]); | - |
301 | | - |
302 | if (i == 0) { evaluated: i == 0 yes Evaluation Count:2 | yes Evaluation Count:8 |
| 2-8 |
303 | minX = glyphRect.left(); | - |
304 | minY = glyphRect.top(); | - |
305 | maxX = glyphRect.right(); | - |
306 | maxY = glyphRect.bottom(); | - |
307 | } else { executed: } Execution Count:2 | 2 |
308 | minX = qMin(glyphRect.left(), minX); | - |
309 | minY = qMin(glyphRect.top(), minY); | - |
310 | maxX = qMax(glyphRect.right(),maxX); | - |
311 | maxY = qMax(glyphRect.bottom(), maxY); | - |
312 | } executed: } Execution Count:8 | 8 |
313 | } | - |
314 | | - |
315 | return QRectF(QPointF(minX, minY), QPointF(maxX, maxY)); executed: return QRectF(QPointF(minX, minY), QPointF(maxX, maxY)); Execution Count:2 | 2 |
316 | } | - |
317 | | - |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | | - |
323 | bool QGlyphRun::isEmpty() const | - |
324 | { | - |
325 | return d->glyphIndexDataSize == 0; executed: return d->glyphIndexDataSize == 0; Execution Count:27 | 27 |
326 | } | - |
327 | | - |
328 | | - |
329 | | - |
| | |