Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qpaintengine.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | qreal QTextItem::descent() const | - | ||||||||||||
5 | { | - | ||||||||||||
6 | const QTextItemInt *ti = static_cast<const QTextItemInt *>(this); | - | ||||||||||||
7 | return never executed: ti->descent.toReal();return ti->descent.toReal(); never executed: return ti->descent.toReal(); | 0 | ||||||||||||
8 | } | - | ||||||||||||
9 | - | |||||||||||||
10 | - | |||||||||||||
11 | - | |||||||||||||
12 | - | |||||||||||||
13 | - | |||||||||||||
14 | - | |||||||||||||
15 | qreal QTextItem::ascent() const | - | ||||||||||||
16 | { | - | ||||||||||||
17 | const QTextItemInt *ti = static_cast<const QTextItemInt *>(this); | - | ||||||||||||
18 | return never executed: ti->ascent.toReal();return ti->ascent.toReal(); never executed: return ti->ascent.toReal(); | 0 | ||||||||||||
19 | } | - | ||||||||||||
20 | - | |||||||||||||
21 | - | |||||||||||||
22 | - | |||||||||||||
23 | - | |||||||||||||
24 | - | |||||||||||||
25 | - | |||||||||||||
26 | qreal QTextItem::width() const | - | ||||||||||||
27 | { | - | ||||||||||||
28 | const QTextItemInt *ti = static_cast<const QTextItemInt *>(this); | - | ||||||||||||
29 | return never executed: ti->width.toReal();return ti->width.toReal(); never executed: return ti->width.toReal(); | 0 | ||||||||||||
30 | } | - | ||||||||||||
31 | - | |||||||||||||
32 | - | |||||||||||||
33 | - | |||||||||||||
34 | - | |||||||||||||
35 | - | |||||||||||||
36 | - | |||||||||||||
37 | QTextItem::RenderFlags QTextItem::renderFlags() const | - | ||||||||||||
38 | { | - | ||||||||||||
39 | const QTextItemInt *ti = static_cast<const QTextItemInt *>(this); | - | ||||||||||||
40 | return never executed: ti->flags;return ti->flags; never executed: return ti->flags; | 0 | ||||||||||||
41 | } | - | ||||||||||||
42 | - | |||||||||||||
43 | - | |||||||||||||
44 | - | |||||||||||||
45 | - | |||||||||||||
46 | - | |||||||||||||
47 | - | |||||||||||||
48 | QString QTextItem::text() const | - | ||||||||||||
49 | { | - | ||||||||||||
50 | const QTextItemInt *ti = static_cast<const QTextItemInt *>(this); | - | ||||||||||||
51 | return never executed: QString(ti->chars, ti->num_chars);return QString(ti->chars, ti->num_chars); never executed: return QString(ti->chars, ti->num_chars); | 0 | ||||||||||||
52 | } | - | ||||||||||||
53 | - | |||||||||||||
54 | - | |||||||||||||
55 | - | |||||||||||||
56 | - | |||||||||||||
57 | - | |||||||||||||
58 | - | |||||||||||||
59 | QFont QTextItem::font() const | - | ||||||||||||
60 | { | - | ||||||||||||
61 | const QTextItemInt *ti = static_cast<const QTextItemInt *>(this); | - | ||||||||||||
62 | return never executed: ti->freturn ti->f ? *ti->f : QGuiApplication::font();
never executed: return ti->f ? *ti->f : QGuiApplication::font(); | 0 | ||||||||||||
63 | } | - | ||||||||||||
64 | void QPaintEngine::syncState() | - | ||||||||||||
65 | { | - | ||||||||||||
66 | ((!(state)) ? qt_assert("state",__FILE__,295) : qt_noop()); | - | ||||||||||||
67 | updateState(*state); | - | ||||||||||||
68 | - | |||||||||||||
69 | if (isExtended()
| 0 | ||||||||||||
70 | static_cast< never executed: QPaintEngineEx *>(this)->sync();static_cast<QPaintEngineEx *>(this)->sync(); never executed: static_cast<QPaintEngineEx *>(this)->sync(); | 0 | ||||||||||||
71 | } never executed: end of block | 0 | ||||||||||||
72 | - | |||||||||||||
73 | static QPaintEngine *qt_polygon_recursion = 0; | - | ||||||||||||
74 | struct QT_Point { | - | ||||||||||||
75 | int x; | - | ||||||||||||
76 | int y; | - | ||||||||||||
77 | }; | - | ||||||||||||
78 | void QPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||
79 | { | - | ||||||||||||
80 | ((!(qt_polygon_recursion != this)) ? qt_assert_x("QPaintEngine::drawPolygon", "At least one drawPolygon function must be implemented", | - | ||||||||||||
81 | __FILE__ | - | ||||||||||||
82 | , | - | ||||||||||||
83 | 321 | - | ||||||||||||
84 | ) : qt_noop()) | - | ||||||||||||
85 | ; | - | ||||||||||||
86 | qt_polygon_recursion = this; | - | ||||||||||||
87 | ((!(sizeof(QT_Point) == sizeof(QPoint))) ? qt_assert("sizeof(QT_Point) == sizeof(QPoint)",__FILE__,323) : qt_noop()); | - | ||||||||||||
88 | QVarLengthArray<QT_Point> p(pointCount); | - | ||||||||||||
89 | for (int i = 0; i < pointCount
| 0 | ||||||||||||
90 | p[i].x = qRound(points[i].x()); | - | ||||||||||||
91 | p[i].y = qRound(points[i].y()); | - | ||||||||||||
92 | } never executed: end of block | 0 | ||||||||||||
93 | drawPolygon((QPoint *)p.data(), pointCount, mode); | - | ||||||||||||
94 | qt_polygon_recursion = 0; | - | ||||||||||||
95 | } never executed: end of block | 0 | ||||||||||||
96 | - | |||||||||||||
97 | struct QT_PointF { | - | ||||||||||||
98 | qreal x; | - | ||||||||||||
99 | qreal y; | - | ||||||||||||
100 | }; | - | ||||||||||||
101 | void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||
102 | { | - | ||||||||||||
103 | ((!(qt_polygon_recursion != this)) ? qt_assert_x("QPaintEngine::drawPolygon", "At least one drawPolygon function must be implemented", | - | ||||||||||||
104 | __FILE__ | - | ||||||||||||
105 | , | - | ||||||||||||
106 | 348 | - | ||||||||||||
107 | ) : qt_noop()) | - | ||||||||||||
108 | ; | - | ||||||||||||
109 | qt_polygon_recursion = this; | - | ||||||||||||
110 | ((!(sizeof(QT_PointF) == sizeof(QPointF))) ? qt_assert("sizeof(QT_PointF) == sizeof(QPointF)",__FILE__,350) : qt_noop()); | - | ||||||||||||
111 | QVarLengthArray<QT_PointF> p(pointCount); | - | ||||||||||||
112 | for (int i=0; i<pointCount
| 0 | ||||||||||||
113 | p[i].x = points[i].x(); | - | ||||||||||||
114 | p[i].y = points[i].y(); | - | ||||||||||||
115 | } never executed: end of block | 0 | ||||||||||||
116 | drawPolygon((QPointF *)p.data(), pointCount, mode); | - | ||||||||||||
117 | qt_polygon_recursion = 0; | - | ||||||||||||
118 | } never executed: end of block | 0 | ||||||||||||
119 | void QPaintEngine::drawPoints(const QPointF *points, int pointCount) | - | ||||||||||||
120 | { | - | ||||||||||||
121 | QPainter *p = painter(); | - | ||||||||||||
122 | if (!p
| 0 | ||||||||||||
123 | return; never executed: return; | 0 | ||||||||||||
124 | - | |||||||||||||
125 | qreal penWidth = p->pen().widthF(); | - | ||||||||||||
126 | if (penWidth == 0
| 0 | ||||||||||||
127 | penWidth = 1; never executed: penWidth = 1; | 0 | ||||||||||||
128 | - | |||||||||||||
129 | bool ellipses = p->pen().capStyle() == Qt::RoundCap; | - | ||||||||||||
130 | - | |||||||||||||
131 | p->save(); | - | ||||||||||||
132 | - | |||||||||||||
133 | QTransform transform; | - | ||||||||||||
134 | if (qt_pen_is_cosmetic(p->pen(), p->renderHints())
| 0 | ||||||||||||
135 | transform = p->transform(); | - | ||||||||||||
136 | p->setTransform(QTransform()); | - | ||||||||||||
137 | } never executed: end of block | 0 | ||||||||||||
138 | - | |||||||||||||
139 | p->setBrush(p->pen().brush()); | - | ||||||||||||
140 | p->setPen(Qt::NoPen); | - | ||||||||||||
141 | - | |||||||||||||
142 | for (int i=0; i<pointCount
| 0 | ||||||||||||
143 | QPointF pos = transform.map(points[i]); | - | ||||||||||||
144 | QRectF rect(pos.x() - penWidth / 2, pos.y() - penWidth / 2, penWidth, penWidth); | - | ||||||||||||
145 | - | |||||||||||||
146 | if (ellipses
| 0 | ||||||||||||
147 | p->drawEllipse(rect); never executed: p->drawEllipse(rect); | 0 | ||||||||||||
148 | else | - | ||||||||||||
149 | p->drawRect(rect); never executed: p->drawRect(rect); | 0 | ||||||||||||
150 | } | - | ||||||||||||
151 | - | |||||||||||||
152 | p->restore(); | - | ||||||||||||
153 | } never executed: end of block | 0 | ||||||||||||
154 | void QPaintEngine::drawPoints(const QPoint *points, int pointCount) | - | ||||||||||||
155 | { | - | ||||||||||||
156 | ((!(sizeof(QT_PointF) == sizeof(QPointF))) ? qt_assert("sizeof(QT_PointF) == sizeof(QPointF)",__FILE__,472) : qt_noop()); | - | ||||||||||||
157 | QT_PointF fp[256]; | - | ||||||||||||
158 | while (pointCount
| 0 | ||||||||||||
159 | int i = 0; | - | ||||||||||||
160 | while (i < pointCount
| 0 | ||||||||||||
161 | fp[i].x = points[i].x(); | - | ||||||||||||
162 | fp[i].y = points[i].y(); | - | ||||||||||||
163 | ++i; | - | ||||||||||||
164 | } never executed: end of block | 0 | ||||||||||||
165 | drawPoints((QPointF *)(void *)fp, i); | - | ||||||||||||
166 | points += i; | - | ||||||||||||
167 | pointCount -= i; | - | ||||||||||||
168 | } never executed: end of block | 0 | ||||||||||||
169 | } never executed: end of block | 0 | ||||||||||||
170 | void QPaintEngine::drawEllipse(const QRectF &rect) | - | ||||||||||||
171 | { | - | ||||||||||||
172 | QPainterPath path; | - | ||||||||||||
173 | path.addEllipse(rect); | - | ||||||||||||
174 | if (hasFeature(PainterPaths)
| 0 | ||||||||||||
175 | drawPath(path); | - | ||||||||||||
176 | } never executed: else {end of block | 0 | ||||||||||||
177 | QPolygonF polygon = path.toFillPolygon(); | - | ||||||||||||
178 | drawPolygon(polygon.data(), polygon.size(), ConvexMode); | - | ||||||||||||
179 | } never executed: end of block | 0 | ||||||||||||
180 | } | - | ||||||||||||
181 | - | |||||||||||||
182 | - | |||||||||||||
183 | - | |||||||||||||
184 | - | |||||||||||||
185 | - | |||||||||||||
186 | void QPaintEngine::drawEllipse(const QRect &rect) | - | ||||||||||||
187 | { | - | ||||||||||||
188 | drawEllipse(QRectF(rect)); | - | ||||||||||||
189 | } never executed: end of block | 0 | ||||||||||||
190 | void qt_fill_tile(QPixmap *tile, const QPixmap &pixmap) | - | ||||||||||||
191 | { | - | ||||||||||||
192 | QPainter p(tile); | - | ||||||||||||
193 | p.drawPixmap(0, 0, pixmap); | - | ||||||||||||
194 | int x = pixmap.width(); | - | ||||||||||||
195 | while (x < tile->width()
| 0 | ||||||||||||
196 | p.drawPixmap(x, 0, *tile, 0, 0, x, pixmap.height()); | - | ||||||||||||
197 | x *= 2; | - | ||||||||||||
198 | } never executed: end of block | 0 | ||||||||||||
199 | int y = pixmap.height(); | - | ||||||||||||
200 | while (y < tile->height()
| 0 | ||||||||||||
201 | p.drawPixmap(0, y, *tile, 0, 0, tile->width(), y); | - | ||||||||||||
202 | y *= 2; | - | ||||||||||||
203 | } never executed: end of block | 0 | ||||||||||||
204 | } never executed: end of block | 0 | ||||||||||||
205 | - | |||||||||||||
206 | void qt_draw_tile(QPaintEngine *gc, qreal x, qreal y, qreal w, qreal h, | - | ||||||||||||
207 | const QPixmap &pixmap, qreal xOffset, qreal yOffset) | - | ||||||||||||
208 | { | - | ||||||||||||
209 | qreal yPos, xPos, drawH, drawW, yOff, xOff; | - | ||||||||||||
210 | yPos = y; | - | ||||||||||||
211 | yOff = yOffset; | - | ||||||||||||
212 | while(yPos < y + h
| 0 | ||||||||||||
213 | drawH = pixmap.height() - yOff; | - | ||||||||||||
214 | if (yPos + drawH > y + h
| 0 | ||||||||||||
215 | drawH = y + h - yPos; never executed: drawH = y + h - yPos; | 0 | ||||||||||||
216 | xPos = x; | - | ||||||||||||
217 | xOff = xOffset; | - | ||||||||||||
218 | while(xPos < x + w
| 0 | ||||||||||||
219 | drawW = pixmap.width() - xOff; | - | ||||||||||||
220 | if (xPos + drawW > x + w
| 0 | ||||||||||||
221 | drawW = x + w - xPos; never executed: drawW = x + w - xPos; | 0 | ||||||||||||
222 | if (drawW > 0
| 0 | ||||||||||||
223 | gc->drawPixmap(QRectF(xPos, yPos, drawW, drawH), pixmap, QRectF(xOff, yOff, drawW, drawH)); never executed: gc->drawPixmap(QRectF(xPos, yPos, drawW, drawH), pixmap, QRectF(xOff, yOff, drawW, drawH)); | 0 | ||||||||||||
224 | xPos += drawW; | - | ||||||||||||
225 | xOff = 0; | - | ||||||||||||
226 | } never executed: end of block | 0 | ||||||||||||
227 | yPos += drawH; | - | ||||||||||||
228 | yOff = 0; | - | ||||||||||||
229 | } never executed: end of block | 0 | ||||||||||||
230 | } never executed: end of block | 0 | ||||||||||||
231 | - | |||||||||||||
232 | - | |||||||||||||
233 | - | |||||||||||||
234 | - | |||||||||||||
235 | - | |||||||||||||
236 | - | |||||||||||||
237 | - | |||||||||||||
238 | void QPaintEngine::drawTiledPixmap(const QRectF &rect, const QPixmap &pixmap, const QPointF &p) | - | ||||||||||||
239 | { | - | ||||||||||||
240 | int sw = pixmap.width(); | - | ||||||||||||
241 | int sh = pixmap.height(); | - | ||||||||||||
242 | - | |||||||||||||
243 | if (sw*sh < 8192
| 0 | ||||||||||||
244 | int tw = sw, th = sh; | - | ||||||||||||
245 | while (tw*th < 32678
| 0 | ||||||||||||
246 | tw *= 2; never executed: tw *= 2; | 0 | ||||||||||||
247 | while (tw*th < 32678
| 0 | ||||||||||||
248 | th *= 2; never executed: th *= 2; | 0 | ||||||||||||
249 | QPixmap tile; | - | ||||||||||||
250 | if (pixmap.depth() == 1
| 0 | ||||||||||||
251 | tile = QBitmap(tw, th); | - | ||||||||||||
252 | } never executed: else {end of block | 0 | ||||||||||||
253 | tile = QPixmap(tw, th); | - | ||||||||||||
254 | if (pixmap.hasAlphaChannel()
| 0 | ||||||||||||
255 | tile.fill(Qt::transparent); never executed: tile.fill(Qt::transparent); | 0 | ||||||||||||
256 | } never executed: end of block | 0 | ||||||||||||
257 | qt_fill_tile(&tile, pixmap); | - | ||||||||||||
258 | qt_draw_tile(this, rect.x(), rect.y(), rect.width(), rect.height(), tile, p.x(), p.y()); | - | ||||||||||||
259 | } never executed: else {end of block | 0 | ||||||||||||
260 | qt_draw_tile(this, rect.x(), rect.y(), rect.width(), rect.height(), pixmap, p.x(), p.y()); | - | ||||||||||||
261 | } never executed: end of block | 0 | ||||||||||||
262 | } | - | ||||||||||||
263 | void QPaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr, | - | ||||||||||||
264 | Qt::ImageConversionFlags flags) | - | ||||||||||||
265 | { | - | ||||||||||||
266 | QRectF baseSize(0, 0, image.width(), image.height()); | - | ||||||||||||
267 | QImage im = image; | - | ||||||||||||
268 | if (baseSize != sr
| 0 | ||||||||||||
269 | im = im.copy(qFloor(sr.x()), qFloor(sr.y()), never executed: im = im.copy(qFloor(sr.x()), qFloor(sr.y()), qCeil(sr.width()), qCeil(sr.height())); | 0 | ||||||||||||
270 | qCeil(sr.width()), qCeil(sr.height())); never executed: im = im.copy(qFloor(sr.x()), qFloor(sr.y()), qCeil(sr.width()), qCeil(sr.height())); | 0 | ||||||||||||
271 | QPixmap pm = QPixmap::fromImage(im, flags); | - | ||||||||||||
272 | drawPixmap(r, pm, QRectF(QPointF(0, 0), pm.size())); | - | ||||||||||||
273 | } never executed: end of block | 0 | ||||||||||||
274 | QPaintEngine::QPaintEngine(PaintEngineFeatures caps) | - | ||||||||||||
275 | : state(0), | - | ||||||||||||
276 | gccaps(caps), | - | ||||||||||||
277 | active(0), | - | ||||||||||||
278 | selfDestruct(false), | - | ||||||||||||
279 | extended(false), | - | ||||||||||||
280 | d_ptr(new QPaintEnginePrivate) | - | ||||||||||||
281 | { | - | ||||||||||||
282 | d_ptr->q_ptr = this; | - | ||||||||||||
283 | } never executed: end of block | 0 | ||||||||||||
284 | - | |||||||||||||
285 | - | |||||||||||||
286 | - | |||||||||||||
287 | - | |||||||||||||
288 | - | |||||||||||||
289 | QPaintEngine::QPaintEngine(QPaintEnginePrivate &dptr, PaintEngineFeatures caps) | - | ||||||||||||
290 | : state(0), | - | ||||||||||||
291 | gccaps(caps), | - | ||||||||||||
292 | active(0), | - | ||||||||||||
293 | selfDestruct(false), | - | ||||||||||||
294 | extended(false), | - | ||||||||||||
295 | d_ptr(&dptr) | - | ||||||||||||
296 | { | - | ||||||||||||
297 | d_ptr->q_ptr = this; | - | ||||||||||||
298 | } never executed: end of block | 0 | ||||||||||||
299 | - | |||||||||||||
300 | - | |||||||||||||
301 | - | |||||||||||||
302 | - | |||||||||||||
303 | QPaintEngine::~QPaintEngine() | - | ||||||||||||
304 | { | - | ||||||||||||
305 | } | - | ||||||||||||
306 | - | |||||||||||||
307 | - | |||||||||||||
308 | - | |||||||||||||
309 | - | |||||||||||||
310 | QPainter *QPaintEngine::painter() const | - | ||||||||||||
311 | { | - | ||||||||||||
312 | return never executed: statereturn state ? state->painter() : 0;
never executed: return state ? state->painter() : 0; | 0 | ||||||||||||
313 | } | - | ||||||||||||
314 | - | |||||||||||||
315 | - | |||||||||||||
316 | - | |||||||||||||
317 | - | |||||||||||||
318 | - | |||||||||||||
319 | void QPaintEngine::drawPath(const QPainterPath &) | - | ||||||||||||
320 | { | - | ||||||||||||
321 | if (hasFeature(PainterPaths)
| 0 | ||||||||||||
322 | QMessageLogger(__FILE__, 732, __PRETTY_FUNCTION__).warning("QPaintEngine::drawPath: Must be implemented when feature PainterPaths is set"); | - | ||||||||||||
323 | } never executed: end of block | 0 | ||||||||||||
324 | } never executed: end of block | 0 | ||||||||||||
325 | - | |||||||||||||
326 | - | |||||||||||||
327 | - | |||||||||||||
328 | - | |||||||||||||
329 | - | |||||||||||||
330 | - | |||||||||||||
331 | - | |||||||||||||
332 | void QPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) | - | ||||||||||||
333 | { | - | ||||||||||||
334 | const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); | - | ||||||||||||
335 | - | |||||||||||||
336 | QPainterPath path; | - | ||||||||||||
337 | path.setFillRule(Qt::WindingFill); | - | ||||||||||||
338 | if (ti.glyphs.numGlyphs
| 0 | ||||||||||||
339 | ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags); never executed: ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags); | 0 | ||||||||||||
340 | if (!path.isEmpty()
| 0 | ||||||||||||
341 | painter()->save(); | - | ||||||||||||
342 | painter()->setRenderHint(QPainter::Antialiasing, | - | ||||||||||||
343 | bool((painter()->renderHints() & QPainter::TextAntialiasing) | - | ||||||||||||
344 | && !(painter()->font().styleStrategy() & QFont::NoAntialias))); | - | ||||||||||||
345 | painter()->translate(p.x(), p.y()); | - | ||||||||||||
346 | painter()->fillPath(path, painter()->pen().brush()); | - | ||||||||||||
347 | painter()->restore(); | - | ||||||||||||
348 | } never executed: end of block | 0 | ||||||||||||
349 | } never executed: end of block | 0 | ||||||||||||
350 | - | |||||||||||||
351 | - | |||||||||||||
352 | - | |||||||||||||
353 | - | |||||||||||||
354 | - | |||||||||||||
355 | - | |||||||||||||
356 | void QPaintEngine::drawLines(const QLineF *lines, int lineCount) | - | ||||||||||||
357 | { | - | ||||||||||||
358 | for (int i=0; i<lineCount
| 0 | ||||||||||||
359 | QPointF pts[2] = { lines[i].p1(), lines[i].p2() }; | - | ||||||||||||
360 | - | |||||||||||||
361 | if (pts[0] == pts[1]
| 0 | ||||||||||||
362 | if (state->pen().capStyle() != Qt::FlatCap
| 0 | ||||||||||||
363 | drawPoints(pts, 1); never executed: drawPoints(pts, 1); | 0 | ||||||||||||
364 | continue; never executed: continue; | 0 | ||||||||||||
365 | } | - | ||||||||||||
366 | - | |||||||||||||
367 | drawPolygon(pts, 2, PolylineMode); | - | ||||||||||||
368 | } never executed: end of block | 0 | ||||||||||||
369 | } never executed: end of block | 0 | ||||||||||||
370 | void QPaintEngine::drawLines(const QLine *lines, int lineCount) | - | ||||||||||||
371 | { | - | ||||||||||||
372 | struct PointF { | - | ||||||||||||
373 | qreal x; | - | ||||||||||||
374 | qreal y; | - | ||||||||||||
375 | }; | - | ||||||||||||
376 | struct LineF { | - | ||||||||||||
377 | PointF p1; | - | ||||||||||||
378 | PointF p2; | - | ||||||||||||
379 | }; | - | ||||||||||||
380 | ((!(sizeof(PointF) == sizeof(QPointF))) ? qt_assert("sizeof(PointF) == sizeof(QPointF)",__FILE__,798) : qt_noop()); | - | ||||||||||||
381 | ((!(sizeof(LineF) == sizeof(QLineF))) ? qt_assert("sizeof(LineF) == sizeof(QLineF)",__FILE__,799) : qt_noop()); | - | ||||||||||||
382 | LineF fl[256]; | - | ||||||||||||
383 | while (lineCount
| 0 | ||||||||||||
384 | int i = 0; | - | ||||||||||||
385 | while (i < lineCount
| 0 | ||||||||||||
386 | fl[i].p1.x = lines[i].x1(); | - | ||||||||||||
387 | fl[i].p1.y = lines[i].y1(); | - | ||||||||||||
388 | fl[i].p2.x = lines[i].x2(); | - | ||||||||||||
389 | fl[i].p2.y = lines[i].y2(); | - | ||||||||||||
390 | ++i; | - | ||||||||||||
391 | } never executed: end of block | 0 | ||||||||||||
392 | drawLines((QLineF *)(void *)fl, i); | - | ||||||||||||
393 | lines += i; | - | ||||||||||||
394 | lineCount -= i; | - | ||||||||||||
395 | } never executed: end of block | 0 | ||||||||||||
396 | } never executed: end of block | 0 | ||||||||||||
397 | void QPaintEngine::drawRects(const QRect *rects, int rectCount) | - | ||||||||||||
398 | { | - | ||||||||||||
399 | struct RectF { | - | ||||||||||||
400 | qreal x; | - | ||||||||||||
401 | qreal y; | - | ||||||||||||
402 | qreal w; | - | ||||||||||||
403 | qreal h; | - | ||||||||||||
404 | }; | - | ||||||||||||
405 | ((!(sizeof(RectF) == sizeof(QRectF))) ? qt_assert("sizeof(RectF) == sizeof(QRectF)",__FILE__,832) : qt_noop()); | - | ||||||||||||
406 | RectF fr[256]; | - | ||||||||||||
407 | while (rectCount
| 0 | ||||||||||||
408 | int i = 0; | - | ||||||||||||
409 | while (i < rectCount
| 0 | ||||||||||||
410 | fr[i].x = rects[i].x(); | - | ||||||||||||
411 | fr[i].y = rects[i].y(); | - | ||||||||||||
412 | fr[i].w = rects[i].width(); | - | ||||||||||||
413 | fr[i].h = rects[i].height(); | - | ||||||||||||
414 | ++i; | - | ||||||||||||
415 | } never executed: end of block | 0 | ||||||||||||
416 | drawRects((QRectF *)(void *)fr, i); | - | ||||||||||||
417 | rects += i; | - | ||||||||||||
418 | rectCount -= i; | - | ||||||||||||
419 | } never executed: end of block | 0 | ||||||||||||
420 | } never executed: end of block | 0 | ||||||||||||
421 | - | |||||||||||||
422 | - | |||||||||||||
423 | - | |||||||||||||
424 | - | |||||||||||||
425 | - | |||||||||||||
426 | - | |||||||||||||
427 | void QPaintEngine::drawRects(const QRectF *rects, int rectCount) | - | ||||||||||||
428 | { | - | ||||||||||||
429 | if (hasFeature(PainterPaths)
| 0 | ||||||||||||
430 | !state->penNeedsResolving()
| 0 | ||||||||||||
431 | !state->brushNeedsResolving()
| 0 | ||||||||||||
432 | for (int i=0; i<rectCount
| 0 | ||||||||||||
433 | QPainterPath path; | - | ||||||||||||
434 | path.addRect(rects[i]); | - | ||||||||||||
435 | if (path.isEmpty()
| 0 | ||||||||||||
436 | continue; never executed: continue; | 0 | ||||||||||||
437 | drawPath(path); | - | ||||||||||||
438 | } never executed: end of block | 0 | ||||||||||||
439 | } never executed: else {end of block | 0 | ||||||||||||
440 | for (int i=0; i<rectCount
| 0 | ||||||||||||
441 | QRectF rf = rects[i]; | - | ||||||||||||
442 | QPointF pts[4] = { QPointF(rf.x(), rf.y()), | - | ||||||||||||
443 | QPointF(rf.x() + rf.width(), rf.y()), | - | ||||||||||||
444 | QPointF(rf.x() + rf.width(), rf.y() + rf.height()), | - | ||||||||||||
445 | QPointF(rf.x(), rf.y() + rf.height()) }; | - | ||||||||||||
446 | drawPolygon(pts, 4, ConvexMode); | - | ||||||||||||
447 | } never executed: end of block | 0 | ||||||||||||
448 | } never executed: end of block | 0 | ||||||||||||
449 | } | - | ||||||||||||
450 | - | |||||||||||||
451 | - | |||||||||||||
452 | - | |||||||||||||
453 | - | |||||||||||||
454 | - | |||||||||||||
455 | void QPaintEngine::setPaintDevice(QPaintDevice *device) | - | ||||||||||||
456 | { | - | ||||||||||||
457 | d_func()->pdev = device; | - | ||||||||||||
458 | } never executed: end of block | 0 | ||||||||||||
459 | - | |||||||||||||
460 | - | |||||||||||||
461 | - | |||||||||||||
462 | - | |||||||||||||
463 | - | |||||||||||||
464 | QPaintDevice *QPaintEngine::paintDevice() const | - | ||||||||||||
465 | { | - | ||||||||||||
466 | return never executed: d_func()->pdev;return d_func()->pdev; never executed: return d_func()->pdev; | 0 | ||||||||||||
467 | } | - | ||||||||||||
468 | QPoint QPaintEngine::coordinateOffset() const | - | ||||||||||||
469 | { | - | ||||||||||||
470 | return never executed: QPoint();return QPoint(); never executed: return QPoint(); | 0 | ||||||||||||
471 | } | - | ||||||||||||
472 | void QPaintEngine::setSystemClip(const QRegion ®ion) | - | ||||||||||||
473 | { | - | ||||||||||||
474 | QPaintEnginePrivate * const d = d_func(); | - | ||||||||||||
475 | d->systemClip = region; | - | ||||||||||||
476 | - | |||||||||||||
477 | - | |||||||||||||
478 | if (d->hasSystemTransform
| 0 | ||||||||||||
479 | d->transformSystemClip(); | - | ||||||||||||
480 | d->systemStateChanged(); | - | ||||||||||||
481 | } never executed: end of block | 0 | ||||||||||||
482 | } never executed: end of block | 0 | ||||||||||||
483 | QRegion QPaintEngine::systemClip() const | - | ||||||||||||
484 | { | - | ||||||||||||
485 | return never executed: d_func()->systemClip;return d_func()->systemClip; never executed: return d_func()->systemClip; | 0 | ||||||||||||
486 | } | - | ||||||||||||
487 | - | |||||||||||||
488 | - | |||||||||||||
489 | - | |||||||||||||
490 | - | |||||||||||||
491 | - | |||||||||||||
492 | - | |||||||||||||
493 | - | |||||||||||||
494 | void QPaintEngine::setSystemRect(const QRect &rect) | - | ||||||||||||
495 | { | - | ||||||||||||
496 | if (isActive()
| 0 | ||||||||||||
497 | QMessageLogger(__FILE__, 954, __PRETTY_FUNCTION__).warning("QPaintEngine::setSystemRect: Should not be changed while engine is active"); | - | ||||||||||||
498 | return; never executed: return; | 0 | ||||||||||||
499 | } | - | ||||||||||||
500 | d_func()->systemRect = rect; | - | ||||||||||||
501 | } never executed: end of block | 0 | ||||||||||||
502 | - | |||||||||||||
503 | - | |||||||||||||
504 | - | |||||||||||||
505 | - | |||||||||||||
506 | - | |||||||||||||
507 | - | |||||||||||||
508 | - | |||||||||||||
509 | QRect QPaintEngine::systemRect() const | - | ||||||||||||
510 | { | - | ||||||||||||
511 | return never executed: d_func()->systemRect;return d_func()->systemRect; never executed: return d_func()->systemRect; | 0 | ||||||||||||
512 | } | - | ||||||||||||
513 | - | |||||||||||||
514 | QPaintEnginePrivate::~QPaintEnginePrivate() | - | ||||||||||||
515 | { | - | ||||||||||||
516 | } | - | ||||||||||||
517 | - | |||||||||||||
518 | void QPaintEnginePrivate::drawBoxTextItem(const QPointF &p, const QTextItemInt &ti) | - | ||||||||||||
519 | { | - | ||||||||||||
520 | if (!ti.glyphs.numGlyphs
| 0 | ||||||||||||
521 | return; never executed: return; | 0 | ||||||||||||
522 | - | |||||||||||||
523 | - | |||||||||||||
524 | const int size = qRound(ti.fontEngine->ascent()); | - | ||||||||||||
525 | QVarLengthArray<QFixedPoint> positions; | - | ||||||||||||
526 | QVarLengthArray<glyph_t> glyphs; | - | ||||||||||||
527 | QTransform matrix = QTransform::fromTranslate(p.x(), p.y() - size); | - | ||||||||||||
528 | ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); | - | ||||||||||||
529 | if (glyphs.size() == 0
| 0 | ||||||||||||
530 | return; never executed: return; | 0 | ||||||||||||
531 | - | |||||||||||||
532 | QSize s(size - 3, size - 3); | - | ||||||||||||
533 | - | |||||||||||||
534 | QPainter *painter = q_func()->state->painter(); | - | ||||||||||||
535 | painter->save(); | - | ||||||||||||
536 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||
537 | QPen pen = painter->pen(); | - | ||||||||||||
538 | pen.setWidthF(ti.fontEngine->lineThickness().toReal()); | - | ||||||||||||
539 | painter->setPen(pen); | - | ||||||||||||
540 | for (int k = 0; k < positions.size()
| 0 | ||||||||||||
541 | painter->drawRect(QRectF(positions[k].toPointF(), s)); never executed: painter->drawRect(QRectF(positions[k].toPointF(), s)); | 0 | ||||||||||||
542 | painter->restore(); | - | ||||||||||||
543 | } never executed: end of block | 0 | ||||||||||||
544 | - | |||||||||||||
545 | - | |||||||||||||
Switch to Source code | Preprocessed file |