Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/printsupport/kernel/qpaintengine_preview.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count |
---|---|---|
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) {} executed 1 time by 1 test: end of block Executed by:
| 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 | - | |
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 | } executed 1 time by 1 test: end of block Executed by:
| 1 |
30 | - | |
31 | QPreviewPaintEngine::~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:
| 1 |
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->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: true;return true; Executed by:
executed 1 time by 1 test: return true; Executed by:
| 1 |
53 | } | - |
54 | - | |
55 | bool 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: true;return true; Executed by:
executed 1 time by 1 test: return true; Executed by:
| 1 |
64 | } | - |
65 | - | |
66 | void 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:
| 8 |
71 | - | |
72 | void 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:
| 4 |
77 | - | |
78 | void 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 | - | |
84 | void 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:
| 4 |
89 | - | |
90 | void 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 | - | |
96 | void 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 | - | |
102 | bool 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: true;return true; Executed by:
executed 3 times by 1 test: return true; Executed by:
| 3 |
125 | } | - |
126 | - | |
127 | bool 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: true;return true; never executed: return true; | 0 |
135 | } | - |
136 | - | |
137 | QList<const QPicture *> QPreviewPaintEngine::pages() | - |
138 | { | - |
139 | QPreviewPaintEnginePrivate * const d = d_func(); | - |
140 | return executed 1 time by 1 test: d->pages;return d->pages; Executed by:
executed 1 time by 1 test: return d->pages; Executed by:
| 1 |
141 | } | - |
142 | - | |
143 | void 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:
| 1 |
149 | - | |
150 | void 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 | - | |
156 | QVariant QPreviewPaintEngine::property(PrintEnginePropertyKey key) const | - |
157 | { | - |
158 | const QPreviewPaintEnginePrivate * const d = d_func(); | - |
159 | return executed 8 times by 1 test: d->proxy_print_engine->property(key);return d->proxy_print_engine->property(key); Executed by:
executed 8 times by 1 test: return d->proxy_print_engine->property(key); Executed by:
| 8 |
160 | } | - |
161 | - | |
162 | int QPreviewPaintEngine::metric(QPaintDevice::PaintDeviceMetric id) const | - |
163 | { | - |
164 | const QPreviewPaintEnginePrivate * const d = d_func(); | - |
165 | return executed 3 times by 1 test: d->proxy_print_engine->metric(id);return d->proxy_print_engine->metric(id); Executed by:
executed 3 times by 1 test: return d->proxy_print_engine->metric(id); Executed by:
| 3 |
166 | } | - |
167 | - | |
168 | QPrinter::PrinterState QPreviewPaintEngine::printerState() const | - |
169 | { | - |
170 | const QPreviewPaintEnginePrivate * const d = d_func(); | - |
171 | return executed 3 times by 1 test: d->state;return d->state; Executed by:
executed 3 times by 1 test: return d->state; Executed by:
| 3 |
172 | } | - |
173 | - | |
174 | - | |
Switch to Source code | Preprocessed file |