Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qsurfaceformat.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | class QSurfaceFormatPrivate | - | ||||||||||||||||||||||||
5 | { | - | ||||||||||||||||||||||||
6 | public: | - | ||||||||||||||||||||||||
7 | explicit QSurfaceFormatPrivate(QSurfaceFormat::FormatOptions _opts = 0) | - | ||||||||||||||||||||||||
8 | : ref(1) | - | ||||||||||||||||||||||||
9 | , opts(_opts) | - | ||||||||||||||||||||||||
10 | , redBufferSize(-1) | - | ||||||||||||||||||||||||
11 | , greenBufferSize(-1) | - | ||||||||||||||||||||||||
12 | , blueBufferSize(-1) | - | ||||||||||||||||||||||||
13 | , alphaBufferSize(-1) | - | ||||||||||||||||||||||||
14 | , depthSize(-1) | - | ||||||||||||||||||||||||
15 | , stencilSize(-1) | - | ||||||||||||||||||||||||
16 | , swapBehavior(QSurfaceFormat::DefaultSwapBehavior) | - | ||||||||||||||||||||||||
17 | , numSamples(-1) | - | ||||||||||||||||||||||||
18 | , renderableType(QSurfaceFormat::DefaultRenderableType) | - | ||||||||||||||||||||||||
19 | , profile(QSurfaceFormat::NoProfile) | - | ||||||||||||||||||||||||
20 | , major(2) | - | ||||||||||||||||||||||||
21 | , minor(0) | - | ||||||||||||||||||||||||
22 | , swapInterval(1) | - | ||||||||||||||||||||||||
23 | { | - | ||||||||||||||||||||||||
24 | } never executed: end of block | 0 | ||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||
26 | QSurfaceFormatPrivate(const QSurfaceFormatPrivate *other) | - | ||||||||||||||||||||||||
27 | : ref(1), | - | ||||||||||||||||||||||||
28 | opts(other->opts), | - | ||||||||||||||||||||||||
29 | redBufferSize(other->redBufferSize), | - | ||||||||||||||||||||||||
30 | greenBufferSize(other->greenBufferSize), | - | ||||||||||||||||||||||||
31 | blueBufferSize(other->blueBufferSize), | - | ||||||||||||||||||||||||
32 | alphaBufferSize(other->alphaBufferSize), | - | ||||||||||||||||||||||||
33 | depthSize(other->depthSize), | - | ||||||||||||||||||||||||
34 | stencilSize(other->stencilSize), | - | ||||||||||||||||||||||||
35 | swapBehavior(other->swapBehavior), | - | ||||||||||||||||||||||||
36 | numSamples(other->numSamples), | - | ||||||||||||||||||||||||
37 | renderableType(other->renderableType), | - | ||||||||||||||||||||||||
38 | profile(other->profile), | - | ||||||||||||||||||||||||
39 | major(other->major), | - | ||||||||||||||||||||||||
40 | minor(other->minor), | - | ||||||||||||||||||||||||
41 | swapInterval(other->swapInterval) | - | ||||||||||||||||||||||||
42 | { | - | ||||||||||||||||||||||||
43 | } never executed: end of block | 0 | ||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||
45 | QAtomicInt ref; | - | ||||||||||||||||||||||||
46 | QSurfaceFormat::FormatOptions opts; | - | ||||||||||||||||||||||||
47 | int redBufferSize; | - | ||||||||||||||||||||||||
48 | int greenBufferSize; | - | ||||||||||||||||||||||||
49 | int blueBufferSize; | - | ||||||||||||||||||||||||
50 | int alphaBufferSize; | - | ||||||||||||||||||||||||
51 | int depthSize; | - | ||||||||||||||||||||||||
52 | int stencilSize; | - | ||||||||||||||||||||||||
53 | QSurfaceFormat::SwapBehavior swapBehavior; | - | ||||||||||||||||||||||||
54 | int numSamples; | - | ||||||||||||||||||||||||
55 | QSurfaceFormat::RenderableType renderableType; | - | ||||||||||||||||||||||||
56 | QSurfaceFormat::OpenGLContextProfile profile; | - | ||||||||||||||||||||||||
57 | int major; | - | ||||||||||||||||||||||||
58 | int minor; | - | ||||||||||||||||||||||||
59 | int swapInterval; | - | ||||||||||||||||||||||||
60 | }; | - | ||||||||||||||||||||||||
61 | QSurfaceFormat::QSurfaceFormat() : d(new QSurfaceFormatPrivate) | - | ||||||||||||||||||||||||
62 | { | - | ||||||||||||||||||||||||
63 | } never executed: end of block | 0 | ||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||
68 | QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) : | - | ||||||||||||||||||||||||
69 | d(new QSurfaceFormatPrivate(options)) | - | ||||||||||||||||||||||||
70 | { | - | ||||||||||||||||||||||||
71 | } never executed: end of block | 0 | ||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||
74 | - | |||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||
76 | void QSurfaceFormat::detach() | - | ||||||||||||||||||||||||
77 | { | - | ||||||||||||||||||||||||
78 | if (d->ref.load() != 1
| 0 | ||||||||||||||||||||||||
79 | QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d); | - | ||||||||||||||||||||||||
80 | if (!d->ref.deref()
| 0 | ||||||||||||||||||||||||
81 | delete d; never executed: delete d; | 0 | ||||||||||||||||||||||||
82 | d = newd; | - | ||||||||||||||||||||||||
83 | } never executed: end of block | 0 | ||||||||||||||||||||||||
84 | } never executed: end of block | 0 | ||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||
89 | QSurfaceFormat::QSurfaceFormat(const QSurfaceFormat &other) | - | ||||||||||||||||||||||||
90 | { | - | ||||||||||||||||||||||||
91 | d = other.d; | - | ||||||||||||||||||||||||
92 | d->ref.ref(); | - | ||||||||||||||||||||||||
93 | } never executed: end of block | 0 | ||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||
95 | - | |||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||
97 | - | |||||||||||||||||||||||||
98 | QSurfaceFormat &QSurfaceFormat::operator=(const QSurfaceFormat &other) | - | ||||||||||||||||||||||||
99 | { | - | ||||||||||||||||||||||||
100 | if (d != other.d
| 0 | ||||||||||||||||||||||||
101 | other.d->ref.ref(); | - | ||||||||||||||||||||||||
102 | if (!d->ref.deref()
| 0 | ||||||||||||||||||||||||
103 | delete d; never executed: delete d; | 0 | ||||||||||||||||||||||||
104 | d = other.d; | - | ||||||||||||||||||||||||
105 | } never executed: end of block | 0 | ||||||||||||||||||||||||
106 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||||||||
107 | } | - | ||||||||||||||||||||||||
108 | - | |||||||||||||||||||||||||
109 | - | |||||||||||||||||||||||||
110 | - | |||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||
112 | QSurfaceFormat::~QSurfaceFormat() | - | ||||||||||||||||||||||||
113 | { | - | ||||||||||||||||||||||||
114 | if (!d->ref.deref()
| 0 | ||||||||||||||||||||||||
115 | delete d; never executed: delete d; | 0 | ||||||||||||||||||||||||
116 | } never executed: end of block | 0 | ||||||||||||||||||||||||
117 | void QSurfaceFormat::setStereo(bool enable) | - | ||||||||||||||||||||||||
118 | { | - | ||||||||||||||||||||||||
119 | QSurfaceFormat::FormatOptions newOptions = d->opts; | - | ||||||||||||||||||||||||
120 | if (enable
| 0 | ||||||||||||||||||||||||
121 | newOptions |= QSurfaceFormat::StereoBuffers; | - | ||||||||||||||||||||||||
122 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
123 | newOptions &= ~QSurfaceFormat::StereoBuffers; | - | ||||||||||||||||||||||||
124 | } never executed: end of block | 0 | ||||||||||||||||||||||||
125 | if (int(newOptions) != int(d->opts)
| 0 | ||||||||||||||||||||||||
126 | detach(); | - | ||||||||||||||||||||||||
127 | d->opts = newOptions; | - | ||||||||||||||||||||||||
128 | } never executed: end of block | 0 | ||||||||||||||||||||||||
129 | } never executed: end of block | 0 | ||||||||||||||||||||||||
130 | - | |||||||||||||||||||||||||
131 | - | |||||||||||||||||||||||||
132 | - | |||||||||||||||||||||||||
133 | - | |||||||||||||||||||||||||
134 | - | |||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||
136 | - | |||||||||||||||||||||||||
137 | int QSurfaceFormat::samples() const | - | ||||||||||||||||||||||||
138 | { | - | ||||||||||||||||||||||||
139 | return never executed: d->numSamples;return d->numSamples; never executed: return d->numSamples; | 0 | ||||||||||||||||||||||||
140 | } | - | ||||||||||||||||||||||||
141 | - | |||||||||||||||||||||||||
142 | - | |||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||
144 | - | |||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||
147 | - | |||||||||||||||||||||||||
148 | void QSurfaceFormat::setSamples(int numSamples) | - | ||||||||||||||||||||||||
149 | { | - | ||||||||||||||||||||||||
150 | if (d->numSamples != numSamples
| 0 | ||||||||||||||||||||||||
151 | detach(); | - | ||||||||||||||||||||||||
152 | d->numSamples = numSamples; | - | ||||||||||||||||||||||||
153 | } never executed: end of block | 0 | ||||||||||||||||||||||||
154 | } never executed: end of block | 0 | ||||||||||||||||||||||||
155 | void QSurfaceFormat::setOption(QSurfaceFormat::FormatOptions opt) | - | ||||||||||||||||||||||||
156 | { | - | ||||||||||||||||||||||||
157 | const QSurfaceFormat::FormatOptions newOptions = d->opts | opt; | - | ||||||||||||||||||||||||
158 | if (int(newOptions) != int(d->opts)
| 0 | ||||||||||||||||||||||||
159 | detach(); | - | ||||||||||||||||||||||||
160 | d->opts = newOptions; | - | ||||||||||||||||||||||||
161 | } never executed: end of block | 0 | ||||||||||||||||||||||||
162 | } never executed: end of block | 0 | ||||||||||||||||||||||||
163 | bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const | - | ||||||||||||||||||||||||
164 | { | - | ||||||||||||||||||||||||
165 | return never executed: d->opts & opt;return d->opts & opt; never executed: return d->opts & opt; | 0 | ||||||||||||||||||||||||
166 | } | - | ||||||||||||||||||||||||
167 | void QSurfaceFormat::setOptions(QSurfaceFormat::FormatOptions options) | - | ||||||||||||||||||||||||
168 | { | - | ||||||||||||||||||||||||
169 | if (int(d->opts) != int(options)
| 0 | ||||||||||||||||||||||||
170 | detach(); | - | ||||||||||||||||||||||||
171 | d->opts = options; | - | ||||||||||||||||||||||||
172 | } never executed: end of block | 0 | ||||||||||||||||||||||||
173 | } never executed: end of block | 0 | ||||||||||||||||||||||||
174 | void QSurfaceFormat::setOption(QSurfaceFormat::FormatOption option, bool on) | - | ||||||||||||||||||||||||
175 | { | - | ||||||||||||||||||||||||
176 | if (testOption(option) == on
| 0 | ||||||||||||||||||||||||
177 | return; never executed: return; | 0 | ||||||||||||||||||||||||
178 | detach(); | - | ||||||||||||||||||||||||
179 | if (on
| 0 | ||||||||||||||||||||||||
180 | d->opts |= option; never executed: d->opts |= option; | 0 | ||||||||||||||||||||||||
181 | else | - | ||||||||||||||||||||||||
182 | d->opts &= ~option; never executed: d->opts &= ~option; | 0 | ||||||||||||||||||||||||
183 | } | - | ||||||||||||||||||||||||
184 | bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOption option) const | - | ||||||||||||||||||||||||
185 | { | - | ||||||||||||||||||||||||
186 | return never executed: d->opts & option;return d->opts & option; never executed: return d->opts & option; | 0 | ||||||||||||||||||||||||
187 | } | - | ||||||||||||||||||||||||
188 | QSurfaceFormat::FormatOptions QSurfaceFormat::options() const | - | ||||||||||||||||||||||||
189 | { | - | ||||||||||||||||||||||||
190 | return never executed: d->opts;return d->opts; never executed: return d->opts; | 0 | ||||||||||||||||||||||||
191 | } | - | ||||||||||||||||||||||||
192 | - | |||||||||||||||||||||||||
193 | - | |||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||
195 | - | |||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||
197 | - | |||||||||||||||||||||||||
198 | void QSurfaceFormat::setDepthBufferSize(int size) | - | ||||||||||||||||||||||||
199 | { | - | ||||||||||||||||||||||||
200 | if (d->depthSize != size
| 0 | ||||||||||||||||||||||||
201 | detach(); | - | ||||||||||||||||||||||||
202 | d->depthSize = size; | - | ||||||||||||||||||||||||
203 | } never executed: end of block | 0 | ||||||||||||||||||||||||
204 | } never executed: end of block | 0 | ||||||||||||||||||||||||
205 | - | |||||||||||||||||||||||||
206 | - | |||||||||||||||||||||||||
207 | - | |||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||
211 | int QSurfaceFormat::depthBufferSize() const | - | ||||||||||||||||||||||||
212 | { | - | ||||||||||||||||||||||||
213 | return never executed: d->depthSize;return d->depthSize; never executed: return d->depthSize; | 0 | ||||||||||||||||||||||||
214 | } | - | ||||||||||||||||||||||||
215 | void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior) | - | ||||||||||||||||||||||||
216 | { | - | ||||||||||||||||||||||||
217 | if (d->swapBehavior != behavior
| 0 | ||||||||||||||||||||||||
218 | detach(); | - | ||||||||||||||||||||||||
219 | d->swapBehavior = behavior; | - | ||||||||||||||||||||||||
220 | } never executed: end of block | 0 | ||||||||||||||||||||||||
221 | } never executed: end of block | 0 | ||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||
223 | - | |||||||||||||||||||||||||
224 | - | |||||||||||||||||||||||||
225 | - | |||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||
228 | QSurfaceFormat::SwapBehavior QSurfaceFormat::swapBehavior() const | - | ||||||||||||||||||||||||
229 | { | - | ||||||||||||||||||||||||
230 | return never executed: d->swapBehavior;return d->swapBehavior; never executed: return d->swapBehavior; | 0 | ||||||||||||||||||||||||
231 | } | - | ||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||
236 | - | |||||||||||||||||||||||||
237 | - | |||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||
239 | bool QSurfaceFormat::hasAlpha() const | - | ||||||||||||||||||||||||
240 | { | - | ||||||||||||||||||||||||
241 | return never executed: d->alphaBufferSize > 0;return d->alphaBufferSize > 0; never executed: return d->alphaBufferSize > 0; | 0 | ||||||||||||||||||||||||
242 | } | - | ||||||||||||||||||||||||
243 | - | |||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||
245 | - | |||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||
248 | - | |||||||||||||||||||||||||
249 | void QSurfaceFormat::setStencilBufferSize(int size) | - | ||||||||||||||||||||||||
250 | { | - | ||||||||||||||||||||||||
251 | if (d->stencilSize != size
| 0 | ||||||||||||||||||||||||
252 | detach(); | - | ||||||||||||||||||||||||
253 | d->stencilSize = size; | - | ||||||||||||||||||||||||
254 | } never executed: end of block | 0 | ||||||||||||||||||||||||
255 | } never executed: end of block | 0 | ||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||
257 | - | |||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | int QSurfaceFormat::stencilBufferSize() const | - | ||||||||||||||||||||||||
263 | { | - | ||||||||||||||||||||||||
264 | return never executed: d->stencilSize;return d->stencilSize; never executed: return d->stencilSize; | 0 | ||||||||||||||||||||||||
265 | } | - | ||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | - | |||||||||||||||||||||||||
268 | - | |||||||||||||||||||||||||
269 | - | |||||||||||||||||||||||||
270 | int QSurfaceFormat::redBufferSize() const | - | ||||||||||||||||||||||||
271 | { | - | ||||||||||||||||||||||||
272 | return never executed: d->redBufferSize;return d->redBufferSize; never executed: return d->redBufferSize; | 0 | ||||||||||||||||||||||||
273 | } | - | ||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | - | |||||||||||||||||||||||||
278 | int QSurfaceFormat::greenBufferSize() const | - | ||||||||||||||||||||||||
279 | { | - | ||||||||||||||||||||||||
280 | return never executed: d->greenBufferSize;return d->greenBufferSize; never executed: return d->greenBufferSize; | 0 | ||||||||||||||||||||||||
281 | } | - | ||||||||||||||||||||||||
282 | - | |||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||
284 | - | |||||||||||||||||||||||||
285 | - | |||||||||||||||||||||||||
286 | int QSurfaceFormat::blueBufferSize() const | - | ||||||||||||||||||||||||
287 | { | - | ||||||||||||||||||||||||
288 | return never executed: d->blueBufferSize;return d->blueBufferSize; never executed: return d->blueBufferSize; | 0 | ||||||||||||||||||||||||
289 | } | - | ||||||||||||||||||||||||
290 | - | |||||||||||||||||||||||||
291 | - | |||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||
293 | - | |||||||||||||||||||||||||
294 | int QSurfaceFormat::alphaBufferSize() const | - | ||||||||||||||||||||||||
295 | { | - | ||||||||||||||||||||||||
296 | return never executed: d->alphaBufferSize;return d->alphaBufferSize; never executed: return d->alphaBufferSize; | 0 | ||||||||||||||||||||||||
297 | } | - | ||||||||||||||||||||||||
298 | void QSurfaceFormat::setRedBufferSize(int size) | - | ||||||||||||||||||||||||
299 | { | - | ||||||||||||||||||||||||
300 | if (d->redBufferSize != size
| 0 | ||||||||||||||||||||||||
301 | detach(); | - | ||||||||||||||||||||||||
302 | d->redBufferSize = size; | - | ||||||||||||||||||||||||
303 | } never executed: end of block | 0 | ||||||||||||||||||||||||
304 | } never executed: end of block | 0 | ||||||||||||||||||||||||
305 | void QSurfaceFormat::setGreenBufferSize(int size) | - | ||||||||||||||||||||||||
306 | { | - | ||||||||||||||||||||||||
307 | if (d->greenBufferSize != size
| 0 | ||||||||||||||||||||||||
308 | detach(); | - | ||||||||||||||||||||||||
309 | d->greenBufferSize = size; | - | ||||||||||||||||||||||||
310 | } never executed: end of block | 0 | ||||||||||||||||||||||||
311 | } never executed: end of block | 0 | ||||||||||||||||||||||||
312 | void QSurfaceFormat::setBlueBufferSize(int size) | - | ||||||||||||||||||||||||
313 | { | - | ||||||||||||||||||||||||
314 | if (d->blueBufferSize != size
| 0 | ||||||||||||||||||||||||
315 | detach(); | - | ||||||||||||||||||||||||
316 | d->blueBufferSize = size; | - | ||||||||||||||||||||||||
317 | } never executed: end of block | 0 | ||||||||||||||||||||||||
318 | } never executed: end of block | 0 | ||||||||||||||||||||||||
319 | - | |||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||
321 | - | |||||||||||||||||||||||||
322 | - | |||||||||||||||||||||||||
323 | void QSurfaceFormat::setAlphaBufferSize(int size) | - | ||||||||||||||||||||||||
324 | { | - | ||||||||||||||||||||||||
325 | if (d->alphaBufferSize != size
| 0 | ||||||||||||||||||||||||
326 | detach(); | - | ||||||||||||||||||||||||
327 | d->alphaBufferSize = size; | - | ||||||||||||||||||||||||
328 | } never executed: end of block | 0 | ||||||||||||||||||||||||
329 | } never executed: end of block | 0 | ||||||||||||||||||||||||
330 | - | |||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||
332 | - | |||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||
334 | - | |||||||||||||||||||||||||
335 | - | |||||||||||||||||||||||||
336 | void QSurfaceFormat::setRenderableType(RenderableType type) | - | ||||||||||||||||||||||||
337 | { | - | ||||||||||||||||||||||||
338 | if (d->renderableType != type
| 0 | ||||||||||||||||||||||||
339 | detach(); | - | ||||||||||||||||||||||||
340 | d->renderableType = type; | - | ||||||||||||||||||||||||
341 | } never executed: end of block | 0 | ||||||||||||||||||||||||
342 | } never executed: end of block | 0 | ||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||
344 | - | |||||||||||||||||||||||||
345 | - | |||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||
349 | QSurfaceFormat::RenderableType QSurfaceFormat::renderableType() const | - | ||||||||||||||||||||||||
350 | { | - | ||||||||||||||||||||||||
351 | return never executed: d->renderableType;return d->renderableType; never executed: return d->renderableType; | 0 | ||||||||||||||||||||||||
352 | } | - | ||||||||||||||||||||||||
353 | - | |||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||
356 | - | |||||||||||||||||||||||||
357 | - | |||||||||||||||||||||||||
358 | - | |||||||||||||||||||||||||
359 | - | |||||||||||||||||||||||||
360 | void QSurfaceFormat::setProfile(OpenGLContextProfile profile) | - | ||||||||||||||||||||||||
361 | { | - | ||||||||||||||||||||||||
362 | if (d->profile != profile
| 0 | ||||||||||||||||||||||||
363 | detach(); | - | ||||||||||||||||||||||||
364 | d->profile = profile; | - | ||||||||||||||||||||||||
365 | } never executed: end of block | 0 | ||||||||||||||||||||||||
366 | } never executed: end of block | 0 | ||||||||||||||||||||||||
367 | - | |||||||||||||||||||||||||
368 | - | |||||||||||||||||||||||||
369 | - | |||||||||||||||||||||||||
370 | - | |||||||||||||||||||||||||
371 | - | |||||||||||||||||||||||||
372 | - | |||||||||||||||||||||||||
373 | - | |||||||||||||||||||||||||
374 | QSurfaceFormat::OpenGLContextProfile QSurfaceFormat::profile() const | - | ||||||||||||||||||||||||
375 | { | - | ||||||||||||||||||||||||
376 | return never executed: d->profile;return d->profile; never executed: return d->profile; | 0 | ||||||||||||||||||||||||
377 | } | - | ||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||
379 | - | |||||||||||||||||||||||||
380 | - | |||||||||||||||||||||||||
381 | - | |||||||||||||||||||||||||
382 | void QSurfaceFormat::setMajorVersion(int major) | - | ||||||||||||||||||||||||
383 | { | - | ||||||||||||||||||||||||
384 | if (d->major != major
| 0 | ||||||||||||||||||||||||
385 | detach(); | - | ||||||||||||||||||||||||
386 | d->major = major; | - | ||||||||||||||||||||||||
387 | } never executed: end of block | 0 | ||||||||||||||||||||||||
388 | } never executed: end of block | 0 | ||||||||||||||||||||||||
389 | - | |||||||||||||||||||||||||
390 | - | |||||||||||||||||||||||||
391 | - | |||||||||||||||||||||||||
392 | - | |||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||
394 | - | |||||||||||||||||||||||||
395 | int QSurfaceFormat::majorVersion() const | - | ||||||||||||||||||||||||
396 | { | - | ||||||||||||||||||||||||
397 | return never executed: d->major;return d->major; never executed: return d->major; | 0 | ||||||||||||||||||||||||
398 | } | - | ||||||||||||||||||||||||
399 | - | |||||||||||||||||||||||||
400 | - | |||||||||||||||||||||||||
401 | - | |||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||
405 | void QSurfaceFormat::setMinorVersion(int minor) | - | ||||||||||||||||||||||||
406 | { | - | ||||||||||||||||||||||||
407 | if (d->minor != minor
| 0 | ||||||||||||||||||||||||
408 | detach(); | - | ||||||||||||||||||||||||
409 | d->minor = minor; | - | ||||||||||||||||||||||||
410 | } never executed: end of block | 0 | ||||||||||||||||||||||||
411 | } never executed: end of block | 0 | ||||||||||||||||||||||||
412 | - | |||||||||||||||||||||||||
413 | - | |||||||||||||||||||||||||
414 | - | |||||||||||||||||||||||||
415 | - | |||||||||||||||||||||||||
416 | int QSurfaceFormat::minorVersion() const | - | ||||||||||||||||||||||||
417 | { | - | ||||||||||||||||||||||||
418 | return never executed: d->minor;return d->minor; never executed: return d->minor; | 0 | ||||||||||||||||||||||||
419 | } | - | ||||||||||||||||||||||||
420 | - | |||||||||||||||||||||||||
421 | - | |||||||||||||||||||||||||
422 | - | |||||||||||||||||||||||||
423 | - | |||||||||||||||||||||||||
424 | - | |||||||||||||||||||||||||
425 | - | |||||||||||||||||||||||||
426 | QPair<int, int> QSurfaceFormat::version() const | - | ||||||||||||||||||||||||
427 | { | - | ||||||||||||||||||||||||
428 | return never executed: qMakePair(d->major, d->minor);return qMakePair(d->major, d->minor); never executed: return qMakePair(d->major, d->minor); | 0 | ||||||||||||||||||||||||
429 | } | - | ||||||||||||||||||||||||
430 | - | |||||||||||||||||||||||||
431 | - | |||||||||||||||||||||||||
432 | - | |||||||||||||||||||||||||
433 | - | |||||||||||||||||||||||||
434 | - | |||||||||||||||||||||||||
435 | - | |||||||||||||||||||||||||
436 | void QSurfaceFormat::setVersion(int major, int minor) | - | ||||||||||||||||||||||||
437 | { | - | ||||||||||||||||||||||||
438 | if (d->minor != minor
| 0 | ||||||||||||||||||||||||
439 | detach(); | - | ||||||||||||||||||||||||
440 | d->minor = minor; | - | ||||||||||||||||||||||||
441 | d->major = major; | - | ||||||||||||||||||||||||
442 | } never executed: end of block | 0 | ||||||||||||||||||||||||
443 | } never executed: end of block | 0 | ||||||||||||||||||||||||
444 | void QSurfaceFormat::setSwapInterval(int interval) | - | ||||||||||||||||||||||||
445 | { | - | ||||||||||||||||||||||||
446 | if (d->swapInterval != interval
| 0 | ||||||||||||||||||||||||
447 | detach(); | - | ||||||||||||||||||||||||
448 | d->swapInterval = interval; | - | ||||||||||||||||||||||||
449 | } never executed: end of block | 0 | ||||||||||||||||||||||||
450 | } never executed: end of block | 0 | ||||||||||||||||||||||||
451 | int QSurfaceFormat::swapInterval() const | - | ||||||||||||||||||||||||
452 | { | - | ||||||||||||||||||||||||
453 | return never executed: d->swapInterval;return d->swapInterval; never executed: return d->swapInterval; | 0 | ||||||||||||||||||||||||
454 | } | - | ||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||
456 | namespace { namespace Q_QGS_qt_default_surface_format { typedef QSurfaceFormat Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
never executed: }guard.store(QtGlobalStatic::Destroyed); never executed: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of block never executed: &holder.value;return &holder.value; never executed: } } } static QGlobalStatic<QSurfaceFormat, Q_QGS_qt_default_surface_format::innerFunction, Q_QGS_qt_default_surface_format::guard> qt_default_surface_format;return &holder.value; | 0 | ||||||||||||||||||||||||
457 | void QSurfaceFormat::setDefaultFormat(const QSurfaceFormat &format) | - | ||||||||||||||||||||||||
458 | { | - | ||||||||||||||||||||||||
459 | - | |||||||||||||||||||||||||
460 | if ((static_cast<
| 0 | ||||||||||||||||||||||||
461 | QOpenGLContext *globalContext = QOpenGLContext::globalShareContext(); | - | ||||||||||||||||||||||||
462 | if (globalContext
| 0 | ||||||||||||||||||||||||
463 | QMessageLogger(__FILE__, 767, __PRETTY_FUNCTION__).warning("Warning: Setting a new default format with a different version or profile " | - | ||||||||||||||||||||||||
464 | "after the global shared context is created may cause issues with context " | - | ||||||||||||||||||||||||
465 | "sharing."); | - | ||||||||||||||||||||||||
466 | } never executed: end of block | 0 | ||||||||||||||||||||||||
467 | } never executed: end of block | 0 | ||||||||||||||||||||||||
468 | - | |||||||||||||||||||||||||
469 | *qt_default_surface_format() = format; | - | ||||||||||||||||||||||||
470 | } never executed: end of block | 0 | ||||||||||||||||||||||||
471 | QSurfaceFormat QSurfaceFormat::defaultFormat() | - | ||||||||||||||||||||||||
472 | { | - | ||||||||||||||||||||||||
473 | return never executed: *qt_default_surface_format();return *qt_default_surface_format(); never executed: return *qt_default_surface_format(); | 0 | ||||||||||||||||||||||||
474 | } | - | ||||||||||||||||||||||||
475 | - | |||||||||||||||||||||||||
476 | - | |||||||||||||||||||||||||
477 | - | |||||||||||||||||||||||||
478 | - | |||||||||||||||||||||||||
479 | - | |||||||||||||||||||||||||
480 | - | |||||||||||||||||||||||||
481 | - | |||||||||||||||||||||||||
482 | bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b) | - | ||||||||||||||||||||||||
483 | { | - | ||||||||||||||||||||||||
484 | return never executed: (return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval);
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
485 | && a.d->stencilSize == b.d->stencilSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
486 | && a.d->redBufferSize == b.d->redBufferSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
487 | && a.d->greenBufferSize == b.d->greenBufferSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
488 | && a.d->blueBufferSize == b.d->blueBufferSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
489 | && a.d->alphaBufferSize == b.d->alphaBufferSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
490 | && a.d->depthSize == b.d->depthSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
491 | && a.d->numSamples == b.d->numSamples
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
492 | && a.d->swapBehavior == b.d->swapBehavior
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
493 | && a.d->profile == b.d->profile
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
494 | && a.d->major == b.d->major
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
495 | && a.d->minor == b.d->minor
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
496 | && a.d->swapInterval == b.d->swapInterval
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->stencilSize == b.d->stencilSize && a.d->redBufferSize == b.d->redBufferSize && a.d->greenBufferSize == b.d->greenBufferSize && a.d->blueBufferSize == b.d->blueBufferSize && a.d->alphaBuffe...ferSize && a.d->depthSize == b.d->depthSize && a.d->numSamples == b.d->numSamples && a.d->swapBehavior == b.d->swapBehavior && a.d->profile == b.d->profile && a.d->major == b.d->major && a.d->minor == b.d->minor && a.d->swapInterval == b.d->swapInterval); | 0 | ||||||||||||||||||||||||
497 | } | - | ||||||||||||||||||||||||
498 | - | |||||||||||||||||||||||||
499 | - | |||||||||||||||||||||||||
500 | - | |||||||||||||||||||||||||
501 | - | |||||||||||||||||||||||||
502 | - | |||||||||||||||||||||||||
503 | - | |||||||||||||||||||||||||
504 | - | |||||||||||||||||||||||||
505 | bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b) | - | ||||||||||||||||||||||||
506 | { | - | ||||||||||||||||||||||||
507 | return never executed: !(a == b);return !(a == b); never executed: return !(a == b); | 0 | ||||||||||||||||||||||||
508 | } | - | ||||||||||||||||||||||||
509 | - | |||||||||||||||||||||||||
510 | - | |||||||||||||||||||||||||
511 | QDebug operator<<(QDebug dbg, const QSurfaceFormat &f) | - | ||||||||||||||||||||||||
512 | { | - | ||||||||||||||||||||||||
513 | const QSurfaceFormatPrivate * const d = f.d; | - | ||||||||||||||||||||||||
514 | QDebugStateSaver saver(dbg); | - | ||||||||||||||||||||||||
515 | - | |||||||||||||||||||||||||
516 | dbg.nospace() << "QSurfaceFormat(" | - | ||||||||||||||||||||||||
517 | << "version " << d->major << '.' << d->minor | - | ||||||||||||||||||||||||
518 | << ", options " << d->opts | - | ||||||||||||||||||||||||
519 | << ", depthBufferSize " << d->depthSize | - | ||||||||||||||||||||||||
520 | << ", redBufferSize " << d->redBufferSize | - | ||||||||||||||||||||||||
521 | << ", greenBufferSize " << d->greenBufferSize | - | ||||||||||||||||||||||||
522 | << ", blueBufferSize " << d->blueBufferSize | - | ||||||||||||||||||||||||
523 | << ", alphaBufferSize " << d->alphaBufferSize | - | ||||||||||||||||||||||||
524 | << ", stencilBufferSize " << d->stencilSize | - | ||||||||||||||||||||||||
525 | << ", samples " << d->numSamples | - | ||||||||||||||||||||||||
526 | << ", swapBehavior " << d->swapBehavior | - | ||||||||||||||||||||||||
527 | << ", swapInterval " << d->swapInterval | - | ||||||||||||||||||||||||
528 | << ", profile " << d->profile | - | ||||||||||||||||||||||||
529 | << ')'; | - | ||||||||||||||||||||||||
530 | - | |||||||||||||||||||||||||
531 | return never executed: dbg;return dbg; never executed: return dbg; | 0 | ||||||||||||||||||||||||
532 | } | - | ||||||||||||||||||||||||
533 | - | |||||||||||||||||||||||||
534 | - | |||||||||||||||||||||||||
535 | - | |||||||||||||||||||||||||
Switch to Source code | Preprocessed file |