qpaintengine_preview.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/printsupport/kernel/qpaintengine_preview.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6class QPreviewPaintEnginePrivate : public QPaintEnginePrivate-
7{-
8 inline QPreviewPaintEngine* q_func() { return static_cast<QPreviewPaintEngine *>(q_ptr); } inline const QPreviewPaintEngine* q_func() const { return static_cast<const QPreviewPaintEngine *>(q_ptr); } friend class QPreviewPaintEngine;-
9public:-
10 QPreviewPaintEnginePrivate() : state(QPrinter::Idle) {}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
11 ~QPreviewPaintEnginePrivate() {}-
12-
13 QList<const QPicture *> pages;-
14 QPaintEngine *engine;-
15 QPainter *painter;-
16 QPrinter::PrinterState state;-
17-
18 QPaintEngine *proxy_paint_engine;-
19 QPrintEngine *proxy_print_engine;-
20};-
21-
22-
23QPreviewPaintEngine::QPreviewPaintEngine()-
24 : QPaintEngine(*(new QPreviewPaintEnginePrivate), PaintEngineFeatures(AllFeatures & ~ObjectBoundingModeGradients))-
25{-
26 QPreviewPaintEnginePrivate * const d = d_func();-
27 d->proxy_print_engine = 0;-
28 d->proxy_paint_engine = 0;-
29}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
30-
31QPreviewPaintEngine::~QPreviewPaintEngine()-
32{-
33 QPreviewPaintEnginePrivate * const d = d_func();-
34-
35 qDeleteAll(d->pages);-
36}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
37-
38bool QPreviewPaintEngine::begin(QPaintDevice *)-
39{-
40 QPreviewPaintEnginePrivate * const d = d_func();-
41-
42 qDeleteAll(d->pages);-
43 d->pages.clear();-
44-
45 QPicture *page = new QPicture;-
46 page->d_func()->in_memory_only = true;-
47 d->painter = new QPainter(page);-
48 d->engine = d->painter->paintEngine();-
49 *d->painter->d_func()->state = *painter()->d_func()->state;-
50 d->pages.append(page);-
51 d->state = QPrinter::Active;-
52 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_QPrinter
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QPrinter
1
53}-
54-
55bool QPreviewPaintEngine::end()-
56{-
57 QPreviewPaintEnginePrivate * const d = d_func();-
58-
59 delete d->painter;-
60 d->painter = 0;-
61 d->engine = 0;-
62 d->state = QPrinter::Idle;-
63 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_QPrinter
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QPrinter
1
64}-
65-
66void QPreviewPaintEngine::updateState(const QPaintEngineState &state)-
67{-
68 QPreviewPaintEnginePrivate * const d = d_func();-
69 d->engine->updateState(state);-
70}
executed 8 times by 1 test: end of block
Executed by:
  • tst_QPrinter
8
71-
72void QPreviewPaintEngine::drawPath(const QPainterPath &path)-
73{-
74 QPreviewPaintEnginePrivate * const d = d_func();-
75 d->engine->drawPath(path);-
76}
executed 4 times by 1 test: end of block
Executed by:
  • tst_QPrinter
4
77-
78void QPreviewPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)-
79{-
80 QPreviewPaintEnginePrivate * const d = d_func();-
81 d->engine->drawPolygon(points, pointCount, mode);-
82}
never executed: end of block
0
83-
84void QPreviewPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)-
85{-
86 QPreviewPaintEnginePrivate * const d = d_func();-
87 d->engine->drawTextItem(p, textItem);-
88}
executed 4 times by 1 test: end of block
Executed by:
  • tst_QPrinter
