opengl/qopenglpaintdevice.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7class QOpenGLPaintDevicePrivate -
8{ -
9public: -
10 QOpenGLPaintDevicePrivate(const QSize &size); -
11 -
12 QSize size; -
13 QOpenGLContext *ctx; -
14 -
15 qreal dpmx; -
16 qreal dpmy; -
17 -
18 bool flipped; -
19 -
20 QPaintEngine *engine; -
21}; -
22QOpenGLPaintDevice::QOpenGLPaintDevice() -
23 : d_ptr(new QOpenGLPaintDevicePrivate(QSize())) -
24{ -
25}
never executed: }
0
26QOpenGLPaintDevice::QOpenGLPaintDevice(const QSize &size) -
27 : d_ptr(new QOpenGLPaintDevicePrivate(size)) -
28{ -
29}
never executed: }
0
30QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height) -
31 : d_ptr(new QOpenGLPaintDevicePrivate(QSize(width, height))) -
32{ -
33}
never executed: }
0
34 -
35 -
36 -
37 -
38 -
39QOpenGLPaintDevice::~QOpenGLPaintDevice() -
40{ -
41 delete d_ptr->engine; -
42}
never executed: }
0
43 -
44 -
45 -
46 -
47 -
48 -
49 -
50QOpenGLPaintDevicePrivate::QOpenGLPaintDevicePrivate(const QSize &sz) -
51 : size(sz) -
52 , ctx(QOpenGLContext::currentContext()) -
53 , dpmx(qt_defaultDpiX() * 100. / 2.54) -
54 , dpmy(qt_defaultDpiY() * 100. / 2.54) -
55 , flipped(false) -
56 , engine(0) -
57{ -
58}
never executed: }
0
59 -
60class QOpenGLEngineThreadStorage -
61{ -
62public: -
63 QPaintEngine *engine() { -
64 QPaintEngine *&localEngine = storage.localData(); -
65 if (!localEngine)
never evaluated: !localEngine
0
66 localEngine = new QOpenGL2PaintEngineEx;
never executed: localEngine = new QOpenGL2PaintEngineEx;
0
67 return localEngine;
never executed: return localEngine;
0
68 } -
69 -
70private: -
71 QThreadStorage<QPaintEngine *> storage; -
72}; -
73 -
74static QOpenGLEngineThreadStorage *qt_opengl_engine() { static QGlobalStatic<QOpenGLEngineThreadStorage > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QOpenGLEngineThreadStorage *x = new QOpenGLEngineThreadStorage; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QOpenGLEngineThreadStorage > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
never evaluated: !thisGlobalStatic.pointer.load()
never evaluated: !thisGlobalStatic.destroyed
never executed: delete x;
never executed: return thisGlobalStatic.pointer.load();
0
75 -
76 -
77 -
78 -
79 -
80QPaintEngine *QOpenGLPaintDevice::paintEngine() const -
81{ -
82 if (d_ptr->engine)
never evaluated: d_ptr->engine
0
83 return d_ptr->engine;
never executed: return d_ptr->engine;
0
84 -
85 QPaintEngine *engine = qt_opengl_engine()->engine(); -
86 if (engine->isActive() && engine->paintDevice() != this) {
never evaluated: engine->isActive()
never evaluated: engine->paintDevice() != this
0
87 d_ptr->engine = new QOpenGL2PaintEngineEx; -
88 return d_ptr->engine;
never executed: return d_ptr->engine;
0
89 } -
90 -
91 return engine;
never executed: return engine;
0
92} -
93 -
94 -
95 -
96 -
97 -
98QOpenGLContext *QOpenGLPaintDevice::context() const -
99{ -
100 return d_ptr->ctx;
never executed: return d_ptr->ctx;
0
101} -
102 -
103 -
104 -
105 -
106 -
107 -
108 -
109QSize QOpenGLPaintDevice::size() const -
110{ -
111 return d_ptr->size;
never executed: return d_ptr->size;
0
112} -
113 -
114 -
115 -
116 -
117 -
118 -
119 -
120void QOpenGLPaintDevice::setSize(const QSize &size) -
121{ -
122 d_ptr->size = size; -
123}
never executed: }
0
124 -
125 -
126 -
127 -
128 -
129int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const -
130{ -
131 switch (metric) { -
132 case PdmWidth: -
133 return d_ptr->size.width();
never executed: return d_ptr->size.width();
0
134 case PdmHeight: -
135 return d_ptr->size.height();
never executed: return d_ptr->size.height();
0
136 case PdmDepth: -
137 return 32;
never executed: return 32;
0
138 case PdmWidthMM: -
139 return qRound(d_ptr->size.width() * 1000 / d_ptr->dpmx);
never executed: return qRound(d_ptr->size.width() * 1000 / d_ptr->dpmx);
0
140 case PdmHeightMM: -
141 return qRound(d_ptr->size.height() * 1000 / d_ptr->dpmy);
never executed: return qRound(d_ptr->size.height() * 1000 / d_ptr->dpmy);
0
142 case PdmNumColors: -
143 return 0;
never executed: return 0;
0
144 case PdmDpiX: -
145 return qRound(d_ptr->dpmx * 0.0254);
never executed: return qRound(d_ptr->dpmx * 0.0254);
0
146 case PdmDpiY: -
147 return qRound(d_ptr->dpmy * 0.0254);
never executed: return qRound(d_ptr->dpmy * 0.0254);
0
148 case PdmPhysicalDpiX: -
149 return qRound(d_ptr->dpmx * 0.0254);
never executed: return qRound(d_ptr->dpmx * 0.0254);
0
150 case PdmPhysicalDpiY: -
151 return qRound(d_ptr->dpmy * 0.0254);
never executed: return qRound(d_ptr->dpmy * 0.0254);
0
152 default: -
153 QMessageLogger("opengl/qopenglpaintdevice.cpp", 279, __PRETTY_FUNCTION__).warning("QOpenGLPaintDevice::metric() - metric %d not known", metric); -
154 return 0;
never executed: return 0;
0
155 } -
156}
never executed: }
0
157 -
158 -
159 -
160 -
161 -
162 -
163 -
164qreal QOpenGLPaintDevice::dotsPerMeterX() const -
165{ -
166 return d_ptr->dpmx;
never executed: return d_ptr->dpmx;
0
167} -
168 -
169 -
170 -
171 -
172 -
173 -
174 -
175qreal QOpenGLPaintDevice::dotsPerMeterY() const -
176{ -
177 return d_ptr->dpmy;
never executed: return d_ptr->dpmy;
0
178} -
179 -
180 -
181 -
182 -
183 -
184 -
185 -
186void QOpenGLPaintDevice::setDotsPerMeterX(qreal dpmx) -
187{ -
188 d_ptr->dpmx = dpmx; -
189}
never executed: }
0
190 -
191 -
192 -
193 -
194 -
195 -
196 -
197void QOpenGLPaintDevice::setDotsPerMeterY(qreal dpmy) -
198{ -
199 d_ptr->dpmx = dpmy; -
200}
never executed: }
0
201 -
202 -
203 -
204 -
205 -
206 -
207void QOpenGLPaintDevice::setPaintFlipped(bool flipped) -
208{ -
209 d_ptr->flipped = flipped; -
210}
never executed: }
0
211 -
212 -
213 -
214 -
215 -
216 -
217 -
218bool QOpenGLPaintDevice::paintFlipped() const -
219{ -
220 return d_ptr->flipped;
never executed: return d_ptr->flipped;
0
221} -
222void QOpenGLPaintDevice::ensureActiveTarget() -
223{ -
224} -
225 -
226 -
227 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial