Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | extern QPixmap qt_pixmapForBrush(int style, bool invert); | - |
8 | | - |
9 | void qt_format_text(const QFont &font, | - |
10 | const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect, | - |
11 | int tabstops, int* tabarray, int tabarraylen, | - |
12 | QPainter *painter); | - |
13 | static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QFontEngine *fe, QTextEngine *textEngine, | - |
14 | QTextCharFormat::UnderlineStyle underlineStyle, | - |
15 | QTextItem::RenderFlags flags, qreal width, | - |
16 | const QTextCharFormat &charFormat); | - |
17 | | - |
18 | __attribute__((visibility("default"))) void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray, | - |
19 | const QFixedPoint *positions, int glyphCount, | - |
20 | QFontEngine *fontEngine, const QFont &font, | - |
21 | const QTextCharFormat &charFormat); | - |
22 | | - |
23 | static inline QGradient::CoordinateMode coordinateMode(const QBrush &brush) | - |
24 | { | - |
25 | switch (brush.style()) { | - |
26 | case Qt::LinearGradientPattern: | - |
27 | case Qt::RadialGradientPattern: | - |
28 | case Qt::ConicalGradientPattern: | - |
29 | return brush.gradient()->coordinateMode(); never executed: return brush.gradient()->coordinateMode(); | 0 |
30 | default: | - |
31 | ; | - |
32 | } | 0 |
33 | return QGradient::LogicalMode; never executed: return QGradient::LogicalMode; | 0 |
34 | } | - |
35 | | - |
36 | | - |
37 | static inline bool check_gradient(const QBrush &brush) | - |
38 | { | - |
39 | return coordinateMode(brush) == QGradient::StretchToDeviceMode; never executed: return coordinateMode(brush) == QGradient::StretchToDeviceMode; | 0 |
40 | } | - |
41 | | - |
42 | extern bool qHasPixmapTexture(const QBrush &); | - |
43 | | - |
44 | static inline bool is_brush_transparent(const QBrush &brush) { | - |
45 | Qt::BrushStyle s = brush.style(); | - |
46 | bool brushBitmap = qHasPixmapTexture(brush) never evaluated: qHasPixmapTexture(brush) | 0 |
47 | ? brush.texture().isQBitmap() | - |
48 | : (brush.textureImage().depth() == 1); | - |
49 | return ((s >= Qt::Dense1Pattern && s <= Qt::DiagCrossPattern) | 0 |
50 | || (s == Qt::TexturePattern && brushBitmap)); never executed: return ((s >= Qt::Dense1Pattern && s <= Qt::DiagCrossPattern) || (s == Qt::TexturePattern && brushBitmap)); | 0 |
51 | } | - |
52 | | - |
53 | static inline bool is_pen_transparent(const QPen &pen) { | - |
54 | return pen.style() > Qt::SolidLine || is_brush_transparent(pen.brush()); never executed: return pen.style() > Qt::SolidLine || is_brush_transparent(pen.brush()); | 0 |
55 | } | - |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
60 | static inline uint line_emulation(uint emulation) | - |
61 | { | - |
62 | return emulation & (QPaintEngine::PrimitiveTransform | 6 |
63 | | QPaintEngine::AlphaBlend | 6 |
64 | | QPaintEngine::Antialiasing | 6 |
65 | | QPaintEngine::BrushStroke | 6 |
66 | | QPaintEngine::ConstantOpacity | 6 |
67 | | 0x10000000 | 6 |
68 | | QPaintEngine::ObjectBoundingModeGradients | 6 |
69 | | 0x40000000); executed: return emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000); Execution Count:6 | 6 |
70 | } | - |
71 | void QPainterPrivate::checkEmulation() | - |
72 | { | - |
73 | qt_noop(); | - |
74 | if (extended->flags() & QPaintEngineEx::DoNotEmulate) evaluated: extended->flags() & QPaintEngineEx::DoNotEmulate yes Evaluation Count:15086 | yes Evaluation Count:61287 |
| 15086-61287 |
75 | return; executed: return; Execution Count:15086 | 15086 |
76 | | - |
77 | bool doEmulation = false; | - |
78 | if (state->bgMode == Qt::OpaqueMode) evaluated: state->bgMode == Qt::OpaqueMode yes Evaluation Count:2939 | yes Evaluation Count:58348 |
| 2939-58348 |
79 | doEmulation = true; executed: doEmulation = true; Execution Count:2939 | 2939 |
80 | | - |
81 | const QGradient *bg = state->brush.gradient(); | - |
82 | if (bg && bg->coordinateMode() > QGradient::LogicalMode) evaluated: bg yes Evaluation Count:799 | yes Evaluation Count:60488 |
evaluated: bg->coordinateMode() > QGradient::LogicalMode yes Evaluation Count:3 | yes Evaluation Count:796 |
| 3-60488 |
83 | doEmulation = true; executed: doEmulation = true; Execution Count:3 | 3 |
84 | | - |
85 | const QGradient *pg = qpen_brush(state->pen).gradient(); | - |
86 | if (pg && pg->coordinateMode() > QGradient::LogicalMode) evaluated: pg yes Evaluation Count:18 | yes Evaluation Count:61269 |
partially evaluated: pg->coordinateMode() > QGradient::LogicalMode no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-61269 |
87 | doEmulation = true; never executed: doEmulation = true; | 0 |
88 | | - |
89 | if (doEmulation) { evaluated: doEmulation yes Evaluation Count:2942 | yes Evaluation Count:58345 |
| 2942-58345 |
90 | if (extended != emulationEngine) { partially evaluated: extended != emulationEngine yes Evaluation Count:2942 | no Evaluation Count:0 |
| 0-2942 |
91 | if (!emulationEngine) partially evaluated: !emulationEngine yes Evaluation Count:2942 | no Evaluation Count:0 |
| 0-2942 |
92 | emulationEngine = new QEmulationPaintEngine(extended); executed: emulationEngine = new QEmulationPaintEngine(extended); Execution Count:2942 | 2942 |
93 | extended = emulationEngine; | - |
94 | extended->setState(state); | - |
95 | } executed: } Execution Count:2942 | 2942 |
96 | } else if (emulationEngine == extended) { executed: } Execution Count:2942 partially evaluated: emulationEngine == extended no Evaluation Count:0 | yes Evaluation Count:58345 |
| 0-58345 |
97 | extended = emulationEngine->real_engine; | - |
98 | } | 0 |
99 | } | - |
100 | | - |
101 | | - |
102 | QPainterPrivate::~QPainterPrivate() | - |
103 | { | - |
104 | delete emulationEngine; | - |
105 | for (int i=0; i<states.size(); ++i) partially evaluated: i<states.size() no Evaluation Count:0 | yes Evaluation Count:27643 |
| 0-27643 |
106 | delete states.at(i); never executed: delete states.at(i); | 0 |
107 | | - |
108 | if (dummyState) evaluated: dummyState yes Evaluation Count:1 | yes Evaluation Count:27642 |
| 1-27642 |
109 | delete dummyState; executed: delete dummyState; Execution Count:1 | 1 |
110 | } executed: } Execution Count:27643 | 27643 |
111 | | - |
112 | | - |
113 | QTransform QPainterPrivate::viewTransform() const | - |
114 | { | - |
115 | if (state->VxF) { evaluated: state->VxF yes Evaluation Count:14 | yes Evaluation Count:2 |
| 2-14 |
116 | qreal scaleW = qreal(state->vw)/qreal(state->ww); | - |
117 | qreal scaleH = qreal(state->vh)/qreal(state->wh); | - |
118 | return QTransform(scaleW, 0, 0, scaleH, | 14 |
119 | state->vx - state->wx*scaleW, state->vy - state->wy*scaleH); executed: return QTransform(scaleW, 0, 0, scaleH, state->vx - state->wx*scaleW, state->vy - state->wy*scaleH); Execution Count:14 | 14 |
120 | } | - |
121 | return QTransform(); executed: return QTransform(); Execution Count:2 | 2 |
122 | } | - |
123 | | - |
124 | QTransform QPainterPrivate::hidpiScaleTransform() const | - |
125 | { | - |
126 | return QTransform(); executed: return QTransform(); Execution Count:57707 | 57707 |
127 | } | - |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev) | - |
134 | { | - |
135 | qt_noop(); | - |
136 | qt_noop(); | - |
137 | | - |
138 | QPainter *sp = pdev->sharedPainter(); | - |
139 | if (!sp) evaluated: !sp yes Evaluation Count:54386 | yes Evaluation Count:40 |
| 40-54386 |
140 | return false; executed: return false; Execution Count:54386 | 54386 |
141 | | - |
142 | | - |
143 | | - |
144 | sp->save(); | - |
145 | if (!sp->d_ptr->d_ptrs) { evaluated: !sp->d_ptr->d_ptrs yes Evaluation Count:13 | yes Evaluation Count:27 |
| 13-27 |
146 | | - |
147 | | - |
148 | | - |
149 | sp->d_ptr->d_ptrs_size = 4; | - |
150 | sp->d_ptr->d_ptrs = (QPainterPrivate **)malloc(4 * sizeof(QPainterPrivate *)); | - |
151 | qt_noop(); | - |
152 | } else if (sp->d_ptr->refcount - 1 == sp->d_ptr->d_ptrs_size) { executed: } Execution Count:13 partially evaluated: sp->d_ptr->refcount - 1 == sp->d_ptr->d_ptrs_size no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
153 | | - |
154 | sp->d_ptr->d_ptrs_size <<= 1; | - |
155 | const int newSize = sp->d_ptr->d_ptrs_size * sizeof(QPainterPrivate *); | - |
156 | sp->d_ptr->d_ptrs = q_check_ptr((QPainterPrivate **)realloc(sp->d_ptr->d_ptrs, newSize)); | - |
157 | } | 0 |
158 | sp->d_ptr->d_ptrs[++sp->d_ptr->refcount - 2] = q->d_ptr.data(); | - |
159 | q->d_ptr.take(); | - |
160 | q->d_ptr.reset(sp->d_ptr.data()); | - |
161 | | - |
162 | qt_noop(); | - |
163 | | - |
164 | | - |
165 | q->initFrom(pdev); | - |
166 | QPoint offset; | - |
167 | pdev->redirected(&offset); | - |
168 | offset += q->d_ptr->engine->coordinateOffset(); | - |
169 | | - |
170 | | - |
171 | q->d_ptr->state->ww = q->d_ptr->state->vw = pdev->width(); | - |
172 | q->d_ptr->state->wh = q->d_ptr->state->vh = pdev->height(); | - |
173 | | - |
174 | | - |
175 | if (q->d_ptr->state->WxF) { evaluated: q->d_ptr->state->WxF yes Evaluation Count:29 | yes Evaluation Count:11 |
| 11-29 |
176 | q->d_ptr->state->redirectionMatrix = q->d_ptr->state->matrix; | - |
177 | q->d_ptr->state->redirectionMatrix.translate(-offset.x(), -offset.y()); | - |
178 | q->d_ptr->state->worldMatrix = QTransform(); | - |
179 | q->d_ptr->state->WxF = false; | - |
180 | } else { executed: } Execution Count:29 | 29 |
181 | q->d_ptr->state->redirectionMatrix = QTransform::fromTranslate(-offset.x(), -offset.y()); | - |
182 | } executed: } Execution Count:11 | 11 |
183 | q->d_ptr->updateMatrix(); | - |
184 | | - |
185 | QPaintEnginePrivate *enginePrivate = q->d_ptr->engine->d_func(); | - |
186 | if (enginePrivate->currentClipDevice == pdev) { evaluated: enginePrivate->currentClipDevice == pdev yes Evaluation Count:14 | yes Evaluation Count:26 |
| 14-26 |
187 | enginePrivate->systemStateChanged(); | - |
188 | return true; executed: return true; Execution Count:14 | 14 |
189 | } | - |
190 | | - |
191 | | - |
192 | enginePrivate->currentClipDevice = pdev; | - |
193 | enginePrivate->setSystemTransform(q->d_ptr->state->matrix); | - |
194 | return true; executed: return true; Execution Count:26 | 26 |
195 | } | - |
196 | | - |
197 | void QPainterPrivate::detachPainterPrivate(QPainter *q) | - |
198 | { | - |
199 | qt_noop(); | - |
200 | qt_noop(); | - |
201 | | - |
202 | QPainterPrivate *original = d_ptrs[--refcount - 1]; | - |
203 | if (inDestructor) { evaluated: inDestructor yes Evaluation Count:39 | yes Evaluation Count:1 |
| 1-39 |
204 | inDestructor = false; | - |
205 | if (original) evaluated: original yes Evaluation Count:6 | yes Evaluation Count:33 |
| 6-33 |
206 | original->inDestructor = true; executed: original->inDestructor = true; Execution Count:6 | 6 |
207 | } else if (!original) { executed: } Execution Count:39 partially evaluated: !original yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-39 |
208 | original = new QPainterPrivate(q); | - |
209 | } executed: } Execution Count:1 | 1 |
210 | | - |
211 | d_ptrs[refcount - 1] = 0; | - |
212 | q->restore(); | - |
213 | q->d_ptr.take(); | - |
214 | q->d_ptr.reset(original); | - |
215 | | - |
216 | if (emulationEngine) { partially evaluated: emulationEngine no Evaluation Count:0 | yes Evaluation Count:40 |
| 0-40 |
217 | extended = emulationEngine->real_engine; | - |
218 | delete emulationEngine; | - |
219 | emulationEngine = 0; | - |
220 | } | 0 |
221 | } executed: } Execution Count:40 | 40 |
222 | | - |
223 | | - |
224 | void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperation op) | - |
225 | { | - |
226 | | - |
227 | | - |
228 | | - |
229 | | - |
230 | | - |
231 | | - |
232 | if (originalPath.isEmpty()) never evaluated: originalPath.isEmpty() | 0 |
233 | return; | 0 |
234 | | - |
235 | QPaintEngine::PaintEngineFeatures gradientStretch = | - |
236 | QPaintEngine::PaintEngineFeatures(0x10000000 | - |
237 | | QPaintEngine::ObjectBoundingModeGradients); | - |
238 | | - |
239 | const bool mustEmulateObjectBoundingModeGradients = extended never evaluated: extended | 0 |
240 | || ((state->emulationSpecifier & QPaintEngine::ObjectBoundingModeGradients) never evaluated: (state->emulationSpecifier & QPaintEngine::ObjectBoundingModeGradients) | 0 |
241 | && !engine->hasFeature(QPaintEngine::PatternTransform)); never evaluated: !engine->hasFeature(QPaintEngine::PatternTransform) | 0 |
242 | | - |
243 | if (!(state->emulationSpecifier & ~gradientStretch) never evaluated: !(state->emulationSpecifier & ~gradientStretch) | 0 |
244 | && !mustEmulateObjectBoundingModeGradients) { never evaluated: !mustEmulateObjectBoundingModeGradients | 0 |
245 | drawStretchedGradient(originalPath, op); | - |
246 | return; | 0 |
247 | } else if (state->emulationSpecifier & 0x40000000) { never evaluated: state->emulationSpecifier & 0x40000000 | 0 |
248 | drawOpaqueBackground(originalPath, op); | - |
249 | return; | 0 |
250 | } | - |
251 | | - |
252 | QPainter * const q = q_func(); | - |
253 | | - |
254 | qreal strokeOffsetX = 0, strokeOffsetY = 0; | - |
255 | | - |
256 | QPainterPath path = originalPath * state->matrix; | - |
257 | QRectF pathBounds = path.boundingRect(); | - |
258 | QRectF strokeBounds; | - |
259 | bool doStroke = (op & StrokeDraw) && (state->pen.style() != Qt::NoPen); never evaluated: (op & StrokeDraw) never evaluated: (state->pen.style() != Qt::NoPen) | 0 |
260 | if (doStroke) { never evaluated: doStroke | 0 |
261 | qreal penWidth = state->pen.widthF(); | - |
262 | if (penWidth == 0) { never evaluated: penWidth == 0 | 0 |
263 | strokeOffsetX = 1; | - |
264 | strokeOffsetY = 1; | - |
265 | } else { | 0 |
266 | | - |
267 | if (state->matrix.type() > QTransform::TxScale) { never evaluated: state->matrix.type() > QTransform::TxScale | 0 |
268 | QPainterPathStroker stroker; | - |
269 | stroker.setWidth(penWidth); | - |
270 | stroker.setJoinStyle(state->pen.joinStyle()); | - |
271 | stroker.setCapStyle(state->pen.capStyle()); | - |
272 | QPainterPath stroke = stroker.createStroke(originalPath); | - |
273 | strokeBounds = (stroke * state->matrix).boundingRect(); | - |
274 | } else { | 0 |
275 | strokeOffsetX = qAbs(penWidth * state->matrix.m11() / 2.0); | - |
276 | strokeOffsetY = qAbs(penWidth * state->matrix.m22() / 2.0); | - |
277 | } | 0 |
278 | } | - |
279 | } | - |
280 | | - |
281 | QRect absPathRect; | - |
282 | if (!strokeBounds.isEmpty()) { never evaluated: !strokeBounds.isEmpty() | 0 |
283 | absPathRect = strokeBounds.intersected(QRectF(0, 0, device->width(), device->height())).toAlignedRect(); | - |
284 | } else { | 0 |
285 | absPathRect = pathBounds.adjusted(-strokeOffsetX, -strokeOffsetY, strokeOffsetX, strokeOffsetY) | - |
286 | .intersected(QRectF(0, 0, device->width(), device->height())).toAlignedRect(); | - |
287 | } | 0 |
288 | | - |
289 | if (q->hasClipping()) { never evaluated: q->hasClipping() | 0 |
290 | bool hasPerspectiveTransform = false; | - |
291 | for (int i = 0; i < state->clipInfo.size(); ++i) { never evaluated: i < state->clipInfo.size() | 0 |
292 | const QPainterClipInfo &info = state->clipInfo.at(i); | - |
293 | if (info.matrix.type() == QTransform::TxProject) { never evaluated: info.matrix.type() == QTransform::TxProject | 0 |
294 | hasPerspectiveTransform = true; | - |
295 | break; | 0 |
296 | } | - |
297 | } | 0 |
298 | | - |
299 | if (!hasPerspectiveTransform) { never evaluated: !hasPerspectiveTransform | 0 |
300 | | - |
301 | | - |
302 | | - |
303 | | - |
304 | | - |
305 | | - |
306 | bool old_txinv = txinv; | - |
307 | QTransform old_invMatrix = invMatrix; | - |
308 | txinv = true; | - |
309 | invMatrix = QTransform(); | - |
310 | QPainterPath clipPath = q->clipPath(); | - |
311 | QRectF r = clipPath.boundingRect().intersected(absPathRect); | - |
312 | absPathRect = r.toAlignedRect(); | - |
313 | txinv = old_txinv; | - |
314 | invMatrix = old_invMatrix; | - |
315 | } | 0 |
316 | } | 0 |
317 | | - |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | | - |
323 | | - |
324 | if (absPathRect.width() <= 0 || absPathRect.height() <= 0) never evaluated: absPathRect.width() <= 0 never evaluated: absPathRect.height() <= 0 | 0 |
325 | return; | 0 |
326 | | - |
327 | QImage image(absPathRect.width(), absPathRect.height(), QImage::Format_ARGB32_Premultiplied); | - |
328 | image.fill(0); | - |
329 | | - |
330 | QPainter p(&image); | - |
331 | | - |
332 | p.d_ptr->helper_device = helper_device; | - |
333 | | - |
334 | p.setOpacity(state->opacity); | - |
335 | p.translate(-absPathRect.x(), -absPathRect.y()); | - |
336 | p.setTransform(state->matrix, true); | - |
337 | p.setPen(doStroke ? state->pen : QPen(Qt::NoPen)); | - |
338 | p.setBrush((op & FillDraw) ? state->brush : QBrush(Qt::NoBrush)); | - |
339 | p.setBackground(state->bgBrush); | - |
340 | p.setBackgroundMode(state->bgMode); | - |
341 | p.setBrushOrigin(state->brushOrigin); | - |
342 | | - |
343 | p.setRenderHint(QPainter::Antialiasing, state->renderHints & QPainter::Antialiasing); | - |
344 | p.setRenderHint(QPainter::SmoothPixmapTransform, | - |
345 | state->renderHints & QPainter::SmoothPixmapTransform); | - |
346 | | - |
347 | p.drawPath(originalPath); | - |
348 | p.end(); | - |
349 | | - |
350 | q->save(); | - |
351 | state->matrix = QTransform(); | - |
352 | if (extended) { never evaluated: extended | 0 |
353 | extended->transformChanged(); | - |
354 | } else { | 0 |
355 | state->dirtyFlags |= QPaintEngine::DirtyTransform; | - |
356 | updateState(state); | - |
357 | } | 0 |
358 | engine->drawImage(absPathRect, | - |
359 | image, | - |
360 | QRectF(0, 0, absPathRect.width(), absPathRect.height()), | - |
361 | Qt::OrderedDither | Qt::OrderedAlphaDither); | - |
362 | q->restore(); | - |
363 | } | 0 |
364 | | - |
365 | void QPainterPrivate::drawOpaqueBackground(const QPainterPath &path, DrawOperation op) | - |
366 | { | - |
367 | QPainter * const q = q_func(); | - |
368 | | - |
369 | q->setBackgroundMode(Qt::TransparentMode); | - |
370 | | - |
371 | if (op & FillDraw && state->brush.style() != Qt::NoBrush) { never evaluated: op & FillDraw never evaluated: state->brush.style() != Qt::NoBrush | 0 |
372 | q->fillPath(path, state->bgBrush.color()); | - |
373 | q->fillPath(path, state->brush); | - |
374 | } | 0 |
375 | | - |
376 | if (op & StrokeDraw && state->pen.style() != Qt::NoPen) { never evaluated: op & StrokeDraw never evaluated: state->pen.style() != Qt::NoPen | 0 |
377 | q->strokePath(path, QPen(state->bgBrush.color(), state->pen.width())); | - |
378 | q->strokePath(path, state->pen); | - |
379 | } | 0 |
380 | | - |
381 | q->setBackgroundMode(Qt::OpaqueMode); | - |
382 | } | 0 |
383 | | - |
384 | static inline QBrush stretchGradientToUserSpace(const QBrush &brush, const QRectF &boundingRect) | - |
385 | { | - |
386 | qt_noop(); | - |
387 | | - |
388 | | - |
389 | QTransform gradientToUser(boundingRect.width(), 0, 0, boundingRect.height(), | - |
390 | boundingRect.x(), boundingRect.y()); | - |
391 | | - |
392 | QGradient g = *brush.gradient(); | - |
393 | g.setCoordinateMode(QGradient::LogicalMode); | - |
394 | | - |
395 | QBrush b(g); | - |
396 | b.setTransform(gradientToUser * b.transform()); | - |
397 | return b; never executed: return b; | 0 |
398 | } | - |
399 | | - |
400 | void QPainterPrivate::drawStretchedGradient(const QPainterPath &path, DrawOperation op) | - |
401 | { | - |
402 | QPainter * const q = q_func(); | - |
403 | | - |
404 | const qreal sw = helper_device->width(); | - |
405 | const qreal sh = helper_device->height(); | - |
406 | | - |
407 | bool changedPen = false; | - |
408 | bool changedBrush = false; | - |
409 | bool needsFill = false; | - |
410 | | - |
411 | const QPen pen = state->pen; | - |
412 | const QBrush brush = state->brush; | - |
413 | | - |
414 | const QGradient::CoordinateMode penMode = coordinateMode(pen.brush()); | - |
415 | const QGradient::CoordinateMode brushMode = coordinateMode(brush); | - |
416 | | - |
417 | QRectF boundingRect; | - |
418 | | - |
419 | | - |
420 | if ((op & FillDraw) && brush.style() != Qt::NoBrush) { never evaluated: (op & FillDraw) never evaluated: brush.style() != Qt::NoBrush | 0 |
421 | if (brushMode == QGradient::StretchToDeviceMode) { never evaluated: brushMode == QGradient::StretchToDeviceMode | 0 |
422 | q->setPen(Qt::NoPen); | - |
423 | changedPen = pen.style() != Qt::NoPen; | - |
424 | q->scale(sw, sh); | - |
425 | updateState(state); | - |
426 | | - |
427 | const qreal isw = 1.0 / sw; | - |
428 | const qreal ish = 1.0 / sh; | - |
429 | QTransform inv(isw, 0, 0, ish, 0, 0); | - |
430 | engine->drawPath(path * inv); | - |
431 | q->scale(isw, ish); | - |
432 | } else { | 0 |
433 | needsFill = true; | - |
434 | | - |
435 | if (brushMode == QGradient::ObjectBoundingMode) { never evaluated: brushMode == QGradient::ObjectBoundingMode | 0 |
436 | qt_noop(); | - |
437 | boundingRect = path.boundingRect(); | - |
438 | q->setBrush(stretchGradientToUserSpace(brush, boundingRect)); | - |
439 | changedBrush = true; | - |
440 | } | 0 |
441 | } | 0 |
442 | } | - |
443 | | - |
444 | if ((op & StrokeDraw) && pen.style() != Qt::NoPen) { never evaluated: (op & StrokeDraw) never evaluated: pen.style() != Qt::NoPen | 0 |
445 | | - |
446 | if (penMode == QGradient::StretchToDeviceMode) { never evaluated: penMode == QGradient::StretchToDeviceMode | 0 |
447 | q->setPen(Qt::NoPen); | - |
448 | changedPen = true; | - |
449 | | - |
450 | if (needsFill) { never evaluated: needsFill | 0 |
451 | updateState(state); | - |
452 | engine->drawPath(path); | - |
453 | } | 0 |
454 | | - |
455 | q->scale(sw, sh); | - |
456 | q->setBrush(pen.brush()); | - |
457 | changedBrush = true; | - |
458 | updateState(state); | - |
459 | | - |
460 | QPainterPathStroker stroker; | - |
461 | stroker.setDashPattern(pen.style()); | - |
462 | stroker.setWidth(pen.widthF()); | - |
463 | stroker.setJoinStyle(pen.joinStyle()); | - |
464 | stroker.setCapStyle(pen.capStyle()); | - |
465 | stroker.setMiterLimit(pen.miterLimit()); | - |
466 | QPainterPath stroke = stroker.createStroke(path); | - |
467 | | - |
468 | const qreal isw = 1.0 / sw; | - |
469 | const qreal ish = 1.0 / sh; | - |
470 | QTransform inv(isw, 0, 0, ish, 0, 0); | - |
471 | engine->drawPath(stroke * inv); | - |
472 | q->scale(isw, ish); | - |
473 | } else { | 0 |
474 | if (!needsFill && brush.style() != Qt::NoBrush) { never evaluated: !needsFill never evaluated: brush.style() != Qt::NoBrush | 0 |
475 | q->setBrush(Qt::NoBrush); | - |
476 | changedBrush = true; | - |
477 | } | 0 |
478 | | - |
479 | if (penMode == QGradient::ObjectBoundingMode) { never evaluated: penMode == QGradient::ObjectBoundingMode | 0 |
480 | qt_noop(); | - |
481 | | - |
482 | | - |
483 | if (!needsFill || brushMode != QGradient::ObjectBoundingMode) never evaluated: !needsFill never evaluated: brushMode != QGradient::ObjectBoundingMode | 0 |
484 | boundingRect = path.boundingRect(); never executed: boundingRect = path.boundingRect(); | 0 |
485 | | - |
486 | QPen p = pen; | - |
487 | p.setBrush(stretchGradientToUserSpace(pen.brush(), boundingRect)); | - |
488 | q->setPen(p); | - |
489 | changedPen = true; | - |
490 | } else if (changedPen) { never evaluated: changedPen | 0 |
491 | q->setPen(pen); | - |
492 | changedPen = false; | - |
493 | } | 0 |
494 | | - |
495 | updateState(state); | - |
496 | engine->drawPath(path); | - |
497 | } | 0 |
498 | } else if (needsFill) { never evaluated: needsFill | 0 |
499 | if (pen.style() != Qt::NoPen) { never evaluated: pen.style() != Qt::NoPen | 0 |
500 | q->setPen(Qt::NoPen); | - |
501 | changedPen = true; | - |
502 | } | 0 |
503 | | - |
504 | updateState(state); | - |
505 | engine->drawPath(path); | - |
506 | } | 0 |
507 | | - |
508 | if (changedPen) never evaluated: changedPen | 0 |
509 | q->setPen(pen); never executed: q->setPen(pen); | 0 |
510 | if (changedBrush) never evaluated: changedBrush | 0 |
511 | q->setBrush(brush); never executed: q->setBrush(brush); | 0 |
512 | } | 0 |
513 | | - |
514 | | - |
515 | void QPainterPrivate::updateMatrix() | - |
516 | { | - |
517 | state->matrix = state->WxF ? state->worldMatrix : QTransform(); evaluated: state->WxF yes Evaluation Count:42151 | yes Evaluation Count:15553 |
| 15553-42151 |
518 | if (state->VxF) evaluated: state->VxF yes Evaluation Count:13 | yes Evaluation Count:57691 |
| 13-57691 |
519 | state->matrix *= viewTransform(); executed: state->matrix *= viewTransform(); Execution Count:13 | 13 |
520 | | - |
521 | txinv = false; | - |
522 | state->matrix *= state->redirectionMatrix; | - |
523 | if (extended) evaluated: extended yes Evaluation Count:57703 | yes Evaluation Count:1 |
| 1-57703 |
524 | extended->transformChanged(); executed: extended->transformChanged(); Execution Count:57703 | 57703 |
525 | else | - |
526 | state->dirtyFlags |= QPaintEngine::DirtyTransform; executed: state->dirtyFlags |= QPaintEngine::DirtyTransform; Execution Count:1 | 1 |
527 | | - |
528 | state->matrix *= hidpiScaleTransform(); | - |
529 | | - |
530 | | - |
531 | | - |
532 | } executed: } Execution Count:57704 | 57704 |
533 | | - |
534 | | - |
535 | void QPainterPrivate::updateInvMatrix() | - |
536 | { | - |
537 | qt_noop(); | - |
538 | txinv = true; | - |
539 | invMatrix = state->matrix.inverted(); | - |
540 | } executed: } Execution Count:2117 | 2117 |
541 | | - |
542 | extern bool qt_isExtendedRadialGradient(const QBrush &brush); | - |
543 | | - |
544 | void QPainterPrivate::updateEmulationSpecifier(QPainterState *s) | - |
545 | { | - |
546 | bool alpha = false; | - |
547 | bool linearGradient = false; | - |
548 | bool radialGradient = false; | - |
549 | bool extendedRadialGradient = false; | - |
550 | bool conicalGradient = false; | - |
551 | bool patternBrush = false; | - |
552 | bool xform = false; | - |
553 | bool complexXform = false; | - |
554 | | - |
555 | bool skip = true; | - |
556 | | - |
557 | | - |
558 | | - |
559 | if (s->state() & (QPaintEngine::DirtyPen | QPaintEngine::DirtyBrush | QPaintEngine::DirtyHints)) { evaluated: s->state() & (QPaintEngine::DirtyPen | QPaintEngine::DirtyBrush | QPaintEngine::DirtyHints) yes Evaluation Count:18 | yes Evaluation Count:12 |
| 12-18 |
560 | | - |
561 | if (!s->pen.isSolid() && !engine->hasFeature(QPaintEngine::BrushStroke)) partially evaluated: !s->pen.isSolid() no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::BrushStroke) | 0-18 |
562 | s->emulationSpecifier |= QPaintEngine::BrushStroke; never executed: s->emulationSpecifier |= QPaintEngine::BrushStroke; | 0 |
563 | else | - |
564 | s->emulationSpecifier &= ~QPaintEngine::BrushStroke; executed: s->emulationSpecifier &= ~QPaintEngine::BrushStroke; Execution Count:18 | 18 |
565 | | - |
566 | skip = false; | - |
567 | | - |
568 | QBrush penBrush = (qpen_style(s->pen) == Qt::NoPen) ? QBrush(Qt::NoBrush) : qpen_brush(s->pen); evaluated: (qpen_style(s->pen) == Qt::NoPen) yes Evaluation Count:8 | yes Evaluation Count:10 |
| 8-10 |
569 | Qt::BrushStyle brushStyle = qbrush_style(s->brush); | - |
570 | Qt::BrushStyle penBrushStyle = qbrush_style(penBrush); | - |
571 | alpha = (penBrushStyle != Qt::NoBrush evaluated: penBrushStyle != Qt::NoBrush yes Evaluation Count:10 | yes Evaluation Count:8 |
| 8-10 |
572 | && (penBrushStyle < Qt::LinearGradientPattern && penBrush.color().alpha() != 255) partially evaluated: penBrushStyle < Qt::LinearGradientPattern yes Evaluation Count:10 | no Evaluation Count:0 |
partially evaluated: penBrush.color().alpha() != 255 no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
573 | && !penBrush.isOpaque()) never evaluated: !penBrush.isOpaque() | 0 |
574 | || (brushStyle != Qt::NoBrush evaluated: brushStyle != Qt::NoBrush yes Evaluation Count:8 | yes Evaluation Count:10 |
| 8-10 |
575 | && (brushStyle < Qt::LinearGradientPattern && s->brush.color().alpha() != 255) partially evaluated: brushStyle < Qt::LinearGradientPattern yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: s->brush.color().alpha() != 255 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
576 | && !s->brush.isOpaque()); never evaluated: !s->brush.isOpaque() | 0 |
577 | linearGradient = ((penBrushStyle == Qt::LinearGradientPattern) || partially evaluated: (penBrushStyle == Qt::LinearGradientPattern) no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
578 | (brushStyle == Qt::LinearGradientPattern)); partially evaluated: (brushStyle == Qt::LinearGradientPattern) no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
579 | radialGradient = ((penBrushStyle == Qt::RadialGradientPattern) || partially evaluated: (penBrushStyle == Qt::RadialGradientPattern) no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
580 | (brushStyle == Qt::RadialGradientPattern)); partially evaluated: (brushStyle == Qt::RadialGradientPattern) no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
581 | extendedRadialGradient = radialGradient && (qt_isExtendedRadialGradient(penBrush) || qt_isExtendedRadialGradient(s->brush)); partially evaluated: radialGradient no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: qt_isExtendedRadialGradient(penBrush) never evaluated: qt_isExtendedRadialGradient(s->brush) | 0-18 |
582 | conicalGradient = ((penBrushStyle == Qt::ConicalGradientPattern) || partially evaluated: (penBrushStyle == Qt::ConicalGradientPattern) no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
583 | (brushStyle == Qt::ConicalGradientPattern)); partially evaluated: (brushStyle == Qt::ConicalGradientPattern) no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
584 | patternBrush = (((penBrushStyle > Qt::SolidPattern partially evaluated: penBrushStyle > Qt::SolidPattern no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
585 | && penBrushStyle < Qt::LinearGradientPattern) never evaluated: penBrushStyle < Qt::LinearGradientPattern | 0 |
586 | || penBrushStyle == Qt::TexturePattern) || partially evaluated: penBrushStyle == Qt::TexturePattern no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
587 | ((brushStyle > Qt::SolidPattern partially evaluated: brushStyle > Qt::SolidPattern no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
588 | && brushStyle < Qt::LinearGradientPattern) never evaluated: brushStyle < Qt::LinearGradientPattern | 0 |
589 | || brushStyle == Qt::TexturePattern)); partially evaluated: brushStyle == Qt::TexturePattern no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
590 | | - |
591 | bool penTextureAlpha = false; | - |
592 | if (penBrush.style() == Qt::TexturePattern) partially evaluated: penBrush.style() == Qt::TexturePattern no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
593 | penTextureAlpha = qHasPixmapTexture(penBrush) never evaluated: qHasPixmapTexture(penBrush) | 0 |
594 | ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha() | 0 |
595 | : penBrush.textureImage().hasAlphaChannel(); never executed: penTextureAlpha = qHasPixmapTexture(penBrush) ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha() : penBrush.textureImage().hasAlphaChannel(); | 0 |
596 | bool brushTextureAlpha = false; | - |
597 | if (s->brush.style() == Qt::TexturePattern) { partially evaluated: s->brush.style() == Qt::TexturePattern no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
598 | brushTextureAlpha = qHasPixmapTexture(s->brush) never evaluated: qHasPixmapTexture(s->brush) | 0 |
599 | ? (s->brush.texture().depth() > 1) && s->brush.texture().hasAlpha() | - |
600 | : s->brush.textureImage().hasAlphaChannel(); | - |
601 | } | 0 |
602 | if (((penBrush.style() == Qt::TexturePattern && penTextureAlpha) partially evaluated: penBrush.style() == Qt::TexturePattern no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: penTextureAlpha | 0-18 |
603 | || (s->brush.style() == Qt::TexturePattern && brushTextureAlpha)) partially evaluated: s->brush.style() == Qt::TexturePattern no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: brushTextureAlpha | 0-18 |
604 | && !engine->hasFeature(QPaintEngine::MaskedBrush)) never evaluated: !engine->hasFeature(QPaintEngine::MaskedBrush) | 0 |
605 | s->emulationSpecifier |= QPaintEngine::MaskedBrush; never executed: s->emulationSpecifier |= QPaintEngine::MaskedBrush; | 0 |
606 | else | - |
607 | s->emulationSpecifier &= ~QPaintEngine::MaskedBrush; executed: s->emulationSpecifier &= ~QPaintEngine::MaskedBrush; Execution Count:18 | 18 |
608 | } | - |
609 | | - |
610 | if (s->state() & (QPaintEngine::DirtyHints | 0-30 |
611 | | QPaintEngine::DirtyOpacity | 0-30 |
612 | | QPaintEngine::DirtyBackgroundMode)) { partially evaluated: s->state() & (QPaintEngine::DirtyHints | QPaintEngine::DirtyOpacity | QPaintEngine::DirtyBackgroundMode) no Evaluation Count:0 | yes Evaluation Count:30 |
| 0-30 |
613 | skip = false; | - |
614 | } | 0 |
615 | | - |
616 | if (skip) evaluated: skip yes Evaluation Count:12 | yes Evaluation Count:18 |
| 12-18 |
617 | return; executed: return; Execution Count:12 | 12 |
618 | if (s->state() & QPaintEngine::DirtyTransform) { partially evaluated: s->state() & QPaintEngine::DirtyTransform no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
619 | xform = !s->matrix.isIdentity(); | - |
620 | complexXform = !s->matrix.isAffine(); | - |
621 | } else if (s->matrix.type() >= QTransform::TxTranslate) { partially evaluated: s->matrix.type() >= QTransform::TxTranslate no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
622 | xform = true; | - |
623 | complexXform = !s->matrix.isAffine(); | - |
624 | } | 0 |
625 | | - |
626 | const bool brushXform = (!s->brush.transform().type() == QTransform::TxNone); | - |
627 | const bool penXform = (!s->pen.brush().transform().type() == QTransform::TxNone); | - |
628 | | - |
629 | const bool patternXform = patternBrush && (xform || brushXform || penXform); partially evaluated: patternBrush no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: brushXform never evaluated: penXform | 0-18 |
630 | | - |
631 | | - |
632 | if (alpha && !engine->hasFeature(QPaintEngine::AlphaBlend)) partially evaluated: alpha no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::AlphaBlend) | 0-18 |
633 | s->emulationSpecifier |= QPaintEngine::AlphaBlend; never executed: s->emulationSpecifier |= QPaintEngine::AlphaBlend; | 0 |
634 | else | - |
635 | s->emulationSpecifier &= ~QPaintEngine::AlphaBlend; executed: s->emulationSpecifier &= ~QPaintEngine::AlphaBlend; Execution Count:18 | 18 |
636 | | - |
637 | | - |
638 | if (linearGradient && !engine->hasFeature(QPaintEngine::LinearGradientFill)) partially evaluated: linearGradient no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::LinearGradientFill) | 0-18 |
639 | s->emulationSpecifier |= QPaintEngine::LinearGradientFill; never executed: s->emulationSpecifier |= QPaintEngine::LinearGradientFill; | 0 |
640 | else | - |
641 | s->emulationSpecifier &= ~QPaintEngine::LinearGradientFill; executed: s->emulationSpecifier &= ~QPaintEngine::LinearGradientFill; Execution Count:18 | 18 |
642 | | - |
643 | | - |
644 | if (extendedRadialGradient || (radialGradient && !engine->hasFeature(QPaintEngine::RadialGradientFill))) partially evaluated: extendedRadialGradient no Evaluation Count:0 | yes Evaluation Count:18 |
partially evaluated: radialGradient no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::RadialGradientFill) | 0-18 |
645 | s->emulationSpecifier |= QPaintEngine::RadialGradientFill; never executed: s->emulationSpecifier |= QPaintEngine::RadialGradientFill; | 0 |
646 | else | - |
647 | s->emulationSpecifier &= ~QPaintEngine::RadialGradientFill; executed: s->emulationSpecifier &= ~QPaintEngine::RadialGradientFill; Execution Count:18 | 18 |
648 | | - |
649 | | - |
650 | if (conicalGradient && !engine->hasFeature(QPaintEngine::ConicalGradientFill)) partially evaluated: conicalGradient no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::ConicalGradientFill) | 0-18 |
651 | s->emulationSpecifier |= QPaintEngine::ConicalGradientFill; never executed: s->emulationSpecifier |= QPaintEngine::ConicalGradientFill; | 0 |
652 | else | - |
653 | s->emulationSpecifier &= ~QPaintEngine::ConicalGradientFill; executed: s->emulationSpecifier &= ~QPaintEngine::ConicalGradientFill; Execution Count:18 | 18 |
654 | | - |
655 | | - |
656 | if (patternBrush && !engine->hasFeature(QPaintEngine::PatternBrush)) partially evaluated: patternBrush no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::PatternBrush) | 0-18 |
657 | s->emulationSpecifier |= QPaintEngine::PatternBrush; never executed: s->emulationSpecifier |= QPaintEngine::PatternBrush; | 0 |
658 | else | - |
659 | s->emulationSpecifier &= ~QPaintEngine::PatternBrush; executed: s->emulationSpecifier &= ~QPaintEngine::PatternBrush; Execution Count:18 | 18 |
660 | | - |
661 | | - |
662 | if (patternXform && !engine->hasFeature(QPaintEngine::PatternTransform)) partially evaluated: patternXform no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::PatternTransform) | 0-18 |
663 | s->emulationSpecifier |= QPaintEngine::PatternTransform; never executed: s->emulationSpecifier |= QPaintEngine::PatternTransform; | 0 |
664 | else | - |
665 | s->emulationSpecifier &= ~QPaintEngine::PatternTransform; executed: s->emulationSpecifier &= ~QPaintEngine::PatternTransform; Execution Count:18 | 18 |
666 | | - |
667 | | - |
668 | if (xform && !engine->hasFeature(QPaintEngine::PrimitiveTransform)) partially evaluated: xform no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::PrimitiveTransform) | 0-18 |
669 | s->emulationSpecifier |= QPaintEngine::PrimitiveTransform; never executed: s->emulationSpecifier |= QPaintEngine::PrimitiveTransform; | 0 |
670 | else | - |
671 | s->emulationSpecifier &= ~QPaintEngine::PrimitiveTransform; executed: s->emulationSpecifier &= ~QPaintEngine::PrimitiveTransform; Execution Count:18 | 18 |
672 | | - |
673 | | - |
674 | if (complexXform && !engine->hasFeature(QPaintEngine::PerspectiveTransform)) partially evaluated: complexXform no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::PerspectiveTransform) | 0-18 |
675 | s->emulationSpecifier |= QPaintEngine::PerspectiveTransform; never executed: s->emulationSpecifier |= QPaintEngine::PerspectiveTransform; | 0 |
676 | else | - |
677 | s->emulationSpecifier &= ~QPaintEngine::PerspectiveTransform; executed: s->emulationSpecifier &= ~QPaintEngine::PerspectiveTransform; Execution Count:18 | 18 |
678 | | - |
679 | | - |
680 | if (state->opacity != 1 && !engine->hasFeature(QPaintEngine::ConstantOpacity)) partially evaluated: state->opacity != 1 no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::ConstantOpacity) | 0-18 |
681 | s->emulationSpecifier |= QPaintEngine::ConstantOpacity; never executed: s->emulationSpecifier |= QPaintEngine::ConstantOpacity; | 0 |
682 | else | - |
683 | s->emulationSpecifier &= ~QPaintEngine::ConstantOpacity; executed: s->emulationSpecifier &= ~QPaintEngine::ConstantOpacity; Execution Count:18 | 18 |
684 | | - |
685 | bool gradientStretch = false; | - |
686 | bool objectBoundingMode = false; | - |
687 | if (linearGradient || conicalGradient || radialGradient) { partially evaluated: linearGradient no Evaluation Count:0 | yes Evaluation Count:18 |
partially evaluated: conicalGradient no Evaluation Count:0 | yes Evaluation Count:18 |
partially evaluated: radialGradient no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
688 | QGradient::CoordinateMode brushMode = coordinateMode(s->brush); | - |
689 | QGradient::CoordinateMode penMode = coordinateMode(s->pen.brush()); | - |
690 | | - |
691 | gradientStretch |= (brushMode == QGradient::StretchToDeviceMode); | - |
692 | gradientStretch |= (penMode == QGradient::StretchToDeviceMode); | - |
693 | | - |
694 | objectBoundingMode |= (brushMode == QGradient::ObjectBoundingMode); | - |
695 | objectBoundingMode |= (penMode == QGradient::ObjectBoundingMode); | - |
696 | } | 0 |
697 | if (gradientStretch) partially evaluated: gradientStretch no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
698 | s->emulationSpecifier |= 0x10000000; never executed: s->emulationSpecifier |= 0x10000000; | 0 |
699 | else | - |
700 | s->emulationSpecifier &= ~0x10000000; executed: s->emulationSpecifier &= ~0x10000000; Execution Count:18 | 18 |
701 | | - |
702 | if (objectBoundingMode && !engine->hasFeature(QPaintEngine::ObjectBoundingModeGradients)) partially evaluated: objectBoundingMode no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: !engine->hasFeature(QPaintEngine::ObjectBoundingModeGradients) | 0-18 |
703 | s->emulationSpecifier |= QPaintEngine::ObjectBoundingModeGradients; never executed: s->emulationSpecifier |= QPaintEngine::ObjectBoundingModeGradients; | 0 |
704 | else | - |
705 | s->emulationSpecifier &= ~QPaintEngine::ObjectBoundingModeGradients; executed: s->emulationSpecifier &= ~QPaintEngine::ObjectBoundingModeGradients; Execution Count:18 | 18 |
706 | | - |
707 | | - |
708 | if (s->bgMode == Qt::OpaqueMode && partially evaluated: s->bgMode == Qt::OpaqueMode no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
709 | (is_pen_transparent(s->pen) || is_brush_transparent(s->brush))) never evaluated: is_pen_transparent(s->pen) never evaluated: is_brush_transparent(s->brush) | 0 |
710 | s->emulationSpecifier |= 0x40000000; never executed: s->emulationSpecifier |= 0x40000000; | 0 |
711 | else | - |
712 | s->emulationSpecifier &= ~0x40000000; executed: s->emulationSpecifier &= ~0x40000000; Execution Count:18 | 18 |
713 | } | - |
714 | | - |
715 | void QPainterPrivate::updateStateImpl(QPainterState *newState) | - |
716 | { | - |
717 | | - |
718 | if (!engine->state) { partially evaluated: !engine->state no Evaluation Count:0 | yes Evaluation Count:30 |
| 0-30 |
719 | engine->state = newState; | - |
720 | engine->setDirty(QPaintEngine::AllDirty); | - |
721 | } | 0 |
722 | | - |
723 | if (engine->state->painter() != newState->painter) partially evaluated: engine->state->painter() != newState->painter no Evaluation Count:0 | yes Evaluation Count:30 |
| 0-30 |
724 | | - |
725 | engine->setDirty(QPaintEngine::AllDirty); never executed: engine->setDirty(QPaintEngine::AllDirty); | 0 |
726 | | - |
727 | | - |
728 | else if (engine->state != newState) evaluated: engine->state != newState yes Evaluation Count:9 | yes Evaluation Count:21 |
| 9-21 |
729 | newState->dirtyFlags |= QPaintEngine::DirtyFlags(static_cast<QPainterState *>(engine->state)->changeFlags); executed: newState->dirtyFlags |= QPaintEngine::DirtyFlags(static_cast<QPainterState *>(engine->state)->changeFlags); Execution Count:9 | 9 |
730 | | - |
731 | | - |
732 | else | - |
733 | newState->changeFlags |= newState->dirtyFlags; executed: newState->changeFlags |= newState->dirtyFlags; Execution Count:21 | 21 |
734 | | - |
735 | updateEmulationSpecifier(newState); | - |
736 | | - |
737 | | - |
738 | newState->dirtyFlags &= ~(QPaintEngine::DirtyBackgroundMode | - |
739 | | QPaintEngine::DirtyBackground); | - |
740 | | - |
741 | engine->state = newState; | - |
742 | engine->updateState(*newState); | - |
743 | engine->clearDirty(QPaintEngine::AllDirty); | - |
744 | | - |
745 | } executed: } Execution Count:30 | 30 |
746 | | - |
747 | void QPainterPrivate::updateState(QPainterState *newState) | - |
748 | { | - |
749 | | - |
750 | if (!newState) { evaluated: !newState yes Evaluation Count:28773 | yes Evaluation Count:57 |
| 57-28773 |
751 | engine->state = newState; | - |
752 | } else if (newState->state() || engine->state!=newState) { executed: } Execution Count:28773 evaluated: newState->state() yes Evaluation Count:21 | yes Evaluation Count:36 |
evaluated: engine->state!=newState yes Evaluation Count:9 | yes Evaluation Count:27 |
| 9-28773 |
753 | updateStateImpl(newState); | - |
754 | } executed: } Execution Count:30 | 30 |
755 | } | - |
756 | QPainter::QPainter() | - |
757 | : d_ptr(new QPainterPrivate(this)) | - |
758 | { | - |
759 | } executed: } Execution Count:2033 | 2033 |
760 | QPainter::QPainter(QPaintDevice *pd) | - |
761 | : d_ptr(0) | - |
762 | { | - |
763 | qt_noop(); | - |
764 | if (!QPainterPrivate::attachPainterPrivate(this, pd)) { evaluated: !QPainterPrivate::attachPainterPrivate(this, pd) yes Evaluation Count:25609 | yes Evaluation Count:34 |
| 34-25609 |
765 | d_ptr.reset(new QPainterPrivate(this)); | - |
766 | begin(pd); | - |
767 | } executed: } Execution Count:25609 | 25609 |
768 | qt_noop(); | - |
769 | } executed: } Execution Count:25643 | 25643 |
770 | | - |
771 | | - |
772 | | - |
773 | | - |
774 | QPainter::~QPainter() | - |
775 | { | - |
776 | d_ptr->inDestructor = true; | - |
777 | if (true) { partially evaluated: true yes Evaluation Count:27676 | no Evaluation Count:0 |
| 0-27676 |
778 | if (isActive()) evaluated: isActive() yes Evaluation Count:22462 | yes Evaluation Count:5214 |
| 5214-22462 |
779 | end(); executed: end(); Execution Count:22462 | 22462 |
780 | else if (d_ptr->refcount > 1) partially evaluated: d_ptr->refcount > 1 no Evaluation Count:0 | yes Evaluation Count:5214 |
| 0-5214 |
781 | d_ptr->detachPainterPrivate(this); never executed: d_ptr->detachPainterPrivate(this); | 0 |
782 | } else { | - |
783 | | - |
784 | } | 0 |
785 | if (d_ptr) { evaluated: d_ptr yes Evaluation Count:27643 | yes Evaluation Count:33 |
| 33-27643 |
786 | | - |
787 | qt_noop(); | - |
788 | d_ptr->inDestructor = false; | - |
789 | qt_noop(); | - |
790 | if (d_ptr->d_ptrs) evaluated: d_ptr->d_ptrs yes Evaluation Count:13 | yes Evaluation Count:27630 |
| 13-27630 |
791 | free(d_ptr->d_ptrs); executed: free(d_ptr->d_ptrs); Execution Count:13 | 13 |
792 | } executed: } Execution Count:27643 | 27643 |
793 | } executed: } Execution Count:27676 | 27676 |
794 | QPaintDevice *QPainter::device() const | - |
795 | { | - |
796 | const QPainterPrivate * const d = d_func(); | - |
797 | if (isActive() && d->engine->d_func()->currentClipDevice) evaluated: isActive() yes Evaluation Count:30103 | yes Evaluation Count:1 |
evaluated: d->engine->d_func()->currentClipDevice yes Evaluation Count:6 | yes Evaluation Count:30097 |
| 1-30103 |
798 | return d->engine->d_func()->currentClipDevice; executed: return d->engine->d_func()->currentClipDevice; Execution Count:6 | 6 |
799 | return d->original_device; executed: return d->original_device; Execution Count:30098 | 30098 |
800 | } | - |
801 | bool QPainter::isActive() const | - |
802 | { | - |
803 | const QPainterPrivate * const d = d_func(); | - |
804 | return d->engine; executed: return d->engine; Execution Count:57858 | 57858 |
805 | } | - |
806 | void QPainter::initFrom(const QPaintDevice *device) | - |
807 | { | - |
808 | qt_noop(); | - |
809 | QPainterPrivate * const d = d_func(); | - |
810 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:23461 |
| 0-23461 |
811 | QMessageLogger("painting/qpainter.cpp", 1540, __PRETTY_FUNCTION__).warning("QPainter::initFrom: Painter not active, aborted"); | - |
812 | return; | 0 |
813 | } | - |
814 | | - |
815 | device->initPainter(this); | - |
816 | | - |
817 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:23461 | no Evaluation Count:0 |
| 0-23461 |
818 | d->extended->penChanged(); | - |
819 | } else if (d->engine) { executed: } Execution Count:23461 never evaluated: d->engine | 0-23461 |
820 | d->engine->setDirty(QPaintEngine::DirtyPen); | - |
821 | d->engine->setDirty(QPaintEngine::DirtyBrush); | - |
822 | d->engine->setDirty(QPaintEngine::DirtyFont); | - |
823 | } | 0 |
824 | } | - |
825 | void QPainter::save() | - |
826 | { | - |
827 | | - |
828 | | - |
829 | | - |
830 | | - |
831 | QPainterPrivate * const d = d_func(); | - |
832 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:30787 |
| 1-30787 |
833 | QMessageLogger("painting/qpainter.cpp", 1572, __PRETTY_FUNCTION__).warning("QPainter::save: Painter not active"); | - |
834 | return; executed: return; Execution Count:1 | 1 |
835 | } | - |
836 | | - |
837 | if (d->extended) { evaluated: d->extended yes Evaluation Count:30778 | yes Evaluation Count:9 |
| 9-30778 |
838 | d->state = d->extended->createState(d->states.back()); | - |
839 | d->extended->setState(d->state); | - |
840 | } else { executed: } Execution Count:30778 | 30778 |
841 | d->updateState(d->state); | - |
842 | d->state = new QPainterState(d->states.back()); | - |
843 | d->engine->state = d->state; | - |
844 | } executed: } Execution Count:9 | 9 |
845 | d->states.push_back(d->state); | - |
846 | } executed: } Execution Count:30787 | 30787 |
847 | void QPainter::restore() | - |
848 | { | - |
849 | | - |
850 | | - |
851 | | - |
852 | | - |
853 | QPainterPrivate * const d = d_func(); | - |
854 | if (d->states.size()<=1) { evaluated: d->states.size()<=1 yes Evaluation Count:1 | yes Evaluation Count:30787 |
| 1-30787 |
855 | QMessageLogger("painting/qpainter.cpp", 1602, __PRETTY_FUNCTION__).warning("QPainter::restore: Unbalanced save/restore"); | - |
856 | return; executed: return; Execution Count:1 | 1 |
857 | } else if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:30787 |
| 0-30787 |
858 | QMessageLogger("painting/qpainter.cpp", 1605, __PRETTY_FUNCTION__).warning("QPainter::restore: Painter not active"); | - |
859 | return; | 0 |
860 | } | - |
861 | | - |
862 | QPainterState *tmp = d->state; | - |
863 | d->states.pop_back(); | - |
864 | d->state = d->states.back(); | - |
865 | d->txinv = false; | - |
866 | | - |
867 | if (d->extended) { evaluated: d->extended yes Evaluation Count:30778 | yes Evaluation Count:9 |
| 9-30778 |
868 | d->checkEmulation(); | - |
869 | d->extended->setState(d->state); | - |
870 | delete tmp; | - |
871 | return; executed: return; Execution Count:30778 | 30778 |
872 | } | - |
873 | | - |
874 | | - |
875 | | - |
876 | if (!d->state->clipInfo.isEmpty() partially evaluated: !d->state->clipInfo.isEmpty() no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
877 | && (tmp->changeFlags & (QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyClipPath))) { never evaluated: (tmp->changeFlags & (QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyClipPath)) | 0 |
878 | | - |
879 | tmp->dirtyFlags = QPaintEngine::DirtyClipPath; | - |
880 | tmp->clipOperation = Qt::NoClip; | - |
881 | tmp->clipPath = QPainterPath(); | - |
882 | d->engine->updateState(*tmp); | - |
883 | | - |
884 | for (int i=0; i<d->state->clipInfo.size(); ++i) { never evaluated: i<d->state->clipInfo.size() | 0 |
885 | const QPainterClipInfo &info = d->state->clipInfo.at(i); | - |
886 | tmp->matrix = info.matrix; | - |
887 | tmp->matrix *= d->state->redirectionMatrix; | - |
888 | tmp->clipOperation = info.operation; | - |
889 | if (info.clipType == QPainterClipInfo::RectClip) { never evaluated: info.clipType == QPainterClipInfo::RectClip | 0 |
890 | tmp->dirtyFlags = QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyTransform; | - |
891 | tmp->clipRegion = info.rect; | - |
892 | } else if (info.clipType == QPainterClipInfo::RegionClip) { never evaluated: info.clipType == QPainterClipInfo::RegionClip | 0 |
893 | tmp->dirtyFlags = QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyTransform; | - |
894 | tmp->clipRegion = info.region; | - |
895 | } else { | 0 |
896 | tmp->dirtyFlags = QPaintEngine::DirtyClipPath | QPaintEngine::DirtyTransform; | - |
897 | tmp->clipPath = info.path; | - |
898 | } | 0 |
899 | d->engine->updateState(*tmp); | - |
900 | } | 0 |
901 | | - |
902 | | - |
903 | | - |
904 | d->state->dirtyFlags &= ~(QPaintEngine::DirtyClipPath | QPaintEngine::DirtyClipRegion); | - |
905 | tmp->changeFlags &= ~(QPaintEngine::DirtyClipPath | QPaintEngine::DirtyClipRegion); | - |
906 | tmp->changeFlags |= QPaintEngine::DirtyTransform; | - |
907 | } | 0 |
908 | | - |
909 | d->updateState(d->state); | - |
910 | delete tmp; | - |
911 | } executed: } Execution Count:9 | 9 |
912 | static inline void qt_cleanup_painter_state(QPainterPrivate *d) | - |
913 | { | - |
914 | d->states.clear(); | - |
915 | delete d->state; | - |
916 | d->state = 0; | - |
917 | d->engine = 0; | - |
918 | d->device = 0; | - |
919 | } executed: } Execution Count:28778 | 28778 |
920 | | - |
921 | bool QPainter::begin(QPaintDevice *pd) | - |
922 | { | - |
923 | qt_noop(); | - |
924 | | - |
925 | if (pd->painters > 0) { evaluated: pd->painters > 0 yes Evaluation Count:1 | yes Evaluation Count:28784 |
| 1-28784 |
926 | QMessageLogger("painting/qpainter.cpp", 1702, __PRETTY_FUNCTION__).warning("QPainter::begin: A paint device can only be painted by one painter at a time."); | - |
927 | return false; executed: return false; Execution Count:1 | 1 |
928 | } | - |
929 | | - |
930 | if (d_ptr->engine) { evaluated: d_ptr->engine yes Evaluation Count:1 | yes Evaluation Count:28783 |
| 1-28783 |
931 | QMessageLogger("painting/qpainter.cpp", 1707, __PRETTY_FUNCTION__).warning("QPainter::begin: Painter already active"); | - |
932 | return false; executed: return false; Execution Count:1 | 1 |
933 | } | - |
934 | | - |
935 | if (QPainterPrivate::attachPainterPrivate(this, pd)) evaluated: QPainterPrivate::attachPainterPrivate(this, pd) yes Evaluation Count:6 | yes Evaluation Count:28777 |
| 6-28777 |
936 | return true; executed: return true; Execution Count:6 | 6 |
937 | | - |
938 | QPainterPrivate * const d = d_func(); | - |
939 | | - |
940 | d->helper_device = pd; | - |
941 | d->original_device = pd; | - |
942 | | - |
943 | QPoint redirectionOffset; | - |
944 | QPaintDevice *rpd = pd->redirected(&redirectionOffset); | - |
945 | if (rpd) evaluated: rpd yes Evaluation Count:23420 | yes Evaluation Count:5357 |
| 5357-23420 |
946 | pd = rpd; executed: pd = rpd; Execution Count:23420 | 23420 |
947 | | - |
948 | | - |
949 | | - |
950 | | - |
951 | | - |
952 | | - |
953 | if (pd->devType() == QInternal::Pixmap) evaluated: pd->devType() == QInternal::Pixmap yes Evaluation Count:834 | yes Evaluation Count:27943 |
| 834-27943 |
954 | static_cast<QPixmap *>(pd)->detach(); executed: static_cast<QPixmap *>(pd)->detach(); Execution Count:834 | 834 |
955 | else if (pd->devType() == QInternal::Image) evaluated: pd->devType() == QInternal::Image yes Evaluation Count:27905 | yes Evaluation Count:38 |
| 38-27905 |
956 | static_cast<QImage *>(pd)->detach(); executed: static_cast<QImage *>(pd)->detach(); Execution Count:27905 | 27905 |
957 | | - |
958 | d->engine = pd->paintEngine(); | - |
959 | | - |
960 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:2 | yes Evaluation Count:28774 |
| 2-28774 |
961 | QMessageLogger("painting/qpainter.cpp", 1737, __PRETTY_FUNCTION__).warning("QPainter::begin: Paint device returned engine == 0, type: %d", pd->devType()); | - |
962 | return false; executed: return false; Execution Count:2 | 2 |
963 | } | - |
964 | | - |
965 | d->device = pd; | - |
966 | | - |
967 | d->extended = d->engine->isExtended() ? static_cast<QPaintEngineEx *>(d->engine) : 0; evaluated: d->engine->isExtended() yes Evaluation Count:28736 | yes Evaluation Count:38 |
| 38-28736 |
968 | if (d->emulationEngine) partially evaluated: d->emulationEngine no Evaluation Count:0 | yes Evaluation Count:28774 |
| 0-28774 |
969 | d->emulationEngine->real_engine = d->extended; never executed: d->emulationEngine->real_engine = d->extended; | 0 |
970 | | - |
971 | | - |
972 | qt_noop(); | - |
973 | d->state = d->extended ? d->extended->createState(0) : new QPainterState; evaluated: d->extended yes Evaluation Count:28736 | yes Evaluation Count:38 |
| 38-28736 |
974 | d->state->painter = this; | - |
975 | d->states.push_back(d->state); | - |
976 | | - |
977 | d->state->redirectionMatrix.translate(-redirectionOffset.x(), -redirectionOffset.y()); | - |
978 | d->state->brushOrigin = QPointF(); | - |
979 | | - |
980 | | - |
981 | if (d->extended) evaluated: d->extended yes Evaluation Count:28737 | yes Evaluation Count:38 |
| 38-28737 |
982 | d->extended->setState(d->state); executed: d->extended->setState(d->state); Execution Count:28737 | 28737 |
983 | else | - |
984 | d->engine->state = d->state; executed: d->engine->state = d->state; Execution Count:38 | 38 |
985 | | - |
986 | switch (pd->devType()) { | - |
987 | case QInternal::Pixmap: | - |
988 | { | - |
989 | QPixmap *pm = static_cast<QPixmap *>(pd); | - |
990 | qt_noop(); | - |
991 | if (pm->isNull()) { partially evaluated: pm->isNull() no Evaluation Count:0 | yes Evaluation Count:833 |
| 0-833 |
992 | QMessageLogger("painting/qpainter.cpp", 1768, __PRETTY_FUNCTION__).warning("QPainter::begin: Cannot paint on a null pixmap"); | - |
993 | qt_cleanup_painter_state(d); | - |
994 | return false; never executed: return false; | 0 |
995 | } | - |
996 | | - |
997 | if (pm->depth() == 1) { evaluated: pm->depth() == 1 yes Evaluation Count:5 | yes Evaluation Count:828 |
| 5-828 |
998 | d->state->pen = QPen(Qt::color1); | - |
999 | d->state->brush = QBrush(Qt::color0); | - |
1000 | } executed: } Execution Count:5 | 5 |
1001 | break; executed: break; Execution Count:833 | 833 |
1002 | } | - |
1003 | case QInternal::Image: | - |
1004 | { | - |
1005 | QImage *img = static_cast<QImage *>(pd); | - |
1006 | qt_noop(); | - |
1007 | if (img->isNull()) { partially evaluated: img->isNull() no Evaluation Count:0 | yes Evaluation Count:27904 |
| 0-27904 |
1008 | QMessageLogger("painting/qpainter.cpp", 1784, __PRETTY_FUNCTION__).warning("QPainter::begin: Cannot paint on a null image"); | - |
1009 | qt_cleanup_painter_state(d); | - |
1010 | return false; never executed: return false; | 0 |
1011 | } else if (img->format() == QImage::Format_Indexed8) { evaluated: img->format() == QImage::Format_Indexed8 yes Evaluation Count:1 | yes Evaluation Count:27903 |
| 1-27903 |
1012 | | - |
1013 | QMessageLogger("painting/qpainter.cpp", 1789, __PRETTY_FUNCTION__).warning("QPainter::begin: Cannot paint on an image with the QImage::Format_Indexed8 format"); | - |
1014 | qt_cleanup_painter_state(d); | - |
1015 | return false; executed: return false; Execution Count:1 | 1 |
1016 | } | - |
1017 | if (img->depth() == 1) { evaluated: img->depth() == 1 yes Evaluation Count:162 | yes Evaluation Count:27741 |
| 162-27741 |
1018 | d->state->pen = QPen(Qt::color1); | - |
1019 | d->state->brush = QBrush(Qt::color0); | - |
1020 | } executed: } Execution Count:162 | 162 |
1021 | break; executed: break; Execution Count:27903 | 27903 |
1022 | } | - |
1023 | default: | - |
1024 | break; executed: break; Execution Count:38 | 38 |
1025 | } | - |
1026 | if (d->state->ww == 0) partially evaluated: d->state->ww == 0 yes Evaluation Count:28774 | no Evaluation Count:0 |
| 0-28774 |
1027 | d->state->ww = d->state->wh = d->state->vw = d->state->vh = 1024; executed: d->state->ww = d->state->wh = d->state->vw = d->state->vh = 1024; Execution Count:28774 | 28774 |
1028 | | - |
1029 | d->engine->setPaintDevice(pd); | - |
1030 | | - |
1031 | bool begun = d->engine->begin(pd); | - |
1032 | if (!begun) { evaluated: !begun yes Evaluation Count:1 | yes Evaluation Count:28773 |
| 1-28773 |
1033 | QMessageLogger("painting/qpainter.cpp", 1809, __PRETTY_FUNCTION__).warning("QPainter::begin(): Returned false"); | - |
1034 | if (d->engine->isActive()) { partially evaluated: d->engine->isActive() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1035 | end(); | - |
1036 | } else { | 0 |
1037 | qt_cleanup_painter_state(d); | - |
1038 | } executed: } Execution Count:1 | 1 |
1039 | return false; executed: return false; Execution Count:1 | 1 |
1040 | } else { | - |
1041 | d->engine->setActive(begun); | - |
1042 | } executed: } Execution Count:28773 | 28773 |
1043 | | - |
1044 | | - |
1045 | | - |
1046 | if (d->original_device->devType() == QInternal::Widget) { evaluated: d->original_device->devType() == QInternal::Widget yes Evaluation Count:23420 | yes Evaluation Count:5353 |
| 5353-23420 |
1047 | initFrom(d->original_device); | - |
1048 | } else { executed: } Execution Count:23420 | 23420 |
1049 | d->state->layoutDirection = Qt::LayoutDirectionAuto; | - |
1050 | | - |
1051 | d->state->deviceFont = d->state->font = QFont(d->state->deviceFont, device()); | - |
1052 | } executed: } Execution Count:5353 | 5353 |
1053 | | - |
1054 | QRect systemRect = d->engine->systemRect(); | - |
1055 | if (!systemRect.isEmpty()) { evaluated: !systemRect.isEmpty() yes Evaluation Count:23420 | yes Evaluation Count:5353 |
| 5353-23420 |
1056 | d->state->ww = d->state->vw = systemRect.width(); | - |
1057 | d->state->wh = d->state->vh = systemRect.height(); | - |
1058 | } else { executed: } Execution Count:23420 | 23420 |
1059 | d->state->ww = d->state->vw = pd->metric(QPaintDevice::PdmWidth); | - |
1060 | d->state->wh = d->state->vh = pd->metric(QPaintDevice::PdmHeight); | - |
1061 | } executed: } Execution Count:5353 | 5353 |
1062 | | - |
1063 | const QPoint coordinateOffset = d->engine->coordinateOffset(); | - |
1064 | d->state->redirectionMatrix.translate(-coordinateOffset.x(), -coordinateOffset.y()); | - |
1065 | | - |
1066 | qt_noop(); | - |
1067 | | - |
1068 | | - |
1069 | | - |
1070 | | - |
1071 | | - |
1072 | | - |
1073 | const bool isHighDpi = false; | - |
1074 | | - |
1075 | if (!d->state->redirectionMatrix.isIdentity() || isHighDpi) evaluated: !d->state->redirectionMatrix.isIdentity() yes Evaluation Count:15494 | yes Evaluation Count:13279 |
partially evaluated: isHighDpi no Evaluation Count:0 | yes Evaluation Count:13279 |
| 0-15494 |
1076 | d->updateMatrix(); executed: d->updateMatrix(); Execution Count:15494 | 15494 |
1077 | | - |
1078 | qt_noop(); | - |
1079 | d->state->renderHints = QPainter::TextAntialiasing; | - |
1080 | ++d->device->painters; | - |
1081 | | - |
1082 | d->state->emulationSpecifier = 0; | - |
1083 | | - |
1084 | return true; executed: return true; Execution Count:28773 | 28773 |
1085 | } | - |
1086 | bool QPainter::end() | - |
1087 | { | - |
1088 | | - |
1089 | | - |
1090 | | - |
1091 | | - |
1092 | QPainterPrivate * const d = d_func(); | - |
1093 | | - |
1094 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:3 | yes Evaluation Count:28813 |
| 3-28813 |
1095 | QMessageLogger("painting/qpainter.cpp", 1882, __PRETTY_FUNCTION__).warning("QPainter::end: Painter not active, aborted"); | - |
1096 | qt_cleanup_painter_state(d); | - |
1097 | return false; executed: return false; Execution Count:3 | 3 |
1098 | } | - |
1099 | | - |
1100 | if (d->refcount > 1) { evaluated: d->refcount > 1 yes Evaluation Count:40 | yes Evaluation Count:28773 |
| 40-28773 |
1101 | d->detachPainterPrivate(this); | - |
1102 | return true; executed: return true; Execution Count:40 | 40 |
1103 | } | - |
1104 | | - |
1105 | bool ended = true; | - |
1106 | | - |
1107 | if (d->engine->isActive()) { partially evaluated: d->engine->isActive() yes Evaluation Count:28773 | no Evaluation Count:0 |
| 0-28773 |
1108 | ended = d->engine->end(); | - |
1109 | d->updateState(0); | - |
1110 | | - |
1111 | --d->device->painters; | - |
1112 | if (d->device->painters == 0) { partially evaluated: d->device->painters == 0 yes Evaluation Count:28773 | no Evaluation Count:0 |
| 0-28773 |
1113 | d->engine->setPaintDevice(0); | - |
1114 | d->engine->setActive(false); | - |
1115 | } executed: } Execution Count:28773 | 28773 |
1116 | } executed: } Execution Count:28773 | 28773 |
1117 | | - |
1118 | if (d->states.size() > 1) { partially evaluated: d->states.size() > 1 no Evaluation Count:0 | yes Evaluation Count:28773 |
| 0-28773 |
1119 | QMessageLogger("painting/qpainter.cpp", 1906, __PRETTY_FUNCTION__).warning("QPainter::end: Painter ended with %d saved states", | - |
1120 | d->states.size()); | - |
1121 | } | 0 |
1122 | | - |
1123 | if (d->engine->autoDestruct()) { partially evaluated: d->engine->autoDestruct() no Evaluation Count:0 | yes Evaluation Count:28773 |
| 0-28773 |
1124 | delete d->engine; | - |
1125 | } | 0 |
1126 | | - |
1127 | if (d->emulationEngine) { evaluated: d->emulationEngine yes Evaluation Count:2942 | yes Evaluation Count:25831 |
| 2942-25831 |
1128 | delete d->emulationEngine; | - |
1129 | d->emulationEngine = 0; | - |
1130 | } executed: } Execution Count:2942 | 2942 |
1131 | | - |
1132 | if (d->extended) { evaluated: d->extended yes Evaluation Count:28736 | yes Evaluation Count:37 |
| 37-28736 |
1133 | d->extended = 0; | - |
1134 | } executed: } Execution Count:28736 | 28736 |
1135 | | - |
1136 | qt_cleanup_painter_state(d); | - |
1137 | | - |
1138 | return ended; executed: return ended; Execution Count:28773 | 28773 |
1139 | } | - |
1140 | QPaintEngine *QPainter::paintEngine() const | - |
1141 | { | - |
1142 | const QPainterPrivate * const d = d_func(); | - |
1143 | return d->engine; executed: return d->engine; Execution Count:135 | 135 |
1144 | } | - |
1145 | void QPainter::beginNativePainting() | - |
1146 | { | - |
1147 | QPainterPrivate * const d = d_func(); | - |
1148 | if (!d->engine) { never evaluated: !d->engine | 0 |
1149 | QMessageLogger("painting/qpainter.cpp", 1977, __PRETTY_FUNCTION__).warning("QPainter::beginNativePainting: Painter not active"); | - |
1150 | return; | 0 |
1151 | } | - |
1152 | | - |
1153 | if (d->extended) never evaluated: d->extended | 0 |
1154 | d->extended->beginNativePainting(); never executed: d->extended->beginNativePainting(); | 0 |
1155 | } | 0 |
1156 | void QPainter::endNativePainting() | - |
1157 | { | - |
1158 | const QPainterPrivate * const d = d_func(); | - |
1159 | if (!d->engine) { never evaluated: !d->engine | 0 |
1160 | QMessageLogger("painting/qpainter.cpp", 1998, __PRETTY_FUNCTION__).warning("QPainter::beginNativePainting: Painter not active"); | - |
1161 | return; | 0 |
1162 | } | - |
1163 | | - |
1164 | if (d->extended) never evaluated: d->extended | 0 |
1165 | d->extended->endNativePainting(); never executed: d->extended->endNativePainting(); | 0 |
1166 | else | - |
1167 | d->engine->syncState(); never executed: d->engine->syncState(); | 0 |
1168 | } | - |
1169 | QFontMetrics QPainter::fontMetrics() const | - |
1170 | { | - |
1171 | const QPainterPrivate * const d = d_func(); | - |
1172 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1173 | QMessageLogger("painting/qpainter.cpp", 2019, __PRETTY_FUNCTION__).warning("QPainter::fontMetrics: Painter not active"); | - |
1174 | return QFontMetrics(QFont()); executed: return QFontMetrics(QFont()); Execution Count:1 | 1 |
1175 | } | - |
1176 | return QFontMetrics(d->state->font); executed: return QFontMetrics(d->state->font); Execution Count:1 | 1 |
1177 | } | - |
1178 | QFontInfo QPainter::fontInfo() const | - |
1179 | { | - |
1180 | const QPainterPrivate * const d = d_func(); | - |
1181 | if (!d->engine) { partially evaluated: !d->engine yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1182 | QMessageLogger("painting/qpainter.cpp", 2037, __PRETTY_FUNCTION__).warning("QPainter::fontInfo: Painter not active"); | - |
1183 | return QFontInfo(QFont()); executed: return QFontInfo(QFont()); Execution Count:1 | 1 |
1184 | } | - |
1185 | return QFontInfo(d->state->font); never executed: return QFontInfo(d->state->font); | 0 |
1186 | } | - |
1187 | qreal QPainter::opacity() const | - |
1188 | { | - |
1189 | const QPainterPrivate * const d = d_func(); | - |
1190 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:334 |
| 1-334 |
1191 | QMessageLogger("painting/qpainter.cpp", 2054, __PRETTY_FUNCTION__).warning("QPainter::opacity: Painter not active"); | - |
1192 | return 1.0; executed: return 1.0; Execution Count:1 | 1 |
1193 | } | - |
1194 | return d->state->opacity; executed: return d->state->opacity; Execution Count:334 | 334 |
1195 | } | - |
1196 | void QPainter::setOpacity(qreal opacity) | - |
1197 | { | - |
1198 | QPainterPrivate * const d = d_func(); | - |
1199 | | - |
1200 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:3208 |
| 1-3208 |
1201 | QMessageLogger("painting/qpainter.cpp", 2076, __PRETTY_FUNCTION__).warning("QPainter::setOpacity: Painter not active"); | - |
1202 | return; executed: return; Execution Count:1 | 1 |
1203 | } | - |
1204 | | - |
1205 | opacity = qMin(qreal(1), qMax(qreal(0), opacity)); | - |
1206 | | - |
1207 | if (opacity == d->state->opacity) evaluated: opacity == d->state->opacity yes Evaluation Count:2792 | yes Evaluation Count:416 |
| 416-2792 |
1208 | return; executed: return; Execution Count:2792 | 2792 |
1209 | | - |
1210 | d->state->opacity = opacity; | - |
1211 | | - |
1212 | if (d->extended) partially evaluated: d->extended yes Evaluation Count:416 | no Evaluation Count:0 |
| 0-416 |
1213 | d->extended->opacityChanged(); executed: d->extended->opacityChanged(); Execution Count:416 | 416 |
1214 | else | - |
1215 | d->state->dirtyFlags |= QPaintEngine::DirtyOpacity; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyOpacity; | 0 |
1216 | } | - |
1217 | QPoint QPainter::brushOrigin() const | - |
1218 | { | - |
1219 | const QPainterPrivate * const d = d_func(); | - |
1220 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:11546 |
| 1-11546 |
1221 | QMessageLogger("painting/qpainter.cpp", 2104, __PRETTY_FUNCTION__).warning("QPainter::brushOrigin: Painter not active"); | - |
1222 | return QPoint(); executed: return QPoint(); Execution Count:1 | 1 |
1223 | } | - |
1224 | return QPointF(d->state->brushOrigin).toPoint(); executed: return QPointF(d->state->brushOrigin).toPoint(); Execution Count:11546 | 11546 |
1225 | } | - |
1226 | void QPainter::setBrushOrigin(const QPointF &p) | - |
1227 | { | - |
1228 | QPainterPrivate * const d = d_func(); | - |
1229 | | - |
1230 | | - |
1231 | | - |
1232 | | - |
1233 | | - |
1234 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:2 | yes Evaluation Count:21057 |
| 2-21057 |
1235 | QMessageLogger("painting/qpainter.cpp", 2137, __PRETTY_FUNCTION__).warning("QPainter::setBrushOrigin: Painter not active"); | - |
1236 | return; executed: return; Execution Count:2 | 2 |
1237 | } | - |
1238 | | - |
1239 | d->state->brushOrigin = p; | - |
1240 | | - |
1241 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:21057 | no Evaluation Count:0 |
| 0-21057 |
1242 | d->extended->brushOriginChanged(); | - |
1243 | return; executed: return; Execution Count:21057 | 21057 |
1244 | } | - |
1245 | | - |
1246 | d->state->dirtyFlags |= QPaintEngine::DirtyBrushOrigin; | - |
1247 | } | 0 |
1248 | void QPainter::setCompositionMode(CompositionMode mode) | - |
1249 | { | - |
1250 | QPainterPrivate * const d = d_func(); | - |
1251 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:6989 |
| 1-6989 |
1252 | QMessageLogger("painting/qpainter.cpp", 2364, __PRETTY_FUNCTION__).warning("QPainter::setCompositionMode: Painter not active"); | - |
1253 | return; executed: return; Execution Count:1 | 1 |
1254 | } | - |
1255 | if (d->state->composition_mode == mode) evaluated: d->state->composition_mode == mode yes Evaluation Count:1 | yes Evaluation Count:6988 |
| 1-6988 |
1256 | return; executed: return; Execution Count:1 | 1 |
1257 | if (d->extended) { evaluated: d->extended yes Evaluation Count:6985 | yes Evaluation Count:3 |
| 3-6985 |
1258 | d->state->composition_mode = mode; | - |
1259 | d->extended->compositionModeChanged(); | - |
1260 | return; executed: return; Execution Count:6985 | 6985 |
1261 | } | - |
1262 | | - |
1263 | if (mode >= QPainter::RasterOp_SourceOrDestination) { partially evaluated: mode >= QPainter::RasterOp_SourceOrDestination no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1264 | if (!d->engine->hasFeature(QPaintEngine::RasterOpModes)) { never evaluated: !d->engine->hasFeature(QPaintEngine::RasterOpModes) | 0 |
1265 | QMessageLogger("painting/qpainter.cpp", 2377, __PRETTY_FUNCTION__).warning("QPainter::setCompositionMode: " | - |
1266 | "Raster operation modes not supported on device"); | - |
1267 | return; | 0 |
1268 | } | - |
1269 | } else if (mode >= QPainter::CompositionMode_Plus) { partially evaluated: mode >= QPainter::CompositionMode_Plus no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1270 | if (!d->engine->hasFeature(QPaintEngine::BlendModes)) { never evaluated: !d->engine->hasFeature(QPaintEngine::BlendModes) | 0 |
1271 | QMessageLogger("painting/qpainter.cpp", 2383, __PRETTY_FUNCTION__).warning("QPainter::setCompositionMode: " | - |
1272 | "Blend modes not supported on device"); | - |
1273 | return; | 0 |
1274 | } | - |
1275 | } else if (!d->engine->hasFeature(QPaintEngine::PorterDuff)) { partially evaluated: !d->engine->hasFeature(QPaintEngine::PorterDuff) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1276 | if (mode != CompositionMode_Source && mode != CompositionMode_SourceOver) { evaluated: mode != CompositionMode_Source yes Evaluation Count:2 | yes Evaluation Count:1 |
evaluated: mode != CompositionMode_SourceOver yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1-2 |
1277 | QMessageLogger("painting/qpainter.cpp", 2389, __PRETTY_FUNCTION__).warning("QPainter::setCompositionMode: " | - |
1278 | "PorterDuff modes not supported on device"); | - |
1279 | return; executed: return; Execution Count:1 | 1 |
1280 | } | - |
1281 | } executed: } Execution Count:2 | 2 |
1282 | | - |
1283 | d->state->composition_mode = mode; | - |
1284 | d->state->dirtyFlags |= QPaintEngine::DirtyCompositionMode; | - |
1285 | } executed: } Execution Count:2 | 2 |
1286 | | - |
1287 | | - |
1288 | | - |
1289 | | - |
1290 | | - |
1291 | | - |
1292 | QPainter::CompositionMode QPainter::compositionMode() const | - |
1293 | { | - |
1294 | const QPainterPrivate * const d = d_func(); | - |
1295 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:3374 |
| 1-3374 |
1296 | QMessageLogger("painting/qpainter.cpp", 2408, __PRETTY_FUNCTION__).warning("QPainter::compositionMode: Painter not active"); | - |
1297 | return QPainter::CompositionMode_SourceOver; executed: return QPainter::CompositionMode_SourceOver; Execution Count:1 | 1 |
1298 | } | - |
1299 | return d->state->composition_mode; executed: return d->state->composition_mode; Execution Count:3374 | 3374 |
1300 | } | - |
1301 | | - |
1302 | | - |
1303 | | - |
1304 | | - |
1305 | | - |
1306 | | - |
1307 | | - |
1308 | const QBrush &QPainter::background() const | - |
1309 | { | - |
1310 | const QPainterPrivate * const d = d_func(); | - |
1311 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:5304 |
| 1-5304 |
1312 | QMessageLogger("painting/qpainter.cpp", 2424, __PRETTY_FUNCTION__).warning("QPainter::background: Painter not active"); | - |
1313 | return d->fakeState()->brush; executed: return d->fakeState()->brush; Execution Count:1 | 1 |
1314 | } | - |
1315 | return d->state->bgBrush; executed: return d->state->bgBrush; Execution Count:5304 | 5304 |
1316 | } | - |
1317 | bool QPainter::hasClipping() const | - |
1318 | { | - |
1319 | const QPainterPrivate * const d = d_func(); | - |
1320 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:45 |
| 1-45 |
1321 | QMessageLogger("painting/qpainter.cpp", 2441, __PRETTY_FUNCTION__).warning("QPainter::hasClipping: Painter not active"); | - |
1322 | return false; executed: return false; Execution Count:1 | 1 |
1323 | } | - |
1324 | return d->state->clipEnabled && d->state->clipOperation != Qt::NoClip; executed: return d->state->clipEnabled && d->state->clipOperation != Qt::NoClip; Execution Count:45 | 45 |
1325 | } | - |
1326 | void QPainter::setClipping(bool enable) | - |
1327 | { | - |
1328 | QPainterPrivate * const d = d_func(); | - |
1329 | | - |
1330 | | - |
1331 | | - |
1332 | | - |
1333 | | - |
1334 | | - |
1335 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1336 | QMessageLogger("painting/qpainter.cpp", 2465, __PRETTY_FUNCTION__).warning("QPainter::setClipping: Painter not active, state will be reset by begin"); | - |
1337 | return; executed: return; Execution Count:1 | 1 |
1338 | } | - |
1339 | | - |
1340 | if (hasClipping() == enable) partially evaluated: hasClipping() == enable no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
1341 | return; | 0 |
1342 | | - |
1343 | | - |
1344 | if (enable evaluated: enable yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
1345 | && (d->state->clipInfo.isEmpty() || d->state->clipInfo.last().operation == Qt::NoClip)) partially evaluated: d->state->clipInfo.isEmpty() no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: d->state->clipInfo.last().operation == Qt::NoClip no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1346 | return; | 0 |
1347 | d->state->clipEnabled = enable; | - |
1348 | | - |
1349 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1350 | d->extended->clipEnabledChanged(); | - |
1351 | return; executed: return; Execution Count:4 | 4 |
1352 | } | - |
1353 | | - |
1354 | d->state->dirtyFlags |= QPaintEngine::DirtyClipEnabled; | - |
1355 | d->updateState(d->state); | - |
1356 | } | 0 |
1357 | QRegion QPainter::clipRegion() const | - |
1358 | { | - |
1359 | const QPainterPrivate * const d = d_func(); | - |
1360 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:2118 |
| 1-2118 |
1361 | QMessageLogger("painting/qpainter.cpp", 2504, __PRETTY_FUNCTION__).warning("QPainter::clipRegion: Painter not active"); | - |
1362 | return QRegion(); executed: return QRegion(); Execution Count:1 | 1 |
1363 | } | - |
1364 | | - |
1365 | QRegion region; | - |
1366 | bool lastWasNothing = true; | - |
1367 | | - |
1368 | if (!d->txinv) evaluated: !d->txinv yes Evaluation Count:2115 | yes Evaluation Count:3 |
| 3-2115 |
1369 | const_cast<QPainter *>(this)->d_ptr->updateInvMatrix(); executed: const_cast<QPainter *>(this)->d_ptr->updateInvMatrix(); Execution Count:2115 | 2115 |
1370 | | - |
1371 | | - |
1372 | for (int i=0; i<d->state->clipInfo.size(); ++i) { evaluated: i<d->state->clipInfo.size() yes Evaluation Count:6 | yes Evaluation Count:2118 |
| 6-2118 |
1373 | const QPainterClipInfo &info = d->state->clipInfo.at(i); | - |
1374 | switch (info.clipType) { | - |
1375 | | - |
1376 | case QPainterClipInfo::RegionClip: { | - |
1377 | QTransform matrix = (info.matrix * d->invMatrix); | - |
1378 | if (lastWasNothing) { partially evaluated: lastWasNothing yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1379 | region = info.region * matrix; | - |
1380 | lastWasNothing = false; | - |
1381 | continue; executed: continue; Execution Count:2 | 2 |
1382 | } | - |
1383 | if (info.operation == Qt::IntersectClip) never evaluated: info.operation == Qt::IntersectClip | 0 |
1384 | region &= info.region * matrix; never executed: region &= info.region * matrix; | 0 |
1385 | else if (info.operation == Qt::NoClip) { never evaluated: info.operation == Qt::NoClip | 0 |
1386 | lastWasNothing = true; | - |
1387 | region = QRegion(); | - |
1388 | } else | 0 |
1389 | region = info.region * matrix; never executed: region = info.region * matrix; | 0 |
1390 | break; | 0 |
1391 | } | - |
1392 | | - |
1393 | case QPainterClipInfo::PathClip: { | - |
1394 | QTransform matrix = (info.matrix * d->invMatrix); | - |
1395 | if (lastWasNothing) { never evaluated: lastWasNothing | 0 |
1396 | region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), | - |
1397 | info.path.fillRule()); | - |
1398 | lastWasNothing = false; | - |
1399 | continue; never executed: continue; | 0 |
1400 | } | - |
1401 | if (info.operation == Qt::IntersectClip) { never evaluated: info.operation == Qt::IntersectClip | 0 |
1402 | region &= QRegion((info.path * matrix).toFillPolygon().toPolygon(), | - |
1403 | info.path.fillRule()); | - |
1404 | } else if (info.operation == Qt::NoClip) { never evaluated: info.operation == Qt::NoClip | 0 |
1405 | lastWasNothing = true; | - |
1406 | region = QRegion(); | - |
1407 | } else { | 0 |
1408 | region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), | - |
1409 | info.path.fillRule()); | - |
1410 | } | 0 |
1411 | break; | 0 |
1412 | } | - |
1413 | | - |
1414 | case QPainterClipInfo::RectClip: { | - |
1415 | QTransform matrix = (info.matrix * d->invMatrix); | - |
1416 | if (lastWasNothing) { partially evaluated: lastWasNothing yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1417 | region = QRegion(info.rect) * matrix; | - |
1418 | lastWasNothing = false; | - |
1419 | continue; executed: continue; Execution Count:2 | 2 |
1420 | } | - |
1421 | if (info.operation == Qt::IntersectClip) { never evaluated: info.operation == Qt::IntersectClip | 0 |
1422 | | - |
1423 | if (matrix.type() <= QTransform::TxScale) never evaluated: matrix.type() <= QTransform::TxScale | 0 |
1424 | region &= matrix.mapRect(info.rect); never executed: region &= matrix.mapRect(info.rect); | 0 |
1425 | else | - |
1426 | region &= matrix.map(QRegion(info.rect)); never executed: region &= matrix.map(QRegion(info.rect)); | 0 |
1427 | } else if (info.operation == Qt::NoClip) { never evaluated: info.operation == Qt::NoClip | 0 |
1428 | lastWasNothing = true; | - |
1429 | region = QRegion(); | - |
1430 | } else { | 0 |
1431 | region = QRegion(info.rect) * matrix; | - |
1432 | } | 0 |
1433 | break; | 0 |
1434 | } | - |
1435 | | - |
1436 | case QPainterClipInfo::RectFClip: { | - |
1437 | QTransform matrix = (info.matrix * d->invMatrix); | - |
1438 | if (lastWasNothing) { partially evaluated: lastWasNothing yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1439 | region = QRegion(info.rectf.toRect()) * matrix; | - |
1440 | lastWasNothing = false; | - |
1441 | continue; executed: continue; Execution Count:2 | 2 |
1442 | } | - |
1443 | if (info.operation == Qt::IntersectClip) { never evaluated: info.operation == Qt::IntersectClip | 0 |
1444 | | - |
1445 | if (matrix.type() <= QTransform::TxScale) never evaluated: matrix.type() <= QTransform::TxScale | 0 |
1446 | region &= matrix.mapRect(info.rectf.toRect()); never executed: region &= matrix.mapRect(info.rectf.toRect()); | 0 |
1447 | else | - |
1448 | region &= matrix.map(QRegion(info.rectf.toRect())); never executed: region &= matrix.map(QRegion(info.rectf.toRect())); | 0 |
1449 | } else if (info.operation == Qt::NoClip) { never evaluated: info.operation == Qt::NoClip | 0 |
1450 | lastWasNothing = true; | - |
1451 | region = QRegion(); | - |
1452 | } else { | 0 |
1453 | region = QRegion(info.rectf.toRect()) * matrix; | - |
1454 | } | 0 |
1455 | break; | 0 |
1456 | } | - |
1457 | } | - |
1458 | } | 0 |
1459 | | - |
1460 | return region; executed: return region; Execution Count:2118 | 2118 |
1461 | } | - |
1462 | | - |
1463 | extern QPainterPath qt_regionToPath(const QRegion ®ion); | - |
1464 | QPainterPath QPainter::clipPath() const | - |
1465 | { | - |
1466 | const QPainterPrivate * const d = d_func(); | - |
1467 | | - |
1468 | | - |
1469 | | - |
1470 | if (!d->engine) { partially evaluated: !d->engine yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1471 | QMessageLogger("painting/qpainter.cpp", 2626, __PRETTY_FUNCTION__).warning("QPainter::clipPath: Painter not active"); | - |
1472 | return QPainterPath(); executed: return QPainterPath(); Execution Count:1 | 1 |
1473 | } | - |
1474 | | - |
1475 | | - |
1476 | if (d->state->clipInfo.size() == 0) { never evaluated: d->state->clipInfo.size() == 0 | 0 |
1477 | return QPainterPath(); never executed: return QPainterPath(); | 0 |
1478 | } else { | - |
1479 | | - |
1480 | | - |
1481 | if (!d->txinv) never evaluated: !d->txinv | 0 |
1482 | const_cast<QPainter *>(this)->d_ptr->updateInvMatrix(); never executed: const_cast<QPainter *>(this)->d_ptr->updateInvMatrix(); | 0 |
1483 | | - |
1484 | | - |
1485 | if (d->state->clipInfo.size() == 1 never evaluated: d->state->clipInfo.size() == 1 | 0 |
1486 | && d->state->clipInfo.at(0).clipType == QPainterClipInfo::PathClip) { never evaluated: d->state->clipInfo.at(0).clipType == QPainterClipInfo::PathClip | 0 |
1487 | QTransform matrix = (d->state->clipInfo.at(0).matrix * d->invMatrix); | - |
1488 | return d->state->clipInfo.at(0).path * matrix; never executed: return d->state->clipInfo.at(0).path * matrix; | 0 |
1489 | | - |
1490 | } else if (d->state->clipInfo.size() == 1 never evaluated: d->state->clipInfo.size() == 1 | 0 |
1491 | && d->state->clipInfo.at(0).clipType == QPainterClipInfo::RectClip) { never evaluated: d->state->clipInfo.at(0).clipType == QPainterClipInfo::RectClip | 0 |
1492 | QTransform matrix = (d->state->clipInfo.at(0).matrix * d->invMatrix); | - |
1493 | QPainterPath path; | - |
1494 | path.addRect(d->state->clipInfo.at(0).rect); | - |
1495 | return path * matrix; never executed: return path * matrix; | 0 |
1496 | } else { | - |
1497 | | - |
1498 | return qt_regionToPath(clipRegion()); never executed: return qt_regionToPath(clipRegion()); | 0 |
1499 | } | - |
1500 | } | - |
1501 | } | - |
1502 | QRectF QPainter::clipBoundingRect() const | - |
1503 | { | - |
1504 | const QPainterPrivate * const d = d_func(); | - |
1505 | | - |
1506 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
1507 | QMessageLogger("painting/qpainter.cpp", 2675, __PRETTY_FUNCTION__).warning("QPainter::clipBoundingRect: Painter not active"); | - |
1508 | return QRectF(); never executed: return QRectF(); | 0 |
1509 | } | - |
1510 | | - |
1511 | | - |
1512 | | - |
1513 | | - |
1514 | QRectF bounds; | - |
1515 | for (int i=0; i<d->state->clipInfo.size(); ++i) { evaluated: i<d->state->clipInfo.size() yes Evaluation Count:740 | yes Evaluation Count:14 |
| 14-740 |
1516 | QRectF r; | - |
1517 | const QPainterClipInfo &info = d->state->clipInfo.at(i); | - |
1518 | | - |
1519 | if (info.clipType == QPainterClipInfo::RectClip) evaluated: info.clipType == QPainterClipInfo::RectClip yes Evaluation Count:728 | yes Evaluation Count:12 |
| 12-728 |
1520 | r = info.rect; executed: r = info.rect; Execution Count:728 | 728 |
1521 | else if (info.clipType == QPainterClipInfo::RectFClip) evaluated: info.clipType == QPainterClipInfo::RectFClip yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
1522 | r = info.rectf; executed: r = info.rectf; Execution Count:6 | 6 |
1523 | else if (info.clipType == QPainterClipInfo::RegionClip) evaluated: info.clipType == QPainterClipInfo::RegionClip yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
1524 | r = info.region.boundingRect(); executed: r = info.region.boundingRect(); Execution Count:2 | 2 |
1525 | else | - |
1526 | r = info.path.boundingRect(); executed: r = info.path.boundingRect(); Execution Count:4 | 4 |
1527 | | - |
1528 | r = info.matrix.mapRect(r); | - |
1529 | | - |
1530 | if (i == 0) evaluated: i == 0 yes Evaluation Count:14 | yes Evaluation Count:726 |
| 14-726 |
1531 | bounds = r; executed: bounds = r; Execution Count:14 | 14 |
1532 | else if (info.operation == Qt::IntersectClip) partially evaluated: info.operation == Qt::IntersectClip yes Evaluation Count:726 | no Evaluation Count:0 |
| 0-726 |
1533 | bounds &= r; executed: bounds &= r; Execution Count:726 | 726 |
1534 | } | - |
1535 | | - |
1536 | | - |
1537 | | - |
1538 | | - |
1539 | if (!d->txinv) evaluated: !d->txinv yes Evaluation Count:2 | yes Evaluation Count:12 |
| 2-12 |
1540 | const_cast<QPainter *>(this)->d_ptr->updateInvMatrix(); executed: const_cast<QPainter *>(this)->d_ptr->updateInvMatrix(); Execution Count:2 | 2 |
1541 | | - |
1542 | return d->invMatrix.mapRect(bounds); executed: return d->invMatrix.mapRect(bounds); Execution Count:14 | 14 |
1543 | } | - |
1544 | void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op) | - |
1545 | { | - |
1546 | QPainterPrivate * const d = d_func(); | - |
1547 | | - |
1548 | if (d->extended) { evaluated: d->extended yes Evaluation Count:336 | yes Evaluation Count:1 |
| 1-336 |
1549 | if ((!d->state->clipEnabled && op != Qt::NoClip)) partially evaluated: !d->state->clipEnabled no Evaluation Count:0 | yes Evaluation Count:336 |
never evaluated: op != Qt::NoClip | 0-336 |
1550 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 |
1551 | | - |
1552 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:336 |
| 0-336 |
1553 | QMessageLogger("painting/qpainter.cpp", 2734, __PRETTY_FUNCTION__).warning("QPainter::setClipRect: Painter not active"); | - |
1554 | return; | 0 |
1555 | } | - |
1556 | qreal right = rect.x() + rect.width(); | - |
1557 | qreal bottom = rect.y() + rect.height(); | - |
1558 | qreal pts[] = { rect.x(), rect.y(), | - |
1559 | right, rect.y(), | - |
1560 | right, bottom, | - |
1561 | rect.x(), bottom }; | - |
1562 | QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint); | - |
1563 | d->state->clipEnabled = true; | - |
1564 | d->extended->clip(vp, op); | - |
1565 | if (op == Qt::ReplaceClip || op == Qt::NoClip) evaluated: op == Qt::ReplaceClip yes Evaluation Count:29 | yes Evaluation Count:307 |
partially evaluated: op == Qt::NoClip no Evaluation Count:0 | yes Evaluation Count:307 |
| 0-307 |
1566 | d->state->clipInfo.clear(); executed: d->state->clipInfo.clear(); Execution Count:29 | 29 |
1567 | d->state->clipInfo << QPainterClipInfo(rect, op, d->state->matrix); | - |
1568 | d->state->clipOperation = op; | - |
1569 | return; executed: return; Execution Count:336 | 336 |
1570 | } | - |
1571 | | - |
1572 | if (qreal(int(rect.top())) == rect.top() partially evaluated: qreal(int(rect.top())) == rect.top() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1573 | && qreal(int(rect.bottom())) == rect.bottom() partially evaluated: qreal(int(rect.bottom())) == rect.bottom() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1574 | && qreal(int(rect.left())) == rect.left() partially evaluated: qreal(int(rect.left())) == rect.left() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1575 | && qreal(int(rect.right())) == rect.right()) partially evaluated: qreal(int(rect.right())) == rect.right() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1576 | { | - |
1577 | setClipRect(rect.toRect(), op); | - |
1578 | return; executed: return; Execution Count:1 | 1 |
1579 | } | - |
1580 | | - |
1581 | if (rect.isEmpty()) { never evaluated: rect.isEmpty() | 0 |
1582 | setClipRegion(QRegion(), op); | - |
1583 | return; | 0 |
1584 | } | - |
1585 | | - |
1586 | QPainterPath path; | - |
1587 | path.addRect(rect); | - |
1588 | setClipPath(path, op); | - |
1589 | } | 0 |
1590 | void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) | - |
1591 | { | - |
1592 | QPainterPrivate * const d = d_func(); | - |
1593 | | - |
1594 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:2 | yes Evaluation Count:21930 |
| 2-21930 |
1595 | QMessageLogger("painting/qpainter.cpp", 2784, __PRETTY_FUNCTION__).warning("QPainter::setClipRect: Painter not active"); | - |
1596 | return; executed: return; Execution Count:2 | 2 |
1597 | } | - |
1598 | | - |
1599 | if ((!d->state->clipEnabled && op != Qt::NoClip)) partially evaluated: !d->state->clipEnabled no Evaluation Count:0 | yes Evaluation Count:21930 |
never evaluated: op != Qt::NoClip | 0-21930 |
1600 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 |
1601 | | - |
1602 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:21930 | no Evaluation Count:0 |
| 0-21930 |
1603 | d->state->clipEnabled = true; | - |
1604 | d->extended->clip(rect, op); | - |
1605 | if (op == Qt::ReplaceClip || op == Qt::NoClip) evaluated: op == Qt::ReplaceClip yes Evaluation Count:21568 | yes Evaluation Count:362 |
partially evaluated: op == Qt::NoClip no Evaluation Count:0 | yes Evaluation Count:362 |
| 0-21568 |
1606 | d->state->clipInfo.clear(); executed: d->state->clipInfo.clear(); Execution Count:21568 | 21568 |
1607 | d->state->clipInfo << QPainterClipInfo(rect, op, d->state->matrix); | - |
1608 | d->state->clipOperation = op; | - |
1609 | return; executed: return; Execution Count:21930 | 21930 |
1610 | } | - |
1611 | | - |
1612 | if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) never evaluated: d->state->clipOperation == Qt::NoClip never evaluated: op == Qt::IntersectClip | 0 |
1613 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 |
1614 | | - |
1615 | d->state->clipRegion = rect; | - |
1616 | d->state->clipOperation = op; | - |
1617 | if (op == Qt::NoClip || op == Qt::ReplaceClip) never evaluated: op == Qt::NoClip never evaluated: op == Qt::ReplaceClip | 0 |
1618 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 |
1619 | d->state->clipInfo << QPainterClipInfo(rect, op, d->state->matrix); | - |
1620 | d->state->clipEnabled = true; | - |
1621 | d->state->dirtyFlags |= QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyClipEnabled; | - |
1622 | d->updateState(d->state); | - |
1623 | } | 0 |
1624 | void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) | - |
1625 | { | - |
1626 | QPainterPrivate * const d = d_func(); | - |
1627 | | - |
1628 | | - |
1629 | | - |
1630 | | - |
1631 | | - |
1632 | | - |
1633 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:2448 |
| 1-2448 |
1634 | QMessageLogger("painting/qpainter.cpp", 2842, __PRETTY_FUNCTION__).warning("QPainter::setClipRegion: Painter not active"); | - |
1635 | return; executed: return; Execution Count:1 | 1 |
1636 | } | - |
1637 | | - |
1638 | if ((!d->state->clipEnabled && op != Qt::NoClip)) partially evaluated: !d->state->clipEnabled no Evaluation Count:0 | yes Evaluation Count:2448 |
never evaluated: op != Qt::NoClip | 0-2448 |
1639 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 |
1640 | | - |
1641 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:2448 | no Evaluation Count:0 |
| 0-2448 |
1642 | d->state->clipEnabled = true; | - |
1643 | d->extended->clip(r, op); | - |
1644 | if (op == Qt::NoClip || op == Qt::ReplaceClip) partially evaluated: op == Qt::NoClip no Evaluation Count:0 | yes Evaluation Count:2448 |
evaluated: op == Qt::ReplaceClip yes Evaluation Count:2426 | yes Evaluation Count:22 |
| 0-2448 |
1645 | d->state->clipInfo.clear(); executed: d->state->clipInfo.clear(); Execution Count:2426 | 2426 |
1646 | d->state->clipInfo << QPainterClipInfo(r, op, d->state->matrix); | - |
1647 | d->state->clipOperation = op; | - |
1648 | return; executed: return; Execution Count:2448 | 2448 |
1649 | } | - |
1650 | | - |
1651 | if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) never evaluated: d->state->clipOperation == Qt::NoClip never evaluated: op == Qt::IntersectClip | 0 |
1652 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 |
1653 | | - |
1654 | d->state->clipRegion = r; | - |
1655 | d->state->clipOperation = op; | - |
1656 | if (op == Qt::NoClip || op == Qt::ReplaceClip) never evaluated: op == Qt::NoClip never evaluated: op == Qt::ReplaceClip | 0 |
1657 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 |
1658 | d->state->clipInfo << QPainterClipInfo(r, op, d->state->matrix); | - |
1659 | d->state->clipEnabled = true; | - |
1660 | d->state->dirtyFlags |= QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyClipEnabled; | - |
1661 | d->updateState(d->state); | - |
1662 | } | 0 |
1663 | void QPainter::setWorldMatrix(const QMatrix &matrix, bool combine) | - |
1664 | { | - |
1665 | setWorldTransform(QTransform(matrix), combine); | - |
1666 | } executed: } Execution Count:1 | 1 |
1667 | const QMatrix &QPainter::worldMatrix() const | - |
1668 | { | - |
1669 | const QPainterPrivate * const d = d_func(); | - |
1670 | if (!d->engine) { partially evaluated: !d->engine yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1671 | QMessageLogger("painting/qpainter.cpp", 2937, __PRETTY_FUNCTION__).warning("QPainter::worldMatrix: Painter not active"); | - |
1672 | return d->fakeState()->transform.toAffine(); executed: return d->fakeState()->transform.toAffine(); Execution Count:1 | 1 |
1673 | } | - |
1674 | return d->state->worldMatrix.toAffine(); never executed: return d->state->worldMatrix.toAffine(); | 0 |
1675 | } | - |
1676 | void QPainter::setMatrix(const QMatrix &matrix, bool combine) | - |
1677 | { | - |
1678 | setWorldTransform(QTransform(matrix), combine); | - |
1679 | } | 0 |
1680 | const QMatrix &QPainter::matrix() const | - |
1681 | { | - |
1682 | return worldMatrix(); never executed: return worldMatrix(); | 0 |
1683 | } | - |
1684 | QMatrix QPainter::combinedMatrix() const | - |
1685 | { | - |
1686 | return combinedTransform().toAffine(); executed: return combinedTransform().toAffine(); Execution Count:2 | 2 |
1687 | } | - |
1688 | const QMatrix &QPainter::deviceMatrix() const | - |
1689 | { | - |
1690 | const QPainterPrivate * const d = d_func(); | - |
1691 | if (!d->engine) { partially evaluated: !d->engine yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1692 | QMessageLogger("painting/qpainter.cpp", 3011, __PRETTY_FUNCTION__).warning("QPainter::deviceMatrix: Painter not active"); | - |
1693 | return d->fakeState()->transform.toAffine(); executed: return d->fakeState()->transform.toAffine(); Execution Count:1 | 1 |
1694 | } | - |
1695 | return d->state->matrix.toAffine(); never executed: return d->state->matrix.toAffine(); | 0 |
1696 | } | - |
1697 | void QPainter::resetMatrix() | - |
1698 | { | - |
1699 | resetTransform(); | - |
1700 | } executed: } Execution Count:5 | 5 |
1701 | void QPainter::setWorldMatrixEnabled(bool enable) | - |
1702 | { | - |
1703 | QPainterPrivate * const d = d_func(); | - |
1704 | | - |
1705 | | - |
1706 | | - |
1707 | | - |
1708 | | - |
1709 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:11 |
| 1-11 |
1710 | QMessageLogger("painting/qpainter.cpp", 3057, __PRETTY_FUNCTION__).warning("QPainter::setMatrixEnabled: Painter not active"); | - |
1711 | return; executed: return; Execution Count:1 | 1 |
1712 | } | - |
1713 | if (enable == d->state->WxF) evaluated: enable == d->state->WxF yes Evaluation Count:2 | yes Evaluation Count:9 |
| 2-9 |
1714 | return; executed: return; Execution Count:2 | 2 |
1715 | | - |
1716 | d->state->WxF = enable; | - |
1717 | d->updateMatrix(); | - |
1718 | } executed: } Execution Count:9 | 9 |
1719 | bool QPainter::worldMatrixEnabled() const | - |
1720 | { | - |
1721 | const QPainterPrivate * const d = d_func(); | - |
1722 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1723 | QMessageLogger("painting/qpainter.cpp", 3080, __PRETTY_FUNCTION__).warning("QPainter::worldMatrixEnabled: Painter not active"); | - |
1724 | return false; never executed: return false; | 0 |
1725 | } | - |
1726 | return d->state->WxF; executed: return d->state->WxF; Execution Count:2 | 2 |
1727 | } | - |
1728 | void QPainter::setMatrixEnabled(bool enable) | - |
1729 | { | - |
1730 | setWorldMatrixEnabled(enable); | - |
1731 | } executed: } Execution Count:11 | 11 |
1732 | bool QPainter::matrixEnabled() const | - |
1733 | { | - |
1734 | return worldMatrixEnabled(); executed: return worldMatrixEnabled(); Execution Count:2 | 2 |
1735 | } | - |
1736 | | - |
1737 | | - |
1738 | | - |
1739 | | - |
1740 | | - |
1741 | | - |
1742 | | - |
1743 | void QPainter::scale(qreal sx, qreal sy) | - |
1744 | { | - |
1745 | | - |
1746 | | - |
1747 | | - |
1748 | | - |
1749 | QPainterPrivate * const d = d_func(); | - |
1750 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:26 |
| 1-26 |
1751 | QMessageLogger("painting/qpainter.cpp", 3126, __PRETTY_FUNCTION__).warning("QPainter::scale: Painter not active"); | - |
1752 | return; executed: return; Execution Count:1 | 1 |
1753 | } | - |
1754 | | - |
1755 | d->state->worldMatrix.scale(sx,sy); | - |
1756 | d->state->WxF = true; | - |
1757 | d->updateMatrix(); | - |
1758 | } executed: } Execution Count:26 | 26 |
1759 | | - |
1760 | | - |
1761 | | - |
1762 | | - |
1763 | | - |
1764 | | - |
1765 | | - |
1766 | void QPainter::shear(qreal sh, qreal sv) | - |
1767 | { | - |
1768 | | - |
1769 | | - |
1770 | | - |
1771 | | - |
1772 | QPainterPrivate * const d = d_func(); | - |
1773 | if (!d->engine) { partially evaluated: !d->engine yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1774 | QMessageLogger("painting/qpainter.cpp", 3149, __PRETTY_FUNCTION__).warning("QPainter::shear: Painter not active"); | - |
1775 | return; executed: return; Execution Count:1 | 1 |
1776 | } | - |
1777 | | - |
1778 | d->state->worldMatrix.shear(sh, sv); | - |
1779 | d->state->WxF = true; | - |
1780 | d->updateMatrix(); | - |
1781 | } | 0 |
1782 | void QPainter::rotate(qreal a) | - |
1783 | { | - |
1784 | | - |
1785 | | - |
1786 | | - |
1787 | | - |
1788 | QPainterPrivate * const d = d_func(); | - |
1789 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:388 |
| 1-388 |
1790 | QMessageLogger("painting/qpainter.cpp", 3174, __PRETTY_FUNCTION__).warning("QPainter::rotate: Painter not active"); | - |
1791 | return; executed: return; Execution Count:1 | 1 |
1792 | } | - |
1793 | | - |
1794 | d->state->worldMatrix.rotate(a); | - |
1795 | d->state->WxF = true; | - |
1796 | d->updateMatrix(); | - |
1797 | } executed: } Execution Count:388 | 388 |
1798 | | - |
1799 | | - |
1800 | | - |
1801 | | - |
1802 | | - |
1803 | | - |
1804 | | - |
1805 | void QPainter::translate(const QPointF &offset) | - |
1806 | { | - |
1807 | qreal dx = offset.x(); | - |
1808 | qreal dy = offset.y(); | - |
1809 | | - |
1810 | | - |
1811 | | - |
1812 | | - |
1813 | QPainterPrivate * const d = d_func(); | - |
1814 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:34906 |
| 1-34906 |
1815 | QMessageLogger("painting/qpainter.cpp", 3199, __PRETTY_FUNCTION__).warning("QPainter::translate: Painter not active"); | - |
1816 | return; executed: return; Execution Count:1 | 1 |
1817 | } | - |
1818 | | - |
1819 | d->state->worldMatrix.translate(dx, dy); | - |
1820 | d->state->WxF = true; | - |
1821 | d->updateMatrix(); | - |
1822 | } executed: } Execution Count:34906 | 34906 |
1823 | void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op) | - |
1824 | { | - |
1825 | | - |
1826 | | - |
1827 | | - |
1828 | | - |
1829 | | - |
1830 | | - |
1831 | | - |
1832 | QPainterPrivate * const d = d_func(); | - |
1833 | | - |
1834 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:335 |
| 1-335 |
1835 | QMessageLogger("painting/qpainter.cpp", 3246, __PRETTY_FUNCTION__).warning("QPainter::setClipPath: Painter not active"); | - |
1836 | return; executed: return; Execution Count:1 | 1 |
1837 | } | - |
1838 | | - |
1839 | if ((!d->state->clipEnabled && op != Qt::NoClip)) partially evaluated: !d->state->clipEnabled no Evaluation Count:0 | yes Evaluation Count:335 |
never evaluated: op != Qt::NoClip | 0-335 |
1840 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 |
1841 | | - |
1842 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:335 | no Evaluation Count:0 |
| 0-335 |
1843 | d->state->clipEnabled = true; | - |
1844 | d->extended->clip(path, op); | - |
1845 | if (op == Qt::NoClip || op == Qt::ReplaceClip) partially evaluated: op == Qt::NoClip no Evaluation Count:0 | yes Evaluation Count:335 |
evaluated: op == Qt::ReplaceClip yes Evaluation Count:200 | yes Evaluation Count:135 |
| 0-335 |
1846 | d->state->clipInfo.clear(); executed: d->state->clipInfo.clear(); Execution Count:200 | 200 |
1847 | d->state->clipInfo << QPainterClipInfo(path, op, d->state->matrix); | - |
1848 | d->state->clipOperation = op; | - |
1849 | return; executed: return; Execution Count:335 | 335 |
1850 | } | - |
1851 | | - |
1852 | if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) never evaluated: d->state->clipOperation == Qt::NoClip never evaluated: op == Qt::IntersectClip | 0 |
1853 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 |
1854 | | - |
1855 | d->state->clipPath = path; | - |
1856 | d->state->clipOperation = op; | - |
1857 | if (op == Qt::NoClip || op == Qt::ReplaceClip) never evaluated: op == Qt::NoClip never evaluated: op == Qt::ReplaceClip | 0 |
1858 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 |
1859 | d->state->clipInfo << QPainterClipInfo(path, op, d->state->matrix); | - |
1860 | d->state->clipEnabled = true; | - |
1861 | d->state->dirtyFlags |= QPaintEngine::DirtyClipPath | QPaintEngine::DirtyClipEnabled; | - |
1862 | d->updateState(d->state); | - |
1863 | } | 0 |
1864 | | - |
1865 | | - |
1866 | | - |
1867 | | - |
1868 | | - |
1869 | | - |
1870 | | - |
1871 | void QPainter::strokePath(const QPainterPath &path, const QPen &pen) | - |
1872 | { | - |
1873 | QPainterPrivate * const d = d_func(); | - |
1874 | | - |
1875 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
1876 | QMessageLogger("painting/qpainter.cpp", 3287, __PRETTY_FUNCTION__).warning("QPainter::strokePath: Painter not active"); | - |
1877 | return; | 0 |
1878 | } | - |
1879 | | - |
1880 | if (path.isEmpty()) partially evaluated: path.isEmpty() no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
1881 | return; | 0 |
1882 | | - |
1883 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
1884 | const QGradient *g = qpen_brush(pen).gradient(); | - |
1885 | if (!g || g->coordinateMode() == QGradient::LogicalMode) { partially evaluated: !g yes Evaluation Count:12 | no Evaluation Count:0 |
never evaluated: g->coordinateMode() == QGradient::LogicalMode | 0-12 |
1886 | d->extended->stroke(qtVectorPathForPath(path), pen); | - |
1887 | return; executed: return; Execution Count:12 | 12 |
1888 | } | - |
1889 | } | 0 |
1890 | | - |
1891 | QBrush oldBrush = d->state->brush; | - |
1892 | QPen oldPen = d->state->pen; | - |
1893 | | - |
1894 | setPen(pen); | - |
1895 | setBrush(Qt::NoBrush); | - |
1896 | | - |
1897 | drawPath(path); | - |
1898 | | - |
1899 | | - |
1900 | setPen(oldPen); | - |
1901 | setBrush(oldBrush); | - |
1902 | } | 0 |
1903 | void QPainter::fillPath(const QPainterPath &path, const QBrush &brush) | - |
1904 | { | - |
1905 | QPainterPrivate * const d = d_func(); | - |
1906 | | - |
1907 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:100002 |
| 0-100002 |
1908 | QMessageLogger("painting/qpainter.cpp", 3330, __PRETTY_FUNCTION__).warning("QPainter::fillPath: Painter not active"); | - |
1909 | return; | 0 |
1910 | } | - |
1911 | | - |
1912 | if (path.isEmpty()) partially evaluated: path.isEmpty() no Evaluation Count:0 | yes Evaluation Count:100002 |
| 0-100002 |
1913 | return; | 0 |
1914 | | - |
1915 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:100002 | no Evaluation Count:0 |
| 0-100002 |
1916 | const QGradient *g = brush.gradient(); | - |
1917 | if (!g || g->coordinateMode() == QGradient::LogicalMode) { evaluated: !g yes Evaluation Count:100001 | yes Evaluation Count:1 |
partially evaluated: g->coordinateMode() == QGradient::LogicalMode no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-100001 |
1918 | d->extended->fill(qtVectorPathForPath(path), brush); | - |
1919 | return; executed: return; Execution Count:100001 | 100001 |
1920 | } | - |
1921 | } executed: } Execution Count:1 | 1 |
1922 | | - |
1923 | QBrush oldBrush = d->state->brush; | - |
1924 | QPen oldPen = d->state->pen; | - |
1925 | | - |
1926 | setPen(Qt::NoPen); | - |
1927 | setBrush(brush); | - |
1928 | | - |
1929 | drawPath(path); | - |
1930 | | - |
1931 | | - |
1932 | setPen(oldPen); | - |
1933 | setBrush(oldBrush); | - |
1934 | } executed: } Execution Count:1 | 1 |
1935 | void QPainter::drawPath(const QPainterPath &path) | - |
1936 | { | - |
1937 | QPainterPrivate * const d = d_func(); | - |
1938 | | - |
1939 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:33309 |
| 0-33309 |
1940 | QMessageLogger("painting/qpainter.cpp", 3385, __PRETTY_FUNCTION__).warning("QPainter::drawPath: Painter not active"); | - |
1941 | return; | 0 |
1942 | } | - |
1943 | | - |
1944 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:33309 | no Evaluation Count:0 |
| 0-33309 |
1945 | d->extended->drawPath(path); | - |
1946 | return; executed: return; Execution Count:33309 | 33309 |
1947 | } | - |
1948 | d->updateState(d->state); | - |
1949 | | - |
1950 | if (d->engine->hasFeature(QPaintEngine::PainterPaths) && d->state->emulationSpecifier == 0) { never evaluated: d->engine->hasFeature(QPaintEngine::PainterPaths) never evaluated: d->state->emulationSpecifier == 0 | 0 |
1951 | d->engine->drawPath(path); | - |
1952 | } else { | 0 |
1953 | d->draw_helper(path); | - |
1954 | } | 0 |
1955 | } | - |
1956 | void QPainter::drawRects(const QRectF *rects, int rectCount) | - |
1957 | { | - |
1958 | | - |
1959 | | - |
1960 | | - |
1961 | | - |
1962 | QPainterPrivate * const d = d_func(); | - |
1963 | | - |
1964 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:614 |
| 0-614 |
1965 | QMessageLogger("painting/qpainter.cpp", 3498, __PRETTY_FUNCTION__).warning("QPainter::drawRects: Painter not active"); | - |
1966 | return; | 0 |
1967 | } | - |
1968 | | - |
1969 | if (rectCount <= 0) partially evaluated: rectCount <= 0 no Evaluation Count:0 | yes Evaluation Count:614 |
| 0-614 |
1970 | return; | 0 |
1971 | | - |
1972 | if (d->extended) { evaluated: d->extended yes Evaluation Count:604 | yes Evaluation Count:10 |
| 10-604 |
1973 | d->extended->drawRects(rects, rectCount); | - |
1974 | return; executed: return; Execution Count:604 | 604 |
1975 | } | - |
1976 | | - |
1977 | d->updateState(d->state); | - |
1978 | | - |
1979 | if (!d->state->emulationSpecifier) { partially evaluated: !d->state->emulationSpecifier yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1980 | d->engine->drawRects(rects, rectCount); | - |
1981 | return; executed: return; Execution Count:10 | 10 |
1982 | } | - |
1983 | | - |
1984 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform never evaluated: d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform | 0 |
1985 | && d->state->matrix.type() == QTransform::TxTranslate) { never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
1986 | for (int i=0; i<rectCount; ++i) { never evaluated: i<rectCount | 0 |
1987 | QRectF r(rects[i].x() + d->state->matrix.dx(), | - |
1988 | rects[i].y() + d->state->matrix.dy(), | - |
1989 | rects[i].width(), | - |
1990 | rects[i].height()); | - |
1991 | d->engine->drawRects(&r, 1); | - |
1992 | } | 0 |
1993 | } else { | 0 |
1994 | if (d->state->brushNeedsResolving() || d->state->penNeedsResolving()) { never evaluated: d->state->brushNeedsResolving() never evaluated: d->state->penNeedsResolving() | 0 |
1995 | for (int i=0; i<rectCount; ++i) { never evaluated: i<rectCount | 0 |
1996 | QPainterPath rectPath; | - |
1997 | rectPath.addRect(rects[i]); | - |
1998 | d->draw_helper(rectPath, QPainterPrivate::StrokeAndFillDraw); | - |
1999 | } | 0 |
2000 | } else { | 0 |
2001 | QPainterPath rectPath; | - |
2002 | for (int i=0; i<rectCount; ++i) never evaluated: i<rectCount | 0 |
2003 | rectPath.addRect(rects[i]); never executed: rectPath.addRect(rects[i]); | 0 |
2004 | d->draw_helper(rectPath, QPainterPrivate::StrokeAndFillDraw); | - |
2005 | } | 0 |
2006 | } | - |
2007 | } | - |
2008 | void QPainter::drawRects(const QRect *rects, int rectCount) | - |
2009 | { | - |
2010 | | - |
2011 | | - |
2012 | | - |
2013 | | - |
2014 | QPainterPrivate * const d = d_func(); | - |
2015 | | - |
2016 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:13580 |
| 0-13580 |
2017 | QMessageLogger("painting/qpainter.cpp", 3558, __PRETTY_FUNCTION__).warning("QPainter::drawRects: Painter not active"); | - |
2018 | return; | 0 |
2019 | } | - |
2020 | | - |
2021 | if (rectCount <= 0) partially evaluated: rectCount <= 0 no Evaluation Count:0 | yes Evaluation Count:13580 |
| 0-13580 |
2022 | return; | 0 |
2023 | | - |
2024 | if (d->extended) { evaluated: d->extended yes Evaluation Count:13578 | yes Evaluation Count:2 |
| 2-13578 |
2025 | d->extended->drawRects(rects, rectCount); | - |
2026 | return; executed: return; Execution Count:13578 | 13578 |
2027 | } | - |
2028 | | - |
2029 | d->updateState(d->state); | - |
2030 | | - |
2031 | if (!d->state->emulationSpecifier) { partially evaluated: !d->state->emulationSpecifier yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2032 | d->engine->drawRects(rects, rectCount); | - |
2033 | return; executed: return; Execution Count:2 | 2 |
2034 | } | - |
2035 | | - |
2036 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform never evaluated: d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform | 0 |
2037 | && d->state->matrix.type() == QTransform::TxTranslate) { never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
2038 | for (int i=0; i<rectCount; ++i) { never evaluated: i<rectCount | 0 |
2039 | QRectF r(rects[i].x() + d->state->matrix.dx(), | - |
2040 | rects[i].y() + d->state->matrix.dy(), | - |
2041 | rects[i].width(), | - |
2042 | rects[i].height()); | - |
2043 | | - |
2044 | d->engine->drawRects(&r, 1); | - |
2045 | } | 0 |
2046 | } else { | 0 |
2047 | if (d->state->brushNeedsResolving() || d->state->penNeedsResolving()) { never evaluated: d->state->brushNeedsResolving() never evaluated: d->state->penNeedsResolving() | 0 |
2048 | for (int i=0; i<rectCount; ++i) { never evaluated: i<rectCount | 0 |
2049 | QPainterPath rectPath; | - |
2050 | rectPath.addRect(rects[i]); | - |
2051 | d->draw_helper(rectPath, QPainterPrivate::StrokeAndFillDraw); | - |
2052 | } | 0 |
2053 | } else { | 0 |
2054 | QPainterPath rectPath; | - |
2055 | for (int i=0; i<rectCount; ++i) never evaluated: i<rectCount | 0 |
2056 | rectPath.addRect(rects[i]); never executed: rectPath.addRect(rects[i]); | 0 |
2057 | | - |
2058 | d->draw_helper(rectPath, QPainterPrivate::StrokeAndFillDraw); | - |
2059 | } | 0 |
2060 | } | - |
2061 | } | - |
2062 | void QPainter::drawPoints(const QPointF *points, int pointCount) | - |
2063 | { | - |
2064 | | - |
2065 | | - |
2066 | | - |
2067 | | - |
2068 | QPainterPrivate * const d = d_func(); | - |
2069 | | - |
2070 | if (!d->engine) { never evaluated: !d->engine | 0 |
2071 | QMessageLogger("painting/qpainter.cpp", 3658, __PRETTY_FUNCTION__).warning("QPainter::drawPoints: Painter not active"); | - |
2072 | return; | 0 |
2073 | } | - |
2074 | | - |
2075 | if (pointCount <= 0) never evaluated: pointCount <= 0 | 0 |
2076 | return; | 0 |
2077 | | - |
2078 | if (d->extended) { never evaluated: d->extended | 0 |
2079 | d->extended->drawPoints(points, pointCount); | - |
2080 | return; | 0 |
2081 | } | - |
2082 | | - |
2083 | d->updateState(d->state); | - |
2084 | | - |
2085 | if (!d->state->emulationSpecifier) { never evaluated: !d->state->emulationSpecifier | 0 |
2086 | d->engine->drawPoints(points, pointCount); | - |
2087 | return; | 0 |
2088 | } | - |
2089 | | - |
2090 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform never evaluated: d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform | 0 |
2091 | && d->state->matrix.type() == QTransform::TxTranslate) { never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
2092 | | - |
2093 | for (int i=0; i<pointCount; ++i) { never evaluated: i<pointCount | 0 |
2094 | QPointF pt(points[i].x() + d->state->matrix.dx(), | - |
2095 | points[i].y() + d->state->matrix.dy()); | - |
2096 | d->engine->drawPoints(&pt, 1); | - |
2097 | } | 0 |
2098 | } else { | 0 |
2099 | QPen pen = d->state->pen; | - |
2100 | bool flat_pen = pen.capStyle() == Qt::FlatCap; | - |
2101 | if (flat_pen) { never evaluated: flat_pen | 0 |
2102 | save(); | - |
2103 | pen.setCapStyle(Qt::SquareCap); | - |
2104 | setPen(pen); | - |
2105 | } | 0 |
2106 | QPainterPath path; | - |
2107 | for (int i=0; i<pointCount; ++i) { never evaluated: i<pointCount | 0 |
2108 | path.moveTo(points[i].x(), points[i].y()); | - |
2109 | path.lineTo(points[i].x() + 0.0001, points[i].y()); | - |
2110 | } | 0 |
2111 | d->draw_helper(path, QPainterPrivate::StrokeDraw); | - |
2112 | if (flat_pen) never evaluated: flat_pen | 0 |
2113 | restore(); never executed: restore(); | 0 |
2114 | } | 0 |
2115 | } | - |
2116 | void QPainter::drawPoints(const QPoint *points, int pointCount) | - |
2117 | { | - |
2118 | | - |
2119 | | - |
2120 | | - |
2121 | | - |
2122 | QPainterPrivate * const d = d_func(); | - |
2123 | | - |
2124 | if (!d->engine) { partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
2125 | QMessageLogger("painting/qpainter.cpp", 3720, __PRETTY_FUNCTION__).warning("QPainter::drawPoints: Painter not active"); | - |
2126 | return; | 0 |
2127 | } | - |
2128 | | - |
2129 | if (pointCount <= 0) partially evaluated: pointCount <= 0 no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
2130 | return; | 0 |
2131 | | - |
2132 | if (d->extended) { evaluated: d->extended yes Evaluation Count:136 | yes Evaluation Count:8 |
| 8-136 |
2133 | d->extended->drawPoints(points, pointCount); | - |
2134 | return; executed: return; Execution Count:136 | 136 |
2135 | } | - |
2136 | | - |
2137 | d->updateState(d->state); | - |
2138 | | - |
2139 | if (!d->state->emulationSpecifier) { partially evaluated: !d->state->emulationSpecifier yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
2140 | d->engine->drawPoints(points, pointCount); | - |
2141 | return; executed: return; Execution Count:8 | 8 |
2142 | } | - |
2143 | | - |
2144 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform never evaluated: d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform | 0 |
2145 | && d->state->matrix.type() == QTransform::TxTranslate) { never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
2146 | | - |
2147 | for (int i=0; i<pointCount; ++i) { never evaluated: i<pointCount | 0 |
2148 | QPointF pt(points[i].x() + d->state->matrix.dx(), | - |
2149 | points[i].y() + d->state->matrix.dy()); | - |
2150 | d->engine->drawPoints(&pt, 1); | - |
2151 | } | 0 |
2152 | } else { | 0 |
2153 | QPen pen = d->state->pen; | - |
2154 | bool flat_pen = (pen.capStyle() == Qt::FlatCap); | - |
2155 | if (flat_pen) { never evaluated: flat_pen | 0 |
2156 | save(); | - |
2157 | pen.setCapStyle(Qt::SquareCap); | - |
2158 | setPen(pen); | - |
2159 | } | 0 |
2160 | QPainterPath path; | - |
2161 | for (int i=0; i<pointCount; ++i) { never evaluated: i<pointCount | 0 |
2162 | path.moveTo(points[i].x(), points[i].y()); | - |
2163 | path.lineTo(points[i].x() + 0.0001, points[i].y()); | - |
2164 | } | 0 |
2165 | d->draw_helper(path, QPainterPrivate::StrokeDraw); | - |
2166 | if (flat_pen) never evaluated: flat_pen | 0 |
2167 | restore(); never executed: restore(); | 0 |
2168 | } | 0 |
2169 | } | - |
2170 | void QPainter::setBackgroundMode(Qt::BGMode mode) | - |
2171 | { | - |
2172 | | - |
2173 | | - |
2174 | | - |
2175 | | - |
2176 | | - |
2177 | QPainterPrivate * const d = d_func(); | - |
2178 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:11578 |
| 1-11578 |
2179 | QMessageLogger("painting/qpainter.cpp", 3805, __PRETTY_FUNCTION__).warning("QPainter::setBackgroundMode: Painter not active"); | - |
2180 | return; executed: return; Execution Count:1 | 1 |
2181 | } | - |
2182 | if (d->state->bgMode == mode) evaluated: d->state->bgMode == mode yes Evaluation Count:1390 | yes Evaluation Count:10188 |
| 1390-10188 |
2183 | return; executed: return; Execution Count:1390 | 1390 |
2184 | | - |
2185 | d->state->bgMode = mode; | - |
2186 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:10188 | no Evaluation Count:0 |
| 0-10188 |
2187 | d->checkEmulation(); | - |
2188 | } else { executed: } Execution Count:10188 | 10188 |
2189 | d->state->dirtyFlags |= QPaintEngine::DirtyBackgroundMode; | - |
2190 | } | 0 |
2191 | } | - |
2192 | | - |
2193 | | - |
2194 | | - |
2195 | | - |
2196 | | - |
2197 | | - |
2198 | Qt::BGMode QPainter::backgroundMode() const | - |
2199 | { | - |
2200 | const QPainterPrivate * const d = d_func(); | - |
2201 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:5028 |
| 1-5028 |
2202 | QMessageLogger("painting/qpainter.cpp", 3828, __PRETTY_FUNCTION__).warning("QPainter::backgroundMode: Painter not active"); | - |
2203 | return Qt::TransparentMode; executed: return Qt::TransparentMode; Execution Count:1 | 1 |
2204 | } | - |
2205 | return d->state->bgMode; executed: return d->state->bgMode; Execution Count:5028 | 5028 |
2206 | } | - |
2207 | void QPainter::setPen(const QColor &color) | - |
2208 | { | - |
2209 | | - |
2210 | | - |
2211 | | - |
2212 | | - |
2213 | QPainterPrivate * const d = d_func(); | - |
2214 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:83971 |
| 1-83971 |
2215 | QMessageLogger("painting/qpainter.cpp", 3850, __PRETTY_FUNCTION__).warning("QPainter::setPen: Painter not active"); | - |
2216 | return; executed: return; Execution Count:1 | 1 |
2217 | } | - |
2218 | | - |
2219 | QPen pen(color.isValid() ? color : QColor(Qt::black)); | - |
2220 | | - |
2221 | if (d->state->pen == pen) evaluated: d->state->pen == pen yes Evaluation Count:1861 | yes Evaluation Count:82110 |
| 1861-82110 |
2222 | return; executed: return; Execution Count:1861 | 1861 |
2223 | | - |
2224 | d->state->pen = pen; | - |
2225 | if (d->extended) partially evaluated: d->extended yes Evaluation Count:82110 | no Evaluation Count:0 |
| 0-82110 |
2226 | d->extended->penChanged(); executed: d->extended->penChanged(); Execution Count:82110 | 82110 |
2227 | else | - |
2228 | d->state->dirtyFlags |= QPaintEngine::DirtyPen; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyPen; | 0 |
2229 | } | - |
2230 | void QPainter::setPen(const QPen &pen) | - |
2231 | { | - |
2232 | | - |
2233 | | - |
2234 | | - |
2235 | | - |
2236 | | - |
2237 | | - |
2238 | QPainterPrivate * const d = d_func(); | - |
2239 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:58138 |
| 1-58138 |
2240 | QMessageLogger("painting/qpainter.cpp", 3885, __PRETTY_FUNCTION__).warning("QPainter::setPen: Painter not active"); | - |
2241 | return; executed: return; Execution Count:1 | 1 |
2242 | } | - |
2243 | | - |
2244 | if (d->state->pen == pen) evaluated: d->state->pen == pen yes Evaluation Count:33327 | yes Evaluation Count:24811 |
| 24811-33327 |
2245 | return; executed: return; Execution Count:33327 | 33327 |
2246 | | - |
2247 | d->state->pen = pen; | - |
2248 | | - |
2249 | if (d->extended) { evaluated: d->extended yes Evaluation Count:24809 | yes Evaluation Count:2 |
| 2-24809 |
2250 | d->checkEmulation(); | - |
2251 | d->extended->penChanged(); | - |
2252 | return; executed: return; Execution Count:24809 | 24809 |
2253 | } | - |
2254 | | - |
2255 | d->state->dirtyFlags |= QPaintEngine::DirtyPen; | - |
2256 | } executed: } Execution Count:2 | 2 |
2257 | void QPainter::setPen(Qt::PenStyle style) | - |
2258 | { | - |
2259 | QPainterPrivate * const d = d_func(); | - |
2260 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:7845 |
| 1-7845 |
2261 | QMessageLogger("painting/qpainter.cpp", 3914, __PRETTY_FUNCTION__).warning("QPainter::setPen: Painter not active"); | - |
2262 | return; executed: return; Execution Count:1 | 1 |
2263 | } | - |
2264 | | - |
2265 | QPen pen = QPen(style); | - |
2266 | | - |
2267 | if (d->state->pen == pen) evaluated: d->state->pen == pen yes Evaluation Count:2259 | yes Evaluation Count:5586 |
| 2259-5586 |
2268 | return; executed: return; Execution Count:2259 | 2259 |
2269 | | - |
2270 | d->state->pen = pen; | - |
2271 | | - |
2272 | if (d->extended) evaluated: d->extended yes Evaluation Count:5578 | yes Evaluation Count:8 |
| 8-5578 |
2273 | d->extended->penChanged(); executed: d->extended->penChanged(); Execution Count:5578 | 5578 |
2274 | else | - |
2275 | d->state->dirtyFlags |= QPaintEngine::DirtyPen; executed: d->state->dirtyFlags |= QPaintEngine::DirtyPen; Execution Count:8 | 8 |
2276 | | - |
2277 | } | - |
2278 | | - |
2279 | | - |
2280 | | - |
2281 | | - |
2282 | | - |
2283 | | - |
2284 | | - |
2285 | const QPen &QPainter::pen() const | - |
2286 | { | - |
2287 | const QPainterPrivate * const d = d_func(); | - |
2288 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:98458 |
| 1-98458 |
2289 | QMessageLogger("painting/qpainter.cpp", 3942, __PRETTY_FUNCTION__).warning("QPainter::pen: Painter not active"); | - |
2290 | return d->fakeState()->pen; executed: return d->fakeState()->pen; Execution Count:1 | 1 |
2291 | } | - |
2292 | return d->state->pen; executed: return d->state->pen; Execution Count:98458 | 98458 |
2293 | } | - |
2294 | void QPainter::setBrush(const QBrush &brush) | - |
2295 | { | - |
2296 | | - |
2297 | | - |
2298 | | - |
2299 | | - |
2300 | QPainterPrivate * const d = d_func(); | - |
2301 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:2 | yes Evaluation Count:12040 |
| 2-12040 |
2302 | QMessageLogger("painting/qpainter.cpp", 3965, __PRETTY_FUNCTION__).warning("QPainter::setBrush: Painter not active"); | - |
2303 | return; executed: return; Execution Count:2 | 2 |
2304 | } | - |
2305 | | - |
2306 | if (d->state->brush.d == brush.d) evaluated: d->state->brush.d == brush.d yes Evaluation Count:1434 | yes Evaluation Count:10606 |
| 1434-10606 |
2307 | return; executed: return; Execution Count:1434 | 1434 |
2308 | | - |
2309 | if (d->extended) { evaluated: d->extended yes Evaluation Count:10598 | yes Evaluation Count:8 |
| 8-10598 |
2310 | d->state->brush = brush; | - |
2311 | d->checkEmulation(); | - |
2312 | d->extended->brushChanged(); | - |
2313 | return; executed: return; Execution Count:10598 | 10598 |
2314 | } | - |
2315 | | - |
2316 | d->state->brush = brush; | - |
2317 | d->state->dirtyFlags |= QPaintEngine::DirtyBrush; | - |
2318 | } executed: } Execution Count:8 | 8 |
2319 | void QPainter::setBrush(Qt::BrushStyle style) | - |
2320 | { | - |
2321 | QPainterPrivate * const d = d_func(); | - |
2322 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:1236 |
| 1-1236 |
2323 | QMessageLogger("painting/qpainter.cpp", 3995, __PRETTY_FUNCTION__).warning("QPainter::setBrush: Painter not active"); | - |
2324 | return; executed: return; Execution Count:1 | 1 |
2325 | } | - |
2326 | if (d->state->brush.style() == style && evaluated: d->state->brush.style() == style yes Evaluation Count:871 | yes Evaluation Count:365 |
| 365-871 |
2327 | (style == Qt::NoBrush partially evaluated: style == Qt::NoBrush yes Evaluation Count:871 | no Evaluation Count:0 |
| 0-871 |
2328 | || (style == Qt::SolidPattern && d->state->brush.color() == QColor(0, 0, 0)))) never evaluated: style == Qt::SolidPattern never evaluated: d->state->brush.color() == QColor(0, 0, 0) | 0 |
2329 | return; executed: return; Execution Count:871 | 871 |
2330 | d->state->brush = QBrush(Qt::black, style); | - |
2331 | if (d->extended) partially evaluated: d->extended yes Evaluation Count:365 | no Evaluation Count:0 |
| 0-365 |
2332 | d->extended->brushChanged(); executed: d->extended->brushChanged(); Execution Count:365 | 365 |
2333 | else | - |
2334 | d->state->dirtyFlags |= QPaintEngine::DirtyBrush; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyBrush; | 0 |
2335 | } | - |
2336 | | - |
2337 | | - |
2338 | | - |
2339 | | - |
2340 | | - |
2341 | | - |
2342 | | - |
2343 | const QBrush &QPainter::brush() const | - |
2344 | { | - |
2345 | const QPainterPrivate * const d = d_func(); | - |
2346 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:875 |
| 1-875 |
2347 | QMessageLogger("painting/qpainter.cpp", 4019, __PRETTY_FUNCTION__).warning("QPainter::brush: Painter not active"); | - |
2348 | return d->fakeState()->brush; executed: return d->fakeState()->brush; Execution Count:1 | 1 |
2349 | } | - |
2350 | return d->state->brush; executed: return d->state->brush; Execution Count:875 | 875 |
2351 | } | - |
2352 | void QPainter::setBackground(const QBrush &bg) | - |
2353 | { | - |
2354 | | - |
2355 | | - |
2356 | | - |
2357 | | - |
2358 | | - |
2359 | QPainterPrivate * const d = d_func(); | - |
2360 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:10159 |
| 1-10159 |
2361 | QMessageLogger("painting/qpainter.cpp", 4047, __PRETTY_FUNCTION__).warning("QPainter::setBackground: Painter not active"); | - |
2362 | return; executed: return; Execution Count:1 | 1 |
2363 | } | - |
2364 | d->state->bgBrush = bg; | - |
2365 | if (!d->extended) partially evaluated: !d->extended no Evaluation Count:0 | yes Evaluation Count:10159 |
| 0-10159 |
2366 | d->state->dirtyFlags |= QPaintEngine::DirtyBackground; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyBackground; | 0 |
2367 | } executed: } Execution Count:10159 | 10159 |
2368 | void QPainter::setFont(const QFont &font) | - |
2369 | { | - |
2370 | QPainterPrivate * const d = d_func(); | - |
2371 | | - |
2372 | | - |
2373 | | - |
2374 | | - |
2375 | | - |
2376 | | - |
2377 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:1696 |
| 1-1696 |
2378 | QMessageLogger("painting/qpainter.cpp", 4078, __PRETTY_FUNCTION__).warning("QPainter::setFont: Painter not active"); | - |
2379 | return; executed: return; Execution Count:1 | 1 |
2380 | } | - |
2381 | | - |
2382 | d->state->font = QFont(font.resolve(d->state->deviceFont), device()); | - |
2383 | if (!d->extended) partially evaluated: !d->extended no Evaluation Count:0 | yes Evaluation Count:1696 |
| 0-1696 |
2384 | d->state->dirtyFlags |= QPaintEngine::DirtyFont; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyFont; | 0 |
2385 | } executed: } Execution Count:1696 | 1696 |
2386 | | - |
2387 | | - |
2388 | | - |
2389 | | - |
2390 | | - |
2391 | | - |
2392 | const QFont &QPainter::font() const | - |
2393 | { | - |
2394 | const QPainterPrivate * const d = d_func(); | - |
2395 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:503 |
| 1-503 |
2396 | QMessageLogger("painting/qpainter.cpp", 4096, __PRETTY_FUNCTION__).warning("QPainter::font: Painter not active"); | - |
2397 | return d->fakeState()->font; executed: return d->fakeState()->font; Execution Count:1 | 1 |
2398 | } | - |
2399 | return d->state->font; executed: return d->state->font; Execution Count:503 | 503 |
2400 | } | - |
2401 | void QPainter::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode) | - |
2402 | { | - |
2403 | | - |
2404 | | - |
2405 | | - |
2406 | | - |
2407 | QPainterPrivate * const d = d_func(); | - |
2408 | | - |
2409 | if (!d->engine) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:305 |
| 0-305 |
2410 | return; | 0 |
2411 | | - |
2412 | if (xRadius <= 0 || yRadius <= 0) { partially evaluated: xRadius <= 0 no Evaluation Count:0 | yes Evaluation Count:305 |
partially evaluated: yRadius <= 0 no Evaluation Count:0 | yes Evaluation Count:305 |
| 0-305 |
2413 | drawRect(rect); | - |
2414 | return; | 0 |
2415 | } | - |
2416 | | - |
2417 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:305 | no Evaluation Count:0 |
| 0-305 |
2418 | d->extended->drawRoundedRect(rect, xRadius, yRadius, mode); | - |
2419 | return; executed: return; Execution Count:305 | 305 |
2420 | } | - |
2421 | | - |
2422 | QPainterPath path; | - |
2423 | path.addRoundedRect(rect, xRadius, yRadius, mode); | - |
2424 | drawPath(path); | - |
2425 | } | 0 |
2426 | void QPainter::drawRoundRect(const QRectF &r, int xRnd, int yRnd) | - |
2427 | { | - |
2428 | drawRoundedRect(r, xRnd, yRnd, Qt::RelativeSize); | - |
2429 | } executed: } Execution Count:223 | 223 |
2430 | void QPainter::drawEllipse(const QRectF &r) | - |
2431 | { | - |
2432 | | - |
2433 | | - |
2434 | | - |
2435 | | - |
2436 | QPainterPrivate * const d = d_func(); | - |
2437 | | - |
2438 | if (!d->engine) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:1042 |
| 0-1042 |
2439 | return; | 0 |
2440 | | - |
2441 | QRectF rect(r.normalized()); | - |
2442 | | - |
2443 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:1042 | no Evaluation Count:0 |
| 0-1042 |
2444 | d->extended->drawEllipse(rect); | - |
2445 | return; executed: return; Execution Count:1042 | 1042 |
2446 | } | - |
2447 | | - |
2448 | d->updateState(d->state); | - |
2449 | if (d->state->emulationSpecifier) { never evaluated: d->state->emulationSpecifier | 0 |
2450 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform never evaluated: d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform | 0 |
2451 | && d->state->matrix.type() == QTransform::TxTranslate) { never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
2452 | rect.translate(QPointF(d->state->matrix.dx(), d->state->matrix.dy())); | - |
2453 | } else { | 0 |
2454 | QPainterPath path; | - |
2455 | path.addEllipse(rect); | - |
2456 | d->draw_helper(path, QPainterPrivate::StrokeAndFillDraw); | - |
2457 | return; | 0 |
2458 | } | - |
2459 | } | - |
2460 | | - |
2461 | d->engine->drawEllipse(rect); | - |
2462 | } | 0 |
2463 | void QPainter::drawEllipse(const QRect &r) | - |
2464 | { | - |
2465 | | - |
2466 | | - |
2467 | | - |
2468 | | - |
2469 | QPainterPrivate * const d = d_func(); | - |
2470 | | - |
2471 | if (!d->engine) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:985 |
| 0-985 |
2472 | return; | 0 |
2473 | | - |
2474 | QRect rect(r.normalized()); | - |
2475 | | - |
2476 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:985 | no Evaluation Count:0 |
| 0-985 |
2477 | d->extended->drawEllipse(rect); | - |
2478 | return; executed: return; Execution Count:985 | 985 |
2479 | } | - |
2480 | | - |
2481 | d->updateState(d->state); | - |
2482 | | - |
2483 | if (d->state->emulationSpecifier) { never evaluated: d->state->emulationSpecifier | 0 |
2484 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform never evaluated: d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform | 0 |
2485 | && d->state->matrix.type() == QTransform::TxTranslate) { never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
2486 | rect.translate(QPoint(qRound(d->state->matrix.dx()), qRound(d->state->matrix.dy()))); | - |
2487 | } else { | 0 |
2488 | QPainterPath path; | - |
2489 | path.addEllipse(rect); | - |
2490 | d->draw_helper(path, QPainterPrivate::StrokeAndFillDraw); | - |
2491 | return; | 0 |
2492 | } | - |
2493 | } | - |
2494 | | - |
2495 | d->engine->drawEllipse(rect); | - |
2496 | } | 0 |
2497 | void QPainter::drawArc(const QRectF &r, int a, int alen) | - |
2498 | { | - |
2499 | | - |
2500 | | - |
2501 | | - |
2502 | | - |
2503 | | - |
2504 | QPainterPrivate * const d = d_func(); | - |
2505 | | - |
2506 | if (!d->engine) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
2507 | return; | 0 |
2508 | | - |
2509 | QRectF rect = r.normalized(); | - |
2510 | | - |
2511 | QPainterPath path; | - |
2512 | path.arcMoveTo(rect, a/16.0); | - |
2513 | path.arcTo(rect, a/16.0, alen/16.0); | - |
2514 | strokePath(path, d->state->pen); | - |
2515 | } executed: } Execution Count:12 | 12 |
2516 | void QPainter::drawPie(const QRectF &r, int a, int alen) | - |
2517 | { | - |
2518 | | - |
2519 | | - |
2520 | | - |
2521 | | - |
2522 | | - |
2523 | QPainterPrivate * const d = d_func(); | - |
2524 | | - |
2525 | if (!d->engine) never evaluated: !d->engine | 0 |
2526 | return; | 0 |
2527 | | - |
2528 | if (a > (360*16)) { never evaluated: a > (360*16) | 0 |
2529 | a = a % (360*16); | - |
2530 | } else if (a < 0) { | 0 |
2531 | a = a % (360*16); | - |
2532 | if (a < 0) a += (360*16); never executed: a += (360*16); | 0 |
2533 | } | 0 |
2534 | | - |
2535 | QRectF rect = r.normalized(); | - |
2536 | | - |
2537 | QPainterPath path; | - |
2538 | path.moveTo(rect.center()); | - |
2539 | path.arcTo(rect.x(), rect.y(), rect.width(), rect.height(), a/16.0, alen/16.0); | - |
2540 | path.closeSubpath(); | - |
2541 | drawPath(path); | - |
2542 | | - |
2543 | } | 0 |
2544 | void QPainter::drawChord(const QRectF &r, int a, int alen) | - |
2545 | { | - |
2546 | | - |
2547 | | - |
2548 | | - |
2549 | | - |
2550 | | - |
2551 | QPainterPrivate * const d = d_func(); | - |
2552 | | - |
2553 | if (!d->engine) never evaluated: !d->engine | 0 |
2554 | return; | 0 |
2555 | | - |
2556 | QRectF rect = r.normalized(); | - |
2557 | | - |
2558 | QPainterPath path; | - |
2559 | path.arcMoveTo(rect, a/16.0); | - |
2560 | path.arcTo(rect, a/16.0, alen/16.0); | - |
2561 | path.closeSubpath(); | - |
2562 | drawPath(path); | - |
2563 | } | 0 |
2564 | void QPainter::drawLines(const QLineF *lines, int lineCount) | - |
2565 | { | - |
2566 | | - |
2567 | | - |
2568 | | - |
2569 | | - |
2570 | | - |
2571 | QPainterPrivate * const d = d_func(); | - |
2572 | | - |
2573 | if (!d->engine || lineCount < 1) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:1988 |
partially evaluated: lineCount < 1 no Evaluation Count:0 | yes Evaluation Count:1988 |
| 0-1988 |
2574 | return; | 0 |
2575 | | - |
2576 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:1988 | no Evaluation Count:0 |
| 0-1988 |
2577 | d->extended->drawLines(lines, lineCount); | - |
2578 | return; executed: return; Execution Count:1988 | 1988 |
2579 | } | - |
2580 | | - |
2581 | d->updateState(d->state); | - |
2582 | | - |
2583 | uint lineEmulation = line_emulation(d->state->emulationSpecifier); | - |
2584 | | - |
2585 | if (lineEmulation) { never evaluated: lineEmulation | 0 |
2586 | if (lineEmulation == QPaintEngine::PrimitiveTransform never evaluated: lineEmulation == QPaintEngine::PrimitiveTransform | 0 |
2587 | && d->state->matrix.type() == QTransform::TxTranslate) { never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
2588 | for (int i = 0; i < lineCount; ++i) { never evaluated: i < lineCount | 0 |
2589 | QLineF line = lines[i]; | - |
2590 | line.translate(d->state->matrix.dx(), d->state->matrix.dy()); | - |
2591 | d->engine->drawLines(&line, 1); | - |
2592 | } | 0 |
2593 | } else { | 0 |
2594 | QPainterPath linePath; | - |
2595 | for (int i = 0; i < lineCount; ++i) { never evaluated: i < lineCount | 0 |
2596 | linePath.moveTo(lines[i].p1()); | - |
2597 | linePath.lineTo(lines[i].p2()); | - |
2598 | } | 0 |
2599 | d->draw_helper(linePath, QPainterPrivate::StrokeDraw); | - |
2600 | } | 0 |
2601 | return; | 0 |
2602 | } | - |
2603 | d->engine->drawLines(lines, lineCount); | - |
2604 | } | 0 |
2605 | void QPainter::drawLines(const QLine *lines, int lineCount) | - |
2606 | { | - |
2607 | | - |
2608 | | - |
2609 | | - |
2610 | | - |
2611 | | - |
2612 | QPainterPrivate * const d = d_func(); | - |
2613 | | - |
2614 | if (!d->engine || lineCount < 1) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:5045 |
partially evaluated: lineCount < 1 no Evaluation Count:0 | yes Evaluation Count:5045 |
| 0-5045 |
2615 | return; | 0 |
2616 | | - |
2617 | if (d->extended) { evaluated: d->extended yes Evaluation Count:5039 | yes Evaluation Count:6 |
| 6-5039 |
2618 | d->extended->drawLines(lines, lineCount); | - |
2619 | return; executed: return; Execution Count:5039 | 5039 |
2620 | } | - |
2621 | | - |
2622 | d->updateState(d->state); | - |
2623 | | - |
2624 | uint lineEmulation = line_emulation(d->state->emulationSpecifier); | - |
2625 | | - |
2626 | if (lineEmulation) { partially evaluated: lineEmulation no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
2627 | if (lineEmulation == QPaintEngine::PrimitiveTransform never evaluated: lineEmulation == QPaintEngine::PrimitiveTransform | 0 |
2628 | && d->state->matrix.type() == QTransform::TxTranslate) { never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
2629 | for (int i = 0; i < lineCount; ++i) { never evaluated: i < lineCount | 0 |
2630 | QLineF line = lines[i]; | - |
2631 | line.translate(d->state->matrix.dx(), d->state->matrix.dy()); | - |
2632 | d->engine->drawLines(&line, 1); | - |
2633 | } | 0 |
2634 | } else { | 0 |
2635 | QPainterPath linePath; | - |
2636 | for (int i = 0; i < lineCount; ++i) { never evaluated: i < lineCount | 0 |
2637 | linePath.moveTo(lines[i].p1()); | - |
2638 | linePath.lineTo(lines[i].p2()); | - |
2639 | } | 0 |
2640 | d->draw_helper(linePath, QPainterPrivate::StrokeDraw); | - |
2641 | } | 0 |
2642 | return; | 0 |
2643 | } | - |
2644 | d->engine->drawLines(lines, lineCount); | - |
2645 | } executed: } Execution Count:6 | 6 |
2646 | void QPainter::drawLines(const QPointF *pointPairs, int lineCount) | - |
2647 | { | - |
2648 | qt_noop(); | - |
2649 | | - |
2650 | drawLines((QLineF*)pointPairs, lineCount); | - |
2651 | } executed: } Execution Count:5 | 5 |
2652 | | - |
2653 | | - |
2654 | | - |
2655 | | - |
2656 | | - |
2657 | | - |
2658 | | - |
2659 | void QPainter::drawLines(const QPoint *pointPairs, int lineCount) | - |
2660 | { | - |
2661 | qt_noop(); | - |
2662 | | - |
2663 | drawLines((QLine*)pointPairs, lineCount); | - |
2664 | } | 0 |
2665 | void QPainter::drawPolyline(const QPointF *points, int pointCount) | - |
2666 | { | - |
2667 | | - |
2668 | | - |
2669 | | - |
2670 | | - |
2671 | QPainterPrivate * const d = d_func(); | - |
2672 | | - |
2673 | if (!d->engine || pointCount < 2) never evaluated: !d->engine never evaluated: pointCount < 2 | 0 |
2674 | return; | 0 |
2675 | | - |
2676 | if (d->extended) { never evaluated: d->extended | 0 |
2677 | d->extended->drawPolygon(points, pointCount, QPaintEngine::PolylineMode); | - |
2678 | return; | 0 |
2679 | } | - |
2680 | | - |
2681 | d->updateState(d->state); | - |
2682 | | - |
2683 | uint lineEmulation = line_emulation(d->state->emulationSpecifier); | - |
2684 | | - |
2685 | if (lineEmulation) { never evaluated: lineEmulation | 0 |
2686 | | - |
2687 | | - |
2688 | | - |
2689 | | - |
2690 | QPainterPath polylinePath(points[0]); | - |
2691 | for (int i=1; i<pointCount; ++i) never evaluated: i<pointCount | 0 |
2692 | polylinePath.lineTo(points[i]); never executed: polylinePath.lineTo(points[i]); | 0 |
2693 | d->draw_helper(polylinePath, QPainterPrivate::StrokeDraw); | - |
2694 | | - |
2695 | } else { | 0 |
2696 | d->engine->drawPolygon(points, pointCount, QPaintEngine::PolylineMode); | - |
2697 | } | 0 |
2698 | } | - |
2699 | | - |
2700 | | - |
2701 | | - |
2702 | | - |
2703 | | - |
2704 | | - |
2705 | | - |
2706 | void QPainter::drawPolyline(const QPoint *points, int pointCount) | - |
2707 | { | - |
2708 | | - |
2709 | | - |
2710 | | - |
2711 | | - |
2712 | QPainterPrivate * const d = d_func(); | - |
2713 | | - |
2714 | if (!d->engine || pointCount < 2) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:61214 |
partially evaluated: pointCount < 2 no Evaluation Count:0 | yes Evaluation Count:61214 |
| 0-61214 |
2715 | return; | 0 |
2716 | | - |
2717 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:61214 | no Evaluation Count:0 |
| 0-61214 |
2718 | d->extended->drawPolygon(points, pointCount, QPaintEngine::PolylineMode); | - |
2719 | return; executed: return; Execution Count:61214 | 61214 |
2720 | } | - |
2721 | | - |
2722 | d->updateState(d->state); | - |
2723 | | - |
2724 | uint lineEmulation = line_emulation(d->state->emulationSpecifier); | - |
2725 | | - |
2726 | if (lineEmulation) { never evaluated: lineEmulation | 0 |
2727 | | - |
2728 | | - |
2729 | | - |
2730 | | - |
2731 | QPainterPath polylinePath(points[0]); | - |
2732 | for (int i=1; i<pointCount; ++i) never evaluated: i<pointCount | 0 |
2733 | polylinePath.lineTo(points[i]); never executed: polylinePath.lineTo(points[i]); | 0 |
2734 | d->draw_helper(polylinePath, QPainterPrivate::StrokeDraw); | - |
2735 | | - |
2736 | } else { | 0 |
2737 | d->engine->drawPolygon(points, pointCount, QPaintEngine::PolylineMode); | - |
2738 | } | 0 |
2739 | } | - |
2740 | void QPainter::drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule) | - |
2741 | { | - |
2742 | | - |
2743 | | - |
2744 | | - |
2745 | | - |
2746 | | - |
2747 | QPainterPrivate * const d = d_func(); | - |
2748 | | - |
2749 | if (!d->engine || pointCount < 2) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:450 |
partially evaluated: pointCount < 2 no Evaluation Count:0 | yes Evaluation Count:450 |
| 0-450 |
2750 | return; | 0 |
2751 | | - |
2752 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:450 | no Evaluation Count:0 |
| 0-450 |
2753 | d->extended->drawPolygon(points, pointCount, QPaintEngine::PolygonDrawMode(fillRule)); | - |
2754 | return; executed: return; Execution Count:450 | 450 |
2755 | } | - |
2756 | | - |
2757 | d->updateState(d->state); | - |
2758 | | - |
2759 | uint emulationSpecifier = d->state->emulationSpecifier; | - |
2760 | | - |
2761 | if (emulationSpecifier) { never evaluated: emulationSpecifier | 0 |
2762 | QPainterPath polygonPath(points[0]); | - |
2763 | for (int i=1; i<pointCount; ++i) never evaluated: i<pointCount | 0 |
2764 | polygonPath.lineTo(points[i]); never executed: polygonPath.lineTo(points[i]); | 0 |
2765 | polygonPath.closeSubpath(); | - |
2766 | polygonPath.setFillRule(fillRule); | - |
2767 | d->draw_helper(polygonPath); | - |
2768 | return; | 0 |
2769 | } | - |
2770 | | - |
2771 | d->engine->drawPolygon(points, pointCount, QPaintEngine::PolygonDrawMode(fillRule)); | - |
2772 | } | 0 |
2773 | | - |
2774 | | - |
2775 | | - |
2776 | | - |
2777 | | - |
2778 | | - |
2779 | void QPainter::drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule) | - |
2780 | { | - |
2781 | | - |
2782 | | - |
2783 | | - |
2784 | | - |
2785 | | - |
2786 | QPainterPrivate * const d = d_func(); | - |
2787 | | - |
2788 | if (!d->engine || pointCount < 2) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:906 |
partially evaluated: pointCount < 2 no Evaluation Count:0 | yes Evaluation Count:906 |
| 0-906 |
2789 | return; | 0 |
2790 | | - |
2791 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:906 | no Evaluation Count:0 |
| 0-906 |
2792 | d->extended->drawPolygon(points, pointCount, QPaintEngine::PolygonDrawMode(fillRule)); | - |
2793 | return; executed: return; Execution Count:906 | 906 |
2794 | } | - |
2795 | | - |
2796 | d->updateState(d->state); | - |
2797 | | - |
2798 | uint emulationSpecifier = d->state->emulationSpecifier; | - |
2799 | | - |
2800 | if (emulationSpecifier) { never evaluated: emulationSpecifier | 0 |
2801 | QPainterPath polygonPath(points[0]); | - |
2802 | for (int i=1; i<pointCount; ++i) never evaluated: i<pointCount | 0 |
2803 | polygonPath.lineTo(points[i]); never executed: polygonPath.lineTo(points[i]); | 0 |
2804 | polygonPath.closeSubpath(); | - |
2805 | polygonPath.setFillRule(fillRule); | - |
2806 | d->draw_helper(polygonPath); | - |
2807 | return; | 0 |
2808 | } | - |
2809 | | - |
2810 | d->engine->drawPolygon(points, pointCount, QPaintEngine::PolygonDrawMode(fillRule)); | - |
2811 | } | 0 |
2812 | void QPainter::drawConvexPolygon(const QPoint *points, int pointCount) | - |
2813 | { | - |
2814 | | - |
2815 | | - |
2816 | | - |
2817 | | - |
2818 | | - |
2819 | QPainterPrivate * const d = d_func(); | - |
2820 | | - |
2821 | if (!d->engine || pointCount < 2) never evaluated: !d->engine never evaluated: pointCount < 2 | 0 |
2822 | return; | 0 |
2823 | | - |
2824 | if (d->extended) { never evaluated: d->extended | 0 |
2825 | d->extended->drawPolygon(points, pointCount, QPaintEngine::ConvexMode); | - |
2826 | return; | 0 |
2827 | } | - |
2828 | | - |
2829 | d->updateState(d->state); | - |
2830 | | - |
2831 | uint emulationSpecifier = d->state->emulationSpecifier; | - |
2832 | | - |
2833 | if (emulationSpecifier) { never evaluated: emulationSpecifier | 0 |
2834 | QPainterPath polygonPath(points[0]); | - |
2835 | for (int i=1; i<pointCount; ++i) never evaluated: i<pointCount | 0 |
2836 | polygonPath.lineTo(points[i]); never executed: polygonPath.lineTo(points[i]); | 0 |
2837 | polygonPath.closeSubpath(); | - |
2838 | polygonPath.setFillRule(Qt::WindingFill); | - |
2839 | d->draw_helper(polygonPath); | - |
2840 | return; | 0 |
2841 | } | - |
2842 | | - |
2843 | d->engine->drawPolygon(points, pointCount, QPaintEngine::ConvexMode); | - |
2844 | } | 0 |
2845 | | - |
2846 | void QPainter::drawConvexPolygon(const QPointF *points, int pointCount) | - |
2847 | { | - |
2848 | | - |
2849 | | - |
2850 | | - |
2851 | | - |
2852 | | - |
2853 | QPainterPrivate * const d = d_func(); | - |
2854 | | - |
2855 | if (!d->engine || pointCount < 2) never evaluated: !d->engine never evaluated: pointCount < 2 | 0 |
2856 | return; | 0 |
2857 | | - |
2858 | if (d->extended) { never evaluated: d->extended | 0 |
2859 | d->extended->drawPolygon(points, pointCount, QPaintEngine::ConvexMode); | - |
2860 | return; | 0 |
2861 | } | - |
2862 | | - |
2863 | d->updateState(d->state); | - |
2864 | | - |
2865 | uint emulationSpecifier = d->state->emulationSpecifier; | - |
2866 | | - |
2867 | if (emulationSpecifier) { never evaluated: emulationSpecifier | 0 |
2868 | QPainterPath polygonPath(points[0]); | - |
2869 | for (int i=1; i<pointCount; ++i) never evaluated: i<pointCount | 0 |
2870 | polygonPath.lineTo(points[i]); never executed: polygonPath.lineTo(points[i]); | 0 |
2871 | polygonPath.closeSubpath(); | - |
2872 | polygonPath.setFillRule(Qt::WindingFill); | - |
2873 | d->draw_helper(polygonPath); | - |
2874 | return; | 0 |
2875 | } | - |
2876 | | - |
2877 | d->engine->drawPolygon(points, pointCount, QPaintEngine::ConvexMode); | - |
2878 | } | 0 |
2879 | | - |
2880 | static inline QPointF roundInDeviceCoordinates(const QPointF &p, const QTransform &m) | - |
2881 | { | - |
2882 | return m.inverted().map(QPointF(m.map(p).toPoint())); never executed: return m.inverted().map(QPointF(m.map(p).toPoint())); | 0 |
2883 | } | - |
2884 | void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) | - |
2885 | { | - |
2886 | | - |
2887 | | - |
2888 | | - |
2889 | | - |
2890 | | - |
2891 | | - |
2892 | | - |
2893 | QPainterPrivate * const d = d_func(); | - |
2894 | | - |
2895 | if (!d->engine || pm.isNull()) evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:6284 |
evaluated: pm.isNull() yes Evaluation Count:71 | yes Evaluation Count:6213 |
| 1-6284 |
2896 | return; executed: return; Execution Count:72 | 72 |
2897 | | - |
2898 | | - |
2899 | | - |
2900 | | - |
2901 | | - |
2902 | if (d->extended) { evaluated: d->extended yes Evaluation Count:6212 | yes Evaluation Count:1 |
| 1-6212 |
2903 | d->extended->drawPixmap(p, pm); | - |
2904 | return; executed: return; Execution Count:6212 | 6212 |
2905 | } | - |
2906 | | - |
2907 | qreal x = p.x(); | - |
2908 | qreal y = p.y(); | - |
2909 | | - |
2910 | int w = pm.width(); | - |
2911 | int h = pm.height(); | - |
2912 | | - |
2913 | if (w <= 0) partially evaluated: w <= 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2914 | return; | 0 |
2915 | | - |
2916 | | - |
2917 | if (d->state->bgMode == Qt::OpaqueMode && pm.isQBitmap()) { partially evaluated: d->state->bgMode == Qt::OpaqueMode no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: pm.isQBitmap() | 0-1 |
2918 | fillRect(QRectF(x, y, w, h), d->state->bgBrush.color()); | - |
2919 | } | 0 |
2920 | | - |
2921 | d->updateState(d->state); | - |
2922 | | - |
2923 | if ((d->state->matrix.type() > QTransform::TxTranslate partially evaluated: d->state->matrix.type() > QTransform::TxTranslate no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2924 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)) never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
2925 | || (!d->state->matrix.isAffine() && !d->engine->hasFeature(QPaintEngine::PerspectiveTransform)) partially evaluated: !d->state->matrix.isAffine() no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: !d->engine->hasFeature(QPaintEngine::PerspectiveTransform) | 0-1 |
2926 | || (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity))) partially evaluated: d->state->opacity != 1.0 no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: !d->engine->hasFeature(QPaintEngine::ConstantOpacity) | 0-1 |
2927 | { | - |
2928 | save(); | - |
2929 | | - |
2930 | | - |
2931 | if (d->state->matrix.type() <= QTransform::TxScale) { never evaluated: d->state->matrix.type() <= QTransform::TxScale | 0 |
2932 | const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); | - |
2933 | x = p.x(); | - |
2934 | y = p.y(); | - |
2935 | } | 0 |
2936 | translate(x, y); | - |
2937 | setBackgroundMode(Qt::TransparentMode); | - |
2938 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - |
2939 | QBrush brush(d->state->pen.color(), pm); | - |
2940 | setBrush(brush); | - |
2941 | setPen(Qt::NoPen); | - |
2942 | setBrushOrigin(QPointF(0, 0)); | - |
2943 | | - |
2944 | drawRect(pm.rect()); | - |
2945 | restore(); | - |
2946 | } else { | 0 |
2947 | if (!d->engine->hasFeature(QPaintEngine::PixmapTransform)) { partially evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2948 | x += d->state->matrix.dx(); | - |
2949 | y += d->state->matrix.dy(); | - |
2950 | } | 0 |
2951 | int scale = pm.devicePixelRatio(); | - |
2952 | d->engine->drawPixmap(QRectF(x, y, w / scale, h / scale), pm, QRectF(0, 0, w, h)); | - |
2953 | } executed: } Execution Count:1 | 1 |
2954 | } | - |
2955 | | - |
2956 | void QPainter::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) | - |
2957 | { | - |
2958 | QPainterPrivate * const d = d_func(); | - |
2959 | if (!d->engine || pm.isNull()) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:4185 |
evaluated: pm.isNull() yes Evaluation Count:12 | yes Evaluation Count:4173 |
| 0-4185 |
2960 | return; executed: return; Execution Count:12 | 12 |
2961 | | - |
2962 | | - |
2963 | | - |
2964 | | - |
2965 | qreal x = r.x(); | - |
2966 | qreal y = r.y(); | - |
2967 | qreal w = r.width(); | - |
2968 | qreal h = r.height(); | - |
2969 | qreal sx = sr.x(); | - |
2970 | qreal sy = sr.y(); | - |
2971 | qreal sw = sr.width(); | - |
2972 | qreal sh = sr.height(); | - |
2973 | | - |
2974 | | - |
2975 | | - |
2976 | | - |
2977 | const qreal pmscale = pm.devicePixelRatio(); | - |
2978 | | - |
2979 | | - |
2980 | if (sw <= 0) evaluated: sw <= 0 yes Evaluation Count:2597 | yes Evaluation Count:1576 |
| 1576-2597 |
2981 | sw = pm.width() - sx; executed: sw = pm.width() - sx; Execution Count:2597 | 2597 |
2982 | | - |
2983 | if (sh <= 0) evaluated: sh <= 0 yes Evaluation Count:2597 | yes Evaluation Count:1576 |
| 1576-2597 |
2984 | sh = pm.height() - sy; executed: sh = pm.height() - sy; Execution Count:2597 | 2597 |
2985 | | - |
2986 | if (w < 0) evaluated: w < 0 yes Evaluation Count:1283 | yes Evaluation Count:2890 |
| 1283-2890 |
2987 | w = sw / pmscale; executed: w = sw / pmscale; Execution Count:1283 | 1283 |
2988 | if (h < 0) evaluated: h < 0 yes Evaluation Count:1283 | yes Evaluation Count:2890 |
| 1283-2890 |
2989 | h = sh / pmscale; executed: h = sh / pmscale; Execution Count:1283 | 1283 |
2990 | | - |
2991 | if (sx < 0) { partially evaluated: sx < 0 no Evaluation Count:0 | yes Evaluation Count:4173 |
| 0-4173 |
2992 | qreal w_ratio = sx * w/sw; | - |
2993 | x -= w_ratio; | - |
2994 | w += w_ratio; | - |
2995 | sw += sx; | - |
2996 | sx = 0; | - |
2997 | } | 0 |
2998 | | - |
2999 | if (sy < 0) { partially evaluated: sy < 0 no Evaluation Count:0 | yes Evaluation Count:4173 |
| 0-4173 |
3000 | qreal h_ratio = sy * h/sh; | - |
3001 | y -= h_ratio; | - |
3002 | h += h_ratio; | - |
3003 | sh += sy; | - |
3004 | sy = 0; | - |
3005 | } | 0 |
3006 | | - |
3007 | if (sw + sx > pm.width()) { partially evaluated: sw + sx > pm.width() no Evaluation Count:0 | yes Evaluation Count:4173 |
| 0-4173 |
3008 | qreal delta = sw - (pm.width() - sx); | - |
3009 | qreal w_ratio = delta * w/sw; | - |
3010 | sw -= delta; | - |
3011 | w -= w_ratio; | - |
3012 | } | 0 |
3013 | | - |
3014 | if (sh + sy > pm.height()) { evaluated: sh + sy > pm.height() yes Evaluation Count:1 | yes Evaluation Count:4172 |
| 1-4172 |
3015 | qreal delta = sh - (pm.height() - sy); | - |
3016 | qreal h_ratio = delta * h/sh; | - |
3017 | sh -= delta; | - |
3018 | h -= h_ratio; | - |
3019 | } executed: } Execution Count:1 | 1 |
3020 | | - |
3021 | if (w == 0 || h == 0 || sw <= 0 || sh <= 0) partially evaluated: w == 0 no Evaluation Count:0 | yes Evaluation Count:4173 |
partially evaluated: h == 0 no Evaluation Count:0 | yes Evaluation Count:4173 |
partially evaluated: sw <= 0 no Evaluation Count:0 | yes Evaluation Count:4173 |
partially evaluated: sh <= 0 no Evaluation Count:0 | yes Evaluation Count:4173 |
| 0-4173 |
3022 | return; | 0 |
3023 | | - |
3024 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:4173 | no Evaluation Count:0 |
| 0-4173 |
3025 | d->extended->drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh)); | - |
3026 | return; executed: return; Execution Count:4173 | 4173 |
3027 | } | - |
3028 | | - |
3029 | | - |
3030 | if (d->state->bgMode == Qt::OpaqueMode && pm.isQBitmap()) never evaluated: d->state->bgMode == Qt::OpaqueMode never evaluated: pm.isQBitmap() | 0 |
3031 | fillRect(QRectF(x, y, w, h), d->state->bgBrush.color()); never executed: fillRect(QRectF(x, y, w, h), d->state->bgBrush.color()); | 0 |
3032 | | - |
3033 | d->updateState(d->state); | - |
3034 | | - |
3035 | if ((d->state->matrix.type() > QTransform::TxTranslate never evaluated: d->state->matrix.type() > QTransform::TxTranslate | 0 |
3036 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)) never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
3037 | || (!d->state->matrix.isAffine() && !d->engine->hasFeature(QPaintEngine::PerspectiveTransform)) never evaluated: !d->state->matrix.isAffine() never evaluated: !d->engine->hasFeature(QPaintEngine::PerspectiveTransform) | 0 |
3038 | || (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity)) never evaluated: d->state->opacity != 1.0 never evaluated: !d->engine->hasFeature(QPaintEngine::ConstantOpacity) | 0 |
3039 | || ((sw != w || sh != h) && !d->engine->hasFeature(QPaintEngine::PixmapTransform))) never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
3040 | { | - |
3041 | save(); | - |
3042 | | - |
3043 | | - |
3044 | if (d->state->matrix.type() <= QTransform::TxScale) { never evaluated: d->state->matrix.type() <= QTransform::TxScale | 0 |
3045 | const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); | - |
3046 | x = p.x(); | - |
3047 | y = p.y(); | - |
3048 | } | 0 |
3049 | | - |
3050 | if (d->state->matrix.type() <= QTransform::TxTranslate && sw == w && sh == h) { never evaluated: d->state->matrix.type() <= QTransform::TxTranslate | 0 |
3051 | sx = qRound(sx); | - |
3052 | sy = qRound(sy); | - |
3053 | sw = qRound(sw); | - |
3054 | sh = qRound(sh); | - |
3055 | } | 0 |
3056 | | - |
3057 | translate(x, y); | - |
3058 | scale(w / sw, h / sh); | - |
3059 | setBackgroundMode(Qt::TransparentMode); | - |
3060 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - |
3061 | QBrush brush; | - |
3062 | | - |
3063 | if (sw == pm.width() && sh == pm.height()) never evaluated: sw == pm.width() never evaluated: sh == pm.height() | 0 |
3064 | brush = QBrush(d->state->pen.color(), pm); never executed: brush = QBrush(d->state->pen.color(), pm); | 0 |
3065 | else | - |
3066 | brush = QBrush(d->state->pen.color(), pm.copy(sx, sy, sw, sh)); never executed: brush = QBrush(d->state->pen.color(), pm.copy(sx, sy, sw, sh)); | 0 |
3067 | | - |
3068 | setBrush(brush); | - |
3069 | setPen(Qt::NoPen); | - |
3070 | | - |
3071 | drawRect(QRectF(0, 0, sw, sh)); | - |
3072 | restore(); | - |
3073 | } else { | 0 |
3074 | if (!d->engine->hasFeature(QPaintEngine::PixmapTransform)) { never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
3075 | x += d->state->matrix.dx(); | - |
3076 | y += d->state->matrix.dy(); | - |
3077 | } | 0 |
3078 | d->engine->drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh)); | - |
3079 | } | 0 |
3080 | } | - |
3081 | void QPainter::drawImage(const QPointF &p, const QImage &image) | - |
3082 | { | - |
3083 | QPainterPrivate * const d = d_func(); | - |
3084 | | - |
3085 | if (!d->engine || image.isNull()) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:2319 |
partially evaluated: image.isNull() no Evaluation Count:0 | yes Evaluation Count:2319 |
| 0-2319 |
3086 | return; | 0 |
3087 | | - |
3088 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:2319 | no Evaluation Count:0 |
| 0-2319 |
3089 | d->extended->drawImage(p, image); | - |
3090 | return; executed: return; Execution Count:2319 | 2319 |
3091 | } | - |
3092 | | - |
3093 | qreal x = p.x(); | - |
3094 | qreal y = p.y(); | - |
3095 | | - |
3096 | int w = image.width(); | - |
3097 | int h = image.height(); | - |
3098 | qreal scale = image.devicePixelRatio(); | - |
3099 | | - |
3100 | d->updateState(d->state); | - |
3101 | | - |
3102 | if (((d->state->matrix.type() > QTransform::TxTranslate) never evaluated: (d->state->matrix.type() > QTransform::TxTranslate) | 0 |
3103 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)) never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
3104 | || (!d->state->matrix.isAffine() && !d->engine->hasFeature(QPaintEngine::PerspectiveTransform)) never evaluated: !d->state->matrix.isAffine() never evaluated: !d->engine->hasFeature(QPaintEngine::PerspectiveTransform) | 0 |
3105 | || (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity))) never evaluated: d->state->opacity != 1.0 never evaluated: !d->engine->hasFeature(QPaintEngine::ConstantOpacity) | 0 |
3106 | { | - |
3107 | save(); | - |
3108 | | - |
3109 | | - |
3110 | if (d->state->matrix.type() <= QTransform::TxScale) { never evaluated: d->state->matrix.type() <= QTransform::TxScale | 0 |
3111 | const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); | - |
3112 | x = p.x(); | - |
3113 | y = p.y(); | - |
3114 | } | 0 |
3115 | translate(x, y); | - |
3116 | setBackgroundMode(Qt::TransparentMode); | - |
3117 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - |
3118 | QBrush brush(image); | - |
3119 | setBrush(brush); | - |
3120 | setPen(Qt::NoPen); | - |
3121 | setBrushOrigin(QPointF(0, 0)); | - |
3122 | drawRect(QRect(QPoint(0, 0), image.size() / scale)); | - |
3123 | restore(); | - |
3124 | return; | 0 |
3125 | } | - |
3126 | | - |
3127 | if (d->state->matrix.type() == QTransform::TxTranslate never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
3128 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)) { never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
3129 | x += d->state->matrix.dx(); | - |
3130 | y += d->state->matrix.dy(); | - |
3131 | } | 0 |
3132 | | - |
3133 | d->engine->drawImage(QRectF(x, y, w / scale, h / scale), image, QRectF(0, 0, w, h), Qt::AutoColor); | - |
3134 | } | 0 |
3135 | | - |
3136 | void QPainter::drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, | - |
3137 | Qt::ImageConversionFlags flags) | - |
3138 | { | - |
3139 | QPainterPrivate * const d = d_func(); | - |
3140 | | - |
3141 | if (!d->engine || image.isNull()) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:227 |
partially evaluated: image.isNull() no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3142 | return; | 0 |
3143 | | - |
3144 | qreal x = targetRect.x(); | - |
3145 | qreal y = targetRect.y(); | - |
3146 | qreal w = targetRect.width(); | - |
3147 | qreal h = targetRect.height(); | - |
3148 | qreal sx = sourceRect.x(); | - |
3149 | qreal sy = sourceRect.y(); | - |
3150 | qreal sw = sourceRect.width(); | - |
3151 | qreal sh = sourceRect.height(); | - |
3152 | qreal imageScale = image.devicePixelRatio(); | - |
3153 | | - |
3154 | | - |
3155 | if (sw <= 0) partially evaluated: sw <= 0 no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3156 | sw = image.width() - sx; never executed: sw = image.width() - sx; | 0 |
3157 | | - |
3158 | if (sh <= 0) partially evaluated: sh <= 0 no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3159 | sh = image.height() - sy; never executed: sh = image.height() - sy; | 0 |
3160 | | - |
3161 | if (w < 0) partially evaluated: w < 0 no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3162 | w = sw / imageScale; never executed: w = sw / imageScale; | 0 |
3163 | if (h < 0) partially evaluated: h < 0 no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3164 | h = sh / imageScale; never executed: h = sh / imageScale; | 0 |
3165 | | - |
3166 | if (sx < 0) { partially evaluated: sx < 0 no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3167 | qreal w_ratio = sx * w/sw; | - |
3168 | x -= w_ratio; | - |
3169 | w += w_ratio; | - |
3170 | sw += sx; | - |
3171 | sx = 0; | - |
3172 | } | 0 |
3173 | | - |
3174 | if (sy < 0) { partially evaluated: sy < 0 no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3175 | qreal h_ratio = sy * h/sh; | - |
3176 | y -= h_ratio; | - |
3177 | h += h_ratio; | - |
3178 | sh += sy; | - |
3179 | sy = 0; | - |
3180 | } | 0 |
3181 | | - |
3182 | if (sw + sx > image.width()) { partially evaluated: sw + sx > image.width() no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3183 | qreal delta = sw - (image.width() - sx); | - |
3184 | qreal w_ratio = delta * w/sw; | - |
3185 | sw -= delta; | - |
3186 | w -= w_ratio; | - |
3187 | } | 0 |
3188 | | - |
3189 | if (sh + sy > image.height()) { partially evaluated: sh + sy > image.height() no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3190 | qreal delta = sh - (image.height() - sy); | - |
3191 | qreal h_ratio = delta * h/sh; | - |
3192 | sh -= delta; | - |
3193 | h -= h_ratio; | - |
3194 | } | 0 |
3195 | | - |
3196 | if (w == 0 || h == 0 || sw <= 0 || sh <= 0) partially evaluated: w == 0 no Evaluation Count:0 | yes Evaluation Count:227 |
partially evaluated: h == 0 no Evaluation Count:0 | yes Evaluation Count:227 |
partially evaluated: sw <= 0 no Evaluation Count:0 | yes Evaluation Count:227 |
partially evaluated: sh <= 0 no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
3197 | return; | 0 |
3198 | | - |
3199 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:227 | no Evaluation Count:0 |
| 0-227 |
3200 | d->extended->drawImage(QRectF(x, y, w, h), image, QRectF(sx, sy, sw, sh), flags); | - |
3201 | return; executed: return; Execution Count:227 | 227 |
3202 | } | - |
3203 | | - |
3204 | d->updateState(d->state); | - |
3205 | | - |
3206 | if (((d->state->matrix.type() > QTransform::TxTranslate || (sw != w || sh != h)) never evaluated: d->state->matrix.type() > QTransform::TxTranslate | 0 |
3207 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)) never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
3208 | || (!d->state->matrix.isAffine() && !d->engine->hasFeature(QPaintEngine::PerspectiveTransform)) never evaluated: !d->state->matrix.isAffine() never evaluated: !d->engine->hasFeature(QPaintEngine::PerspectiveTransform) | 0 |
3209 | || (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity))) never evaluated: d->state->opacity != 1.0 never evaluated: !d->engine->hasFeature(QPaintEngine::ConstantOpacity) | 0 |
3210 | { | - |
3211 | save(); | - |
3212 | | - |
3213 | | - |
3214 | if (d->state->matrix.type() <= QTransform::TxScale) { never evaluated: d->state->matrix.type() <= QTransform::TxScale | 0 |
3215 | const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); | - |
3216 | x = p.x(); | - |
3217 | y = p.y(); | - |
3218 | } | 0 |
3219 | | - |
3220 | if (d->state->matrix.type() <= QTransform::TxTranslate && sw == w && sh == h) { never evaluated: d->state->matrix.type() <= QTransform::TxTranslate | 0 |
3221 | sx = qRound(sx); | - |
3222 | sy = qRound(sy); | - |
3223 | sw = qRound(sw); | - |
3224 | sh = qRound(sh); | - |
3225 | } | 0 |
3226 | translate(x, y); | - |
3227 | scale(w / sw, h / sh); | - |
3228 | setBackgroundMode(Qt::TransparentMode); | - |
3229 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - |
3230 | QBrush brush(image); | - |
3231 | setBrush(brush); | - |
3232 | setPen(Qt::NoPen); | - |
3233 | setBrushOrigin(QPointF(-sx, -sy)); | - |
3234 | | - |
3235 | drawRect(QRectF(0, 0, sw, sh)); | - |
3236 | restore(); | - |
3237 | return; | 0 |
3238 | } | - |
3239 | | - |
3240 | if (d->state->matrix.type() == QTransform::TxTranslate never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
3241 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)) { never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
3242 | x += d->state->matrix.dx(); | - |
3243 | y += d->state->matrix.dy(); | - |
3244 | } | 0 |
3245 | | - |
3246 | d->engine->drawImage(QRectF(x, y, w, h), image, QRectF(sx, sy, sw, sh), flags); | - |
3247 | } | 0 |
3248 | void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) | - |
3249 | { | - |
3250 | QPainterPrivate * const d = d_func(); | - |
3251 | | - |
3252 | QRawFont font = glyphRun.rawFont(); | - |
3253 | if (!font.isValid()) partially evaluated: !font.isValid() no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
3254 | return; | 0 |
3255 | | - |
3256 | QGlyphRunPrivate *glyphRun_d = QGlyphRunPrivate::get(glyphRun); | - |
3257 | | - |
3258 | const quint32 *glyphIndexes = glyphRun_d->glyphIndexData; | - |
3259 | const QPointF *glyphPositions = glyphRun_d->glyphPositionData; | - |
3260 | | - |
3261 | int count = qMin(glyphRun_d->glyphIndexDataSize, glyphRun_d->glyphPositionDataSize); | - |
3262 | QVarLengthArray<QFixedPoint, 128> fixedPointPositions(count); | - |
3263 | | - |
3264 | QRawFontPrivate *fontD = QRawFontPrivate::get(font); | - |
3265 | bool supportsTransformations = d->extended partially evaluated: d->extended yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
3266 | ? d->extended->supportsTransformations(fontD->fontEngine, d->state->matrix) | - |
3267 | : d->engine->type() == QPaintEngine::CoreGraphics || d->state->matrix.isAffine(); | - |
3268 | | - |
3269 | for (int i=0; i<count; ++i) { evaluated: i<count yes Evaluation Count:35 | yes Evaluation Count:12 |
| 12-35 |
3270 | QPointF processedPosition = position + glyphPositions[i]; | - |
3271 | if (!supportsTransformations) partially evaluated: !supportsTransformations yes Evaluation Count:35 | no Evaluation Count:0 |
| 0-35 |
3272 | processedPosition = d->state->transform().map(processedPosition); executed: processedPosition = d->state->transform().map(processedPosition); Execution Count:35 | 35 |
3273 | fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition); | - |
3274 | } executed: } Execution Count:35 | 35 |
3275 | | - |
3276 | d->drawGlyphs(glyphIndexes, fixedPointPositions.data(), count, font, glyphRun.overline(), | - |
3277 | glyphRun.underline(), glyphRun.strikeOut()); | - |
3278 | } executed: } Execution Count:12 | 12 |
3279 | | - |
3280 | void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positions, | - |
3281 | int glyphCount, | - |
3282 | const QRawFont &font, bool overline, bool underline, | - |
3283 | bool strikeOut) | - |
3284 | { | - |
3285 | QPainter * const q = q_func(); | - |
3286 | | - |
3287 | updateState(state); | - |
3288 | | - |
3289 | QRawFontPrivate *fontD = QRawFontPrivate::get(font); | - |
3290 | QFontEngine *fontEngine = fontD->fontEngine; | - |
3291 | | - |
3292 | QFixed leftMost; | - |
3293 | QFixed rightMost; | - |
3294 | QFixed baseLine; | - |
3295 | for (int i=0; i<glyphCount; ++i) { evaluated: i<glyphCount yes Evaluation Count:35 | yes Evaluation Count:12 |
| 12-35 |
3296 | glyph_metrics_t gm = fontEngine->boundingBox(glyphArray[i]); | - |
3297 | if (i == 0 || leftMost > positions[i].x) evaluated: i == 0 yes Evaluation Count:12 | yes Evaluation Count:23 |
evaluated: leftMost > positions[i].x yes Evaluation Count:1 | yes Evaluation Count:22 |
| 1-23 |
3298 | leftMost = positions[i].x; executed: leftMost = positions[i].x; Execution Count:13 | 13 |
3299 | | - |
3300 | | - |
3301 | | - |
3302 | | - |
3303 | if (i == 0 || baseLine < positions[i].y) evaluated: i == 0 yes Evaluation Count:12 | yes Evaluation Count:23 |
evaluated: baseLine < positions[i].y yes Evaluation Count:3 | yes Evaluation Count:20 |
| 3-23 |
3304 | baseLine = positions[i].y; executed: baseLine = positions[i].y; Execution Count:15 | 15 |
3305 | | - |
3306 | | - |
3307 | if (i == 0 || rightMost < positions[i].x + gm.xoff) evaluated: i == 0 yes Evaluation Count:12 | yes Evaluation Count:23 |
evaluated: rightMost < positions[i].x + gm.xoff yes Evaluation Count:19 | yes Evaluation Count:4 |
| 4-23 |
3308 | rightMost = positions[i].x + gm.xoff; executed: rightMost = positions[i].x + gm.xoff; Execution Count:31 | 31 |
3309 | } executed: } Execution Count:35 | 35 |
3310 | | - |
3311 | QFixed width = rightMost - leftMost; | - |
3312 | | - |
3313 | if (extended != 0 && state->matrix.isAffine()) { partially evaluated: extended != 0 yes Evaluation Count:12 | no Evaluation Count:0 |
partially evaluated: state->matrix.isAffine() yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
3314 | QStaticTextItem staticTextItem; | - |
3315 | staticTextItem.color = state->pen.color(); | - |
3316 | staticTextItem.font = state->font; | - |
3317 | staticTextItem.setFontEngine(fontEngine); | - |
3318 | staticTextItem.numGlyphs = glyphCount; | - |
3319 | staticTextItem.glyphs = reinterpret_cast<glyph_t *>(const_cast<glyph_t *>(glyphArray)); | - |
3320 | staticTextItem.glyphPositions = positions; | - |
3321 | | - |
3322 | extended->drawStaticTextItem(&staticTextItem); | - |
3323 | } else { executed: } Execution Count:12 | 12 |
3324 | QTextItemInt textItem; | - |
3325 | textItem.fontEngine = fontEngine; | - |
3326 | | - |
3327 | QVarLengthArray<QFixed, 128> advances(glyphCount); | - |
3328 | QVarLengthArray<QGlyphJustification, 128> glyphJustifications(glyphCount); | - |
3329 | QVarLengthArray<HB_GlyphAttributes, 128> glyphAttributes(glyphCount); | - |
3330 | memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes)); | - |
3331 | memset(advances.data(), 0, advances.size() * sizeof(QFixed)); | - |
3332 | memset(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification)); | - |
3333 | | - |
3334 | textItem.glyphs.numGlyphs = glyphCount; | - |
3335 | textItem.glyphs.glyphs = reinterpret_cast<HB_Glyph *>(const_cast<quint32 *>(glyphArray)); | - |
3336 | textItem.glyphs.offsets = positions; | - |
3337 | textItem.glyphs.advances_x = advances.data(); | - |
3338 | textItem.glyphs.advances_y = advances.data(); | - |
3339 | textItem.glyphs.justifications = glyphJustifications.data(); | - |
3340 | textItem.glyphs.attributes = glyphAttributes.data(); | - |
3341 | | - |
3342 | engine->drawTextItem(QPointF(0, 0), textItem); | - |
3343 | } | 0 |
3344 | | - |
3345 | QTextItemInt::RenderFlags flags; | - |
3346 | if (underline) evaluated: underline yes Evaluation Count:2 | yes Evaluation Count:10 |
| 2-10 |
3347 | flags |= QTextItemInt::Underline; executed: flags |= QTextItemInt::Underline; Execution Count:2 | 2 |
3348 | if (overline) evaluated: overline yes Evaluation Count:1 | yes Evaluation Count:11 |
| 1-11 |
3349 | flags |= QTextItemInt::Overline; executed: flags |= QTextItemInt::Overline; Execution Count:1 | 1 |
3350 | if (strikeOut) evaluated: strikeOut yes Evaluation Count:1 | yes Evaluation Count:11 |
| 1-11 |
3351 | flags |= QTextItemInt::StrikeOut; executed: flags |= QTextItemInt::StrikeOut; Execution Count:1 | 1 |
3352 | | - |
3353 | drawTextItemDecoration(q, QPointF(leftMost.toReal(), baseLine.toReal()), | - |
3354 | fontEngine, | - |
3355 | 0, | - |
3356 | (underline | - |
3357 | ? QTextCharFormat::SingleUnderline | - |
3358 | : QTextCharFormat::NoUnderline), | - |
3359 | flags, width.toReal(), QTextCharFormat()); | - |
3360 | } executed: } Execution Count:12 | 12 |
3361 | void QPainter::drawText(const QPointF &p, const QString &str) | - |
3362 | { | - |
3363 | drawText(p, str, 0, 0); | - |
3364 | } executed: } Execution Count:899 | 899 |
3365 | void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText) | - |
3366 | { | - |
3367 | QPainterPrivate * const d = d_func(); | - |
3368 | if (!d->engine || staticText.text().isEmpty() || pen().style() == Qt::NoPen) never evaluated: !d->engine never evaluated: staticText.text().isEmpty() never evaluated: pen().style() == Qt::NoPen | 0 |
3369 | return; | 0 |
3370 | | - |
3371 | QStaticTextPrivate *staticText_d = | - |
3372 | const_cast<QStaticTextPrivate *>(QStaticTextPrivate::get(&staticText)); | - |
3373 | | - |
3374 | if (font() != staticText_d->font) { never evaluated: font() != staticText_d->font | 0 |
3375 | staticText_d->font = font(); | - |
3376 | staticText_d->needsRelayout = true; | - |
3377 | } | 0 |
3378 | | - |
3379 | | - |
3380 | | - |
3381 | if (d->extended == 0 || !d->state->matrix.isAffine()) { never evaluated: d->extended == 0 never evaluated: !d->state->matrix.isAffine() | 0 |
3382 | staticText_d->paintText(topLeftPosition, this); | - |
3383 | return; | 0 |
3384 | } | - |
3385 | | - |
3386 | QFontEngine *fe = staticText_d->font.d->engineForScript(QUnicodeTables::Common); | - |
3387 | if (fe->type() == QFontEngine::Multi) never evaluated: fe->type() == QFontEngine::Multi | 0 |
3388 | fe = static_cast<QFontEngineMulti *>(fe)->engine(0); never executed: fe = static_cast<QFontEngineMulti *>(fe)->engine(0); | 0 |
3389 | bool supportsTransformations = d->extended->supportsTransformations(fe, | - |
3390 | d->state->matrix); | - |
3391 | if (supportsTransformations && !staticText_d->untransformedCoordinates) { never evaluated: supportsTransformations never evaluated: !staticText_d->untransformedCoordinates | 0 |
3392 | staticText_d->untransformedCoordinates = true; | - |
3393 | staticText_d->needsRelayout = true; | - |
3394 | } else if (!supportsTransformations && staticText_d->untransformedCoordinates) { never evaluated: !supportsTransformations never evaluated: staticText_d->untransformedCoordinates | 0 |
3395 | staticText_d->untransformedCoordinates = false; | - |
3396 | staticText_d->needsRelayout = true; | - |
3397 | } | 0 |
3398 | | - |
3399 | | - |
3400 | | - |
3401 | QPointF transformedPosition = topLeftPosition; | - |
3402 | if (!staticText_d->untransformedCoordinates) never evaluated: !staticText_d->untransformedCoordinates | 0 |
3403 | transformedPosition = transformedPosition * d->state->matrix; never executed: transformedPosition = transformedPosition * d->state->matrix; | 0 |
3404 | QTransform oldMatrix; | - |
3405 | | - |
3406 | | - |
3407 | | - |
3408 | if (d->state->matrix.isTranslating() && !staticText_d->untransformedCoordinates) { never evaluated: d->state->matrix.isTranslating() never evaluated: !staticText_d->untransformedCoordinates | 0 |
3409 | qreal m11 = d->state->matrix.m11(); | - |
3410 | qreal m12 = d->state->matrix.m12(); | - |
3411 | qreal m13 = d->state->matrix.m13(); | - |
3412 | qreal m21 = d->state->matrix.m21(); | - |
3413 | qreal m22 = d->state->matrix.m22(); | - |
3414 | qreal m23 = d->state->matrix.m23(); | - |
3415 | qreal m33 = d->state->matrix.m33(); | - |
3416 | | - |
3417 | oldMatrix = d->state->matrix; | - |
3418 | d->state->matrix.setMatrix(m11, m12, m13, | - |
3419 | m21, m22, m23, | - |
3420 | 0.0, 0.0, m33); | - |
3421 | } | 0 |
3422 | | - |
3423 | | - |
3424 | | - |
3425 | bool staticTextNeedsReinit = staticText_d->needsRelayout; | - |
3426 | if (!staticText_d->untransformedCoordinates && staticText_d->matrix != d->state->matrix) { never evaluated: !staticText_d->untransformedCoordinates never evaluated: staticText_d->matrix != d->state->matrix | 0 |
3427 | staticText_d->matrix = d->state->matrix; | - |
3428 | staticTextNeedsReinit = true; | - |
3429 | } | 0 |
3430 | | - |
3431 | | - |
3432 | if (staticTextNeedsReinit) never evaluated: staticTextNeedsReinit | 0 |
3433 | staticText_d->init(); never executed: staticText_d->init(); | 0 |
3434 | | - |
3435 | if (transformedPosition != staticText_d->position) { never evaluated: transformedPosition != staticText_d->position | 0 |
3436 | QFixed fx = QFixed::fromReal(transformedPosition.x()); | - |
3437 | QFixed fy = QFixed::fromReal(transformedPosition.y()); | - |
3438 | QFixed oldX = QFixed::fromReal(staticText_d->position.x()); | - |
3439 | QFixed oldY = QFixed::fromReal(staticText_d->position.y()); | - |
3440 | for (int item=0; item<staticText_d->itemCount;++item) { never evaluated: item<staticText_d->itemCount | 0 |
3441 | QStaticTextItem *textItem = staticText_d->items + item; | - |
3442 | for (int i=0; i<textItem->numGlyphs; ++i) { never evaluated: i<textItem->numGlyphs | 0 |
3443 | textItem->glyphPositions[i].x += fx - oldX; | - |
3444 | textItem->glyphPositions[i].y += fy - oldY; | - |
3445 | } | 0 |
3446 | textItem->userDataNeedsUpdate = true; | - |
3447 | } | 0 |
3448 | | - |
3449 | staticText_d->position = transformedPosition; | - |
3450 | } | 0 |
3451 | | - |
3452 | QPen oldPen = d->state->pen; | - |
3453 | QColor currentColor = oldPen.color(); | - |
3454 | for (int i=0; i<staticText_d->itemCount; ++i) { never evaluated: i<staticText_d->itemCount | 0 |
3455 | QStaticTextItem *item = staticText_d->items + i; | - |
3456 | if (item->color.isValid() && currentColor != item->color) { never evaluated: item->color.isValid() never evaluated: currentColor != item->color | 0 |
3457 | setPen(item->color); | - |
3458 | currentColor = item->color; | - |
3459 | } | 0 |
3460 | d->extended->drawStaticTextItem(item); | - |
3461 | | - |
3462 | qt_draw_decoration_for_glyphs(this, item->glyphs, item->glyphPositions, | - |
3463 | item->numGlyphs, item->fontEngine(), staticText_d->font, | - |
3464 | QTextCharFormat()); | - |
3465 | } | 0 |
3466 | if (currentColor != oldPen.color()) never evaluated: currentColor != oldPen.color() | 0 |
3467 | setPen(oldPen); never executed: setPen(oldPen); | 0 |
3468 | | - |
3469 | if (!staticText_d->untransformedCoordinates && oldMatrix.isTranslating()) never evaluated: !staticText_d->untransformedCoordinates never evaluated: oldMatrix.isTranslating() | 0 |
3470 | d->state->matrix = oldMatrix; never executed: d->state->matrix = oldMatrix; | 0 |
3471 | } | 0 |
3472 | | - |
3473 | | - |
3474 | | - |
3475 | | - |
3476 | void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justificationPadding) | - |
3477 | { | - |
3478 | | - |
3479 | | - |
3480 | | - |
3481 | | - |
3482 | | - |
3483 | QPainterPrivate * const d = d_func(); | - |
3484 | | - |
3485 | if (!d->engine || str.isEmpty() || pen().style() == Qt::NoPen) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:899 |
evaluated: str.isEmpty() yes Evaluation Count:2 | yes Evaluation Count:897 |
partially evaluated: pen().style() == Qt::NoPen no Evaluation Count:0 | yes Evaluation Count:897 |
| 0-899 |
3486 | return; executed: return; Execution Count:2 | 2 |
3487 | | - |
3488 | if (tf & Qt::TextBypassShaping) { partially evaluated: tf & Qt::TextBypassShaping no Evaluation Count:0 | yes Evaluation Count:897 |
| 0-897 |
3489 | | - |
3490 | int len = str.length(); | - |
3491 | int numGlyphs = len; | - |
3492 | QVarLengthGlyphLayoutArray glyphs(len); | - |
3493 | QFontEngine *fontEngine = d->state->font.d->engineForScript(QUnicodeTables::Common); | - |
3494 | if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0)) { never evaluated: !fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0) | 0 |
3495 | glyphs.resize(numGlyphs); | - |
3496 | if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0)) never evaluated: !fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0) | 0 |
3497 | qt_noop(); never executed: qt_noop(); | 0 |
3498 | } | 0 |
3499 | | - |
3500 | QTextItemInt gf(glyphs, &d->state->font, str.data(), len, fontEngine); | - |
3501 | drawTextItem(p, gf); | - |
3502 | return; | 0 |
3503 | } | - |
3504 | | - |
3505 | QStackTextEngine engine(str, d->state->font); | - |
3506 | engine.option.setTextDirection(d->state->layoutDirection); | - |
3507 | if (tf & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft)) { partially evaluated: tf & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft) no Evaluation Count:0 | yes Evaluation Count:897 |
| 0-897 |
3508 | engine.ignoreBidi = true; | - |
3509 | engine.option.setTextDirection((tf & Qt::TextForceLeftToRight) ? Qt::LeftToRight : Qt::RightToLeft); | - |
3510 | } | 0 |
3511 | engine.itemize(); | - |
3512 | QScriptLine line; | - |
3513 | line.length = str.length(); | - |
3514 | engine.shapeLine(line); | - |
3515 | | - |
3516 | int nItems = engine.layoutData->items.size(); | - |
3517 | QVarLengthArray<int> visualOrder(nItems); | - |
3518 | QVarLengthArray<uchar> levels(nItems); | - |
3519 | for (int i = 0; i < nItems; ++i) evaluated: i < nItems yes Evaluation Count:897 | yes Evaluation Count:897 |
| 897 |
3520 | levels[i] = engine.layoutData->items[i].analysis.bidiLevel; executed: levels[i] = engine.layoutData->items[i].analysis.bidiLevel; Execution Count:897 | 897 |
3521 | QTextEngine::bidiReorder(nItems, levels.data(), visualOrder.data()); | - |
3522 | | - |
3523 | if (justificationPadding > 0) { partially evaluated: justificationPadding > 0 no Evaluation Count:0 | yes Evaluation Count:897 |
| 0-897 |
3524 | engine.option.setAlignment(Qt::AlignJustify); | - |
3525 | engine.forceJustification = true; | - |
3526 | | - |
3527 | line.width = justificationPadding; | - |
3528 | engine.justify(line); | - |
3529 | } | 0 |
3530 | QFixed x = QFixed::fromReal(p.x()); | - |
3531 | | - |
3532 | for (int i = 0; i < nItems; ++i) { evaluated: i < nItems yes Evaluation Count:897 | yes Evaluation Count:897 |
| 897 |
3533 | int item = visualOrder[i]; | - |
3534 | const QScriptItem &si = engine.layoutData->items.at(item); | - |
3535 | if (si.analysis.flags >= QScriptAnalysis::TabOrObject) { partially evaluated: si.analysis.flags >= QScriptAnalysis::TabOrObject no Evaluation Count:0 | yes Evaluation Count:897 |
| 0-897 |
3536 | x += si.width; | - |
3537 | continue; never executed: continue; | 0 |
3538 | } | - |
3539 | QFont f = engine.font(si); | - |
3540 | QTextItemInt gf(si, &f); | - |
3541 | gf.glyphs = engine.shapedGlyphs(&si); | - |
3542 | gf.chars = engine.layoutData->string.unicode() + si.position; | - |
3543 | gf.num_chars = engine.length(item); | - |
3544 | if (engine.forceJustification) { partially evaluated: engine.forceJustification no Evaluation Count:0 | yes Evaluation Count:897 |
| 0-897 |
3545 | for (int j=0; j<gf.glyphs.numGlyphs; ++j) never evaluated: j<gf.glyphs.numGlyphs | 0 |
3546 | gf.width += gf.glyphs.effectiveAdvance(j); never executed: gf.width += gf.glyphs.effectiveAdvance(j); | 0 |
3547 | } else { | 0 |
3548 | gf.width = si.width; | - |
3549 | } executed: } Execution Count:897 | 897 |
3550 | gf.logClusters = engine.logClusters(&si); | - |
3551 | | - |
3552 | drawTextItem(QPointF(x.toReal(), p.y()), gf); | - |
3553 | | - |
3554 | x += gf.width; | - |
3555 | } executed: } Execution Count:897 | 897 |
3556 | } executed: } Execution Count:897 | 897 |
3557 | | - |
3558 | void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br) | - |
3559 | { | - |
3560 | | - |
3561 | | - |
3562 | | - |
3563 | | - |
3564 | | - |
3565 | | - |
3566 | QPainterPrivate * const d = d_func(); | - |
3567 | | - |
3568 | if (!d->engine || str.length() == 0 || pen().style() == Qt::NoPen) evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:3930 |
evaluated: str.length() == 0 yes Evaluation Count:189 | yes Evaluation Count:3741 |
partially evaluated: pen().style() == Qt::NoPen no Evaluation Count:0 | yes Evaluation Count:3741 |
| 0-3930 |
3569 | return; executed: return; Execution Count:190 | 190 |
3570 | | - |
3571 | if (!d->extended) partially evaluated: !d->extended no Evaluation Count:0 | yes Evaluation Count:3741 |
| 0-3741 |
3572 | d->updateState(d->state); never executed: d->updateState(d->state); | 0 |
3573 | | - |
3574 | QRectF bounds; | - |
3575 | qt_format_text(d->state->font, r, flags, 0, str, br ? &bounds : 0, 0, 0, 0, this); | - |
3576 | if (br) partially evaluated: br no Evaluation Count:0 | yes Evaluation Count:3741 |
| 0-3741 |
3577 | *br = bounds.toAlignedRect(); never executed: *br = bounds.toAlignedRect(); | 0 |
3578 | } executed: } Execution Count:3741 | 3741 |
3579 | void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF *br) | - |
3580 | { | - |
3581 | | - |
3582 | | - |
3583 | | - |
3584 | | - |
3585 | | - |
3586 | | - |
3587 | QPainterPrivate * const d = d_func(); | - |
3588 | | - |
3589 | if (!d->engine || str.length() == 0 || pen().style() == Qt::NoPen) partially evaluated: !d->engine yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: str.length() == 0 never evaluated: pen().style() == Qt::NoPen | 0-1 |
3590 | return; executed: return; Execution Count:1 | 1 |
3591 | | - |
3592 | if (!d->extended) never evaluated: !d->extended | 0 |
3593 | d->updateState(d->state); never executed: d->updateState(d->state); | 0 |
3594 | | - |
3595 | qt_format_text(d->state->font, r, flags, 0, str, br, 0, 0, 0, this); | - |
3596 | } | 0 |
3597 | void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption &o) | - |
3598 | { | - |
3599 | | - |
3600 | | - |
3601 | | - |
3602 | | - |
3603 | | - |
3604 | | - |
3605 | QPainterPrivate * const d = d_func(); | - |
3606 | | - |
3607 | if (!d->engine || text.length() == 0 || pen().style() == Qt::NoPen) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: text.length() == 0 yes Evaluation Count:3 | no Evaluation Count:0 |
never evaluated: pen().style() == Qt::NoPen | 0-3 |
3608 | return; executed: return; Execution Count:3 | 3 |
3609 | | - |
3610 | if (!d->extended) never evaluated: !d->extended | 0 |
3611 | d->updateState(d->state); never executed: d->updateState(d->state); | 0 |
3612 | | - |
3613 | qt_format_text(d->state->font, r, 0, &o, text, 0, 0, 0, 0, this); | - |
3614 | } | 0 |
3615 | static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen) | - |
3616 | { | - |
3617 | const qreal radiusBase = qMax(qreal(1), maxRadius); | - |
3618 | | - |
3619 | QString key = QLatin1String("WaveUnderline-") | - |
3620 | % pen.color().name() | - |
3621 | % HexString<qreal>(radiusBase); | - |
3622 | | - |
3623 | QPixmap pixmap; | - |
3624 | if (QPixmapCache::find(key, pixmap)) never evaluated: QPixmapCache::find(key, pixmap) | 0 |
3625 | return pixmap; never executed: return pixmap; | 0 |
3626 | | - |
3627 | const qreal halfPeriod = qMax(qreal(2), qreal(radiusBase * 1.61803399)); | - |
3628 | const int width = qCeil(100 / (2 * halfPeriod)) * (2 * halfPeriod); | - |
3629 | const int radius = qFloor(radiusBase); | - |
3630 | | - |
3631 | QPainterPath path; | - |
3632 | | - |
3633 | qreal xs = 0; | - |
3634 | qreal ys = radius; | - |
3635 | | - |
3636 | while (xs < width) { never evaluated: xs < width | 0 |
3637 | xs += halfPeriod; | - |
3638 | ys = -ys; | - |
3639 | path.quadTo(xs - halfPeriod / 2, ys, xs, 0); | - |
3640 | } | 0 |
3641 | | - |
3642 | pixmap = QPixmap(width, radius * 2); | - |
3643 | pixmap.fill(Qt::transparent); | - |
3644 | { | - |
3645 | QPen wavePen = pen; | - |
3646 | wavePen.setCapStyle(Qt::SquareCap); | - |
3647 | | - |
3648 | | - |
3649 | | - |
3650 | const qreal maxPenWidth = .8 * radius; | - |
3651 | if (wavePen.widthF() > maxPenWidth) never evaluated: wavePen.widthF() > maxPenWidth | 0 |
3652 | wavePen.setWidth(maxPenWidth); never executed: wavePen.setWidth(maxPenWidth); | 0 |
3653 | | - |
3654 | QPainter imgPainter(&pixmap); | - |
3655 | imgPainter.setPen(wavePen); | - |
3656 | imgPainter.setRenderHint(QPainter::Antialiasing); | - |
3657 | imgPainter.translate(0, radius); | - |
3658 | imgPainter.drawPath(path); | - |
3659 | } | - |
3660 | | - |
3661 | QPixmapCache::insert(key, pixmap); | - |
3662 | | - |
3663 | return pixmap; never executed: return pixmap; | 0 |
3664 | } | - |
3665 | | - |
3666 | static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QFontEngine *fe, QTextEngine *textEngine, | - |
3667 | QTextCharFormat::UnderlineStyle underlineStyle, | - |
3668 | QTextItem::RenderFlags flags, qreal width, | - |
3669 | const QTextCharFormat &charFormat) | - |
3670 | { | - |
3671 | if (underlineStyle == QTextCharFormat::NoUnderline evaluated: underlineStyle == QTextCharFormat::NoUnderline yes Evaluation Count:22491 | yes Evaluation Count:540 |
| 540-22491 |
3672 | && !(flags & (QTextItem::StrikeOut | QTextItem::Overline))) evaluated: !(flags & (QTextItem::StrikeOut | QTextItem::Overline)) yes Evaluation Count:22487 | yes Evaluation Count:4 |
| 4-22487 |
3673 | return; executed: return; Execution Count:22487 | 22487 |
3674 | | - |
3675 | const QPen oldPen = painter->pen(); | - |
3676 | const QBrush oldBrush = painter->brush(); | - |
3677 | painter->setBrush(Qt::NoBrush); | - |
3678 | QPen pen = oldPen; | - |
3679 | pen.setStyle(Qt::SolidLine); | - |
3680 | pen.setWidthF(fe->lineThickness().toReal()); | - |
3681 | pen.setCapStyle(Qt::FlatCap); | - |
3682 | | - |
3683 | QLineF line(pos.x(), pos.y(), pos.x() + qFloor(width), pos.y()); | - |
3684 | | - |
3685 | bool wasCompatiblePainting = painter->renderHints() | - |
3686 | & QPainter::Qt4CompatiblePainting; | - |
3687 | | - |
3688 | if (wasCompatiblePainting) partially evaluated: wasCompatiblePainting no Evaluation Count:0 | yes Evaluation Count:544 |
| 0-544 |
3689 | painter->setRenderHint(QPainter::Qt4CompatiblePainting, false); never executed: painter->setRenderHint(QPainter::Qt4CompatiblePainting, false); | 0 |
3690 | | - |
3691 | const qreal underlineOffset = fe->underlinePosition().toReal(); | - |
3692 | | - |
3693 | | - |
3694 | const qreal underlinePos = pos.y() + qCeil(underlineOffset) + 0.5; | - |
3695 | | - |
3696 | if (underlineStyle == QTextCharFormat::SpellCheckUnderline) { partially evaluated: underlineStyle == QTextCharFormat::SpellCheckUnderline no Evaluation Count:0 | yes Evaluation Count:544 |
| 0-544 |
3697 | QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); | - |
3698 | if (theme) | 0 |
3699 | underlineStyle = QTextCharFormat::UnderlineStyle(theme->themeHint(QPlatformTheme::SpellCheckUnderlineStyle).toInt()); never executed: underlineStyle = QTextCharFormat::UnderlineStyle(theme->themeHint(QPlatformTheme::SpellCheckUnderlineStyle).toInt()); | 0 |
3700 | } | 0 |
3701 | | - |
3702 | if (underlineStyle == QTextCharFormat::WaveUnderline) { partially evaluated: underlineStyle == QTextCharFormat::WaveUnderline no Evaluation Count:0 | yes Evaluation Count:544 |
| 0-544 |
3703 | painter->save(); | - |
3704 | painter->translate(0, pos.y() + 1); | - |
3705 | | - |
3706 | QColor uc = charFormat.underlineColor(); | - |
3707 | if (uc.isValid()) never evaluated: uc.isValid() | 0 |
3708 | pen.setColor(uc); never executed: pen.setColor(uc); | 0 |
3709 | | - |
3710 | | - |
3711 | const QPixmap wave = generateWavyPixmap(qMax(underlineOffset, pen.widthF()), pen); | - |
3712 | const int descent = (int) fe->descent().toReal(); | - |
3713 | | - |
3714 | painter->setBrushOrigin(painter->brushOrigin().x(), 0); | - |
3715 | painter->fillRect(pos.x(), 0, qCeil(width), qMin(wave.height(), descent), wave); | - |
3716 | painter->restore(); | - |
3717 | } else if (underlineStyle != QTextCharFormat::NoUnderline) { evaluated: underlineStyle != QTextCharFormat::NoUnderline yes Evaluation Count:540 | yes Evaluation Count:4 |
| 0-540 |
3718 | QColor uc = charFormat.underlineColor(); | - |
3719 | if (uc.isValid()) partially evaluated: uc.isValid() no Evaluation Count:0 | yes Evaluation Count:540 |
| 0-540 |
3720 | pen.setColor(uc); never executed: pen.setColor(uc); | 0 |
3721 | | - |
3722 | pen.setStyle((Qt::PenStyle)(underlineStyle)); | - |
3723 | painter->setPen(pen); | - |
3724 | QLineF underline(line.x1(), underlinePos, line.x2(), underlinePos); | - |
3725 | if (textEngine) evaluated: textEngine yes Evaluation Count:538 | yes Evaluation Count:2 |
| 2-538 |
3726 | textEngine->addUnderline(painter, underline); executed: textEngine->addUnderline(painter, underline); Execution Count:538 | 538 |
3727 | else | - |
3728 | painter->drawLine(underline); executed: painter->drawLine(underline); Execution Count:2 | 2 |
3729 | } | - |
3730 | | - |
3731 | pen.setStyle(Qt::SolidLine); | - |
3732 | pen.setColor(oldPen.color()); | - |
3733 | | - |
3734 | if (flags & QTextItem::StrikeOut) { evaluated: flags & QTextItem::StrikeOut yes Evaluation Count:2 | yes Evaluation Count:542 |
| 2-542 |
3735 | QLineF strikeOutLine = line; | - |
3736 | strikeOutLine.translate(0., - fe->ascent().toReal() / 3.); | - |
3737 | painter->setPen(pen); | - |
3738 | if (textEngine) evaluated: textEngine yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
3739 | textEngine->addStrikeOut(painter, strikeOutLine); executed: textEngine->addStrikeOut(painter, strikeOutLine); Execution Count:1 | 1 |
3740 | else | - |
3741 | painter->drawLine(strikeOutLine); executed: painter->drawLine(strikeOutLine); Execution Count:1 | 1 |
3742 | } | - |
3743 | | - |
3744 | if (flags & QTextItem::Overline) { evaluated: flags & QTextItem::Overline yes Evaluation Count:2 | yes Evaluation Count:542 |
| 2-542 |
3745 | QLineF overline = line; | - |
3746 | overline.translate(0., - fe->ascent().toReal()); | - |
3747 | painter->setPen(pen); | - |
3748 | if (textEngine) evaluated: textEngine yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
3749 | textEngine->addOverline(painter, overline); executed: textEngine->addOverline(painter, overline); Execution Count:1 | 1 |
3750 | else | - |
3751 | painter->drawLine(overline); executed: painter->drawLine(overline); Execution Count:1 | 1 |
3752 | } | - |
3753 | | - |
3754 | painter->setPen(oldPen); | - |
3755 | painter->setBrush(oldBrush); | - |
3756 | | - |
3757 | if (wasCompatiblePainting) partially evaluated: wasCompatiblePainting no Evaluation Count:0 | yes Evaluation Count:544 |
| 0-544 |
3758 | painter->setRenderHint(QPainter::Qt4CompatiblePainting); never executed: painter->setRenderHint(QPainter::Qt4CompatiblePainting); | 0 |
3759 | } executed: } Execution Count:544 | 544 |
3760 | | - |
3761 | __attribute__((visibility("default"))) void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray, | - |
3762 | const QFixedPoint *positions, int glyphCount, | - |
3763 | QFontEngine *fontEngine, const QFont &font, | - |
3764 | const QTextCharFormat &charFormat) | - |
3765 | { | - |
3766 | if (!(font.underline() || font.strikeOut() || font.overline())) never evaluated: font.underline() never evaluated: font.strikeOut() never evaluated: font.overline() | 0 |
3767 | return; | 0 |
3768 | | - |
3769 | QFixed leftMost; | - |
3770 | QFixed rightMost; | - |
3771 | QFixed baseLine; | - |
3772 | for (int i=0; i<glyphCount; ++i) { never evaluated: i<glyphCount | 0 |
3773 | glyph_metrics_t gm = fontEngine->boundingBox(glyphArray[i]); | - |
3774 | if (i == 0 || leftMost > positions[i].x) never evaluated: leftMost > positions[i].x | 0 |
3775 | leftMost = positions[i].x; never executed: leftMost = positions[i].x; | 0 |
3776 | | - |
3777 | | - |
3778 | | - |
3779 | | - |
3780 | if (i == 0 || baseLine < positions[i].y) never evaluated: baseLine < positions[i].y | 0 |
3781 | baseLine = positions[i].y; never executed: baseLine = positions[i].y; | 0 |
3782 | | - |
3783 | | - |
3784 | if (i == 0 || rightMost < positions[i].x + gm.xoff) never evaluated: rightMost < positions[i].x + gm.xoff | 0 |
3785 | rightMost = positions[i].x + gm.xoff; never executed: rightMost = positions[i].x + gm.xoff; | 0 |
3786 | } | 0 |
3787 | | - |
3788 | QFixed width = rightMost - leftMost; | - |
3789 | QTextItem::RenderFlags flags = 0; | - |
3790 | | - |
3791 | if (font.underline()) never evaluated: font.underline() | 0 |
3792 | flags |= QTextItem::Underline; never executed: flags |= QTextItem::Underline; | 0 |
3793 | if (font.overline()) never evaluated: font.overline() | 0 |
3794 | flags |= QTextItem::Overline; never executed: flags |= QTextItem::Overline; | 0 |
3795 | if (font.strikeOut()) never evaluated: font.strikeOut() | 0 |
3796 | flags |= QTextItem::StrikeOut; never executed: flags |= QTextItem::StrikeOut; | 0 |
3797 | | - |
3798 | drawTextItemDecoration(painter, QPointF(leftMost.toReal(), baseLine.toReal()), | - |
3799 | fontEngine, | - |
3800 | 0, | - |
3801 | font.underline() ? QTextCharFormat::SingleUnderline | - |
3802 | : QTextCharFormat::NoUnderline, flags, | - |
3803 | width.toReal(), charFormat); | - |
3804 | } | 0 |
3805 | | - |
3806 | void QPainter::drawTextItem(const QPointF &p, const QTextItem &ti) | - |
3807 | { | - |
3808 | QPainterPrivate * const d = d_func(); | - |
3809 | | - |
3810 | d->drawTextItem(p, ti, static_cast<QTextEngine *>(0)); | - |
3811 | } executed: } Execution Count:897 | 897 |
3812 | | - |
3813 | void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QTextEngine *textEngine) | - |
3814 | { | - |
3815 | | - |
3816 | | - |
3817 | | - |
3818 | | - |
3819 | | - |
3820 | | - |
3821 | QPainter * const q = q_func(); | - |
3822 | | - |
3823 | if (!engine) partially evaluated: !engine no Evaluation Count:0 | yes Evaluation Count:23019 |
| 0-23019 |
3824 | return; | 0 |
3825 | | - |
3826 | | - |
3827 | | - |
3828 | | - |
3829 | | - |
3830 | | - |
3831 | | - |
3832 | QTextItemInt &ti = const_cast<QTextItemInt &>(static_cast<const QTextItemInt &>(_ti)); | - |
3833 | | - |
3834 | if (!extended && state->bgMode == Qt::OpaqueMode) { partially evaluated: !extended no Evaluation Count:0 | yes Evaluation Count:23019 |
never evaluated: state->bgMode == Qt::OpaqueMode | 0-23019 |
3835 | QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal()); | - |
3836 | q->fillRect(rect, state->bgBrush); | - |
3837 | } | 0 |
3838 | | - |
3839 | if (q->pen().style() == Qt::NoPen) partially evaluated: q->pen().style() == Qt::NoPen no Evaluation Count:0 | yes Evaluation Count:23019 |
| 0-23019 |
3840 | return; | 0 |
3841 | | - |
3842 | const QPainter::RenderHints oldRenderHints = state->renderHints; | - |
3843 | if (!state->renderHints & QPainter::Antialiasing && state->matrix.type() >= QTransform::TxScale) { partially evaluated: !state->renderHints & QPainter::Antialiasing no Evaluation Count:0 | yes Evaluation Count:23019 |
never evaluated: state->matrix.type() >= QTransform::TxScale | 0-23019 |
3844 | | - |
3845 | | - |
3846 | | - |
3847 | bool aa = true; | - |
3848 | const QTransform &m = state->matrix; | - |
3849 | if (state->matrix.type() < QTransform::TxShear) { never evaluated: state->matrix.type() < QTransform::TxShear | 0 |
3850 | bool isPlain90DegreeRotation = | - |
3851 | (qFuzzyIsNull(m.m11()) never evaluated: qFuzzyIsNull(m.m11()) | 0 |
3852 | && qFuzzyIsNull(m.m12() - qreal(1)) never evaluated: qFuzzyIsNull(m.m12() - qreal(1)) | 0 |
3853 | && qFuzzyIsNull(m.m21() + qreal(1)) never evaluated: qFuzzyIsNull(m.m21() + qreal(1)) | 0 |
3854 | && qFuzzyIsNull(m.m22()) never evaluated: qFuzzyIsNull(m.m22()) | 0 |
3855 | ) | - |
3856 | || | - |
3857 | (qFuzzyIsNull(m.m11() + qreal(1)) never evaluated: qFuzzyIsNull(m.m11() + qreal(1)) | 0 |
3858 | && qFuzzyIsNull(m.m12()) never evaluated: qFuzzyIsNull(m.m12()) | 0 |
3859 | && qFuzzyIsNull(m.m21()) never evaluated: qFuzzyIsNull(m.m21()) | 0 |
3860 | && qFuzzyIsNull(m.m22() + qreal(1)) never evaluated: qFuzzyIsNull(m.m22() + qreal(1)) | 0 |
3861 | ) | - |
3862 | || | - |
3863 | (qFuzzyIsNull(m.m11()) never evaluated: qFuzzyIsNull(m.m11()) | 0 |
3864 | && qFuzzyIsNull(m.m12() + qreal(1)) never evaluated: qFuzzyIsNull(m.m12() + qreal(1)) | 0 |
3865 | && qFuzzyIsNull(m.m21() - qreal(1)) never evaluated: qFuzzyIsNull(m.m21() - qreal(1)) | 0 |
3866 | && qFuzzyIsNull(m.m22()) never evaluated: qFuzzyIsNull(m.m22()) | 0 |
3867 | ) | - |
3868 | ; | - |
3869 | aa = !isPlain90DegreeRotation; | - |
3870 | } | 0 |
3871 | if (aa) | 0 |
3872 | q->setRenderHint(QPainter::Antialiasing, true); never executed: q->setRenderHint(QPainter::Antialiasing, true); | 0 |
3873 | } | 0 |
3874 | | - |
3875 | if (!extended) partially evaluated: !extended no Evaluation Count:0 | yes Evaluation Count:23019 |
| 0-23019 |
3876 | updateState(state); never executed: updateState(state); | 0 |
3877 | | - |
3878 | if (!ti.glyphs.numGlyphs) { evaluated: !ti.glyphs.numGlyphs yes Evaluation Count:2 | yes Evaluation Count:23017 |
| 2-23017 |
3879 | | - |
3880 | } else if (ti.fontEngine->type() == QFontEngine::Multi) { evaluated: ti.fontEngine->type() == QFontEngine::Multi yes Evaluation Count:23009 | yes Evaluation Count:8 |
executed: } Execution Count:2 | 2-23009 |
3881 | QFontEngineMulti *multi = static_cast<QFontEngineMulti *>(ti.fontEngine); | - |
3882 | | - |
3883 | const QGlyphLayout &glyphs = ti.glyphs; | - |
3884 | int which = glyphs.glyphs[0] >> 24; | - |
3885 | | - |
3886 | qreal x = p.x(); | - |
3887 | qreal y = p.y(); | - |
3888 | | - |
3889 | bool rtl = ti.flags & QTextItem::RightToLeft; | - |
3890 | if (rtl) evaluated: rtl yes Evaluation Count:13 | yes Evaluation Count:22996 |
| 13-22996 |
3891 | x += ti.width.toReal(); executed: x += ti.width.toReal(); Execution Count:13 | 13 |
3892 | | - |
3893 | int start = 0; | - |
3894 | int end, i; | - |
3895 | for (end = 0; end < ti.glyphs.numGlyphs; ++end) { evaluated: end < ti.glyphs.numGlyphs yes Evaluation Count:145541 | yes Evaluation Count:23009 |
| 23009-145541 |
3896 | const int e = glyphs.glyphs[end] >> 24; | - |
3897 | if (e == which) partially evaluated: e == which yes Evaluation Count:145541 | no Evaluation Count:0 |
| 0-145541 |
3898 | continue; executed: continue; Execution Count:145541 | 145541 |
3899 | | - |
3900 | | - |
3901 | QTextItemInt ti2 = ti.midItem(multi->engine(which), start, end - start); | - |
3902 | ti2.width = 0; | - |
3903 | | - |
3904 | for (i = start; i < end; ++i) { | 0 |
3905 | glyphs.glyphs[i] = glyphs.glyphs[i] & 0xffffff; | - |
3906 | ti2.width += ti.glyphs.effectiveAdvance(i); | - |
3907 | } | 0 |
3908 | | - |
3909 | if (rtl) | 0 |
3910 | x -= ti2.width.toReal(); never executed: x -= ti2.width.toReal(); | 0 |
3911 | | - |
3912 | engine->drawTextItem(QPointF(x, y), ti2); | - |
3913 | | - |
3914 | if (!rtl) | 0 |
3915 | x += ti2.width.toReal(); never executed: x += ti2.width.toReal(); | 0 |
3916 | | - |
3917 | | - |
3918 | const int hi = which << 24; | - |
3919 | for (i = start; i < end; ++i) { | 0 |
3920 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | - |
3921 | } | 0 |
3922 | | - |
3923 | | - |
3924 | start = end; | - |
3925 | which = e; | - |
3926 | } | 0 |
3927 | | - |
3928 | QTextItemInt ti2 = ti.midItem(multi->engine(which), start, end - start); | - |
3929 | ti2.width = 0; | - |
3930 | | - |
3931 | for (i = start; i < end; ++i) { evaluated: i < end yes Evaluation Count:145541 | yes Evaluation Count:23009 |
| 23009-145541 |
3932 | glyphs.glyphs[i] = glyphs.glyphs[i] & 0xffffff; | - |
3933 | ti2.width += ti.glyphs.effectiveAdvance(i); | - |
3934 | } executed: } Execution Count:145541 | 145541 |
3935 | | - |
3936 | if (rtl) evaluated: rtl yes Evaluation Count:13 | yes Evaluation Count:22996 |
| 13-22996 |
3937 | x -= ti2.width.toReal(); executed: x -= ti2.width.toReal(); Execution Count:13 | 13 |
3938 | | - |
3939 | if (extended) partially evaluated: extended yes Evaluation Count:23009 | no Evaluation Count:0 |
| 0-23009 |
3940 | extended->drawTextItem(QPointF(x, y), ti2); executed: extended->drawTextItem(QPointF(x, y), ti2); Execution Count:23009 | 23009 |
3941 | else | - |
3942 | engine->drawTextItem(QPointF(x,y), ti2); never executed: engine->drawTextItem(QPointF(x,y), ti2); | 0 |
3943 | | - |
3944 | | - |
3945 | const int hi = which << 24; | - |
3946 | for (i = start; i < end; ++i) evaluated: i < end yes Evaluation Count:145541 | yes Evaluation Count:23009 |
| 23009-145541 |
3947 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; Execution Count:145541 | 145541 |
3948 | | - |
3949 | } else { executed: } Execution Count:23009 | 23009 |
3950 | if (extended) partially evaluated: extended yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
3951 | extended->drawTextItem(p, ti); executed: extended->drawTextItem(p, ti); Execution Count:8 | 8 |
3952 | else | - |
3953 | engine->drawTextItem(p, ti); never executed: engine->drawTextItem(p, ti); | 0 |
3954 | } | - |
3955 | drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle, | - |
3956 | ti.flags, ti.width.toReal(), ti.charFormat); | - |
3957 | | - |
3958 | if (state->renderHints != oldRenderHints) { partially evaluated: state->renderHints != oldRenderHints no Evaluation Count:0 | yes Evaluation Count:23019 |
| 0-23019 |
3959 | state->renderHints = oldRenderHints; | - |
3960 | if (extended) never evaluated: extended | 0 |
3961 | extended->renderHintsChanged(); never executed: extended->renderHintsChanged(); | 0 |
3962 | else | - |
3963 | state->dirtyFlags |= QPaintEngine::DirtyHints; never executed: state->dirtyFlags |= QPaintEngine::DirtyHints; | 0 |
3964 | } | - |
3965 | } executed: } Execution Count:23019 | 23019 |
3966 | QRect QPainter::boundingRect(const QRect &rect, int flags, const QString &str) | - |
3967 | { | - |
3968 | if (str.isEmpty()) partially evaluated: str.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3969 | return QRect(rect.x(),rect.y(), 0,0); never executed: return QRect(rect.x(),rect.y(), 0,0); | 0 |
3970 | QRect brect; | - |
3971 | drawText(rect, flags | Qt::TextDontPrint, str, &brect); | - |
3972 | return brect; executed: return brect; Execution Count:1 | 1 |
3973 | } | - |
3974 | | - |
3975 | | - |
3976 | | - |
3977 | QRectF QPainter::boundingRect(const QRectF &rect, int flags, const QString &str) | - |
3978 | { | - |
3979 | if (str.isEmpty()) partially evaluated: str.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3980 | return QRectF(rect.x(),rect.y(), 0,0); never executed: return QRectF(rect.x(),rect.y(), 0,0); | 0 |
3981 | QRectF brect; | - |
3982 | drawText(rect, flags | Qt::TextDontPrint, str, &brect); | - |
3983 | return brect; executed: return brect; Execution Count:1 | 1 |
3984 | } | - |
3985 | QRectF QPainter::boundingRect(const QRectF &r, const QString &text, const QTextOption &o) | - |
3986 | { | - |
3987 | QPainterPrivate * const d = d_func(); | - |
3988 | | - |
3989 | if (!d->engine || text.length() == 0) never evaluated: !d->engine never evaluated: text.length() == 0 | 0 |
3990 | return QRectF(r.x(),r.y(), 0,0); never executed: return QRectF(r.x(),r.y(), 0,0); | 0 |
3991 | | - |
3992 | QRectF br; | - |
3993 | qt_format_text(d->state->font, r, Qt::TextDontPrint, &o, text, &br, 0, 0, 0, this); | - |
3994 | return br; never executed: return br; | 0 |
3995 | } | - |
3996 | void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &sp) | - |
3997 | { | - |
3998 | QPainterPrivate * const d = d_func(); | - |
3999 | if (!d->engine || pixmap.isNull() || r.isEmpty()) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:9 |
partially evaluated: pixmap.isNull() no Evaluation Count:0 | yes Evaluation Count:9 |
partially evaluated: r.isEmpty() no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
4000 | return; | 0 |
4001 | | - |
4002 | | - |
4003 | | - |
4004 | | - |
4005 | | - |
4006 | qreal sw = pixmap.width(); | - |
4007 | qreal sh = pixmap.height(); | - |
4008 | qreal sx = sp.x(); | - |
4009 | qreal sy = sp.y(); | - |
4010 | if (sx < 0) partially evaluated: sx < 0 no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
4011 | sx = qRound(sw) - qRound(-sx) % qRound(sw); never executed: sx = qRound(sw) - qRound(-sx) % qRound(sw); | 0 |
4012 | else | - |
4013 | sx = qRound(sx) % qRound(sw); executed: sx = qRound(sx) % qRound(sw); Execution Count:9 | 9 |
4014 | if (sy < 0) partially evaluated: sy < 0 no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
4015 | sy = qRound(sh) - -qRound(sy) % qRound(sh); never executed: sy = qRound(sh) - -qRound(sy) % qRound(sh); | 0 |
4016 | else | - |
4017 | sy = qRound(sy) % qRound(sh); executed: sy = qRound(sy) % qRound(sh); Execution Count:9 | 9 |
4018 | | - |
4019 | | - |
4020 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
4021 | d->extended->drawTiledPixmap(r, pixmap, QPointF(sx, sy)); | - |
4022 | return; executed: return; Execution Count:9 | 9 |
4023 | } | - |
4024 | | - |
4025 | if (d->state->bgMode == Qt::OpaqueMode && pixmap.isQBitmap()) never evaluated: d->state->bgMode == Qt::OpaqueMode never evaluated: pixmap.isQBitmap() | 0 |
4026 | fillRect(r, d->state->bgBrush); never executed: fillRect(r, d->state->bgBrush); | 0 |
4027 | | - |
4028 | d->updateState(d->state); | - |
4029 | if ((d->state->matrix.type() > QTransform::TxTranslate never evaluated: d->state->matrix.type() > QTransform::TxTranslate | 0 |
4030 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)) never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
4031 | || (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity))) never evaluated: d->state->opacity != 1.0 never evaluated: !d->engine->hasFeature(QPaintEngine::ConstantOpacity) | 0 |
4032 | { | - |
4033 | save(); | - |
4034 | setBackgroundMode(Qt::TransparentMode); | - |
4035 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - |
4036 | setBrush(QBrush(d->state->pen.color(), pixmap)); | - |
4037 | setPen(Qt::NoPen); | - |
4038 | | - |
4039 | | - |
4040 | | - |
4041 | if (d->state->matrix.type() <= QTransform::TxScale) { never evaluated: d->state->matrix.type() <= QTransform::TxScale | 0 |
4042 | const QPointF p = roundInDeviceCoordinates(r.topLeft(), d->state->matrix); | - |
4043 | | - |
4044 | if (d->state->matrix.type() <= QTransform::TxTranslate) { never evaluated: d->state->matrix.type() <= QTransform::TxTranslate | 0 |
4045 | sx = qRound(sx); | - |
4046 | sy = qRound(sy); | - |
4047 | } | 0 |
4048 | | - |
4049 | setBrushOrigin(QPointF(r.x()-sx, r.y()-sy)); | - |
4050 | drawRect(QRectF(p, r.size())); | - |
4051 | } else { | 0 |
4052 | setBrushOrigin(QPointF(r.x()-sx, r.y()-sy)); | - |
4053 | drawRect(r); | - |
4054 | } | 0 |
4055 | restore(); | - |
4056 | return; | 0 |
4057 | } | - |
4058 | | - |
4059 | qreal x = r.x(); | - |
4060 | qreal y = r.y(); | - |
4061 | if (d->state->matrix.type() == QTransform::TxTranslate never evaluated: d->state->matrix.type() == QTransform::TxTranslate | 0 |
4062 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)) { never evaluated: !d->engine->hasFeature(QPaintEngine::PixmapTransform) | 0 |
4063 | x += d->state->matrix.dx(); | - |
4064 | y += d->state->matrix.dy(); | - |
4065 | } | 0 |
4066 | | - |
4067 | d->engine->drawTiledPixmap(QRectF(x, y, r.width(), r.height()), pixmap, QPointF(sx, sy)); | - |
4068 | } | 0 |
4069 | void QPainter::drawPicture(const QPointF &p, const QPicture &picture) | - |
4070 | { | - |
4071 | QPainterPrivate * const d = d_func(); | - |
4072 | | - |
4073 | if (!d->engine) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
4074 | return; | 0 |
4075 | | - |
4076 | if (!d->extended) partially evaluated: !d->extended no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
4077 | d->updateState(d->state); never executed: d->updateState(d->state); | 0 |
4078 | | - |
4079 | save(); | - |
4080 | translate(p); | - |
4081 | const_cast<QPicture *>(&picture)->play(this); | - |
4082 | restore(); | - |
4083 | } executed: } Execution Count:1 | 1 |
4084 | void QPainter::eraseRect(const QRectF &r) | - |
4085 | { | - |
4086 | QPainterPrivate * const d = d_func(); | - |
4087 | | - |
4088 | fillRect(r, d->state->bgBrush); | - |
4089 | } executed: } Execution Count:55 | 55 |
4090 | | - |
4091 | static inline bool needsResolving(const QBrush &brush) | - |
4092 | { | - |
4093 | Qt::BrushStyle s = brush.style(); | - |
4094 | return ((s == Qt::LinearGradientPattern || s == Qt::RadialGradientPattern || | 20 |
4095 | s == Qt::ConicalGradientPattern) && | 20 |
4096 | brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode); executed: return ((s == Qt::LinearGradientPattern || s == Qt::RadialGradientPattern || s == Qt::ConicalGradientPattern) && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode); Execution Count:20 | 20 |
4097 | } | - |
4098 | void QPainter::fillRect(const QRectF &r, const QBrush &brush) | - |
4099 | { | - |
4100 | QPainterPrivate * const d = d_func(); | - |
4101 | | - |
4102 | if (!d->engine) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:961 |
| 0-961 |
4103 | return; | 0 |
4104 | | - |
4105 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:961 | no Evaluation Count:0 |
| 0-961 |
4106 | const QGradient *g = brush.gradient(); | - |
4107 | if (!g || g->coordinateMode() == QGradient::LogicalMode) { evaluated: !g yes Evaluation Count:459 | yes Evaluation Count:502 |
partially evaluated: g->coordinateMode() == QGradient::LogicalMode yes Evaluation Count:502 | no Evaluation Count:0 |
| 0-502 |
4108 | d->extended->fillRect(r, brush); | - |
4109 | return; executed: return; Execution Count:961 | 961 |
4110 | } | - |
4111 | } | 0 |
4112 | | - |
4113 | QPen oldPen = pen(); | - |
4114 | QBrush oldBrush = this->brush(); | - |
4115 | setPen(Qt::NoPen); | - |
4116 | if (brush.style() == Qt::SolidPattern) { never evaluated: brush.style() == Qt::SolidPattern | 0 |
4117 | d->colorBrush.setStyle(Qt::SolidPattern); | - |
4118 | d->colorBrush.setColor(brush.color()); | - |
4119 | setBrush(d->colorBrush); | - |
4120 | } else { | 0 |
4121 | setBrush(brush); | - |
4122 | } | 0 |
4123 | | - |
4124 | drawRect(r); | - |
4125 | setBrush(oldBrush); | - |
4126 | setPen(oldPen); | - |
4127 | } | 0 |
4128 | void QPainter::fillRect(const QRect &r, const QBrush &brush) | - |
4129 | { | - |
4130 | QPainterPrivate * const d = d_func(); | - |
4131 | | - |
4132 | if (!d->engine) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:58657 |
| 0-58657 |
4133 | return; | 0 |
4134 | | - |
4135 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:58658 | no Evaluation Count:0 |
| 0-58658 |
4136 | const QGradient *g = brush.gradient(); | - |
4137 | if (!g || g->coordinateMode() == QGradient::LogicalMode) { evaluated: !g yes Evaluation Count:42471 | yes Evaluation Count:16187 |
evaluated: g->coordinateMode() == QGradient::LogicalMode yes Evaluation Count:16186 | yes Evaluation Count:2 |
| 2-42471 |
4138 | d->extended->fillRect(r, brush); | - |
4139 | return; executed: return; Execution Count:58642 | 58642 |
4140 | } | - |
4141 | } executed: } Execution Count:2 | 2 |
4142 | | - |
4143 | QPen oldPen = pen(); | - |
4144 | QBrush oldBrush = this->brush(); | - |
4145 | setPen(Qt::NoPen); | - |
4146 | if (brush.style() == Qt::SolidPattern) { partially evaluated: brush.style() == Qt::SolidPattern no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
4147 | d->colorBrush.setStyle(Qt::SolidPattern); | - |
4148 | d->colorBrush.setColor(brush.color()); | - |
4149 | setBrush(d->colorBrush); | - |
4150 | } else { | 0 |
4151 | setBrush(brush); | - |
4152 | } executed: } Execution Count:2 | 2 |
4153 | | - |
4154 | drawRect(r); | - |
4155 | setBrush(oldBrush); | - |
4156 | setPen(oldPen); | - |
4157 | } executed: } Execution Count:2 | 2 |
4158 | void QPainter::fillRect(const QRect &r, const QColor &color) | - |
4159 | { | - |
4160 | QPainterPrivate * const d = d_func(); | - |
4161 | | - |
4162 | if (!d->engine) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:2934 |
| 0-2934 |
4163 | return; | 0 |
4164 | | - |
4165 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:2934 | no Evaluation Count:0 |
| 0-2934 |
4166 | d->extended->fillRect(r, color); | - |
4167 | return; executed: return; Execution Count:2934 | 2934 |
4168 | } | - |
4169 | | - |
4170 | fillRect(r, QBrush(color)); | - |
4171 | } | 0 |
4172 | void QPainter::fillRect(const QRectF &r, const QColor &color) | - |
4173 | { | - |
4174 | QPainterPrivate * const d = d_func(); | - |
4175 | | - |
4176 | if (!d->engine) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:89 |
| 0-89 |
4177 | return; | 0 |
4178 | | - |
4179 | if (d->extended) { partially evaluated: d->extended yes Evaluation Count:89 | no Evaluation Count:0 |
| 0-89 |
4180 | d->extended->fillRect(r, color); | - |
4181 | return; executed: return; Execution Count:89 | 89 |
4182 | } | - |
4183 | | - |
4184 | fillRect(r, QBrush(color)); | - |
4185 | } | 0 |
4186 | void QPainter::setRenderHint(RenderHint hint, bool on) | - |
4187 | { | - |
4188 | setRenderHints(hint, on); | - |
4189 | } executed: } Execution Count:1354 | 1354 |
4190 | void QPainter::setRenderHints(RenderHints hints, bool on) | - |
4191 | { | - |
4192 | QPainterPrivate * const d = d_func(); | - |
4193 | | - |
4194 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:2 | yes Evaluation Count:5426 |
| 2-5426 |
4195 | QMessageLogger("painting/qpainter.cpp", 7054, __PRETTY_FUNCTION__).warning("QPainter::setRenderHint: Painter must be active to set rendering hints"); | - |
4196 | return; executed: return; Execution Count:2 | 2 |
4197 | } | - |
4198 | | - |
4199 | if (on) evaluated: on yes Evaluation Count:3311 | yes Evaluation Count:2115 |
| 2115-3311 |
4200 | d->state->renderHints |= hints; executed: d->state->renderHints |= hints; Execution Count:3311 | 3311 |
4201 | else | - |
4202 | d->state->renderHints &= ~hints; executed: d->state->renderHints &= ~hints; Execution Count:2115 | 2115 |
4203 | | - |
4204 | if (d->extended) partially evaluated: d->extended yes Evaluation Count:5426 | no Evaluation Count:0 |
| 0-5426 |
4205 | d->extended->renderHintsChanged(); executed: d->extended->renderHintsChanged(); Execution Count:5426 | 5426 |
4206 | else | - |
4207 | d->state->dirtyFlags |= QPaintEngine::DirtyHints; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyHints; | 0 |
4208 | } | - |
4209 | | - |
4210 | | - |
4211 | | - |
4212 | | - |
4213 | | - |
4214 | | - |
4215 | | - |
4216 | QPainter::RenderHints QPainter::renderHints() const | - |
4217 | { | - |
4218 | const QPainterPrivate * const d = d_func(); | - |
4219 | | - |
4220 | if (!d->engine) evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:28321 |
| 1-28321 |
4221 | return 0; executed: return 0; Execution Count:1 | 1 |
4222 | | - |
4223 | return d->state->renderHints; executed: return d->state->renderHints; Execution Count:28321 | 28321 |
4224 | } | - |
4225 | bool QPainter::viewTransformEnabled() const | - |
4226 | { | - |
4227 | const QPainterPrivate * const d = d_func(); | - |
4228 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
4229 | QMessageLogger("painting/qpainter.cpp", 7105, __PRETTY_FUNCTION__).warning("QPainter::viewTransformEnabled: Painter not active"); | - |
4230 | return false; executed: return false; Execution Count:1 | 1 |
4231 | } | - |
4232 | return d->state->VxF; executed: return d->state->VxF; Execution Count:2 | 2 |
4233 | } | - |
4234 | void QPainter::setWindow(const QRect &r) | - |
4235 | { | - |
4236 | | - |
4237 | | - |
4238 | | - |
4239 | | - |
4240 | | - |
4241 | QPainterPrivate * const d = d_func(); | - |
4242 | | - |
4243 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-6 |
4244 | QMessageLogger("painting/qpainter.cpp", 7146, __PRETTY_FUNCTION__).warning("QPainter::setWindow: Painter not active"); | - |
4245 | return; executed: return; Execution Count:1 | 1 |
4246 | } | - |
4247 | | - |
4248 | d->state->wx = r.x(); | - |
4249 | d->state->wy = r.y(); | - |
4250 | d->state->ww = r.width(); | - |
4251 | d->state->wh = r.height(); | - |
4252 | | - |
4253 | d->state->VxF = true; | - |
4254 | d->updateMatrix(); | - |
4255 | } executed: } Execution Count:6 | 6 |
4256 | | - |
4257 | | - |
4258 | | - |
4259 | | - |
4260 | | - |
4261 | | - |
4262 | | - |
4263 | QRect QPainter::window() const | - |
4264 | { | - |
4265 | const QPainterPrivate * const d = d_func(); | - |
4266 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:9 |
| 1-9 |
4267 | QMessageLogger("painting/qpainter.cpp", 7169, __PRETTY_FUNCTION__).warning("QPainter::window: Painter not active"); | - |
4268 | return QRect(); executed: return QRect(); Execution Count:1 | 1 |
4269 | } | - |
4270 | return QRect(d->state->wx, d->state->wy, d->state->ww, d->state->wh); executed: return QRect(d->state->wx, d->state->wy, d->state->ww, d->state->wh); Execution Count:9 | 9 |
4271 | } | - |
4272 | void QPainter::setViewport(const QRect &r) | - |
4273 | { | - |
4274 | | - |
4275 | | - |
4276 | | - |
4277 | | - |
4278 | | - |
4279 | QPainterPrivate * const d = d_func(); | - |
4280 | | - |
4281 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
4282 | QMessageLogger("painting/qpainter.cpp", 7210, __PRETTY_FUNCTION__).warning("QPainter::setViewport: Painter not active"); | - |
4283 | return; executed: return; Execution Count:1 | 1 |
4284 | } | - |
4285 | | - |
4286 | d->state->vx = r.x(); | - |
4287 | d->state->vy = r.y(); | - |
4288 | d->state->vw = r.width(); | - |
4289 | d->state->vh = r.height(); | - |
4290 | | - |
4291 | d->state->VxF = true; | - |
4292 | d->updateMatrix(); | - |
4293 | } executed: } Execution Count:5 | 5 |
4294 | | - |
4295 | | - |
4296 | | - |
4297 | | - |
4298 | | - |
4299 | | - |
4300 | | - |
4301 | QRect QPainter::viewport() const | - |
4302 | { | - |
4303 | const QPainterPrivate * const d = d_func(); | - |
4304 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:10 |
| 1-10 |
4305 | QMessageLogger("painting/qpainter.cpp", 7233, __PRETTY_FUNCTION__).warning("QPainter::viewport: Painter not active"); | - |
4306 | return QRect(); executed: return QRect(); Execution Count:1 | 1 |
4307 | } | - |
4308 | return QRect(d->state->vx, d->state->vy, d->state->vw, d->state->vh); executed: return QRect(d->state->vx, d->state->vy, d->state->vw, d->state->vh); Execution Count:10 | 10 |
4309 | } | - |
4310 | void QPainter::setViewTransformEnabled(bool enable) | - |
4311 | { | - |
4312 | | - |
4313 | | - |
4314 | | - |
4315 | | - |
4316 | | - |
4317 | QPainterPrivate * const d = d_func(); | - |
4318 | | - |
4319 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:11 |
| 1-11 |
4320 | QMessageLogger("painting/qpainter.cpp", 7257, __PRETTY_FUNCTION__).warning("QPainter::setViewTransformEnabled: Painter not active"); | - |
4321 | return; executed: return; Execution Count:1 | 1 |
4322 | } | - |
4323 | | - |
4324 | if (enable == d->state->VxF) evaluated: enable == d->state->VxF yes Evaluation Count:10 | yes Evaluation Count:1 |
| 1-10 |
4325 | return; executed: return; Execution Count:10 | 10 |
4326 | | - |
4327 | d->state->VxF = enable; | - |
4328 | d->updateMatrix(); | - |
4329 | } executed: } Execution Count:1 | 1 |
4330 | void QPainter::setRedirected(const QPaintDevice *device, | - |
4331 | QPaintDevice *replacement, | - |
4332 | const QPoint &offset) | - |
4333 | { | - |
4334 | qt_noop(); | - |
4335 | (void)device; | - |
4336 | (void)replacement; | - |
4337 | (void)offset; | - |
4338 | QMessageLogger("painting/qpainter.cpp", 7299, __PRETTY_FUNCTION__).warning("QPainter::setRedirected(): ignoring call to deprecated function, use QWidget::render() instead"); | - |
4339 | } | 0 |
4340 | void QPainter::restoreRedirected(const QPaintDevice *device) | - |
4341 | { | - |
4342 | (void)device; | - |
4343 | QMessageLogger("painting/qpainter.cpp", 7322, __PRETTY_FUNCTION__).warning("QPainter::restoreRedirected(): ignoring call to deprecated function, use QWidget::render() instead"); | - |
4344 | } | 0 |
4345 | QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset) | - |
4346 | { | - |
4347 | (void)device; | - |
4348 | (void)offset; | - |
4349 | return 0; executed: return 0; Execution Count:90 | 90 |
4350 | } | - |
4351 | | - |
4352 | void qt_format_text(const QFont &fnt, const QRectF &_r, | - |
4353 | int tf, const QString& str, QRectF *brect, | - |
4354 | int tabstops, int *ta, int tabarraylen, | - |
4355 | QPainter *painter) | - |
4356 | { | - |
4357 | qt_format_text(fnt, _r, | - |
4358 | tf, 0, str, brect, | - |
4359 | tabstops, ta, tabarraylen, | - |
4360 | painter); | - |
4361 | } executed: } Execution Count:31890 | 31890 |
4362 | void qt_format_text(const QFont &fnt, const QRectF &_r, | - |
4363 | int tf, const QTextOption *option, const QString& str, QRectF *brect, | - |
4364 | int tabstops, int *ta, int tabarraylen, | - |
4365 | QPainter *painter) | - |
4366 | { | - |
4367 | | - |
4368 | qt_noop(); | - |
4369 | | - |
4370 | if (option) { partially evaluated: option no Evaluation Count:0 | yes Evaluation Count:35631 |
| 0-35631 |
4371 | tf |= option->alignment(); | - |
4372 | if (option->wrapMode() != QTextOption::NoWrap) never evaluated: option->wrapMode() != QTextOption::NoWrap | 0 |
4373 | tf |= Qt::TextWordWrap; never executed: tf |= Qt::TextWordWrap; | 0 |
4374 | | - |
4375 | if (option->flags() & QTextOption::IncludeTrailingSpaces) never evaluated: option->flags() & QTextOption::IncludeTrailingSpaces | 0 |
4376 | tf |= Qt::TextIncludeTrailingSpaces; never executed: tf |= Qt::TextIncludeTrailingSpaces; | 0 |
4377 | | - |
4378 | if (option->tabStop() >= 0 || !option->tabArray().isEmpty()) never evaluated: option->tabStop() >= 0 never evaluated: !option->tabArray().isEmpty() | 0 |
4379 | tf |= Qt::TextExpandTabs; never executed: tf |= Qt::TextExpandTabs; | 0 |
4380 | } | 0 |
4381 | | - |
4382 | | - |
4383 | QRectF r(_r); | - |
4384 | | - |
4385 | bool dontclip = (tf & Qt::TextDontClip); | - |
4386 | bool wordwrap = (tf & Qt::TextWordWrap) || (tf & Qt::TextWrapAnywhere); evaluated: (tf & Qt::TextWordWrap) yes Evaluation Count:511 | yes Evaluation Count:35120 |
partially evaluated: (tf & Qt::TextWrapAnywhere) no Evaluation Count:0 | yes Evaluation Count:35120 |
| 0-35120 |
4387 | bool singleline = (tf & Qt::TextSingleLine); | - |
4388 | bool showmnemonic = (tf & Qt::TextShowMnemonic); | - |
4389 | bool hidemnmemonic = (tf & Qt::TextHideMnemonic); | - |
4390 | | - |
4391 | Qt::LayoutDirection layout_direction; | - |
4392 | if (tf & Qt::TextForceLeftToRight) evaluated: tf & Qt::TextForceLeftToRight yes Evaluation Count:454 | yes Evaluation Count:35177 |
| 454-35177 |
4393 | layout_direction = Qt::LeftToRight; executed: layout_direction = Qt::LeftToRight; Execution Count:454 | 454 |
4394 | else if (tf & Qt::TextForceRightToLeft) evaluated: tf & Qt::TextForceRightToLeft yes Evaluation Count:1 | yes Evaluation Count:35176 |
| 1-35176 |
4395 | layout_direction = Qt::RightToLeft; executed: layout_direction = Qt::RightToLeft; Execution Count:1 | 1 |
4396 | else if (option) partially evaluated: option no Evaluation Count:0 | yes Evaluation Count:35176 |
| 0-35176 |
4397 | layout_direction = option->textDirection(); never executed: layout_direction = option->textDirection(); | 0 |
4398 | else if (painter) evaluated: painter yes Evaluation Count:3286 | yes Evaluation Count:31890 |
| 3286-31890 |
4399 | layout_direction = painter->layoutDirection(); executed: layout_direction = painter->layoutDirection(); Execution Count:3286 | 3286 |
4400 | else | - |
4401 | layout_direction = Qt::LeftToRight; executed: layout_direction = Qt::LeftToRight; Execution Count:31890 | 31890 |
4402 | | - |
4403 | tf = QGuiApplicationPrivate::visualAlignment(layout_direction, QFlag(tf)); | - |
4404 | | - |
4405 | bool isRightToLeft = layout_direction == Qt::RightToLeft; | - |
4406 | bool expandtabs = ((tf & Qt::TextExpandTabs) && evaluated: (tf & Qt::TextExpandTabs) yes Evaluation Count:3341 | yes Evaluation Count:32290 |
| 3341-32290 |
4407 | (((tf & Qt::AlignLeft) && !isRightToLeft) || evaluated: (tf & Qt::AlignLeft) yes Evaluation Count:3282 | yes Evaluation Count:59 |
partially evaluated: !isRightToLeft yes Evaluation Count:3282 | no Evaluation Count:0 |
| 0-3282 |
4408 | ((tf & Qt::AlignRight) && isRightToLeft))); evaluated: (tf & Qt::AlignRight) yes Evaluation Count:56 | yes Evaluation Count:3 |
evaluated: isRightToLeft yes Evaluation Count:1 | yes Evaluation Count:55 |
| 1-56 |
4409 | | - |
4410 | if (!painter) evaluated: !painter yes Evaluation Count:31890 | yes Evaluation Count:3741 |
| 3741-31890 |
4411 | tf |= Qt::TextDontPrint; executed: tf |= Qt::TextDontPrint; Execution Count:31890 | 31890 |
4412 | | - |
4413 | uint maxUnderlines = 0; | - |
4414 | int numUnderlines = 0; | - |
4415 | QVarLengthArray<int, 32> underlinePositions(1); | - |
4416 | | - |
4417 | QFontMetricsF fm(fnt); | - |
4418 | QString text = str; | - |
4419 | int offset = 0; | - |
4420 | start_lengthVariant: code before this statement executed: start_lengthVariant: Execution Count:35631 | 35631 |
4421 | bool hasMoreLengthVariants = false; | - |
4422 | | - |
4423 | | - |
4424 | int old_offset = offset; | - |
4425 | for (; offset < text.length(); offset++) { evaluated: offset < text.length() yes Evaluation Count:144043 | yes Evaluation Count:35631 |
| 35631-144043 |
4426 | QChar chr = text.at(offset); | - |
4427 | if (chr == QLatin1Char('\r') || (singleline && chr == QLatin1Char('\n'))) { partially evaluated: chr == QLatin1Char('\r') no Evaluation Count:0 | yes Evaluation Count:144043 |
evaluated: singleline yes Evaluation Count:12439 | yes Evaluation Count:131604 |
evaluated: chr == QLatin1Char('\n') yes Evaluation Count:6 | yes Evaluation Count:12433 |
| 0-144043 |
4428 | text[offset] = QLatin1Char(' '); | - |
4429 | } else if (chr == QLatin1Char('\n')) { evaluated: chr == QLatin1Char('\n') yes Evaluation Count:124 | yes Evaluation Count:143913 |
executed: } Execution Count:6 | 6-143913 |
4430 | text[offset] = QChar::LineSeparator; | - |
4431 | } else if (chr == QLatin1Char('&')) { evaluated: chr == QLatin1Char('&') yes Evaluation Count:2171 | yes Evaluation Count:141742 |
executed: } Execution Count:124 | 124-141742 |
4432 | ++maxUnderlines; | - |
4433 | } else if (chr == QLatin1Char('\t')) { partially evaluated: chr == QLatin1Char('\t') no Evaluation Count:0 | yes Evaluation Count:141742 |
executed: } Execution Count:2171 | 0-141742 |
4434 | if (!expandtabs) { never evaluated: !expandtabs | 0 |
4435 | text[offset] = QLatin1Char(' '); | - |
4436 | } else if (!tabarraylen && !tabstops) { never evaluated: !tabarraylen never evaluated: !tabstops | 0 |
4437 | tabstops = qRound(fm.width(QLatin1Char('x'))*8); | - |
4438 | } | 0 |
4439 | } else if (chr == QChar(ushort(0x9c))) { partially evaluated: chr == QChar(ushort(0x9c)) no Evaluation Count:0 | yes Evaluation Count:141742 |
| 0-141742 |
4440 | | - |
4441 | hasMoreLengthVariants = true; | - |
4442 | break; | 0 |
4443 | } | - |
4444 | } | - |
4445 | | - |
4446 | int length = offset - old_offset; | - |
4447 | if ((hidemnmemonic || showmnemonic) && maxUnderlines > 0) { partially evaluated: hidemnmemonic no Evaluation Count:0 | yes Evaluation Count:35631 |
evaluated: showmnemonic yes Evaluation Count:5961 | yes Evaluation Count:29670 |
evaluated: maxUnderlines > 0 yes Evaluation Count:2164 | yes Evaluation Count:3797 |
| 0-35631 |
4448 | underlinePositions.resize(maxUnderlines + 1); | - |
4449 | | - |
4450 | QChar *cout = text.data() + old_offset; | - |
4451 | QChar *cin = cout; | - |
4452 | int l = length; | - |
4453 | while (l) { evaluated: l yes Evaluation Count:14376 | yes Evaluation Count:2164 |
| 2164-14376 |
4454 | if (*cin == QLatin1Char('&')) { evaluated: *cin == QLatin1Char('&') yes Evaluation Count:2168 | yes Evaluation Count:12208 |
| 2168-12208 |
4455 | ++cin; | - |
4456 | --length; | - |
4457 | --l; | - |
4458 | if (!l) partially evaluated: !l no Evaluation Count:0 | yes Evaluation Count:2168 |
| 0-2168 |
4459 | break; | 0 |
4460 | if (*cin != QLatin1Char('&') && !hidemnmemonic) partially evaluated: *cin != QLatin1Char('&') yes Evaluation Count:2168 | no Evaluation Count:0 |
partially evaluated: !hidemnmemonic yes Evaluation Count:2168 | no Evaluation Count:0 |
| 0-2168 |
4461 | underlinePositions[numUnderlines++] = cout - text.data() - old_offset; executed: underlinePositions[numUnderlines++] = cout - text.data() - old_offset; Execution Count:2168 | 2168 |
4462 | } executed: } Execution Count:2168 | 2168 |
4463 | *cout = *cin; | - |
4464 | ++cout; | - |
4465 | ++cin; | - |
4466 | --l; | - |
4467 | } executed: } Execution Count:14376 | 14376 |
4468 | } executed: } Execution Count:2164 | 2164 |
4469 | | - |
4470 | | - |
4471 | if (tf & Qt::TextDontPrint) evaluated: tf & Qt::TextDontPrint yes Evaluation Count:31890 | yes Evaluation Count:3741 |
| 3741-31890 |
4472 | numUnderlines = 0; executed: numUnderlines = 0; Execution Count:31890 | 31890 |
4473 | | - |
4474 | underlinePositions[numUnderlines] = -1; | - |
4475 | qreal height = 0; | - |
4476 | qreal width = 0; | - |
4477 | | - |
4478 | QString finalText = text.mid(old_offset, length); | - |
4479 | QStackTextEngine engine(finalText, fnt); | - |
4480 | if (option) { partially evaluated: option no Evaluation Count:0 | yes Evaluation Count:35631 |
| 0-35631 |
4481 | engine.option = *option; | - |
4482 | } | 0 |
4483 | | - |
4484 | if (engine.option.tabStop() < 0 && tabstops > 0) partially evaluated: engine.option.tabStop() < 0 yes Evaluation Count:35631 | no Evaluation Count:0 |
partially evaluated: tabstops > 0 no Evaluation Count:0 | yes Evaluation Count:35631 |
| 0-35631 |
4485 | engine.option.setTabStop(tabstops); never executed: engine.option.setTabStop(tabstops); | 0 |
4486 | | - |
4487 | if (engine.option.tabs().isEmpty() && ta) { partially evaluated: engine.option.tabs().isEmpty() yes Evaluation Count:35631 | no Evaluation Count:0 |
partially evaluated: ta no Evaluation Count:0 | yes Evaluation Count:35631 |
| 0-35631 |
4488 | QList<qreal> tabs; | - |
4489 | for (int i = 0; i < tabarraylen; i++) never evaluated: i < tabarraylen | 0 |
4490 | tabs.append(qreal(ta[i])); never executed: tabs.append(qreal(ta[i])); | 0 |
4491 | engine.option.setTabArray(tabs); | - |
4492 | } | 0 |
4493 | | - |
4494 | engine.option.setTextDirection(layout_direction); | - |
4495 | if (tf & Qt::AlignJustify) partially evaluated: tf & Qt::AlignJustify no Evaluation Count:0 | yes Evaluation Count:35631 |
| 0-35631 |
4496 | engine.option.setAlignment(Qt::AlignJustify); never executed: engine.option.setAlignment(Qt::AlignJustify); | 0 |
4497 | else | - |
4498 | engine.option.setAlignment(Qt::AlignLeft); executed: engine.option.setAlignment(Qt::AlignLeft); Execution Count:35631 | 35631 |
4499 | | - |
4500 | if (!option && (tf & Qt::TextWrapAnywhere)) partially evaluated: !option yes Evaluation Count:35631 | no Evaluation Count:0 |
partially evaluated: (tf & Qt::TextWrapAnywhere) no Evaluation Count:0 | yes Evaluation Count:35631 |
| 0-35631 |
4501 | engine.option.setWrapMode(QTextOption::WrapAnywhere); never executed: engine.option.setWrapMode(QTextOption::WrapAnywhere); | 0 |
4502 | | - |
4503 | if (tf & Qt::TextJustificationForced) partially evaluated: tf & Qt::TextJustificationForced no Evaluation Count:0 | yes Evaluation Count:35631 |
| 0-35631 |
4504 | engine.forceJustification = true; never executed: engine.forceJustification = true; | 0 |
4505 | QTextLayout textLayout(&engine); | - |
4506 | textLayout.setCacheEnabled(true); | - |
4507 | textLayout.engine()->underlinePositions = underlinePositions.data(); | - |
4508 | | - |
4509 | if (finalText.isEmpty()) { evaluated: finalText.isEmpty() yes Evaluation Count:242 | yes Evaluation Count:35389 |
| 242-35389 |
4510 | height = fm.height(); | - |
4511 | width = 0; | - |
4512 | tf |= Qt::TextDontPrint; | - |
4513 | } else { executed: } Execution Count:242 | 242 |
4514 | qreal lineWidth = 0x01000000; | - |
4515 | if (wordwrap || (tf & Qt::TextJustificationForced)) evaluated: wordwrap yes Evaluation Count:511 | yes Evaluation Count:34878 |
partially evaluated: (tf & Qt::TextJustificationForced) no Evaluation Count:0 | yes Evaluation Count:34878 |
| 0-34878 |
4516 | lineWidth = qMax<qreal>(0, r.width()); executed: lineWidth = qMax<qreal>(0, r.width()); Execution Count:511 | 511 |
4517 | if(!wordwrap) evaluated: !wordwrap yes Evaluation Count:34878 | yes Evaluation Count:511 |
| 511-34878 |
4518 | tf |= Qt::TextIncludeTrailingSpaces; executed: tf |= Qt::TextIncludeTrailingSpaces; Execution Count:34878 | 34878 |
4519 | textLayout.engine()->ignoreBidi = bool(tf & Qt::TextDontPrint); | - |
4520 | textLayout.beginLayout(); | - |
4521 | | - |
4522 | qreal leading = fm.leading(); | - |
4523 | height = -leading; | - |
4524 | | - |
4525 | while (1) { partially evaluated: 1 yes Evaluation Count:70715 | no Evaluation Count:0 |
| 0-70715 |
4526 | QTextLine l = textLayout.createLine(); | - |
4527 | if (!l.isValid()) evaluated: !l.isValid() yes Evaluation Count:34145 | yes Evaluation Count:36570 |
| 34145-36570 |
4528 | break; executed: break; Execution Count:34145 | 34145 |
4529 | | - |
4530 | l.setLineWidth(lineWidth); | - |
4531 | height += leading; | - |
4532 | | - |
4533 | | - |
4534 | height = qCeil(height); | - |
4535 | l.setPosition(QPointF(0., height)); | - |
4536 | height += textLayout.engine()->lines[l.lineNumber()].height().toReal(); | - |
4537 | width = qMax(width, l.naturalTextWidth()); | - |
4538 | if (!dontclip && !brect && height >= r.height()) evaluated: !dontclip yes Evaluation Count:36415 | yes Evaluation Count:155 |
evaluated: !brect yes Evaluation Count:3662 | yes Evaluation Count:32753 |
evaluated: height >= r.height() yes Evaluation Count:1244 | yes Evaluation Count:2418 |
| 155-36415 |
4539 | break; executed: break; Execution Count:1244 | 1244 |
4540 | } executed: } Execution Count:35326 | 35326 |
4541 | textLayout.endLayout(); | - |
4542 | } executed: } Execution Count:35389 | 35389 |
4543 | | - |
4544 | qreal yoff = 0; | - |
4545 | qreal xoff = 0; | - |
4546 | if (tf & Qt::AlignBottom) partially evaluated: tf & Qt::AlignBottom no Evaluation Count:0 | yes Evaluation Count:35631 |
| 0-35631 |
4547 | yoff = r.height() - height; never executed: yoff = r.height() - height; | 0 |
4548 | else if (tf & Qt::AlignVCenter) evaluated: tf & Qt::AlignVCenter yes Evaluation Count:3496 | yes Evaluation Count:32135 |
| 3496-32135 |
4549 | yoff = (r.height() - height)/2; executed: yoff = (r.height() - height)/2; Execution Count:3496 | 3496 |
4550 | | - |
4551 | if (tf & Qt::AlignRight) evaluated: tf & Qt::AlignRight yes Evaluation Count:64 | yes Evaluation Count:35567 |
| 64-35567 |
4552 | xoff = r.width() - width; executed: xoff = r.width() - width; Execution Count:64 | 64 |
4553 | else if (tf & Qt::AlignHCenter) evaluated: tf & Qt::AlignHCenter yes Evaluation Count:1410 | yes Evaluation Count:34157 |
| 1410-34157 |
4554 | xoff = (r.width() - width)/2; executed: xoff = (r.width() - width)/2; Execution Count:1410 | 1410 |
4555 | | - |
4556 | QRectF bounds = QRectF(r.x() + xoff, r.y() + yoff, width, height); | - |
4557 | | - |
4558 | if (hasMoreLengthVariants && !(tf & Qt::TextLongestVariant) && !r.contains(bounds)) { partially evaluated: hasMoreLengthVariants no Evaluation Count:0 | yes Evaluation Count:35631 |
never evaluated: !(tf & Qt::TextLongestVariant) never evaluated: !r.contains(bounds) | 0-35631 |
4559 | offset++; | - |
4560 | goto start_lengthVariant; never executed: goto start_lengthVariant; | 0 |
4561 | } | - |
4562 | if (brect) evaluated: brect yes Evaluation Count:31890 | yes Evaluation Count:3741 |
| 3741-31890 |
4563 | *brect = bounds; executed: *brect = bounds; Execution Count:31890 | 31890 |
4564 | | - |
4565 | if (!(tf & Qt::TextDontPrint)) { evaluated: !(tf & Qt::TextDontPrint) yes Evaluation Count:3741 | yes Evaluation Count:31890 |
| 3741-31890 |
4566 | bool restore = false; | - |
4567 | if (!dontclip && !r.contains(bounds)) { evaluated: !dontclip yes Evaluation Count:3586 | yes Evaluation Count:155 |
evaluated: !r.contains(bounds) yes Evaluation Count:20 | yes Evaluation Count:3566 |
| 20-3586 |
4568 | restore = true; | - |
4569 | painter->save(); | - |
4570 | painter->setClipRect(r, Qt::IntersectClip); | - |
4571 | } executed: } Execution Count:20 | 20 |
4572 | | - |
4573 | for (int i = 0; i < textLayout.lineCount(); i++) { evaluated: i < textLayout.lineCount() yes Evaluation Count:3817 | yes Evaluation Count:3741 |
| 3741-3817 |
4574 | QTextLine line = textLayout.lineAt(i); | - |
4575 | QTextEngine *eng = textLayout.engine(); | - |
4576 | eng->enableDelayDecorations(); | - |
4577 | | - |
4578 | qreal advance = line.horizontalAdvance(); | - |
4579 | xoff = 0; | - |
4580 | if (tf & Qt::AlignRight) { evaluated: tf & Qt::AlignRight yes Evaluation Count:22 | yes Evaluation Count:3795 |
| 22-3795 |
4581 | xoff = r.width() - advance - | - |
4582 | eng->leadingSpaceWidth(eng->lines[line.lineNumber()]).toReal(); | - |
4583 | } executed: } Execution Count:22 | 22 |
4584 | else if (tf & Qt::AlignHCenter) evaluated: tf & Qt::AlignHCenter yes Evaluation Count:1406 | yes Evaluation Count:2389 |
| 1406-2389 |
4585 | xoff = (r.width() - advance) / 2; executed: xoff = (r.width() - advance) / 2; Execution Count:1406 | 1406 |
4586 | | - |
4587 | line.draw(painter, QPointF(r.x() + xoff, r.y() + yoff)); | - |
4588 | eng->drawDecorations(painter); | - |
4589 | } executed: } Execution Count:3817 | 3817 |
4590 | | - |
4591 | if (restore) { evaluated: restore yes Evaluation Count:20 | yes Evaluation Count:3721 |
| 20-3721 |
4592 | painter->restore(); | - |
4593 | } executed: } Execution Count:20 | 20 |
4594 | } executed: } Execution Count:3741 | 3741 |
4595 | } executed: } Execution Count:35631 | 35631 |
4596 | void QPainter::setLayoutDirection(Qt::LayoutDirection direction) | - |
4597 | { | - |
4598 | QPainterPrivate * const d = d_func(); | - |
4599 | if (d->state) evaluated: d->state yes Evaluation Count:490 | yes Evaluation Count:1 |
| 1-490 |
4600 | d->state->layoutDirection = direction; executed: d->state->layoutDirection = direction; Execution Count:490 | 490 |
4601 | } executed: } Execution Count:491 | 491 |
4602 | | - |
4603 | | - |
4604 | | - |
4605 | | - |
4606 | | - |
4607 | | - |
4608 | Qt::LayoutDirection QPainter::layoutDirection() const | - |
4609 | { | - |
4610 | const QPainterPrivate * const d = d_func(); | - |
4611 | return d->state ? d->state->layoutDirection : Qt::LayoutDirectionAuto; executed: return d->state ? d->state->layoutDirection : Qt::LayoutDirectionAuto; Execution Count:6119 | 6119 |
4612 | } | - |
4613 | | - |
4614 | QPainterState::QPainterState(const QPainterState *s) | - |
4615 | : brushOrigin(s->brushOrigin), font(s->font), deviceFont(s->deviceFont), | - |
4616 | pen(s->pen), brush(s->brush), bgBrush(s->bgBrush), | - |
4617 | clipRegion(s->clipRegion), clipPath(s->clipPath), | - |
4618 | clipOperation(s->clipOperation), | - |
4619 | renderHints(s->renderHints), clipInfo(s->clipInfo), | - |
4620 | worldMatrix(s->worldMatrix), matrix(s->matrix), redirectionMatrix(s->redirectionMatrix), | - |
4621 | wx(s->wx), wy(s->wy), ww(s->ww), wh(s->wh), | - |
4622 | vx(s->vx), vy(s->vy), vw(s->vw), vh(s->vh), | - |
4623 | opacity(s->opacity), WxF(s->WxF), VxF(s->VxF), | - |
4624 | clipEnabled(s->clipEnabled), bgMode(s->bgMode), painter(s->painter), | - |
4625 | layoutDirection(s->layoutDirection), | - |
4626 | composition_mode(s->composition_mode), | - |
4627 | emulationSpecifier(s->emulationSpecifier), changeFlags(0) | - |
4628 | { | - |
4629 | dirtyFlags = s->dirtyFlags; | - |
4630 | } executed: } Execution Count:9 | 9 |
4631 | | - |
4632 | QPainterState::QPainterState() | - |
4633 | : brushOrigin(0, 0), bgBrush(Qt::white), clipOperation(Qt::NoClip), | - |
4634 | renderHints(0), | - |
4635 | wx(0), wy(0), ww(0), wh(0), vx(0), vy(0), vw(0), vh(0), | - |
4636 | opacity(1), WxF(false), VxF(false), clipEnabled(true), | - |
4637 | bgMode(Qt::TransparentMode), painter(0), | - |
4638 | layoutDirection(QGuiApplication::layoutDirection()), | - |
4639 | composition_mode(QPainter::CompositionMode_SourceOver), | - |
4640 | emulationSpecifier(0), changeFlags(0) | - |
4641 | { | - |
4642 | dirtyFlags = 0; | - |
4643 | } executed: } Execution Count:28775 | 28775 |
4644 | | - |
4645 | QPainterState::~QPainterState() | - |
4646 | { | - |
4647 | } | - |
4648 | | - |
4649 | void QPainterState::init(QPainter *p) { | - |
4650 | bgBrush = Qt::white; | - |
4651 | bgMode = Qt::TransparentMode; | - |
4652 | WxF = false; | - |
4653 | VxF = false; | - |
4654 | clipEnabled = true; | - |
4655 | wx = wy = ww = wh = 0; | - |
4656 | vx = vy = vw = vh = 0; | - |
4657 | painter = p; | - |
4658 | pen = QPen(); | - |
4659 | brushOrigin = QPointF(0, 0); | - |
4660 | brush = QBrush(); | - |
4661 | font = deviceFont = QFont(); | - |
4662 | clipRegion = QRegion(); | - |
4663 | clipPath = QPainterPath(); | - |
4664 | clipOperation = Qt::NoClip; | - |
4665 | clipInfo.clear(); | - |
4666 | worldMatrix.reset(); | - |
4667 | matrix.reset(); | - |
4668 | layoutDirection = QGuiApplication::layoutDirection(); | - |
4669 | composition_mode = QPainter::CompositionMode_SourceOver; | - |
4670 | emulationSpecifier = 0; | - |
4671 | dirtyFlags = 0; | - |
4672 | changeFlags = 0; | - |
4673 | renderHints = 0; | - |
4674 | opacity = 1; | - |
4675 | } | 0 |
4676 | QPen QPaintEngineState::pen() const | - |
4677 | { | - |
4678 | return static_cast<const QPainterState *>(this)->pen; executed: return static_cast<const QPainterState *>(this)->pen; Execution Count:18 | 18 |
4679 | } | - |
4680 | QBrush QPaintEngineState::brush() const | - |
4681 | { | - |
4682 | return static_cast<const QPainterState *>(this)->brush; executed: return static_cast<const QPainterState *>(this)->brush; Execution Count:16 | 16 |
4683 | } | - |
4684 | QPointF QPaintEngineState::brushOrigin() const | - |
4685 | { | - |
4686 | return static_cast<const QPainterState *>(this)->brushOrigin; never executed: return static_cast<const QPainterState *>(this)->brushOrigin; | 0 |
4687 | } | - |
4688 | QBrush QPaintEngineState::backgroundBrush() const | - |
4689 | { | - |
4690 | return static_cast<const QPainterState *>(this)->bgBrush; never executed: return static_cast<const QPainterState *>(this)->bgBrush; | 0 |
4691 | } | - |
4692 | Qt::BGMode QPaintEngineState::backgroundMode() const | - |
4693 | { | - |
4694 | return static_cast<const QPainterState *>(this)->bgMode; never executed: return static_cast<const QPainterState *>(this)->bgMode; | 0 |
4695 | } | - |
4696 | QFont QPaintEngineState::font() const | - |
4697 | { | - |
4698 | return static_cast<const QPainterState *>(this)->font; never executed: return static_cast<const QPainterState *>(this)->font; | 0 |
4699 | } | - |
4700 | QMatrix QPaintEngineState::matrix() const | - |
4701 | { | - |
4702 | const QPainterState *st = static_cast<const QPainterState *>(this); | - |
4703 | | - |
4704 | return st->matrix.toAffine(); never executed: return st->matrix.toAffine(); | 0 |
4705 | } | - |
4706 | QTransform QPaintEngineState::transform() const | - |
4707 | { | - |
4708 | const QPainterState *st = static_cast<const QPainterState *>(this); | - |
4709 | | - |
4710 | return st->matrix; executed: return st->matrix; Execution Count:35 | 35 |
4711 | } | - |
4712 | Qt::ClipOperation QPaintEngineState::clipOperation() const | - |
4713 | { | - |
4714 | return static_cast<const QPainterState *>(this)->clipOperation; never executed: return static_cast<const QPainterState *>(this)->clipOperation; | 0 |
4715 | } | - |
4716 | bool QPaintEngineState::brushNeedsResolving() const | - |
4717 | { | - |
4718 | const QBrush &brush = static_cast<const QPainterState *>(this)->brush; | - |
4719 | return needsResolving(brush); executed: return needsResolving(brush); Execution Count:10 | 10 |
4720 | } | - |
4721 | bool QPaintEngineState::penNeedsResolving() const | - |
4722 | { | - |
4723 | const QPen &pen = static_cast<const QPainterState *>(this)->pen; | - |
4724 | return needsResolving(pen.brush()); executed: return needsResolving(pen.brush()); Execution Count:10 | 10 |
4725 | } | - |
4726 | QRegion QPaintEngineState::clipRegion() const | - |
4727 | { | - |
4728 | return static_cast<const QPainterState *>(this)->clipRegion; never executed: return static_cast<const QPainterState *>(this)->clipRegion; | 0 |
4729 | } | - |
4730 | QPainterPath QPaintEngineState::clipPath() const | - |
4731 | { | - |
4732 | return static_cast<const QPainterState *>(this)->clipPath; never executed: return static_cast<const QPainterState *>(this)->clipPath; | 0 |
4733 | } | - |
4734 | bool QPaintEngineState::isClipEnabled() const | - |
4735 | { | - |
4736 | return static_cast<const QPainterState *>(this)->clipEnabled; never executed: return static_cast<const QPainterState *>(this)->clipEnabled; | 0 |
4737 | } | - |
4738 | QPainter::RenderHints QPaintEngineState::renderHints() const | - |
4739 | { | - |
4740 | return static_cast<const QPainterState *>(this)->renderHints; executed: return static_cast<const QPainterState *>(this)->renderHints; Execution Count:2 | 2 |
4741 | } | - |
4742 | QPainter::CompositionMode QPaintEngineState::compositionMode() const | - |
4743 | { | - |
4744 | return static_cast<const QPainterState *>(this)->composition_mode; executed: return static_cast<const QPainterState *>(this)->composition_mode; Execution Count:471 | 471 |
4745 | } | - |
4746 | | - |
4747 | | - |
4748 | | - |
4749 | | - |
4750 | | - |
4751 | | - |
4752 | | - |
4753 | QPainter *QPaintEngineState::painter() const | - |
4754 | { | - |
4755 | return static_cast<const QPainterState *>(this)->painter; executed: return static_cast<const QPainterState *>(this)->painter; Execution Count:23092 | 23092 |
4756 | } | - |
4757 | qreal QPaintEngineState::opacity() const | - |
4758 | { | - |
4759 | return static_cast<const QPainterState *>(this)->opacity; never executed: return static_cast<const QPainterState *>(this)->opacity; | 0 |
4760 | } | - |
4761 | void QPainter::setTransform(const QTransform &transform, bool combine ) | - |
4762 | { | - |
4763 | setWorldTransform(transform, combine); | - |
4764 | } executed: } Execution Count:47 | 47 |
4765 | | - |
4766 | | - |
4767 | | - |
4768 | | - |
4769 | | - |
4770 | | - |
4771 | | - |
4772 | const QTransform & QPainter::transform() const | - |
4773 | { | - |
4774 | return worldTransform(); executed: return worldTransform(); Execution Count:416 | 416 |
4775 | } | - |
4776 | const QTransform & QPainter::deviceTransform() const | - |
4777 | { | - |
4778 | const QPainterPrivate * const d = d_func(); | - |
4779 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:1 | yes Evaluation Count:39 |
| 1-39 |
4780 | QMessageLogger("painting/qpainter.cpp", 8173, __PRETTY_FUNCTION__).warning("QPainter::deviceTransform: Painter not active"); | - |
4781 | return d->fakeState()->transform; executed: return d->fakeState()->transform; Execution Count:1 | 1 |
4782 | } | - |
4783 | return d->state->matrix; executed: return d->state->matrix; Execution Count:39 | 39 |
4784 | } | - |
4785 | void QPainter::resetTransform() | - |
4786 | { | - |
4787 | QPainterPrivate * const d = d_func(); | - |
4788 | | - |
4789 | | - |
4790 | | - |
4791 | | - |
4792 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:2 | yes Evaluation Count:9 |
| 2-9 |
4793 | QMessageLogger("painting/qpainter.cpp", 8196, __PRETTY_FUNCTION__).warning("QPainter::resetMatrix: Painter not active"); | - |
4794 | return; executed: return; Execution Count:2 | 2 |
4795 | } | - |
4796 | | - |
4797 | d->state->wx = d->state->wy = d->state->vx = d->state->vy = 0; | - |
4798 | d->state->ww = d->state->vw = d->device->metric(QPaintDevice::PdmWidth); | - |
4799 | d->state->wh = d->state->vh = d->device->metric(QPaintDevice::PdmHeight); | - |
4800 | d->state->worldMatrix = QTransform(); | - |
4801 | setMatrixEnabled(false); | - |
4802 | setViewTransformEnabled(false); | - |
4803 | if (d->extended) partially evaluated: d->extended yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
4804 | d->extended->transformChanged(); executed: d->extended->transformChanged(); Execution Count:9 | 9 |
4805 | else | - |
4806 | d->state->dirtyFlags |= QPaintEngine::DirtyTransform; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyTransform; | 0 |
4807 | } | - |
4808 | void QPainter::setWorldTransform(const QTransform &matrix, bool combine ) | - |
4809 | { | - |
4810 | QPainterPrivate * const d = d_func(); | - |
4811 | | - |
4812 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:3 | yes Evaluation Count:6829 |
| 3-6829 |
4813 | QMessageLogger("painting/qpainter.cpp", 8225, __PRETTY_FUNCTION__).warning("QPainter::setWorldTransform: Painter not active"); | - |
4814 | return; executed: return; Execution Count:3 | 3 |
4815 | } | - |
4816 | | - |
4817 | if (combine) evaluated: combine yes Evaluation Count:20 | yes Evaluation Count:6809 |
| 20-6809 |
4818 | d->state->worldMatrix = matrix * d->state->worldMatrix; executed: d->state->worldMatrix = matrix * d->state->worldMatrix; Execution Count:20 | 20 |
4819 | else | - |
4820 | d->state->worldMatrix = matrix; executed: d->state->worldMatrix = matrix; Execution Count:6809 | 6809 |
4821 | | - |
4822 | d->state->WxF = true; | - |
4823 | d->updateMatrix(); | - |
4824 | } executed: } Execution Count:6829 | 6829 |
4825 | | - |
4826 | | - |
4827 | | - |
4828 | | - |
4829 | | - |
4830 | const QTransform & QPainter::worldTransform() const | - |
4831 | { | - |
4832 | const QPainterPrivate * const d = d_func(); | - |
4833 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:2 | yes Evaluation Count:2716 |
| 2-2716 |
4834 | QMessageLogger("painting/qpainter.cpp", 8246, __PRETTY_FUNCTION__).warning("QPainter::worldTransform: Painter not active"); | - |
4835 | return d->fakeState()->transform; executed: return d->fakeState()->transform; Execution Count:2 | 2 |
4836 | } | - |
4837 | return d->state->worldMatrix; executed: return d->state->worldMatrix; Execution Count:2716 | 2716 |
4838 | } | - |
4839 | QTransform QPainter::combinedTransform() const | - |
4840 | { | - |
4841 | const QPainterPrivate * const d = d_func(); | - |
4842 | if (!d->engine) { evaluated: !d->engine yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
4843 | QMessageLogger("painting/qpainter.cpp", 8263, __PRETTY_FUNCTION__).warning("QPainter::combinedTransform: Painter not active"); | - |
4844 | return QTransform(); executed: return QTransform(); Execution Count:2 | 2 |
4845 | } | - |
4846 | return d->state->worldMatrix * d->viewTransform() * d->hidpiScaleTransform(); executed: return d->state->worldMatrix * d->viewTransform() * d->hidpiScaleTransform(); Execution Count:3 | 3 |
4847 | } | - |
4848 | void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount, | - |
4849 | const QPixmap &pixmap, PixmapFragmentHints hints) | - |
4850 | { | - |
4851 | QPainterPrivate * const d = d_func(); | - |
4852 | | - |
4853 | if (!d->engine || pixmap.isNull()) partially evaluated: !d->engine no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: pixmap.isNull() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
4854 | return; | 0 |
4855 | if (d->engine->isExtended()) { partially evaluated: d->engine->isExtended() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
4856 | d->extended->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); | - |
4857 | } else { executed: } Execution Count:3 | 3 |
4858 | qreal oldOpacity = opacity(); | - |
4859 | QTransform oldTransform = transform(); | - |
4860 | | - |
4861 | for (int i = 0; i < fragmentCount; ++i) { never evaluated: i < fragmentCount | 0 |
4862 | QTransform transform = oldTransform; | - |
4863 | qreal xOffset = 0; | - |
4864 | qreal yOffset = 0; | - |
4865 | if (fragments[i].rotation == 0) { never evaluated: fragments[i].rotation == 0 | 0 |
4866 | xOffset = fragments[i].x; | - |
4867 | yOffset = fragments[i].y; | - |
4868 | } else { | 0 |
4869 | transform.translate(fragments[i].x, fragments[i].y); | - |
4870 | transform.rotate(fragments[i].rotation); | - |
4871 | } | 0 |
4872 | setOpacity(oldOpacity * fragments[i].opacity); | - |
4873 | setTransform(transform); | - |
4874 | | - |
4875 | qreal w = fragments[i].scaleX * fragments[i].width; | - |
4876 | qreal h = fragments[i].scaleY * fragments[i].height; | - |
4877 | QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, | - |
4878 | fragments[i].width, fragments[i].height); | - |
4879 | drawPixmap(QRectF(-0.5 * w + xOffset, -0.5 * h + yOffset, w, h), pixmap, sourceRect); | - |
4880 | } | 0 |
4881 | | - |
4882 | setOpacity(oldOpacity); | - |
4883 | setTransform(oldTransform); | - |
4884 | } | 0 |
4885 | } | - |
4886 | QPainter::PixmapFragment QPainter::PixmapFragment::create(const QPointF &pos, const QRectF &sourceRect, | - |
4887 | qreal scaleX, qreal scaleY, qreal rotation, | - |
4888 | qreal opacity) | - |
4889 | { | - |
4890 | PixmapFragment fragment = {pos.x(), pos.y(), sourceRect.x(), sourceRect.y(), sourceRect.width(), | - |
4891 | sourceRect.height(), scaleX, scaleY, rotation, opacity}; | - |
4892 | return fragment; executed: return fragment; Execution Count:1 | 1 |
4893 | } | - |
4894 | void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation) | - |
4895 | { | - |
4896 | p->draw_helper(path, operation); | - |
4897 | } | 0 |
4898 | | - |
4899 | | - |
4900 | | - |
| | |