qglyphrun.cpp

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

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