qpainter.cpp

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

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