4
89-
90void QPreviewPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)-
91{-
92 QPreviewPaintEnginePrivate * const d = d_func();-
93 d->engine->drawPixmap(r, pm, sr);-
94}
never executed: end of block
0
95-
96void QPreviewPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p)-
97{-
98 QPreviewPaintEnginePrivate * const d = d_func();-
99 d->engine->drawTiledPixmap(r, pm, p);-
100}
never executed: end of block
0
101-
102bool QPreviewPaintEngine::newPage()-
103{-
104 QPreviewPaintEnginePrivate * const d = d_func();-
105-
106 QPicture *page = new QPicture;-
107 page->d_func()->in_memory_only = true;-
108 QPainter *tmp_painter = new QPainter(page);-
109 QPaintEngine *tmp_engine = tmp_painter->paintEngine();-
110-
111-
112 ((!(painter()->d_func()->state && tmp_painter->d_func()->state)) ? qt_assert("painter()->d_func()->state && tmp_painter->d_func()->state",__FILE__,158) : qt_noop());-
113 *tmp_painter->d_func()->state = *painter()->d_func()->state;-
114-
115-
116-
117 tmp_engine->setDirty(DirtyFlags(AllDirty & ~DirtyCompositionMode));-
118 tmp_engine->syncState();-
119-
120 delete d->painter;-
121 d->painter = tmp_painter;-
122 d->pages.append(page);-
123 d->engine = tmp_engine;-
124 return
executed 3 times by 1 test: return true;
Executed by:
  • tst_QPrinter
true;
executed 3 times by 1 test: return true;
Executed by:
  • tst_QPrinter
3
125}-
126-
127bool QPreviewPaintEngine::abort()-
128{-
129 QPreviewPaintEnginePrivate * const d = d_func();-
130 end();-
131 qDeleteAll(d->pages);-
132 d->state = QPrinter::Aborted;-
133-
134 return
never executed: return true;
true;
never executed: return true;
0
135}-
136-
137QList<const QPicture *> QPreviewPaintEngine::pages()-
138{-
139 QPreviewPaintEnginePrivate * const d = d_func();-
140 return
executed 1 time by 1 test: return d->pages;
Executed by:
  • tst_QPrinter
d->pages;
executed 1 time by 1 test: return d->pages;
Executed by:
  • tst_QPrinter
1
141}-
142-
143void QPreviewPaintEngine::setProxyEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine)-
144{-
145 QPreviewPaintEnginePrivate * const d = d_func();-
146 d->proxy_print_engine = printEngine;-
147 d->proxy_paint_engine = paintEngine;-
148}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
149-
150void QPreviewPaintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)-
151{-
152 QPreviewPaintEnginePrivate * const d = d_func();-
153 d->proxy_print_engine->setProperty(key, value);-
154}
never executed: end of block
0
155-
156QVariant QPreviewPaintEngine::property(PrintEnginePropertyKey key) const-
157{-
158 const QPreviewPaintEnginePrivate * const d = d_func();-
159 return
executed 8 times by 1 test: return d->proxy_print_engine->property(key);
Executed by:
  • tst_QPrinter
d->proxy_print_engine->property(key);
executed 8 times by 1 test: return d->proxy_print_engine->property(key);
Executed by:
  • tst_QPrinter
8
160}-
161-
162int QPreviewPaintEngine::metric(QPaintDevice::PaintDeviceMetric id) const-
163{-
164 const QPreviewPaintEnginePrivate * const d = d_func();-
165 return
executed 3 times by 1 test: return d->proxy_print_engine->metric(id);
Executed by:
  • tst_QPrinter
d->proxy_print_engine->metric(id);
executed 3 times by 1 test: return d->proxy_print_engine->metric(id);
Executed by:
  • tst_QPrinter
3
166}-
167-
168QPrinter::PrinterState QPreviewPaintEngine::printerState() const-
169{-
170 const QPreviewPaintEnginePrivate * const d = d_func();-
171 return
executed 3 times by 1 test: return d->state;
Executed by:
  • tst_QPrinter
d->state;
executed 3 times by 1 test: return d->state;
Executed by:
  • tst_QPrinter
3
172}-
173-
174-
Switch to Source codePreprocessed file

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