Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | class 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; | - |
9 | public: | - |
10 | QPreviewPaintEnginePrivate() : state(QPrinter::Idle) {} | 0 |
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 | | - |
23 | QPreviewPaintEngine::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 | } | 0 |
30 | | - |
31 | QPreviewPaintEngine::~QPreviewPaintEngine() | - |
32 | { | - |
33 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
34 | | - |
35 | qDeleteAll(d->pages); | - |
36 | } | 0 |
37 | | - |
38 | bool 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->pages.append(page); | - |
50 | d->state = QPrinter::Active; | - |
51 | return true; never executed: return true; | 0 |
52 | } | - |
53 | | - |
54 | bool QPreviewPaintEngine::end() | - |
55 | { | - |
56 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
57 | | - |
58 | delete d->painter; | - |
59 | d->painter = 0; | - |
60 | d->engine = 0; | - |
61 | d->state = QPrinter::Idle; | - |
62 | return true; never executed: return true; | 0 |
63 | } | - |
64 | | - |
65 | void QPreviewPaintEngine::updateState(const QPaintEngineState &state) | - |
66 | { | - |
67 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
68 | d->engine->updateState(state); | - |
69 | } | 0 |
70 | | - |
71 | void QPreviewPaintEngine::drawPath(const QPainterPath &path) | - |
72 | { | - |
73 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
74 | d->engine->drawPath(path); | - |
75 | } | 0 |
76 | | - |
77 | void QPreviewPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - |
78 | { | - |
79 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
80 | d->engine->drawPolygon(points, pointCount, mode); | - |
81 | } | 0 |
82 | | - |
83 | void QPreviewPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) | - |
84 | { | - |
85 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
86 | d->engine->drawTextItem(p, textItem); | - |
87 | } | 0 |
88 | | - |
89 | void QPreviewPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) | - |
90 | { | - |
91 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
92 | d->engine->drawPixmap(r, pm, sr); | - |
93 | } | 0 |
94 | | - |
95 | void QPreviewPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p) | - |
96 | { | - |
97 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
98 | d->engine->drawTiledPixmap(r, pm, p); | - |
99 | } | 0 |
100 | | - |
101 | bool QPreviewPaintEngine::newPage() | - |
102 | { | - |
103 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
104 | | - |
105 | QPicture *page = new QPicture; | - |
106 | page->d_func()->in_memory_only = true; | - |
107 | QPainter *tmp_painter = new QPainter(page); | - |
108 | QPaintEngine *tmp_engine = tmp_painter->paintEngine(); | - |
109 | | - |
110 | | - |
111 | qt_noop(); | - |
112 | *tmp_painter->d_func()->state = *painter()->d_func()->state; | - |
113 | | - |
114 | | - |
115 | | - |
116 | tmp_engine->setDirty(DirtyFlags(AllDirty & ~DirtyCompositionMode)); | - |
117 | tmp_engine->syncState(); | - |
118 | | - |
119 | delete d->painter; | - |
120 | d->painter = tmp_painter; | - |
121 | d->pages.append(page); | - |
122 | d->engine = tmp_engine; | - |
123 | return true; never executed: return true; | 0 |
124 | } | - |
125 | | - |
126 | bool QPreviewPaintEngine::abort() | - |
127 | { | - |
128 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
129 | end(); | - |
130 | qDeleteAll(d->pages); | - |
131 | d->state = QPrinter::Aborted; | - |
132 | | - |
133 | return true; never executed: return true; | 0 |
134 | } | - |
135 | | - |
136 | QList<const QPicture *> QPreviewPaintEngine::pages() | - |
137 | { | - |
138 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
139 | return d->pages; never executed: return d->pages; | 0 |
140 | } | - |
141 | | - |
142 | void QPreviewPaintEngine::setProxyEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine) | - |
143 | { | - |
144 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
145 | d->proxy_print_engine = printEngine; | - |
146 | d->proxy_paint_engine = paintEngine; | - |
147 | } | 0 |
148 | | - |
149 | void QPreviewPaintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value) | - |
150 | { | - |
151 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
152 | d->proxy_print_engine->setProperty(key, value); | - |
153 | } | 0 |
154 | | - |
155 | QVariant QPreviewPaintEngine::property(PrintEnginePropertyKey key) const | - |
156 | { | - |
157 | const QPreviewPaintEnginePrivate * const d = d_func(); | - |
158 | return d->proxy_print_engine->property(key); never executed: return d->proxy_print_engine->property(key); | 0 |
159 | } | - |
160 | | - |
161 | int QPreviewPaintEngine::metric(QPaintDevice::PaintDeviceMetric id) const | - |
162 | { | - |
163 | const QPreviewPaintEnginePrivate * const d = d_func(); | - |
164 | return d->proxy_print_engine->metric(id); never executed: return d->proxy_print_engine->metric(id); | 0 |
165 | } | - |
166 | | - |
167 | QPrinter::PrinterState QPreviewPaintEngine::printerState() const | - |
168 | { | - |
169 | const QPreviewPaintEnginePrivate * const d = d_func(); | - |
170 | return d->state; never executed: return d->state; | 0 |
171 | } | - |
172 | | - |
173 | | - |
174 | | - |
| | |