kernel/qpaintengine_alpha.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 <qglobal.h> -
43 -
44#ifndef QT_NO_PRINTER -
45#include <qdebug.h> -
46#include "private/qpaintengine_alpha_p.h" -
47 -
48#include "private/qpainter_p.h" -
49#include "private/qpicture_p.h" -
50#include "private/qfont_p.h" -
51#include "QtGui/qpicture.h" -
52 -
53QT_BEGIN_NAMESPACE -
54 -
55QAlphaPaintEngine::QAlphaPaintEngine(QAlphaPaintEnginePrivate &data, PaintEngineFeatures devcaps) -
56 : QPaintEngine(data, devcaps) -
57{ -
58 -
59}
never executed: }
0
60 -
61QAlphaPaintEngine::~QAlphaPaintEngine() -
62{ -
63 -
64} -
65 -
66bool QAlphaPaintEngine::begin(QPaintDevice *pdev) -
67{ -
68 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
69 -
70 d->m_continueCall = true;
never executed (the execution status of this line is deduced): d->m_continueCall = true;
-
71 if (d->m_pass != 0) {
never evaluated: d->m_pass != 0
0
72 return true;
never executed: return true;
0
73 } -
74 -
75 d->m_savedcaps = gccaps;
never executed (the execution status of this line is deduced): d->m_savedcaps = gccaps;
-
76 d->m_pdev = pdev;
never executed (the execution status of this line is deduced): d->m_pdev = pdev;
-
77 -
78 d->m_alphaPen = false;
never executed (the execution status of this line is deduced): d->m_alphaPen = false;
-
79 d->m_alphaBrush = false;
never executed (the execution status of this line is deduced): d->m_alphaBrush = false;
-
80 d->m_alphaOpacity = false;
never executed (the execution status of this line is deduced): d->m_alphaOpacity = false;
-
81 d->m_hasalpha = false;
never executed (the execution status of this line is deduced): d->m_hasalpha = false;
-
82 d->m_advancedPen = false;
never executed (the execution status of this line is deduced): d->m_advancedPen = false;
-
83 d->m_advancedBrush = false;
never executed (the execution status of this line is deduced): d->m_advancedBrush = false;
-
84 d->m_complexTransform = false;
never executed (the execution status of this line is deduced): d->m_complexTransform = false;
-
85 d->m_emulateProjectiveTransforms = false;
never executed (the execution status of this line is deduced): d->m_emulateProjectiveTransforms = false;
-
86 -
87 // clear alpha region -
88 d->m_alphargn = QRegion();
never executed (the execution status of this line is deduced): d->m_alphargn = QRegion();
-
89 d->m_cliprgn = QRegion();
never executed (the execution status of this line is deduced): d->m_cliprgn = QRegion();
-
90 d->m_pen = QPen();
never executed (the execution status of this line is deduced): d->m_pen = QPen();
-
91 d->m_transform = QTransform();
never executed (the execution status of this line is deduced): d->m_transform = QTransform();
-
92 -
93 flushAndInit();
never executed (the execution status of this line is deduced): flushAndInit();
-
94 -
95 return true;
never executed: return true;
0
96} -
97 -
98bool QAlphaPaintEngine::end() -
99{ -
100 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
101 -
102 d->m_continueCall = true;
never executed (the execution status of this line is deduced): d->m_continueCall = true;
-
103 if (d->m_pass != 0) {
never evaluated: d->m_pass != 0
0
104 return true;
never executed: return true;
0
105 } -
106 -
107 flushAndInit(false);
never executed (the execution status of this line is deduced): flushAndInit(false);
-
108 return true;
never executed: return true;
0
109} -
110 -
111void QAlphaPaintEngine::updateState(const QPaintEngineState &state) -
112{ -
113 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
114 -
115 DirtyFlags flags = state.state();
never executed (the execution status of this line is deduced): DirtyFlags flags = state.state();
-
116 if (flags & QPaintEngine::DirtyTransform) {
never evaluated: flags & QPaintEngine::DirtyTransform
0
117 d->m_transform = state.transform();
never executed (the execution status of this line is deduced): d->m_transform = state.transform();
-
118 d->m_complexTransform = (d->m_transform.type() > QTransform::TxScale);
never executed (the execution status of this line is deduced): d->m_complexTransform = (d->m_transform.type() > QTransform::TxScale);
-
119 d->m_emulateProjectiveTransforms = !(d->m_savedcaps & QPaintEngine::PerspectiveTransform)
never evaluated: !(d->m_savedcaps & QPaintEngine::PerspectiveTransform)
0
120 && !(d->m_savedcaps & QPaintEngine::AlphaBlend)
never evaluated: !(d->m_savedcaps & QPaintEngine::AlphaBlend)
0
121 && (d->m_transform.type() >= QTransform::TxProject);
never evaluated: (d->m_transform.type() >= QTransform::TxProject)
0
122 }
never executed: }
0
123 if (flags & QPaintEngine::DirtyPen) {
never evaluated: flags & QPaintEngine::DirtyPen
0
124 d->m_pen = state.pen();
never executed (the execution status of this line is deduced): d->m_pen = state.pen();
-
125 if (d->m_pen.style() == Qt::NoPen) {
never evaluated: d->m_pen.style() == Qt::NoPen
0
126 d->m_advancedPen = false;
never executed (the execution status of this line is deduced): d->m_advancedPen = false;
-
127 d->m_alphaPen = false;
never executed (the execution status of this line is deduced): d->m_alphaPen = false;
-
128 } else {
never executed: }
0
129 d->m_advancedPen = (d->m_pen.brush().style() != Qt::SolidPattern);
never executed (the execution status of this line is deduced): d->m_advancedPen = (d->m_pen.brush().style() != Qt::SolidPattern);
-
130 d->m_alphaPen = !d->m_pen.brush().isOpaque();
never executed (the execution status of this line is deduced): d->m_alphaPen = !d->m_pen.brush().isOpaque();
-
131 }
never executed: }
0
132 } -
133 -
134 if (d->m_pass != 0) {
never evaluated: d->m_pass != 0
0
135 d->m_continueCall = true;
never executed (the execution status of this line is deduced): d->m_continueCall = true;
-
136 return;
never executed: return;
0
137 } -
138 d->m_continueCall = false;
never executed (the execution status of this line is deduced): d->m_continueCall = false;
-
139 -
140 if (flags & QPaintEngine::DirtyOpacity) {
never evaluated: flags & QPaintEngine::DirtyOpacity
0
141 d->m_alphaOpacity = (state.opacity() != 1.0f);
never executed (the execution status of this line is deduced): d->m_alphaOpacity = (state.opacity() != 1.0f);
-
142 }
never executed: }
0
143 -
144 if (flags & QPaintEngine::DirtyBrush) {
never evaluated: flags & QPaintEngine::DirtyBrush
0
145 if (state.brush().style() == Qt::NoBrush) {
never evaluated: state.brush().style() == Qt::NoBrush
0
146 d->m_advancedBrush = false;
never executed (the execution status of this line is deduced): d->m_advancedBrush = false;
-
147 d->m_alphaBrush = false;
never executed (the execution status of this line is deduced): d->m_alphaBrush = false;
-
148 } else {
never executed: }
0
149 d->m_advancedBrush = (state.brush().style() != Qt::SolidPattern);
never executed (the execution status of this line is deduced): d->m_advancedBrush = (state.brush().style() != Qt::SolidPattern);
-
150 d->m_alphaBrush = !state.brush().isOpaque();
never executed (the execution status of this line is deduced): d->m_alphaBrush = !state.brush().isOpaque();
-
151 }
never executed: }
0
152 } -
153 -
154 -
155 d->m_hasalpha = d->m_alphaOpacity || d->m_alphaBrush || d->m_alphaPen;
never evaluated: d->m_alphaOpacity
never evaluated: d->m_alphaBrush
never evaluated: d->m_alphaPen
0
156 -
157 if (d->m_picengine)
never evaluated: d->m_picengine
0
158 d->m_picengine->updateState(state);
never executed: d->m_picengine->updateState(state);
0
159}
never executed: }
0
160 -
161void QAlphaPaintEngine::drawPath(const QPainterPath &path) -
162{ -
163 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
164 -
165 QRectF tr = d->addPenWidth(path);
never executed (the execution status of this line is deduced): QRectF tr = d->addPenWidth(path);
-
166 -
167 if (d->m_pass == 0) {
never evaluated: d->m_pass == 0
0
168 d->m_continueCall = false;
never executed (the execution status of this line is deduced): d->m_continueCall = false;
-
169 if (d->m_hasalpha || d->m_advancedPen || d->m_advancedBrush
never evaluated: d->m_hasalpha
never evaluated: d->m_advancedPen
never evaluated: d->m_advancedBrush
0
170 || d->m_emulateProjectiveTransforms)
never evaluated: d->m_emulateProjectiveTransforms
0
171 { -
172 d->addAlphaRect(tr);
never executed (the execution status of this line is deduced): d->addAlphaRect(tr);
-
173 }
never executed: }
0
174 if (d->m_picengine)
never evaluated: d->m_picengine
0
175 d->m_picengine->drawPath(path);
never executed: d->m_picengine->drawPath(path);
0
176 } else {
never executed: }
0
177 d->m_continueCall = !d->fullyContained(tr);
never executed (the execution status of this line is deduced): d->m_continueCall = !d->fullyContained(tr);
-
178 }
never executed: }
0
179} -
180 -
181void QAlphaPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) -
182{ -
183 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
184 -
185 QPolygonF poly;
never executed (the execution status of this line is deduced): QPolygonF poly;
-
186 for (int i=0; i<pointCount; ++i)
never evaluated: i<pointCount
0
187 poly.append(points[i]);
never executed: poly.append(points[i]);
0
188 -
189 QPainterPath path;
never executed (the execution status of this line is deduced): QPainterPath path;
-
190 path.addPolygon(poly);
never executed (the execution status of this line is deduced): path.addPolygon(poly);
-
191 QRectF tr = d->addPenWidth(path);
never executed (the execution status of this line is deduced): QRectF tr = d->addPenWidth(path);
-
192 -
193 if (d->m_pass == 0) {
never evaluated: d->m_pass == 0
0
194 d->m_continueCall = false;
never executed (the execution status of this line is deduced): d->m_continueCall = false;
-
195 if (d->m_hasalpha || d->m_advancedPen || d->m_advancedBrush
never evaluated: d->m_hasalpha
never evaluated: d->m_advancedPen
never evaluated: d->m_advancedBrush
0
196 || d->m_emulateProjectiveTransforms)
never evaluated: d->m_emulateProjectiveTransforms
0
197 { -
198 d->addAlphaRect(tr);
never executed (the execution status of this line is deduced): d->addAlphaRect(tr);
-
199 }
never executed: }
0
200 -
201 if (d->m_picengine)
never evaluated: d->m_picengine
0
202 d->m_picengine->drawPolygon(points, pointCount, mode);
never executed: d->m_picengine->drawPolygon(points, pointCount, mode);
0
203 } else {
never executed: }
0
204 d->m_continueCall = !d->fullyContained(tr);
never executed (the execution status of this line is deduced): d->m_continueCall = !d->fullyContained(tr);
-
205 }
never executed: }
0
206} -
207 -
208void QAlphaPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) -
209{ -
210 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
211 -
212 QRectF tr = d->m_transform.mapRect(r);
never executed (the execution status of this line is deduced): QRectF tr = d->m_transform.mapRect(r);
-
213 if (d->m_pass == 0) {
never evaluated: d->m_pass == 0
0
214 d->m_continueCall = false;
never executed (the execution status of this line is deduced): d->m_continueCall = false;
-
215 if (pm.hasAlpha() || d->m_alphaOpacity || d->m_complexTransform || pm.isQBitmap()) {
never evaluated: pm.hasAlpha()
never evaluated: d->m_alphaOpacity
never evaluated: d->m_complexTransform
never evaluated: pm.isQBitmap()
0
216 d->addAlphaRect(tr);
never executed (the execution status of this line is deduced): d->addAlphaRect(tr);
-
217 }
never executed: }
0
218 -
219 if (d->m_picengine)
never evaluated: d->m_picengine
0
220 d->m_picengine->drawPixmap(r, pm, sr);
never executed: d->m_picengine->drawPixmap(r, pm, sr);
0
221 -
222 } else {
never executed: }
0
223 d->m_continueCall = !d->fullyContained(tr);
never executed (the execution status of this line is deduced): d->m_continueCall = !d->fullyContained(tr);
-
224 }
never executed: }
0
225} -
226 -
227void QAlphaPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) -
228{ -
229 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
230 -
231 QRectF tr(p.x(), p.y() - textItem.ascent(), textItem.width() + 5, textItem.ascent() + textItem.descent() + 5);
never executed (the execution status of this line is deduced): QRectF tr(p.x(), p.y() - textItem.ascent(), textItem.width() + 5, textItem.ascent() + textItem.descent() + 5);
-
232 tr = d->m_transform.mapRect(tr);
never executed (the execution status of this line is deduced): tr = d->m_transform.mapRect(tr);
-
233 -
234 if (d->m_pass == 0) {
never evaluated: d->m_pass == 0
0
235 d->m_continueCall = false;
never executed (the execution status of this line is deduced): d->m_continueCall = false;
-
236 if (d->m_alphaPen || d->m_alphaOpacity || d->m_advancedPen) {
never evaluated: d->m_alphaPen
never evaluated: d->m_alphaOpacity
never evaluated: d->m_advancedPen
0
237 d->addAlphaRect(tr);
never executed (the execution status of this line is deduced): d->addAlphaRect(tr);
-
238 }
never executed: }
0
239 if (d->m_picengine) {
never evaluated: d->m_picengine
0
240 d->m_picengine->drawTextItem(p, textItem);
never executed (the execution status of this line is deduced): d->m_picengine->drawTextItem(p, textItem);
-
241 }
never executed: }
0
242 } else {
never executed: }
0
243 d->m_continueCall = !d->fullyContained(tr);
never executed (the execution status of this line is deduced): d->m_continueCall = !d->fullyContained(tr);
-
244 }
never executed: }
0
245} -
246 -
247void QAlphaPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) -
248{ -
249 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
250 -
251 QRectF brect = d->m_transform.mapRect(r);
never executed (the execution status of this line is deduced): QRectF brect = d->m_transform.mapRect(r);
-
252 -
253 if (d->m_pass == 0) {
never evaluated: d->m_pass == 0
0
254 d->m_continueCall = false;
never executed (the execution status of this line is deduced): d->m_continueCall = false;
-
255 if (pixmap.hasAlpha() || d->m_alphaOpacity || d->m_complexTransform || pixmap.isQBitmap()) {
never evaluated: pixmap.hasAlpha()
never evaluated: d->m_alphaOpacity
never evaluated: d->m_complexTransform
never evaluated: pixmap.isQBitmap()
0
256 d->addAlphaRect(brect);
never executed (the execution status of this line is deduced): d->addAlphaRect(brect);
-
257 }
never executed: }
0
258 if (d->m_picengine)
never evaluated: d->m_picengine
0
259 d->m_picengine->drawTiledPixmap(r, pixmap, s);
never executed: d->m_picengine->drawTiledPixmap(r, pixmap, s);
0
260 } else {
never executed: }
0
261 d->m_continueCall = !d->fullyContained(brect);
never executed (the execution status of this line is deduced): d->m_continueCall = !d->fullyContained(brect);
-
262 }
never executed: }
0
263} -
264 -
265QRegion QAlphaPaintEngine::alphaClipping() const -
266{ -
267 Q_D(const QAlphaPaintEngine);
never executed (the execution status of this line is deduced): const QAlphaPaintEnginePrivate * const d = d_func();
-
268 return d->m_cliprgn;
never executed: return d->m_cliprgn;
0
269} -
270 -
271bool QAlphaPaintEngine::continueCall() const -
272{ -
273 Q_D(const QAlphaPaintEngine);
never executed (the execution status of this line is deduced): const QAlphaPaintEnginePrivate * const d = d_func();
-
274 return d->m_continueCall;
never executed: return d->m_continueCall;
0
275} -
276 -
277void QAlphaPaintEngine::flushAndInit(bool init) -
278{ -
279 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
280 Q_ASSERT(d->m_pass == 0);
never executed (the execution status of this line is deduced): qt_noop();
-
281 -
282 if (d->m_pic) {
never evaluated: d->m_pic
0
283 d->m_picpainter->end();
never executed (the execution status of this line is deduced): d->m_picpainter->end();
-
284 -
285 // set clip region -
286 d->m_alphargn = d->m_alphargn.intersected(QRect(0, 0, d->m_pdev->width(), d->m_pdev->height()));
never executed (the execution status of this line is deduced): d->m_alphargn = d->m_alphargn.intersected(QRect(0, 0, d->m_pdev->width(), d->m_pdev->height()));
-
287 -
288 // just use the bounding rect if it's a complex region.. -
289 QVector<QRect> rects = d->m_alphargn.rects();
never executed (the execution status of this line is deduced): QVector<QRect> rects = d->m_alphargn.rects();
-
290 if (rects.size() > 10) {
never evaluated: rects.size() > 10
0
291 QRect br = d->m_alphargn.boundingRect();
never executed (the execution status of this line is deduced): QRect br = d->m_alphargn.boundingRect();
-
292 d->m_alphargn = QRegion(br);
never executed (the execution status of this line is deduced): d->m_alphargn = QRegion(br);
-
293 rects.clear();
never executed (the execution status of this line is deduced): rects.clear();
-
294 rects.append(br);
never executed (the execution status of this line is deduced): rects.append(br);
-
295 }
never executed: }
0
296 -
297 d->m_cliprgn = d->m_alphargn;
never executed (the execution status of this line is deduced): d->m_cliprgn = d->m_alphargn;
-
298 -
299 // now replay the QPicture -
300 ++d->m_pass; // we are now doing pass #2
never executed (the execution status of this line is deduced): ++d->m_pass;
-
301 -
302 // reset states -
303 gccaps = d->m_savedcaps;
never executed (the execution status of this line is deduced): gccaps = d->m_savedcaps;
-
304 -
305 painter()->save();
never executed (the execution status of this line is deduced): painter()->save();
-
306 d->resetState(painter());
never executed (the execution status of this line is deduced): d->resetState(painter());
-
307 -
308 // make sure the output from QPicture is unscaled -
309 QTransform mtx;
never executed (the execution status of this line is deduced): QTransform mtx;
-
310 mtx.scale(1.0f / (qreal(d->m_pdev->logicalDpiX()) / qreal(qt_defaultDpiX())),
never executed (the execution status of this line is deduced): mtx.scale(1.0f / (qreal(d->m_pdev->logicalDpiX()) / qreal(qt_defaultDpiX())),
-
311 1.0f / (qreal(d->m_pdev->logicalDpiY()) / qreal(qt_defaultDpiY())));
never executed (the execution status of this line is deduced): 1.0f / (qreal(d->m_pdev->logicalDpiY()) / qreal(qt_defaultDpiY())));
-
312 painter()->setTransform(mtx);
never executed (the execution status of this line is deduced): painter()->setTransform(mtx);
-
313 painter()->drawPicture(0, 0, *d->m_pic);
never executed (the execution status of this line is deduced): painter()->drawPicture(0, 0, *d->m_pic);
-
314 -
315 d->m_cliprgn = QRegion();
never executed (the execution status of this line is deduced): d->m_cliprgn = QRegion();
-
316 d->resetState(painter());
never executed (the execution status of this line is deduced): d->resetState(painter());
-
317 -
318 // fill in the alpha images -
319 for (int i=0; i<rects.size(); ++i)
never evaluated: i<rects.size()
0
320 d->drawAlphaImage(rects.at(i));
never executed: d->drawAlphaImage(rects.at(i));
0
321 -
322 d->m_alphargn = QRegion();
never executed (the execution status of this line is deduced): d->m_alphargn = QRegion();
-
323 -
324 painter()->restore();
never executed (the execution status of this line is deduced): painter()->restore();
-
325 -
326 --d->m_pass; // pass #2 finished
never executed (the execution status of this line is deduced): --d->m_pass;
-
327 -
328 cleanUp();
never executed (the execution status of this line is deduced): cleanUp();
-
329 }
never executed: }
0
330 -
331 if (init) {
never evaluated: init
0
332 gccaps = PaintEngineFeatures(AllFeatures & ~QPaintEngine::ObjectBoundingModeGradients);
never executed (the execution status of this line is deduced): gccaps = PaintEngineFeatures(AllFeatures & ~QPaintEngine::ObjectBoundingModeGradients);
-
333 -
334 d->m_pic = new QPicture();
never executed (the execution status of this line is deduced): d->m_pic = new QPicture();
-
335 d->m_pic->d_ptr->in_memory_only = true;
never executed (the execution status of this line is deduced): d->m_pic->d_ptr->in_memory_only = true;
-
336 d->m_picpainter = new QPainter(d->m_pic);
never executed (the execution status of this line is deduced): d->m_picpainter = new QPainter(d->m_pic);
-
337 d->m_picengine = d->m_picpainter->paintEngine();
never executed (the execution status of this line is deduced): d->m_picengine = d->m_picpainter->paintEngine();
-
338 -
339 // When newPage() is called and the m_picpainter is recreated -
340 // we have to copy the current state of the original printer -
341 // painter back to the m_picpainter -
342 d->m_picpainter->setPen(painter()->pen());
never executed (the execution status of this line is deduced): d->m_picpainter->setPen(painter()->pen());
-
343 d->m_picpainter->setBrush(painter()->brush());
never executed (the execution status of this line is deduced): d->m_picpainter->setBrush(painter()->brush());
-
344 d->m_picpainter->setBrushOrigin(painter()->brushOrigin());
never executed (the execution status of this line is deduced): d->m_picpainter->setBrushOrigin(painter()->brushOrigin());
-
345 d->m_picpainter->setFont(painter()->font());
never executed (the execution status of this line is deduced): d->m_picpainter->setFont(painter()->font());
-
346 d->m_picpainter->setOpacity(painter()->opacity());
never executed (the execution status of this line is deduced): d->m_picpainter->setOpacity(painter()->opacity());
-
347 d->m_picpainter->setTransform(painter()->combinedTransform());
never executed (the execution status of this line is deduced): d->m_picpainter->setTransform(painter()->combinedTransform());
-
348 d->m_picengine->syncState();
never executed (the execution status of this line is deduced): d->m_picengine->syncState();
-
349 }
never executed: }
0
350}
never executed: }
0
351 -
352void QAlphaPaintEngine::cleanUp() -
353{ -
354 Q_D(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEnginePrivate * const d = d_func();
-
355 -
356 delete d->m_picpainter;
never executed (the execution status of this line is deduced): delete d->m_picpainter;
-
357 delete d->m_pic;
never executed (the execution status of this line is deduced): delete d->m_pic;
-
358 -
359 d->m_picpainter = 0;
never executed (the execution status of this line is deduced): d->m_picpainter = 0;
-
360 d->m_pic = 0;
never executed (the execution status of this line is deduced): d->m_pic = 0;
-
361 d->m_picengine = 0;
never executed (the execution status of this line is deduced): d->m_picengine = 0;
-
362}
never executed: }
0
363 -
364QAlphaPaintEnginePrivate::QAlphaPaintEnginePrivate() -
365 : m_pass(0), -
366 m_pic(0), -
367 m_picengine(0), -
368 m_picpainter(0), -
369 m_hasalpha(false), -
370 m_alphaPen(false), -
371 m_alphaBrush(false), -
372 m_alphaOpacity(false), -
373 m_advancedPen(false), -
374 m_advancedBrush(false), -
375 m_complexTransform(false) -
376{ -
377 -
378}
never executed: }
0
379 -
380QAlphaPaintEnginePrivate::~QAlphaPaintEnginePrivate() -
381{ -
382 delete m_picpainter;
never executed (the execution status of this line is deduced): delete m_picpainter;
-
383 delete m_pic;
never executed (the execution status of this line is deduced): delete m_pic;
-
384}
never executed: }
0
385 -
386QRectF QAlphaPaintEnginePrivate::addPenWidth(const QPainterPath &path) -
387{ -
388 Q_Q(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEngine * const q = q_func();
-
389 -
390 QPainterPath tmp = path;
never executed (the execution status of this line is deduced): QPainterPath tmp = path;
-
391 -
392 if (m_pen.style() == Qt::NoPen)
never evaluated: m_pen.style() == Qt::NoPen
0
393 return (path.controlPointRect() * m_transform).boundingRect();
never executed: return (path.controlPointRect() * m_transform).boundingRect();
0
394 bool cosmetic = qt_pen_is_cosmetic(m_pen, q->state->renderHints());
never executed (the execution status of this line is deduced): bool cosmetic = qt_pen_is_cosmetic(m_pen, q->state->renderHints());
-
395 if (cosmetic)
never evaluated: cosmetic
0
396 tmp = path * m_transform;
never executed: tmp = path * m_transform;
0
397 -
398 QPainterPathStroker stroker;
never executed (the execution status of this line is deduced): QPainterPathStroker stroker;
-
399 if (m_pen.widthF() == 0.0f)
never evaluated: m_pen.widthF() == 0.0f
0
400 stroker.setWidth(1.0);
never executed: stroker.setWidth(1.0);
0
401 else -
402 stroker.setWidth(m_pen.widthF());
never executed: stroker.setWidth(m_pen.widthF());
0
403 stroker.setJoinStyle(m_pen.joinStyle());
never executed (the execution status of this line is deduced): stroker.setJoinStyle(m_pen.joinStyle());
-
404 stroker.setCapStyle(m_pen.capStyle());
never executed (the execution status of this line is deduced): stroker.setCapStyle(m_pen.capStyle());
-
405 tmp = stroker.createStroke(tmp);
never executed (the execution status of this line is deduced): tmp = stroker.createStroke(tmp);
-
406 if (cosmetic)
never evaluated: cosmetic
0
407 return tmp.controlPointRect();
never executed: return tmp.controlPointRect();
0
408 -
409 return (tmp.controlPointRect() * m_transform).boundingRect();
never executed: return (tmp.controlPointRect() * m_transform).boundingRect();
0
410} -
411 -
412QRect QAlphaPaintEnginePrivate::toRect(const QRectF &rect) const -
413{ -
414 QRect r;
never executed (the execution status of this line is deduced): QRect r;
-
415 r.setLeft(int(rect.left()));
never executed (the execution status of this line is deduced): r.setLeft(int(rect.left()));
-
416 r.setTop(int(rect.top()));
never executed (the execution status of this line is deduced): r.setTop(int(rect.top()));
-
417 r.setRight(int(rect.right() + 1));
never executed (the execution status of this line is deduced): r.setRight(int(rect.right() + 1));
-
418 r.setBottom(int(rect.bottom() + 1));
never executed (the execution status of this line is deduced): r.setBottom(int(rect.bottom() + 1));
-
419 return r;
never executed: return r;
0
420} -
421 -
422void QAlphaPaintEnginePrivate::addAlphaRect(const QRectF &rect) -
423{ -
424 m_alphargn |= toRect(rect);
never executed (the execution status of this line is deduced): m_alphargn |= toRect(rect);
-
425}
never executed: }
0
426 -
427void QAlphaPaintEnginePrivate::drawAlphaImage(const QRectF &rect) -
428{ -
429 Q_Q(QAlphaPaintEngine);
never executed (the execution status of this line is deduced): QAlphaPaintEngine * const q = q_func();
-
430 -
431 qreal dpiX = qMax(m_pdev->logicalDpiX(), 300);
never executed (the execution status of this line is deduced): qreal dpiX = qMax(m_pdev->logicalDpiX(), 300);
-
432 qreal dpiY = qMax(m_pdev->logicalDpiY(), 300);
never executed (the execution status of this line is deduced): qreal dpiY = qMax(m_pdev->logicalDpiY(), 300);
-
433 qreal xscale = (dpiX / m_pdev->logicalDpiX());
never executed (the execution status of this line is deduced): qreal xscale = (dpiX / m_pdev->logicalDpiX());
-
434 qreal yscale = (dpiY / m_pdev->logicalDpiY());
never executed (the execution status of this line is deduced): qreal yscale = (dpiY / m_pdev->logicalDpiY());
-
435 -
436 QTransform picscale;
never executed (the execution status of this line is deduced): QTransform picscale;
-
437 picscale.scale(xscale, yscale);
never executed (the execution status of this line is deduced): picscale.scale(xscale, yscale);
-
438 -
439 const int tileSize = 2048;
never executed (the execution status of this line is deduced): const int tileSize = 2048;
-
440 QSize size((int(rect.width() * xscale)), int(rect.height() * yscale));
never executed (the execution status of this line is deduced): QSize size((int(rect.width() * xscale)), int(rect.height() * yscale));
-
441 int divw = (size.width() / tileSize);
never executed (the execution status of this line is deduced): int divw = (size.width() / tileSize);
-
442 int divh = (size.height() / tileSize);
never executed (the execution status of this line is deduced): int divh = (size.height() / tileSize);
-
443 divw += 1;
never executed (the execution status of this line is deduced): divw += 1;
-
444 divh += 1;
never executed (the execution status of this line is deduced): divh += 1;
-
445 -
446 int incx = int(rect.width() / divw);
never executed (the execution status of this line is deduced): int incx = int(rect.width() / divw);
-
447 int incy = int(rect.height() / divh);
never executed (the execution status of this line is deduced): int incy = int(rect.height() / divh);
-
448 -
449 for (int y=0; y<divh; ++y) {
never evaluated: y<divh
0
450 int ypos = int((incy * y) + rect.y());
never executed (the execution status of this line is deduced): int ypos = int((incy * y) + rect.y());
-
451 int height = int((y == (divh - 1)) ? (rect.height() - (incy * y)) : incy) + 1;
never executed (the execution status of this line is deduced): int height = int((y == (divh - 1)) ? (rect.height() - (incy * y)) : incy) + 1;
-
452 -
453 for (int x=0; x<divw; ++x) {
never evaluated: x<divw
0
454 int xpos = int((incx * x) + rect.x());
never executed (the execution status of this line is deduced): int xpos = int((incx * x) + rect.x());
-
455 int width = int((x == (divw - 1)) ? (rect.width() - (incx * x)) : incx) + 1;
never executed (the execution status of this line is deduced): int width = int((x == (divw - 1)) ? (rect.width() - (incx * x)) : incx) + 1;
-
456 -
457 QSize imgsize((int)(width * xscale), (int)(height * yscale));
never executed (the execution status of this line is deduced): QSize imgsize((int)(width * xscale), (int)(height * yscale));
-
458 QImage img(imgsize, QImage::Format_RGB32);
never executed (the execution status of this line is deduced): QImage img(imgsize, QImage::Format_RGB32);
-
459 img.fill(0xffffffff);
never executed (the execution status of this line is deduced): img.fill(0xffffffff);
-
460 -
461 QPainter imgpainter(&img);
never executed (the execution status of this line is deduced): QPainter imgpainter(&img);
-
462 imgpainter.setTransform(picscale);
never executed (the execution status of this line is deduced): imgpainter.setTransform(picscale);
-
463 QPointF picpos(qreal(-xpos), qreal(-ypos));
never executed (the execution status of this line is deduced): QPointF picpos(qreal(-xpos), qreal(-ypos));
-
464 imgpainter.drawPicture(picpos, *m_pic);
never executed (the execution status of this line is deduced): imgpainter.drawPicture(picpos, *m_pic);
-
465 imgpainter.end();
never executed (the execution status of this line is deduced): imgpainter.end();
-
466 -
467 q->painter()->setTransform(QTransform());
never executed (the execution status of this line is deduced): q->painter()->setTransform(QTransform());
-
468 QRect r(xpos, ypos, width, height);
never executed (the execution status of this line is deduced): QRect r(xpos, ypos, width, height);
-
469 q->painter()->drawImage(r, img);
never executed (the execution status of this line is deduced): q->painter()->drawImage(r, img);
-
470 }
never executed: }
0
471 }
never executed: }
0
472}
never executed: }
0
473 -
474bool QAlphaPaintEnginePrivate::fullyContained(const QRectF &rect) const -
475{ -
476 QRegion r(toRect(rect));
never executed (the execution status of this line is deduced): QRegion r(toRect(rect));
-
477 return (m_cliprgn.intersected(r) == r);
never executed: return (m_cliprgn.intersected(r) == r);
0
478} -
479 -
480void QAlphaPaintEnginePrivate::resetState(QPainter *p) -
481{ -
482 p->setPen(QPen());
never executed (the execution status of this line is deduced): p->setPen(QPen());
-
483 p->setBrush(QBrush());
never executed (the execution status of this line is deduced): p->setBrush(QBrush());
-
484 p->setBrushOrigin(0,0);
never executed (the execution status of this line is deduced): p->setBrushOrigin(0,0);
-
485 p->setBackground(QBrush());
never executed (the execution status of this line is deduced): p->setBackground(QBrush());
-
486 p->setFont(QFont());
never executed (the execution status of this line is deduced): p->setFont(QFont());
-
487 p->setTransform(QTransform());
never executed (the execution status of this line is deduced): p->setTransform(QTransform());
-
488 // The view transform is already recorded and included in the -
489 // picture we're about to replay. If we don't turn if off, -
490 // the view matrix will be applied twice. -
491 p->setViewTransformEnabled(false);
never executed (the execution status of this line is deduced): p->setViewTransformEnabled(false);
-
492 p->setClipRegion(QRegion(), Qt::NoClip);
never executed (the execution status of this line is deduced): p->setClipRegion(QRegion(), Qt::NoClip);
-
493 p->setClipPath(QPainterPath(), Qt::NoClip);
never executed (the execution status of this line is deduced): p->setClipPath(QPainterPath(), Qt::NoClip);
-
494 p->setClipping(false);
never executed (the execution status of this line is deduced): p->setClipping(false);
-
495 p->setOpacity(1.0f);
never executed (the execution status of this line is deduced): p->setOpacity(1.0f);
-
496}
never executed: }
0
497 -
498 -
499QT_END_NAMESPACE -
500 -
501#endif // QT_NO_PRINTER -
502 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial