Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qsurfaceformat.h" | - |
43 | | - |
44 | #include <QtCore/qatomic.h> | - |
45 | #include <QtCore/QDebug> | - |
46 | | - |
47 | #ifdef major | - |
48 | #undef major | - |
49 | #endif | - |
50 | | - |
51 | #ifdef minor | - |
52 | #undef minor | - |
53 | #endif | - |
54 | | - |
55 | QT_BEGIN_NAMESPACE | - |
56 | | - |
57 | class QSurfaceFormatPrivate | - |
58 | { | - |
59 | public: | - |
60 | explicit QSurfaceFormatPrivate(QSurfaceFormat::FormatOptions _opts = 0) | - |
61 | : ref(1) | - |
62 | , opts(_opts) | - |
63 | , redBufferSize(-1) | - |
64 | , greenBufferSize(-1) | - |
65 | , blueBufferSize(-1) | - |
66 | , alphaBufferSize(-1) | - |
67 | , depthSize(-1) | - |
68 | , stencilSize(-1) | - |
69 | , swapBehavior(QSurfaceFormat::DefaultSwapBehavior) | - |
70 | , numSamples(-1) | - |
71 | , renderableType(QSurfaceFormat::DefaultRenderableType) | - |
72 | , profile(QSurfaceFormat::NoProfile) | - |
73 | , major(2) | - |
74 | , minor(0) | - |
75 | { | - |
76 | } executed: } Execution Count:3936 | 3936 |
77 | | - |
78 | QSurfaceFormatPrivate(const QSurfaceFormatPrivate *other) | - |
79 | : ref(1), | - |
80 | opts(other->opts), | - |
81 | redBufferSize(other->redBufferSize), | - |
82 | greenBufferSize(other->greenBufferSize), | - |
83 | blueBufferSize(other->blueBufferSize), | - |
84 | alphaBufferSize(other->alphaBufferSize), | - |
85 | depthSize(other->depthSize), | - |
86 | stencilSize(other->stencilSize), | - |
87 | swapBehavior(other->swapBehavior), | - |
88 | numSamples(other->numSamples), | - |
89 | renderableType(other->renderableType), | - |
90 | profile(other->profile), | - |
91 | major(other->major), | - |
92 | minor(other->minor) | - |
93 | { | - |
94 | } executed: } Execution Count:3094 | 3094 |
95 | | - |
96 | QAtomicInt ref; | - |
97 | QSurfaceFormat::FormatOptions opts; | - |
98 | int redBufferSize; | - |
99 | int greenBufferSize; | - |
100 | int blueBufferSize; | - |
101 | int alphaBufferSize; | - |
102 | int depthSize; | - |
103 | int stencilSize; | - |
104 | QSurfaceFormat::SwapBehavior swapBehavior; | - |
105 | int numSamples; | - |
106 | QSurfaceFormat::RenderableType renderableType; | - |
107 | QSurfaceFormat::OpenGLContextProfile profile; | - |
108 | int major; | - |
109 | int minor; | - |
110 | }; | - |
111 | | - |
112 | /*! | - |
113 | \class QSurfaceFormat | - |
114 | \since 5.0 | - |
115 | \brief The QSurfaceFormat class represents the format of a QSurface. | - |
116 | \inmodule QtGui | - |
117 | | - |
118 | The format includes the size of the color buffers, red, green, and blue; | - |
119 | the size of the alpha buffer; the size of the depth and stencil buffers; | - |
120 | and number of samples per pixel for multisampling. In addition, the format | - |
121 | contains surface configuration parameters such as OpenGL profile and | - |
122 | version for rendering, whether or not enable stereo buffers, and swap | - |
123 | behaviour. | - |
124 | */ | - |
125 | | - |
126 | /*! | - |
127 | \enum QSurfaceFormat::FormatOption | - |
128 | | - |
129 | This enum contains format options for use with QSurfaceFormat. | - |
130 | | - |
131 | \value StereoBuffers Used to request stereo buffers in the surface format. | - |
132 | \value DebugContext Used to request a debug context with extra debugging information. | - |
133 | This requires OpenGL version 3.0 or higher. | - |
134 | \value DeprecatedFunctions Used to request that deprecated functions be included | - |
135 | in the OpenGL context profile. If not specified, you should get a forward compatible context | - |
136 | without support functionality marked as deprecated. This requires OpenGL version 3.0 or higher. | - |
137 | */ | - |
138 | | - |
139 | /*! | - |
140 | \enum QSurfaceFormat::SwapBehavior | - |
141 | | - |
142 | This enum is used by QSurfaceFormat to specify the swap behaviour of a surface. The swap behaviour | - |
143 | is mostly transparent to the application, but it affects factors such as rendering latency and | - |
144 | throughput. | - |
145 | | - |
146 | \value DefaultSwapBehavior The default, unspecified swap behaviour of the platform. | - |
147 | \value SingleBuffer Used to request single buffering, which might result in flickering | - |
148 | when OpenGL rendering is done directly to screen without an intermediate offscreen | - |
149 | buffer. | - |
150 | \value DoubleBuffer This is typically the default swap behaviour on desktop platforms, | - |
151 | consisting of one back buffer and one front buffer. Rendering is done to the back | - |
152 | buffer, and then the back buffer and front buffer are swapped, or the contents of | - |
153 | the back buffer are copied to the front buffer, depending on the implementation. | - |
154 | \value TripleBuffer This swap behaviour is sometimes used in order to decrease the | - |
155 | risk of skipping a frame when the rendering rate is just barely keeping up with | - |
156 | the screen refresh rate. Depending on the platform it might also lead to slightly | - |
157 | more efficient use of the GPU due to improved pipelining behaviour. Triple buffering | - |
158 | comes at the cost of an extra frame of memory usage and latency, and might not be | - |
159 | supported depending on the underlying platform. | - |
160 | */ | - |
161 | | - |
162 | /*! | - |
163 | \enum QSurfaceFormat::RenderableType | - |
164 | | - |
165 | This enum specifies the rendering backend for the surface. | - |
166 | | - |
167 | \value DefaultRenderableType The default, unspecified rendering method | - |
168 | \value OpenGL Desktop OpenGL rendering | - |
169 | \value OpenGLES OpenGL ES 2.0 rendering | - |
170 | \value OpenVG Open Vector Graphics rendering | - |
171 | */ | - |
172 | | - |
173 | /*! | - |
174 | \enum QSurfaceFormat::OpenGLContextProfile | - |
175 | | - |
176 | This enum is used to specify the OpenGL context profile, in | - |
177 | conjunction with QSurfaceFormat::setMajorVersion() and | - |
178 | QSurfaceFormat::setMinorVersion(). | - |
179 | | - |
180 | Profiles are exposed in OpenGL 3.2 and above, and are used | - |
181 | to choose between a restricted core profile, and a compatibility | - |
182 | profile which might contain deprecated support functionality. | - |
183 | | - |
184 | Note that the core profile might still contain functionality that | - |
185 | is deprecated and scheduled for removal in a higher version. To | - |
186 | get access to the deprecated functionality for the core profile | - |
187 | in the set OpenGL version you can use the QSurfaceFormat format option | - |
188 | QSurfaceFormat::DeprecatedFunctions. | - |
189 | | - |
190 | \value NoProfile OpenGL version is lower than 3.2. | - |
191 | \value CoreProfile Functionality deprecated in OpenGL version 3.0 is not available. | - |
192 | \value CompatibilityProfile Functionality from earlier OpenGL versions is available. | - |
193 | */ | - |
194 | | - |
195 | /*! | - |
196 | Constructs a default initialized QSurfaceFormat. | - |
197 | */ | - |
198 | QSurfaceFormat::QSurfaceFormat() : d(new QSurfaceFormatPrivate) | - |
199 | { | - |
200 | } executed: } Execution Count:3936 | 3936 |
201 | | - |
202 | /*! | - |
203 | Constructs a QSurfaceFormat with the given format \a options. | - |
204 | */ | - |
205 | QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) : | - |
206 | d(new QSurfaceFormatPrivate(options)) | - |
207 | { | - |
208 | } | 0 |
209 | | - |
210 | /*! | - |
211 | \internal | - |
212 | */ | - |
213 | void QSurfaceFormat::detach() | - |
214 | { | - |
215 | if (d->ref.load() != 1) { evaluated: d->ref.load() != 1 yes Evaluation Count:3094 | yes Evaluation Count:3 |
| 3-3094 |
216 | QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d); executed (the execution status of this line is deduced): QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d); | - |
217 | if (!d->ref.deref()) partially evaluated: !d->ref.deref() no Evaluation Count:0 | yes Evaluation Count:3094 |
| 0-3094 |
218 | delete d; never executed: delete d; | 0 |
219 | d = newd; executed (the execution status of this line is deduced): d = newd; | - |
220 | } executed: } Execution Count:3094 | 3094 |
221 | } executed: } Execution Count:3097 | 3097 |
222 | | - |
223 | /*! | - |
224 | Constructs a copy of \a other. | - |
225 | */ | - |
226 | QSurfaceFormat::QSurfaceFormat(const QSurfaceFormat &other) | - |
227 | { | - |
228 | d = other.d; executed (the execution status of this line is deduced): d = other.d; | - |
229 | d->ref.ref(); executed (the execution status of this line is deduced): d->ref.ref(); | - |
230 | } executed: } Execution Count:10814 | 10814 |
231 | | - |
232 | /*! | - |
233 | Assigns \a other to this object. | - |
234 | */ | - |
235 | QSurfaceFormat &QSurfaceFormat::operator=(const QSurfaceFormat &other) | - |
236 | { | - |
237 | if (d != other.d) { evaluated: d != other.d yes Evaluation Count:4641 | yes Evaluation Count:3088 |
| 3088-4641 |
238 | other.d->ref.ref(); executed (the execution status of this line is deduced): other.d->ref.ref(); | - |
239 | if (!d->ref.deref()) evaluated: !d->ref.deref() yes Evaluation Count:1553 | yes Evaluation Count:3088 |
| 1553-3088 |
240 | delete d; executed: delete d; Execution Count:1553 | 1553 |
241 | d = other.d; executed (the execution status of this line is deduced): d = other.d; | - |
242 | } executed: } Execution Count:4641 | 4641 |
243 | return *this; executed: return *this; Execution Count:7729 | 7729 |
244 | } | - |
245 | | - |
246 | /*! | - |
247 | Destroys the QSurfaceFormat. | - |
248 | */ | - |
249 | QSurfaceFormat::~QSurfaceFormat() | - |
250 | { | - |
251 | if (!d->ref.deref()) evaluated: !d->ref.deref() yes Evaluation Count:5388 | yes Evaluation Count:9237 |
| 5388-9237 |
252 | delete d; executed: delete d; Execution Count:5388 | 5388 |
253 | } executed: } Execution Count:14625 | 14625 |
254 | | - |
255 | /*! | - |
256 | \fn bool QSurfaceFormat::stereo() const | - |
257 | | - |
258 | Returns true if stereo buffering is enabled; otherwise returns | - |
259 | false. Stereo buffering is disabled by default. | - |
260 | | - |
261 | \sa setStereo() | - |
262 | */ | - |
263 | | - |
264 | /*! | - |
265 | If \a enable is true enables stereo buffering; otherwise disables | - |
266 | stereo buffering. | - |
267 | | - |
268 | Stereo buffering is disabled by default. | - |
269 | | - |
270 | Stereo buffering provides extra color buffers to generate left-eye | - |
271 | and right-eye images. | - |
272 | | - |
273 | \sa stereo() | - |
274 | */ | - |
275 | void QSurfaceFormat::setStereo(bool enable) | - |
276 | { | - |
277 | QSurfaceFormat::FormatOptions newOptions = d->opts; never executed (the execution status of this line is deduced): QSurfaceFormat::FormatOptions newOptions = d->opts; | - |
278 | if (enable) { | 0 |
279 | newOptions |= QSurfaceFormat::StereoBuffers; never executed (the execution status of this line is deduced): newOptions |= QSurfaceFormat::StereoBuffers; | - |
280 | } else { | 0 |
281 | newOptions &= ~QSurfaceFormat::StereoBuffers; never executed (the execution status of this line is deduced): newOptions &= ~QSurfaceFormat::StereoBuffers; | - |
282 | } | 0 |
283 | if (int(newOptions) != int(d->opts)) { never evaluated: int(newOptions) != int(d->opts) | 0 |
284 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
285 | d->opts = newOptions; never executed (the execution status of this line is deduced): d->opts = newOptions; | - |
286 | } | 0 |
287 | } | 0 |
288 | | - |
289 | /*! | - |
290 | Returns the number of samples per pixel when multisampling is | - |
291 | enabled. By default, multisampling is disabled. | - |
292 | | - |
293 | \sa setSamples() | - |
294 | */ | - |
295 | int QSurfaceFormat::samples() const | - |
296 | { | - |
297 | return d->numSamples; executed: return d->numSamples; Execution Count:9273 | 9273 |
298 | } | - |
299 | | - |
300 | /*! | - |
301 | Set the preferred number of samples per pixel when multisampling | - |
302 | is enabled to \a numSamples. By default, multisampling is disabled. | - |
303 | | - |
304 | \sa samples() | - |
305 | */ | - |
306 | void QSurfaceFormat::setSamples(int numSamples) | - |
307 | { | - |
308 | if (d->numSamples != numSamples) { never evaluated: d->numSamples != numSamples | 0 |
309 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
310 | d->numSamples = numSamples; never executed (the execution status of this line is deduced): d->numSamples = numSamples; | - |
311 | } | 0 |
312 | } | 0 |
313 | | - |
314 | /*! | - |
315 | Sets the format option to \a opt. | - |
316 | | - |
317 | \sa testOption() | - |
318 | */ | - |
319 | void QSurfaceFormat::setOption(QSurfaceFormat::FormatOptions opt) | - |
320 | { | - |
321 | const QSurfaceFormat::FormatOptions newOptions = d->opts | opt; never executed (the execution status of this line is deduced): const QSurfaceFormat::FormatOptions newOptions = d->opts | opt; | - |
322 | if (int(newOptions) != int(d->opts)) { never evaluated: int(newOptions) != int(d->opts) | 0 |
323 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
324 | d->opts = newOptions; never executed (the execution status of this line is deduced): d->opts = newOptions; | - |
325 | } | 0 |
326 | } | 0 |
327 | | - |
328 | /*! | - |
329 | Returns true if format option \a opt is set; otherwise returns false. | - |
330 | | - |
331 | \sa setOption() | - |
332 | */ | - |
333 | bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const | - |
334 | { | - |
335 | return d->opts & opt; executed: return d->opts & opt; Execution Count:9273 | 9273 |
336 | } | - |
337 | | - |
338 | /*! | - |
339 | Set the minimum depth buffer size to \a size. | - |
340 | | - |
341 | \sa depthBufferSize(), setDepth(), depth() | - |
342 | */ | - |
343 | void QSurfaceFormat::setDepthBufferSize(int size) | - |
344 | { | - |
345 | if (d->depthSize != size) { never evaluated: d->depthSize != size | 0 |
346 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
347 | d->depthSize = size; never executed (the execution status of this line is deduced): d->depthSize = size; | - |
348 | } | 0 |
349 | } | 0 |
350 | | - |
351 | /*! | - |
352 | Returns the depth buffer size. | - |
353 | | - |
354 | \sa setDepthBufferSize(), setDepth(), depth() | - |
355 | */ | - |
356 | int QSurfaceFormat::depthBufferSize() const | - |
357 | { | - |
358 | return d->depthSize; executed: return d->depthSize; Execution Count:12358 | 12358 |
359 | } | - |
360 | | - |
361 | /*! | - |
362 | Set the swap \a behavior of the surface. | - |
363 | | - |
364 | The swap behavior specifies whether single, double, or triple | - |
365 | buffering is desired. The default, SwapBehavior::DefaultSwapBehavior, | - |
366 | gives the default swap behavior of the platform. | - |
367 | */ | - |
368 | void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior) | - |
369 | { | - |
370 | if (d->swapBehavior != behavior) { partially evaluated: d->swapBehavior != behavior yes Evaluation Count:3088 | no Evaluation Count:0 |
| 0-3088 |
371 | detach(); executed (the execution status of this line is deduced): detach(); | - |
372 | d->swapBehavior = behavior; executed (the execution status of this line is deduced): d->swapBehavior = behavior; | - |
373 | } executed: } Execution Count:3088 | 3088 |
374 | } executed: } Execution Count:3088 | 3088 |
375 | | - |
376 | /*! | - |
377 | Returns the configured swap behaviour. | - |
378 | | - |
379 | \sa setSwapBehavior() | - |
380 | */ | - |
381 | QSurfaceFormat::SwapBehavior QSurfaceFormat::swapBehavior() const | - |
382 | { | - |
383 | return d->swapBehavior; executed: return d->swapBehavior; Execution Count:12358 | 12358 |
384 | } | - |
385 | | - |
386 | /*! | - |
387 | Returns true if the alpha buffer size is greater than zero. | - |
388 | | - |
389 | This means that the surface might be used with per pixel | - |
390 | translucency effects. | - |
391 | */ | - |
392 | bool QSurfaceFormat::hasAlpha() const | - |
393 | { | - |
394 | return d->alphaBufferSize > 0; executed: return d->alphaBufferSize > 0; Execution Count:9273 | 9273 |
395 | } | - |
396 | | - |
397 | /*! | - |
398 | Set the preferred stencil buffer size to \a size bits. | - |
399 | | - |
400 | \sa stencilBufferSize(), setStencil(), stencil() | - |
401 | */ | - |
402 | void QSurfaceFormat::setStencilBufferSize(int size) | - |
403 | { | - |
404 | if (d->stencilSize != size) { never evaluated: d->stencilSize != size | 0 |
405 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
406 | d->stencilSize = size; never executed (the execution status of this line is deduced): d->stencilSize = size; | - |
407 | } | 0 |
408 | } | 0 |
409 | | - |
410 | /*! | - |
411 | Returns the stencil buffer size in bits. | - |
412 | | - |
413 | \sa stencil(), setStencil(), setStencilBufferSize() | - |
414 | */ | - |
415 | int QSurfaceFormat::stencilBufferSize() const | - |
416 | { | - |
417 | return d->stencilSize; executed: return d->stencilSize; Execution Count:12364 | 12364 |
418 | } | - |
419 | | - |
420 | /*! | - |
421 | Get the size in bits of the red channel of the color buffer. | - |
422 | */ | - |
423 | int QSurfaceFormat::redBufferSize() const | - |
424 | { | - |
425 | return d->redBufferSize; executed: return d->redBufferSize; Execution Count:12364 | 12364 |
426 | } | - |
427 | | - |
428 | /*! | - |
429 | Get the size in bits of the green channel of the color buffer. | - |
430 | */ | - |
431 | int QSurfaceFormat::greenBufferSize() const | - |
432 | { | - |
433 | return d->greenBufferSize; executed: return d->greenBufferSize; Execution Count:12364 | 12364 |
434 | } | - |
435 | | - |
436 | /*! | - |
437 | Get the size in bits of the blue channel of the color buffer. | - |
438 | */ | - |
439 | int QSurfaceFormat::blueBufferSize() const | - |
440 | { | - |
441 | return d->blueBufferSize; executed: return d->blueBufferSize; Execution Count:12364 | 12364 |
442 | } | - |
443 | | - |
444 | /*! | - |
445 | Get the size in bits of the alpha channel of the color buffer. | - |
446 | */ | - |
447 | int QSurfaceFormat::alphaBufferSize() const | - |
448 | { | - |
449 | return d->alphaBufferSize; executed: return d->alphaBufferSize; Execution Count:3 | 3 |
450 | } | - |
451 | | - |
452 | /*! | - |
453 | Set the desired \a size in bits of the red channel of the color buffer. | - |
454 | */ | - |
455 | void QSurfaceFormat::setRedBufferSize(int size) | - |
456 | { | - |
457 | if (d->redBufferSize != size) { never evaluated: d->redBufferSize != size | 0 |
458 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
459 | d->redBufferSize = size; never executed (the execution status of this line is deduced): d->redBufferSize = size; | - |
460 | } | 0 |
461 | } | 0 |
462 | | - |
463 | /*! | - |
464 | Set the desired \a size in bits of the green channel of the color buffer. | - |
465 | */ | - |
466 | void QSurfaceFormat::setGreenBufferSize(int size) | - |
467 | { | - |
468 | if (d->greenBufferSize != size) { never evaluated: d->greenBufferSize != size | 0 |
469 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
470 | d->greenBufferSize = size; never executed (the execution status of this line is deduced): d->greenBufferSize = size; | - |
471 | } | 0 |
472 | } | 0 |
473 | | - |
474 | /*! | - |
475 | Set the desired \a size in bits of the blue channel of the color buffer. | - |
476 | */ | - |
477 | void QSurfaceFormat::setBlueBufferSize(int size) | - |
478 | { | - |
479 | if (d->blueBufferSize != size) { never evaluated: d->blueBufferSize != size | 0 |
480 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
481 | d->blueBufferSize = size; never executed (the execution status of this line is deduced): d->blueBufferSize = size; | - |
482 | } | 0 |
483 | } | 0 |
484 | | - |
485 | /*! | - |
486 | Set the desired \a size in bits of the alpha channel of the color buffer. | - |
487 | */ | - |
488 | void QSurfaceFormat::setAlphaBufferSize(int size) | - |
489 | { | - |
490 | if (d->alphaBufferSize != size) { partially evaluated: d->alphaBufferSize != size yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
491 | detach(); executed (the execution status of this line is deduced): detach(); | - |
492 | d->alphaBufferSize = size; executed (the execution status of this line is deduced): d->alphaBufferSize = size; | - |
493 | } executed: } Execution Count:9 | 9 |
494 | } executed: } Execution Count:9 | 9 |
495 | | - |
496 | /*! | - |
497 | Sets the desired renderable \a type. | - |
498 | | - |
499 | Chooses between desktop OpenGL, OpenGL ES, and OpenVG. | - |
500 | */ | - |
501 | void QSurfaceFormat::setRenderableType(RenderableType type) | - |
502 | { | - |
503 | if (d->renderableType != type) { never evaluated: d->renderableType != type | 0 |
504 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
505 | d->renderableType = type; never executed (the execution status of this line is deduced): d->renderableType = type; | - |
506 | } | 0 |
507 | } | 0 |
508 | | - |
509 | /*! | - |
510 | Gets the renderable type. | - |
511 | | - |
512 | Chooses between desktop OpenGL, OpenGL ES, and OpenVG. | - |
513 | */ | - |
514 | QSurfaceFormat::RenderableType QSurfaceFormat::renderableType() const | - |
515 | { | - |
516 | return d->renderableType; never executed: return d->renderableType; | 0 |
517 | } | - |
518 | | - |
519 | /*! | - |
520 | Sets the desired OpenGL context \a profile. | - |
521 | | - |
522 | This setting is ignored if the requested OpenGL version is | - |
523 | less than 3.2. | - |
524 | */ | - |
525 | void QSurfaceFormat::setProfile(OpenGLContextProfile profile) | - |
526 | { | - |
527 | if (d->profile != profile) { never evaluated: d->profile != profile | 0 |
528 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
529 | d->profile = profile; never executed (the execution status of this line is deduced): d->profile = profile; | - |
530 | } | 0 |
531 | } | 0 |
532 | | - |
533 | /*! | - |
534 | Get the configured OpenGL context profile. | - |
535 | | - |
536 | This setting is ignored if the requested OpenGL version is | - |
537 | less than 3.2. | - |
538 | */ | - |
539 | QSurfaceFormat::OpenGLContextProfile QSurfaceFormat::profile() const | - |
540 | { | - |
541 | return d->profile; never executed: return d->profile; | 0 |
542 | } | - |
543 | | - |
544 | /*! | - |
545 | Sets the desired \a major OpenGL version. | - |
546 | */ | - |
547 | void QSurfaceFormat::setMajorVersion(int major) | - |
548 | { | - |
549 | if (d->major != major) { never evaluated: d->major != major | 0 |
550 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
551 | d->major = major; never executed (the execution status of this line is deduced): d->major = major; | - |
552 | } | 0 |
553 | } | 0 |
554 | | - |
555 | /*! | - |
556 | Returns the major OpenGL version. | - |
557 | | - |
558 | The default version is 2.0. | - |
559 | */ | - |
560 | int QSurfaceFormat::majorVersion() const | - |
561 | { | - |
562 | return d->major; never executed: return d->major; | 0 |
563 | } | - |
564 | | - |
565 | /*! | - |
566 | Sets the desired \a minor OpenGL version. | - |
567 | | - |
568 | The default version is 2.0. | - |
569 | */ | - |
570 | void QSurfaceFormat::setMinorVersion(int minor) | - |
571 | { | - |
572 | if (d->minor != minor) { never evaluated: d->minor != minor | 0 |
573 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
574 | d->minor = minor; never executed (the execution status of this line is deduced): d->minor = minor; | - |
575 | } | 0 |
576 | } | 0 |
577 | | - |
578 | /*! | - |
579 | Returns the minor OpenGL version. | - |
580 | */ | - |
581 | int QSurfaceFormat::minorVersion() const | - |
582 | { | - |
583 | return d->minor; never executed: return d->minor; | 0 |
584 | } | - |
585 | | - |
586 | /*! | - |
587 | Returns true if all the options of the two QSurfaceFormat objects | - |
588 | \a a and \a b are equal. | - |
589 | | - |
590 | \relates QSurfaceFormat | - |
591 | */ | - |
592 | bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b) | - |
593 | { | - |
594 | return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
595 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
596 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
597 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
598 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
599 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
600 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
601 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
602 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
603 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
604 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
605 | && 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->alphaBufferSize == b.d->alphaBufferSize && 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); | 0 |
606 | } | - |
607 | | - |
608 | /*! | - |
609 | Returns false if all the options of the two QSurfaceFormat objects | - |
610 | \a a and \a b are equal; otherwise returns true. | - |
611 | | - |
612 | \relates QSurfaceFormat | - |
613 | */ | - |
614 | bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b) | - |
615 | { | - |
616 | return !(a == b); never executed: return !(a == b); | 0 |
617 | } | - |
618 | | - |
619 | #ifndef QT_NO_DEBUG_STREAM | - |
620 | QDebug operator<<(QDebug dbg, const QSurfaceFormat &f) | - |
621 | { | - |
622 | const QSurfaceFormatPrivate * const d = f.d; never executed (the execution status of this line is deduced): const QSurfaceFormatPrivate * const d = f.d; | - |
623 | | - |
624 | dbg.nospace() << "QSurfaceFormat(" never executed (the execution status of this line is deduced): dbg.nospace() << "QSurfaceFormat(" | - |
625 | << "version " << d->major << '.' << d->minor never executed (the execution status of this line is deduced): << "version " << d->major << '.' << d->minor | - |
626 | << ", options " << d->opts never executed (the execution status of this line is deduced): << ", options " << d->opts | - |
627 | << ", depthBufferSize " << d->depthSize never executed (the execution status of this line is deduced): << ", depthBufferSize " << d->depthSize | - |
628 | << ", redBufferSize " << d->redBufferSize never executed (the execution status of this line is deduced): << ", redBufferSize " << d->redBufferSize | - |
629 | << ", greenBufferSize " << d->greenBufferSize never executed (the execution status of this line is deduced): << ", greenBufferSize " << d->greenBufferSize | - |
630 | << ", blueBufferSize " << d->blueBufferSize never executed (the execution status of this line is deduced): << ", blueBufferSize " << d->blueBufferSize | - |
631 | << ", alphaBufferSize " << d->alphaBufferSize never executed (the execution status of this line is deduced): << ", alphaBufferSize " << d->alphaBufferSize | - |
632 | << ", stencilBufferSize " << d->stencilSize never executed (the execution status of this line is deduced): << ", stencilBufferSize " << d->stencilSize | - |
633 | << ", samples " << d->numSamples never executed (the execution status of this line is deduced): << ", samples " << d->numSamples | - |
634 | << ", swapBehavior " << d->swapBehavior never executed (the execution status of this line is deduced): << ", swapBehavior " << d->swapBehavior | - |
635 | << ", profile " << d->profile never executed (the execution status of this line is deduced): << ", profile " << d->profile | - |
636 | << ')'; never executed (the execution status of this line is deduced): << ')'; | - |
637 | | - |
638 | return dbg.space(); never executed: return dbg.space(); | 0 |
639 | } | - |
640 | #endif | - |
641 | | - |
642 | QT_END_NAMESPACE | - |
643 | | - |
| | |