image/qpaintengine_pic.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "private/qpaintengine_p.h" -
43#include "private/qpainter_p.h" -
44#include "private/qpicture_p.h" -
45#include "private/qfont_p.h" -
46 -
47#ifndef QT_NO_PICTURE -
48 -
49#include "qbuffer.h" -
50#include "qbytearray.h" -
51#include "qdatastream.h" -
52#include "qmath.h" -
53#include "qpaintengine_pic_p.h" -
54#include "qpicture.h" -
55#include "qpolygon.h" -
56#include "qrect.h" -
57#include <private/qtextengine_p.h> -
58 -
59//#define QT_PICTURE_DEBUG -
60#include <qdebug.h> -
61 -
62 -
63QT_BEGIN_NAMESPACE -
64 -
65class QPicturePaintEnginePrivate : public QPaintEnginePrivate -
66{ -
67 Q_DECLARE_PUBLIC(QPicturePaintEngine) -
68public: -
69 QDataStream s; -
70 QPainter *pt; -
71 QPicturePrivate *pic_d; -
72}; -
73 -
74QPicturePaintEngine::QPicturePaintEngine() -
75 : QPaintEngine(*(new QPicturePaintEnginePrivate), AllFeatures) -
76{ -
77 Q_D(QPicturePaintEngine);
executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
78 d->pt = 0;
executed (the execution status of this line is deduced): d->pt = 0;
-
79}
executed: }
Execution Count:16
16
80 -
81QPicturePaintEngine::QPicturePaintEngine(QPaintEnginePrivate &dptr) -
82 : QPaintEngine(dptr, AllFeatures) -
83{ -
84 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
85 d->pt = 0;
never executed (the execution status of this line is deduced): d->pt = 0;
-
86}
never executed: }
0
87 -
88QPicturePaintEngine::~QPicturePaintEngine() -
89{ -
90} -
91 -
92bool QPicturePaintEngine::begin(QPaintDevice *pd) -
93{ -
94 Q_D(QPicturePaintEngine);
executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
95#ifdef QT_PICTURE_DEBUG -
96 qDebug() << "QPicturePaintEngine::begin()"; -
97#endif -
98 Q_ASSERT(pd);
executed (the execution status of this line is deduced): qt_noop();
-
99 QPicture *pic = static_cast<QPicture *>(pd);
executed (the execution status of this line is deduced): QPicture *pic = static_cast<QPicture *>(pd);
-
100 -
101 d->pdev = pd;
executed (the execution status of this line is deduced): d->pdev = pd;
-
102 d->pic_d = pic->d_func();
executed (the execution status of this line is deduced): d->pic_d = pic->d_func();
-
103 Q_ASSERT(d->pic_d);
executed (the execution status of this line is deduced): qt_noop();
-
104 -
105 d->s.setDevice(&d->pic_d->pictb);
executed (the execution status of this line is deduced): d->s.setDevice(&d->pic_d->pictb);
-
106 d->s.setVersion(d->pic_d->formatMajor);
executed (the execution status of this line is deduced): d->s.setVersion(d->pic_d->formatMajor);
-
107 -
108 d->pic_d->pictb.open(QIODevice::WriteOnly | QIODevice::Truncate);
executed (the execution status of this line is deduced): d->pic_d->pictb.open(QIODevice::WriteOnly | QIODevice::Truncate);
-
109 d->s.writeRawData(qt_mfhdr_tag, 4);
executed (the execution status of this line is deduced): d->s.writeRawData(qt_mfhdr_tag, 4);
-
110 d->s << (quint16) 0 << (quint16) d->pic_d->formatMajor << (quint16) d->pic_d->formatMinor;
executed (the execution status of this line is deduced): d->s << (quint16) 0 << (quint16) d->pic_d->formatMajor << (quint16) d->pic_d->formatMinor;
-
111 d->s << (quint8) QPicturePrivate::PdcBegin << (quint8) sizeof(qint32);
executed (the execution status of this line is deduced): d->s << (quint8) QPicturePrivate::PdcBegin << (quint8) sizeof(qint32);
-
112 d->pic_d->brect = QRect();
executed (the execution status of this line is deduced): d->pic_d->brect = QRect();
-
113 if (d->pic_d->formatMajor >= 4) {
partially evaluated: d->pic_d->formatMajor >= 4
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
114 QRect r = pic->boundingRect();
executed (the execution status of this line is deduced): QRect r = pic->boundingRect();
-
115 d->s << (qint32) r.left() << (qint32) r.top() << (qint32) r.width()
executed (the execution status of this line is deduced): d->s << (qint32) r.left() << (qint32) r.top() << (qint32) r.width()
-
116 << (qint32) r.height();
executed (the execution status of this line is deduced): << (qint32) r.height();
-
117 }
executed: }
Execution Count:16
16
118 d->pic_d->trecs = 0;
executed (the execution status of this line is deduced): d->pic_d->trecs = 0;
-
119 d->s << (quint32)d->pic_d->trecs; // total number of records
executed (the execution status of this line is deduced): d->s << (quint32)d->pic_d->trecs;
-
120 d->pic_d->formatOk = false;
executed (the execution status of this line is deduced): d->pic_d->formatOk = false;
-
121 setActive(true);
executed (the execution status of this line is deduced): setActive(true);
-
122 return true;
executed: return true;
Execution Count:16
16
123} -
124 -
125bool QPicturePaintEngine::end() -
126{ -
127 Q_D(QPicturePaintEngine);
executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
128#ifdef QT_PICTURE_DEBUG -
129 qDebug() << "QPicturePaintEngine::end()"; -
130#endif -
131 d->pic_d->trecs++;
executed (the execution status of this line is deduced): d->pic_d->trecs++;
-
132 d->s << (quint8) QPicturePrivate::PdcEnd << (quint8) 0;
executed (the execution status of this line is deduced): d->s << (quint8) QPicturePrivate::PdcEnd << (quint8) 0;
-
133 int cs_start = sizeof(quint32); // pos of checksum word
executed (the execution status of this line is deduced): int cs_start = sizeof(quint32);
-
134 int data_start = cs_start + sizeof(quint16);
executed (the execution status of this line is deduced): int data_start = cs_start + sizeof(quint16);
-
135 int brect_start = data_start + 2*sizeof(qint16) + 2*sizeof(quint8);
executed (the execution status of this line is deduced): int brect_start = data_start + 2*sizeof(qint16) + 2*sizeof(quint8);
-
136 int pos = d->pic_d->pictb.pos();
executed (the execution status of this line is deduced): int pos = d->pic_d->pictb.pos();
-
137 d->pic_d->pictb.seek(brect_start);
executed (the execution status of this line is deduced): d->pic_d->pictb.seek(brect_start);
-
138 if (d->pic_d->formatMajor >= 4) { // bounding rectangle
partially evaluated: d->pic_d->formatMajor >= 4
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
139 QRect r = static_cast<QPicture *>(d->pdev)->boundingRect();
executed (the execution status of this line is deduced): QRect r = static_cast<QPicture *>(d->pdev)->boundingRect();
-
140 d->s << (qint32) r.left() << (qint32) r.top() << (qint32) r.width()
executed (the execution status of this line is deduced): d->s << (qint32) r.left() << (qint32) r.top() << (qint32) r.width()
-
141 << (qint32) r.height();
executed (the execution status of this line is deduced): << (qint32) r.height();
-
142 }
executed: }
Execution Count:16
16
143 d->s << (quint32) d->pic_d->trecs; // write number of records
executed (the execution status of this line is deduced): d->s << (quint32) d->pic_d->trecs;
-
144 d->pic_d->pictb.seek(cs_start);
executed (the execution status of this line is deduced): d->pic_d->pictb.seek(cs_start);
-
145 QByteArray buf = d->pic_d->pictb.buffer();
executed (the execution status of this line is deduced): QByteArray buf = d->pic_d->pictb.buffer();
-
146 quint16 cs = (quint16) qChecksum(buf.constData() + data_start, pos - data_start);
executed (the execution status of this line is deduced): quint16 cs = (quint16) qChecksum(buf.constData() + data_start, pos - data_start);
-
147 d->s << cs; // write checksum
executed (the execution status of this line is deduced): d->s << cs;
-
148 d->pic_d->pictb.close();
executed (the execution status of this line is deduced): d->pic_d->pictb.close();
-
149 setActive(false);
executed (the execution status of this line is deduced): setActive(false);
-
150 return true;
executed: return true;
Execution Count:16
16
151} -
152 -
153#define SERIALIZE_CMD(c) \ -
154 d->pic_d->trecs++; \ -
155 d->s << (quint8) c; \ -
156 d->s << (quint8) 0; \ -
157 pos = d->pic_d->pictb.pos() -
158 -
159void QPicturePaintEngine::updatePen(const QPen &pen) -
160{ -
161 Q_D(QPicturePaintEngine);
executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
162#ifdef QT_PICTURE_DEBUG -
163 qDebug() << " -> updatePen(): width:" << pen.width() << "style:" -
164 << pen.style() << "color:" << pen.color(); -
165#endif -
166 int pos;
executed (the execution status of this line is deduced): int pos;
-
167 SERIALIZE_CMD(QPicturePrivate::PdcSetPen);
executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetPen; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
168 if (d->pic_d->in_memory_only) {
partially evaluated: d->pic_d->in_memory_only
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
169 int index = d->pic_d->pen_list.size();
never executed (the execution status of this line is deduced): int index = d->pic_d->pen_list.size();
-
170 d->pic_d->pen_list.append(pen);
never executed (the execution status of this line is deduced): d->pic_d->pen_list.append(pen);
-
171 d->s << index;
never executed (the execution status of this line is deduced): d->s << index;
-
172 } else {
never executed: }
0
173 d->s << pen;
executed (the execution status of this line is deduced): d->s << pen;
-
174 }
executed: }
Execution Count:16
16
175 writeCmdLength(pos, QRect(), false);
executed (the execution status of this line is deduced): writeCmdLength(pos, QRect(), false);
-
176}
executed: }
Execution Count:16
16
177 -
178void QPicturePaintEngine::updateCompositionMode(QPainter::CompositionMode cmode) -
179{ -
180 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
181#ifdef QT_PICTURE_DEBUG -
182 qDebug() << " -> updateCompositionMode():" << cmode; -
183#endif -
184 int pos;
never executed (the execution status of this line is deduced): int pos;
-
185 SERIALIZE_CMD(QPicturePrivate::PdcSetCompositionMode);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetCompositionMode; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
186 d->s << (qint32)cmode;
never executed (the execution status of this line is deduced): d->s << (qint32)cmode;
-
187 writeCmdLength(pos, QRectF(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
188}
never executed: }
0
189 -
190void QPicturePaintEngine::updateClipEnabled(bool enabled) -
191{ -
192 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
193#ifdef QT_PICTURE_DEBUG -
194 qDebug() << " -> updateClipEnabled():" << enabled; -
195#endif -
196 int pos;
never executed (the execution status of this line is deduced): int pos;
-
197 SERIALIZE_CMD(QPicturePrivate::PdcSetClipEnabled);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetClipEnabled; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
198 d->s << enabled;
never executed (the execution status of this line is deduced): d->s << enabled;
-
199 writeCmdLength(pos, QRectF(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
200}
never executed: }
0
201 -
202void QPicturePaintEngine::updateOpacity(qreal opacity) -
203{ -
204 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
205#ifdef QT_PICTURE_DEBUG -
206 qDebug() << " -> updateOpacity():" << opacity; -
207#endif -
208 int pos;
never executed (the execution status of this line is deduced): int pos;
-
209 SERIALIZE_CMD(QPicturePrivate::PdcSetOpacity);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetOpacity; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
210 d->s << double(opacity);
never executed (the execution status of this line is deduced): d->s << double(opacity);
-
211 writeCmdLength(pos, QRectF(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
212}
never executed: }
0
213 -
214void QPicturePaintEngine::updateBrush(const QBrush &brush) -
215{ -
216 Q_D(QPicturePaintEngine);
executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
217#ifdef QT_PICTURE_DEBUG -
218 qDebug() << " -> updateBrush(): style:" << brush.style(); -
219#endif -
220 int pos;
executed (the execution status of this line is deduced): int pos;
-
221 SERIALIZE_CMD(QPicturePrivate::PdcSetBrush);
executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetBrush; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
222 if (d->pic_d->in_memory_only) {
partially evaluated: d->pic_d->in_memory_only
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
223 int index = d->pic_d->brush_list.size();
never executed (the execution status of this line is deduced): int index = d->pic_d->brush_list.size();
-
224 d->pic_d->brush_list.append(brush);
never executed (the execution status of this line is deduced): d->pic_d->brush_list.append(brush);
-
225 d->s << index;
never executed (the execution status of this line is deduced): d->s << index;
-
226 } else {
never executed: }
0
227 d->s << brush;
executed (the execution status of this line is deduced): d->s << brush;
-
228 }
executed: }
Execution Count:16
16
229 writeCmdLength(pos, QRect(), false);
executed (the execution status of this line is deduced): writeCmdLength(pos, QRect(), false);
-
230}
executed: }
Execution Count:16
16
231 -
232void QPicturePaintEngine::updateBrushOrigin(const QPointF &p) -
233{ -
234 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
235#ifdef QT_PICTURE_DEBUG -
236 qDebug() << " -> updateBrushOrigin(): " << p; -
237#endif -
238 int pos;
never executed (the execution status of this line is deduced): int pos;
-
239 SERIALIZE_CMD(QPicturePrivate::PdcSetBrushOrigin);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetBrushOrigin; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
240 d->s << p;
never executed (the execution status of this line is deduced): d->s << p;
-
241 writeCmdLength(pos, QRect(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRect(), false);
-
242}
never executed: }
0
243 -
244void QPicturePaintEngine::updateFont(const QFont &font) -
245{ -
246 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
247#ifdef QT_PICTURE_DEBUG -
248 qDebug() << " -> updateFont(): pt sz:" << font.pointSize(); -
249#endif -
250 int pos;
never executed (the execution status of this line is deduced): int pos;
-
251 SERIALIZE_CMD(QPicturePrivate::PdcSetFont);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetFont; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
252 QFont fnt = font;
never executed (the execution status of this line is deduced): QFont fnt = font;
-
253 d->s << fnt;
never executed (the execution status of this line is deduced): d->s << fnt;
-
254 writeCmdLength(pos, QRectF(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
255}
never executed: }
0
256 -
257void QPicturePaintEngine::updateBackground(Qt::BGMode bgMode, const QBrush &bgBrush) -
258{ -
259 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
260#ifdef QT_PICTURE_DEBUG -
261 qDebug() << " -> updateBackground(): mode:" << bgMode << "style:" << bgBrush.style(); -
262#endif -
263 int pos;
never executed (the execution status of this line is deduced): int pos;
-
264 SERIALIZE_CMD(QPicturePrivate::PdcSetBkColor);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetBkColor; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
265 d->s << bgBrush.color();
never executed (the execution status of this line is deduced): d->s << bgBrush.color();
-
266 writeCmdLength(pos, QRect(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRect(), false);
-
267 -
268 SERIALIZE_CMD(QPicturePrivate::PdcSetBkMode);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetBkMode; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
269 d->s << (qint8) bgMode;
never executed (the execution status of this line is deduced): d->s << (qint8) bgMode;
-
270 writeCmdLength(pos, QRectF(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
271}
never executed: }
0
272 -
273void QPicturePaintEngine::updateMatrix(const QTransform &matrix) -
274{ -
275 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
276#ifdef QT_PICTURE_DEBUG -
277 qDebug() << " -> updateMatrix():" << matrix; -
278#endif -
279 int pos;
never executed (the execution status of this line is deduced): int pos;
-
280 SERIALIZE_CMD(QPicturePrivate::PdcSetWMatrix);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetWMatrix; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
281 d->s << matrix << (qint8) false;
never executed (the execution status of this line is deduced): d->s << matrix << (qint8) false;
-
282 writeCmdLength(pos, QRectF(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
283}
never executed: }
0
284 -
285void QPicturePaintEngine::updateClipRegion(const QRegion &region, Qt::ClipOperation op) -
286{ -
287 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
288#ifdef QT_PICTURE_DEBUG -
289 qDebug() << " -> updateClipRegion(): op:" << op -
290 << "bounding rect:" << region.boundingRect(); -
291#endif -
292 int pos;
never executed (the execution status of this line is deduced): int pos;
-
293 SERIALIZE_CMD(QPicturePrivate::PdcSetClipRegion);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetClipRegion; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
294 d->s << region << qint8(op);
never executed (the execution status of this line is deduced): d->s << region << qint8(op);
-
295 writeCmdLength(pos, QRectF(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
296}
never executed: }
0
297 -
298void QPicturePaintEngine::updateClipPath(const QPainterPath &path, Qt::ClipOperation op) -
299{ -
300 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
301#ifdef QT_PICTURE_DEBUG -
302 qDebug() << " -> updateClipPath(): op:" << op -
303 << "bounding rect:" << path.boundingRect(); -
304#endif -
305 int pos;
never executed (the execution status of this line is deduced): int pos;
-
306 -
307 SERIALIZE_CMD(QPicturePrivate::PdcSetClipPath);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetClipPath; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
308 d->s << path << qint8(op);
never executed (the execution status of this line is deduced): d->s << path << qint8(op);
-
309 writeCmdLength(pos, QRectF(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
310}
never executed: }
0
311 -
312void QPicturePaintEngine::updateRenderHints(QPainter::RenderHints hints) -
313{ -
314 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
315#ifdef QT_PICTURE_DEBUG -
316 qDebug() << " -> updateRenderHints(): " << hints; -
317#endif -
318 int pos;
never executed (the execution status of this line is deduced): int pos;
-
319 SERIALIZE_CMD(QPicturePrivate::PdcSetRenderHint);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcSetRenderHint; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
320 d->s << (quint32) hints;
never executed (the execution status of this line is deduced): d->s << (quint32) hints;
-
321 writeCmdLength(pos, QRect(), false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRect(), false);
-
322}
never executed: }
0
323 -
324void QPicturePaintEngine::writeCmdLength(int pos, const QRectF &r, bool corr) -
325{ -
326 Q_D(QPicturePaintEngine);
executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
327 int newpos = d->pic_d->pictb.pos(); // new position
executed (the execution status of this line is deduced): int newpos = d->pic_d->pictb.pos();
-
328 int length = newpos - pos;
executed (the execution status of this line is deduced): int length = newpos - pos;
-
329 QRectF br(r);
executed (the execution status of this line is deduced): QRectF br(r);
-
330 -
331 if (length < 255) { // write 8-bit length
evaluated: length < 255
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:1
1-48
332 d->pic_d->pictb.seek(pos - 1); // position to right index
executed (the execution status of this line is deduced): d->pic_d->pictb.seek(pos - 1);
-
333 d->s << (quint8)length;
executed (the execution status of this line is deduced): d->s << (quint8)length;
-
334 } else { // write 32-bit length
executed: }
Execution Count:48
48
335 d->s << (quint32)0; // extend the buffer
executed (the execution status of this line is deduced): d->s << (quint32)0;
-
336 d->pic_d->pictb.seek(pos - 1); // position to right index
executed (the execution status of this line is deduced): d->pic_d->pictb.seek(pos - 1);
-
337 d->s << (quint8)255; // indicate 32-bit length
executed (the execution status of this line is deduced): d->s << (quint8)255;
-
338 char *p = d->pic_d->pictb.buffer().data();
executed (the execution status of this line is deduced): char *p = d->pic_d->pictb.buffer().data();
-
339 memmove(p+pos+4, p+pos, length); // make room for 4 byte
executed (the execution status of this line is deduced): memmove(p+pos+4, p+pos, length);
-
340 d->s << (quint32)length;
executed (the execution status of this line is deduced): d->s << (quint32)length;
-
341 newpos += 4;
executed (the execution status of this line is deduced): newpos += 4;
-
342 }
executed: }
Execution Count:1
1
343 d->pic_d->pictb.seek(newpos); // set to new position
executed (the execution status of this line is deduced): d->pic_d->pictb.seek(newpos);
-
344 -
345 if (br.width() > 0.0 || br.height() > 0.0) {
evaluated: br.width() > 0.0
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:33
evaluated: br.height() > 0.0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:32
1-33
346 if (corr) { // widen bounding rect
evaluated: corr
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:1
1-16
347 int w2 = painter()->pen().width() / 2;
executed (the execution status of this line is deduced): int w2 = painter()->pen().width() / 2;
-
348 br.setCoords(br.left() - w2, br.top() - w2,
executed (the execution status of this line is deduced): br.setCoords(br.left() - w2, br.top() - w2,
-
349 br.right() + w2, br.bottom() + w2);
executed (the execution status of this line is deduced): br.right() + w2, br.bottom() + w2);
-
350 }
executed: }
Execution Count:16
16
351 br = painter()->transform().mapRect(br);
executed (the execution status of this line is deduced): br = painter()->transform().mapRect(br);
-
352 if (painter()->hasClipping()) {
partially evaluated: painter()->hasClipping()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
353 QRect cr = painter()->clipRegion().boundingRect();
never executed (the execution status of this line is deduced): QRect cr = painter()->clipRegion().boundingRect();
-
354 br &= cr;
never executed (the execution status of this line is deduced): br &= cr;
-
355 }
never executed: }
0
356 -
357 if (br.width() > 0.0 || br.height() > 0.0) {
evaluated: br.width() > 0.0
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:1
partially evaluated: br.height() > 0.0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-16
358 int minx = qFloor(br.left());
executed (the execution status of this line is deduced): int minx = qFloor(br.left());
-
359 int miny = qFloor(br.top());
executed (the execution status of this line is deduced): int miny = qFloor(br.top());
-
360 int maxx = qCeil(br.right());
executed (the execution status of this line is deduced): int maxx = qCeil(br.right());
-
361 int maxy = qCeil(br.bottom());
executed (the execution status of this line is deduced): int maxy = qCeil(br.bottom());
-
362 -
363 if (d->pic_d->brect.width() > 0 || d->pic_d->brect.height() > 0) {
evaluated: d->pic_d->brect.width() > 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:15
partially evaluated: d->pic_d->brect.height() > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
364 minx = qMin(minx, d->pic_d->brect.left());
executed (the execution status of this line is deduced): minx = qMin(minx, d->pic_d->brect.left());
-
365 miny = qMin(miny, d->pic_d->brect.top());
executed (the execution status of this line is deduced): miny = qMin(miny, d->pic_d->brect.top());
-
366 maxx = qMax(maxx, d->pic_d->brect.x() + d->pic_d->brect.width());
executed (the execution status of this line is deduced): maxx = qMax(maxx, d->pic_d->brect.x() + d->pic_d->brect.width());
-
367 maxy = qMax(maxy, d->pic_d->brect.y() + d->pic_d->brect.height());
executed (the execution status of this line is deduced): maxy = qMax(maxy, d->pic_d->brect.y() + d->pic_d->brect.height());
-
368 d->pic_d->brect = QRect(minx, miny, maxx - minx, maxy - miny);
executed (the execution status of this line is deduced): d->pic_d->brect = QRect(minx, miny, maxx - minx, maxy - miny);
-
369 } else {
executed: }
Execution Count:2
2
370 d->pic_d->brect = QRect(minx, miny, maxx - minx, maxy - miny);
executed (the execution status of this line is deduced): d->pic_d->brect = QRect(minx, miny, maxx - minx, maxy - miny);
-
371 }
executed: }
Execution Count:15
15
372 } -
373 }
executed: }
Execution Count:17
17
374}
executed: }
Execution Count:49
49
375 -
376void QPicturePaintEngine::drawEllipse(const QRectF &rect) -
377{ -
378 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
379#ifdef QT_PICTURE_DEBUG -
380 qDebug() << " -> drawEllipse():" << rect; -
381#endif -
382 int pos;
never executed (the execution status of this line is deduced): int pos;
-
383 SERIALIZE_CMD(QPicturePrivate::PdcDrawEllipse);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawEllipse; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
384 d->s << rect;
never executed (the execution status of this line is deduced): d->s << rect;
-
385 writeCmdLength(pos, rect, true);
never executed (the execution status of this line is deduced): writeCmdLength(pos, rect, true);
-
386}
never executed: }
0
387 -
388void QPicturePaintEngine::drawPath(const QPainterPath &path) -
389{ -
390 Q_D(QPicturePaintEngine);
executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
391#ifdef QT_PICTURE_DEBUG -
392 qDebug() << " -> drawPath():" << path.boundingRect(); -
393#endif -
394 int pos;
executed (the execution status of this line is deduced): int pos;
-
395 SERIALIZE_CMD(QPicturePrivate::PdcDrawPath);
executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawPath; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
396 d->s << path;
executed (the execution status of this line is deduced): d->s << path;
-
397 writeCmdLength(pos, path.boundingRect(), true);
executed (the execution status of this line is deduced): writeCmdLength(pos, path.boundingRect(), true);
-
398}
executed: }
Execution Count:10
10
399 -
400void QPicturePaintEngine::drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode) -
401{ -
402 Q_D(QPicturePaintEngine);
executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
403#ifdef QT_PICTURE_DEBUG -
404 qDebug() << " -> drawPolygon(): size=" << numPoints; -
405#endif -
406 int pos;
executed (the execution status of this line is deduced): int pos;
-
407 -
408 QPolygonF polygon;
executed (the execution status of this line is deduced): QPolygonF polygon;
-
409 for (int i=0; i<numPoints; ++i)
evaluated: i<numPoints
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:6
6-12
410 polygon << points[i];
executed: polygon << points[i];
Execution Count:12
12
411 -
412 if (mode == PolylineMode) {
partially evaluated: mode == PolylineMode
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
413 SERIALIZE_CMD(QPicturePrivate::PdcDrawPolyline);
executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawPolyline; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
414 d->s << polygon;
executed (the execution status of this line is deduced): d->s << polygon;
-
415 } else {
executed: }
Execution Count:6
6
416 SERIALIZE_CMD(QPicturePrivate::PdcDrawPolygon);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawPolygon; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
417 d->s << polygon;
never executed (the execution status of this line is deduced): d->s << polygon;
-
418 d->s << (qint8)(mode == OddEvenMode ? 0 : 1);
never executed (the execution status of this line is deduced): d->s << (qint8)(mode == OddEvenMode ? 0 : 1);
-
419 }
never executed: }
0
420 -
421 writeCmdLength(pos, polygon.boundingRect(), true);
executed (the execution status of this line is deduced): writeCmdLength(pos, polygon.boundingRect(), true);
-
422}
executed: }
Execution Count:6
6
423 -
424void QPicturePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) -
425{ -
426 Q_D(QPicturePaintEngine);
executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
427#ifdef QT_PICTURE_DEBUG -
428 qDebug() << " -> drawPixmap():" << r; -
429#endif -
430 int pos;
executed (the execution status of this line is deduced): int pos;
-
431 SERIALIZE_CMD(QPicturePrivate::PdcDrawPixmap);
executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawPixmap; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
432 -
433 if (d->pic_d->in_memory_only) {
partially evaluated: d->pic_d->in_memory_only
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
434 int index = d->pic_d->pixmap_list.size();
never executed (the execution status of this line is deduced): int index = d->pic_d->pixmap_list.size();
-
435 d->pic_d->pixmap_list.append(pm);
never executed (the execution status of this line is deduced): d->pic_d->pixmap_list.append(pm);
-
436 d->s << r << index << sr;
never executed (the execution status of this line is deduced): d->s << r << index << sr;
-
437 } else {
never executed: }
0
438 d->s << r << pm << sr;
executed (the execution status of this line is deduced): d->s << r << pm << sr;
-
439 }
executed: }
Execution Count:1
1
440 writeCmdLength(pos, r, false);
executed (the execution status of this line is deduced): writeCmdLength(pos, r, false);
-
441}
executed: }
Execution Count:1
1
442 -
443void QPicturePaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) -
444{ -
445 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
446#ifdef QT_PICTURE_DEBUG -
447 qDebug() << " -> drawTiledPixmap():" << r << s; -
448#endif -
449 int pos;
never executed (the execution status of this line is deduced): int pos;
-
450 SERIALIZE_CMD(QPicturePrivate::PdcDrawTiledPixmap);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawTiledPixmap; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
451 if (d->pic_d->in_memory_only) {
never evaluated: d->pic_d->in_memory_only
0
452 int index = d->pic_d->pixmap_list.size();
never executed (the execution status of this line is deduced): int index = d->pic_d->pixmap_list.size();
-
453 d->pic_d->pixmap_list.append(pixmap);
never executed (the execution status of this line is deduced): d->pic_d->pixmap_list.append(pixmap);
-
454 d->s << r << index << s;
never executed (the execution status of this line is deduced): d->s << r << index << s;
-
455 } else {
never executed: }
0
456 d->s << r << pixmap << s;
never executed (the execution status of this line is deduced): d->s << r << pixmap << s;
-
457 }
never executed: }
0
458 writeCmdLength(pos, r, false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, r, false);
-
459}
never executed: }
0
460 -
461void QPicturePaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr, -
462 Qt::ImageConversionFlags flags) -
463{ -
464 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
465#ifdef QT_PICTURE_DEBUG -
466 qDebug() << " -> drawImage():" << r << sr; -
467#endif -
468 int pos;
never executed (the execution status of this line is deduced): int pos;
-
469 SERIALIZE_CMD(QPicturePrivate::PdcDrawImage);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawImage; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
470 if (d->pic_d->in_memory_only) {
never evaluated: d->pic_d->in_memory_only
0
471 int index = d->pic_d->image_list.size();
never executed (the execution status of this line is deduced): int index = d->pic_d->image_list.size();
-
472 d->pic_d->image_list.append(image);
never executed (the execution status of this line is deduced): d->pic_d->image_list.append(image);
-
473 d->s << r << index << sr << (quint32) flags;
never executed (the execution status of this line is deduced): d->s << r << index << sr << (quint32) flags;
-
474 } else {
never executed: }
0
475 d->s << r << image << sr << (quint32) flags;
never executed (the execution status of this line is deduced): d->s << r << image << sr << (quint32) flags;
-
476 }
never executed: }
0
477 writeCmdLength(pos, r, false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, r, false);
-
478}
never executed: }
0
479 -
480void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) -
481{ -
482 Q_D(QPicturePaintEngine);
never executed (the execution status of this line is deduced): QPicturePaintEnginePrivate * const d = d_func();
-
483#ifdef QT_PICTURE_DEBUG -
484 qDebug() << " -> drawTextItem():" << p << ti.text(); -
485#endif -
486 -
487 const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
never executed (the execution status of this line is deduced): const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
-
488 if (si.chars == 0)
never evaluated: si.chars == 0
0
489 QPaintEngine::drawTextItem(p, ti); // Draw as path
never executed: QPaintEngine::drawTextItem(p, ti);
0
490 -
491 if (d->pic_d->formatMajor >= 9) {
never evaluated: d->pic_d->formatMajor >= 9
0
492 int pos;
never executed (the execution status of this line is deduced): int pos;
-
493 SERIALIZE_CMD(QPicturePrivate::PdcDrawTextItem);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawTextItem; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
494 QFont fnt = ti.font();
never executed (the execution status of this line is deduced): QFont fnt = ti.font();
-
495 fnt.setUnderline(false);
never executed (the execution status of this line is deduced): fnt.setUnderline(false);
-
496 fnt.setStrikeOut(false);
never executed (the execution status of this line is deduced): fnt.setStrikeOut(false);
-
497 fnt.setOverline(false);
never executed (the execution status of this line is deduced): fnt.setOverline(false);
-
498 -
499 qreal justificationWidth = 0;
never executed (the execution status of this line is deduced): qreal justificationWidth = 0;
-
500 if (si.justified)
never evaluated: si.justified
0
501 justificationWidth = si.width.toReal();
never executed: justificationWidth = si.width.toReal();
0
502 -
503 d->s << p << ti.text() << fnt << ti.renderFlags() << double(fnt.d->dpi)/qt_defaultDpi() << justificationWidth;
never executed (the execution status of this line is deduced): d->s << p << ti.text() << fnt << ti.renderFlags() << double(fnt.d->dpi)/qt_defaultDpi() << justificationWidth;
-
504 writeCmdLength(pos, /*brect=*/QRectF(), /*corr=*/false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
505 } else if (d->pic_d->formatMajor >= 8) {
never executed: }
never evaluated: d->pic_d->formatMajor >= 8
0
506 // old old (buggy) format -
507 int pos;
never executed (the execution status of this line is deduced): int pos;
-
508 SERIALIZE_CMD(QPicturePrivate::PdcDrawTextItem);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawTextItem; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
509 d->s << QPointF(p.x(), p.y() - ti.ascent()) << ti.text() << ti.font() << ti.renderFlags();
never executed (the execution status of this line is deduced): d->s << QPointF(p.x(), p.y() - ti.ascent()) << ti.text() << ti.font() << ti.renderFlags();
-
510 writeCmdLength(pos, /*brect=*/QRectF(), /*corr=*/false);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(), false);
-
511 } else {
never executed: }
0
512 // old (buggy) format -
513 int pos;
never executed (the execution status of this line is deduced): int pos;
-
514 SERIALIZE_CMD(QPicturePrivate::PdcDrawText2);
never executed (the execution status of this line is deduced): d->pic_d->trecs++; d->s << (quint8) QPicturePrivate::PdcDrawText2; d->s << (quint8) 0; pos = d->pic_d->pictb.pos();
-
515 d->s << p << ti.text();
never executed (the execution status of this line is deduced): d->s << p << ti.text();
-
516 writeCmdLength(pos, QRectF(p, QSizeF(1,1)), true);
never executed (the execution status of this line is deduced): writeCmdLength(pos, QRectF(p, QSizeF(1,1)), true);
-
517 }
never executed: }
0
518} -
519 -
520void QPicturePaintEngine::updateState(const QPaintEngineState &state) -
521{ -
522 QPaintEngine::DirtyFlags flags = state.state();
executed (the execution status of this line is deduced): QPaintEngine::DirtyFlags flags = state.state();
-
523 if (flags & DirtyPen) updatePen(state.pen());
executed: updatePen(state.pen());
Execution Count:16
evaluated: flags & DirtyPen
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:1
1-16
524 if (flags & DirtyBrush) updateBrush(state.brush());
executed: updateBrush(state.brush());
Execution Count:16
evaluated: flags & DirtyBrush
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:1
1-16
525 if (flags & DirtyBrushOrigin) updateBrushOrigin(state.brushOrigin());
never executed: updateBrushOrigin(state.brushOrigin());
partially evaluated: flags & DirtyBrushOrigin
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
526 if (flags & DirtyFont) updateFont(state.font());
never executed: updateFont(state.font());
partially evaluated: flags & DirtyFont
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
527 if (flags & DirtyBackground) updateBackground(state.backgroundMode(), state.backgroundBrush());
never executed: updateBackground(state.backgroundMode(), state.backgroundBrush());
partially evaluated: flags & DirtyBackground
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
528 if (flags & DirtyTransform) updateMatrix(state.transform());
never executed: updateMatrix(state.transform());
partially evaluated: flags & DirtyTransform
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
529 if (flags & DirtyClipEnabled) updateClipEnabled(state.isClipEnabled());
never executed: updateClipEnabled(state.isClipEnabled());
partially evaluated: flags & DirtyClipEnabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
530 if (flags & DirtyClipRegion) updateClipRegion(state.clipRegion(), state.clipOperation());
never executed: updateClipRegion(state.clipRegion(), state.clipOperation());
partially evaluated: flags & DirtyClipRegion
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
531 if (flags & DirtyClipPath) updateClipPath(state.clipPath(), state.clipOperation());
never executed: updateClipPath(state.clipPath(), state.clipOperation());
partially evaluated: flags & DirtyClipPath
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
532 if (flags & DirtyHints) updateRenderHints(state.renderHints());
never executed: updateRenderHints(state.renderHints());
partially evaluated: flags & DirtyHints
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
533 if (flags & DirtyCompositionMode) updateCompositionMode(state.compositionMode());
never executed: updateCompositionMode(state.compositionMode());
partially evaluated: flags & DirtyCompositionMode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
534 if (flags & DirtyOpacity) updateOpacity(state.opacity());
never executed: updateOpacity(state.opacity());
partially evaluated: flags & DirtyOpacity
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
535}
executed: }
Execution Count:17
17
536 -
537QT_END_NAMESPACE -
538 -
539#endif // QT_NO_PICTURE -
540 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial