| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 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:6249 | 6249 |
| 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:5176 | 5176 |
| 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 | \value DeprecatedFunctions Used to request that deprecated functions be included | - |
| 134 | in the OpenGL context profile. If not specified, you should get a forward compatible context | - |
| 135 | without support functionality marked as deprecated. This requires OpenGL version 3.0 or higher. | - |
| 136 | */ | - |
| 137 | | - |
| 138 | /*! | - |
| 139 | \enum QSurfaceFormat::SwapBehavior | - |
| 140 | | - |
| 141 | This enum is used by QSurfaceFormat to specify the swap behaviour of a surface. The swap behaviour | - |
| 142 | is mostly transparent to the application, but it affects factors such as rendering latency and | - |
| 143 | throughput. | - |
| 144 | | - |
| 145 | \value DefaultSwapBehavior The default, unspecified swap behaviour of the platform. | - |
| 146 | \value SingleBuffer Used to request single buffering, which might result in flickering | - |
| 147 | when OpenGL rendering is done directly to screen without an intermediate offscreen | - |
| 148 | buffer. | - |
| 149 | \value DoubleBuffer This is typically the default swap behaviour on desktop platforms, | - |
| 150 | consisting of one back buffer and one front buffer. Rendering is done to the back | - |
| 151 | buffer, and then the back buffer and front buffer are swapped, or the contents of | - |
| 152 | the back buffer are copied to the front buffer, depending on the implementation. | - |
| 153 | \value TripleBuffer This swap behaviour is sometimes used in order to decrease the | - |
| 154 | risk of skipping a frame when the rendering rate is just barely keeping up with | - |
| 155 | the screen refresh rate. Depending on the platform it might also lead to slightly | - |
| 156 | more efficient use of the GPU due to improved pipelining behaviour. Triple buffering | - |
| 157 | comes at the cost of an extra frame of memory usage and latency, and might not be | - |
| 158 | supported depending on the underlying platform. | - |
| 159 | */ | - |
| 160 | | - |
| 161 | /*! | - |
| 162 | \enum QSurfaceFormat::RenderableType | - |
| 163 | | - |
| 164 | This enum specifies the rendering backend for the surface. | - |
| 165 | | - |
| 166 | \value DefaultRenderableType The default, unspecified rendering method | - |
| 167 | \value OpenGL Desktop OpenGL rendering | - |
| 168 | \value OpenGLES OpenGL ES 2.0 rendering | - |
| 169 | \value OpenVG Open Vector Graphics rendering | - |
| 170 | */ | - |
| 171 | | - |
| 172 | /*! | - |
| 173 | \enum QSurfaceFormat::OpenGLContextProfile | - |
| 174 | | - |
| 175 | This enum is used to specify the OpenGL context profile, in | - |
| 176 | conjunction with QSurfaceFormat::setMajorVersion() and | - |
| 177 | QSurfaceFormat::setMinorVersion(). | - |
| 178 | | - |
| 179 | Profiles are exposed in OpenGL 3.2 and above, and are used | - |
| 180 | to choose between a restricted core profile, and a compatibility | - |
| 181 | profile which might contain deprecated support functionality. | - |
| 182 | | - |
| 183 | Note that the core profile might still contain functionality that | - |
| 184 | is deprecated and scheduled for removal in a higher version. To | - |
| 185 | get access to the deprecated functionality for the core profile | - |
| 186 | in the set OpenGL version you can use the QSurfaceFormat format option | - |
| 187 | QSurfaceFormat::DeprecatedFunctions. | - |
| 188 | | - |
| 189 | \value NoProfile OpenGL version is lower than 3.2. | - |
| 190 | \value CoreProfile Functionality deprecated in OpenGL version 3.0 is not available. | - |
| 191 | \value CompatibilityProfile Functionality from earlier OpenGL versions is available. | - |
| 192 | */ | - |
| 193 | | - |
| 194 | /*! | - |
| 195 | Constructs a default initialized QSurfaceFormat. | - |
| 196 | */ | - |
| 197 | QSurfaceFormat::QSurfaceFormat() : d(new QSurfaceFormatPrivate) | - |
| 198 | { | - |
| 199 | } executed: }Execution Count:6249 | 6249 |
| 200 | | - |
| 201 | /*! | - |
| 202 | Constructs a QSurfaceFormat with the given format \a options. | - |
| 203 | */ | - |
| 204 | QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) : | - |
| 205 | d(new QSurfaceFormatPrivate(options)) | - |
| 206 | { | - |
| 207 | } | 0 |
| 208 | | - |
| 209 | /*! | - |
| 210 | \internal | - |
| 211 | */ | - |
| 212 | void QSurfaceFormat::detach() | - |
| 213 | { | - |
| 214 | if (d->ref.load() != 1) { evaluated: d->ref.load() != 1| yes Evaluation Count:5176 | yes Evaluation Count:4 |
| 4-5176 |
| 215 | QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d); executed (the execution status of this line is deduced): QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d); | - |
| 216 | if (!d->ref.deref()) partially evaluated: !d->ref.deref()| no Evaluation Count:0 | yes Evaluation Count:5176 |
| 0-5176 |
| 217 | delete d; never executed: delete d; | 0 |
| 218 | d = newd; executed (the execution status of this line is deduced): d = newd; | - |
| 219 | } executed: }Execution Count:5176 | 5176 |
| 220 | } executed: }Execution Count:5180 | 5180 |
| 221 | | - |
| 222 | /*! | - |
| 223 | Constructs a copy of \a other. | - |
| 224 | */ | - |
| 225 | QSurfaceFormat::QSurfaceFormat(const QSurfaceFormat &other) | - |
| 226 | { | - |
| 227 | d = other.d; executed (the execution status of this line is deduced): d = other.d; | - |
| 228 | d->ref.ref(); executed (the execution status of this line is deduced): d->ref.ref(); | - |
| 229 | } executed: }Execution Count:18071 | 18071 |
| 230 | | - |
| 231 | /*! | - |
| 232 | Assigns \a other to this object. | - |
| 233 | */ | - |
| 234 | QSurfaceFormat &QSurfaceFormat::operator=(const QSurfaceFormat &other) | - |
| 235 | { | - |
| 236 | if (d != other.d) { evaluated: d != other.d| yes Evaluation Count:7759 | yes Evaluation Count:5158 |
| 5158-7759 |
| 237 | other.d->ref.ref(); executed (the execution status of this line is deduced): other.d->ref.ref(); | - |
| 238 | if (!d->ref.deref()) evaluated: !d->ref.deref()| yes Evaluation Count:2596 | yes Evaluation Count:5163 |
| 2596-5163 |
| 239 | delete d; executed: delete d;Execution Count:2596 | 2596 |
| 240 | d = other.d; executed (the execution status of this line is deduced): d = other.d; | - |
| 241 | } executed: }Execution Count:7759 | 7759 |
| 242 | return *this; executed: return *this;Execution Count:12917 | 12917 |
| 243 | } | - |
| 244 | | - |
| 245 | /*! | - |
| 246 | Destroys the QSurfaceFormat. | - |
| 247 | */ | - |
| 248 | QSurfaceFormat::~QSurfaceFormat() | - |
| 249 | { | - |
| 250 | if (!d->ref.deref()) evaluated: !d->ref.deref()| yes Evaluation Count:8821 | yes Evaluation Count:15491 |
| 8821-15491 |
| 251 | delete d; executed: delete d;Execution Count:8821 | 8821 |
| 252 | } executed: }Execution Count:24312 | 24312 |
| 253 | | - |
| 254 | /*! | - |
| 255 | \fn bool QSurfaceFormat::stereo() const | - |
| 256 | | - |
| 257 | Returns true if stereo buffering is enabled; otherwise returns | - |
| 258 | false. Stereo buffering is disabled by default. | - |
| 259 | | - |
| 260 | \sa setStereo() | - |
| 261 | */ | - |
| 262 | | - |
| 263 | /*! | - |
| 264 | If \a enable is true enables stereo buffering; otherwise disables | - |
| 265 | stereo buffering. | - |
| 266 | | - |
| 267 | Stereo buffering is disabled by default. | - |
| 268 | | - |
| 269 | Stereo buffering provides extra color buffers to generate left-eye | - |
| 270 | and right-eye images. | - |
| 271 | | - |
| 272 | \sa stereo() | - |
| 273 | */ | - |
| 274 | void QSurfaceFormat::setStereo(bool enable) | - |
| 275 | { | - |
| 276 | QSurfaceFormat::FormatOptions newOptions = d->opts; never executed (the execution status of this line is deduced): QSurfaceFormat::FormatOptions newOptions = d->opts; | - |
| 277 | if (enable) { | 0 |
| 278 | newOptions |= QSurfaceFormat::StereoBuffers; never executed (the execution status of this line is deduced): newOptions |= QSurfaceFormat::StereoBuffers; | - |
| 279 | } else { | 0 |
| 280 | newOptions &= ~QSurfaceFormat::StereoBuffers; never executed (the execution status of this line is deduced): newOptions &= ~QSurfaceFormat::StereoBuffers; | - |
| 281 | } | 0 |
| 282 | if (int(newOptions) != int(d->opts)) { never evaluated: int(newOptions) != int(d->opts) | 0 |
| 283 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 284 | d->opts = newOptions; never executed (the execution status of this line is deduced): d->opts = newOptions; | - |
| 285 | } | 0 |
| 286 | } | 0 |
| 287 | | - |
| 288 | /*! | - |
| 289 | Returns the number of samples per pixel when multisampling is | - |
| 290 | enabled. By default, multisampling is disabled. | - |
| 291 | | - |
| 292 | \sa setSamples() | - |
| 293 | */ | - |
| 294 | int QSurfaceFormat::samples() const | - |
| 295 | { | - |
| 296 | return d->numSamples; executed: return d->numSamples;Execution Count:15486 | 15486 |
| 297 | } | - |
| 298 | | - |
| 299 | /*! | - |
| 300 | Set the preferred number of samples per pixel when multisampling | - |
| 301 | is enabled to \a numSamples. By default, multisampling is disabled. | - |
| 302 | | - |
| 303 | \sa samples() | - |
| 304 | */ | - |
| 305 | void QSurfaceFormat::setSamples(int numSamples) | - |
| 306 | { | - |
| 307 | if (d->numSamples != numSamples) { never evaluated: d->numSamples != numSamples | 0 |
| 308 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 309 | d->numSamples = numSamples; never executed (the execution status of this line is deduced): d->numSamples = numSamples; | - |
| 310 | } | 0 |
| 311 | } | 0 |
| 312 | | - |
| 313 | /*! | - |
| 314 | Sets the format option to \a opt. | - |
| 315 | | - |
| 316 | \sa testOption() | - |
| 317 | */ | - |
| 318 | void QSurfaceFormat::setOption(QSurfaceFormat::FormatOptions opt) | - |
| 319 | { | - |
| 320 | const QSurfaceFormat::FormatOptions newOptions = d->opts | opt; never executed (the execution status of this line is deduced): const QSurfaceFormat::FormatOptions newOptions = d->opts | opt; | - |
| 321 | if (int(newOptions) != int(d->opts)) { never evaluated: int(newOptions) != int(d->opts) | 0 |
| 322 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 323 | d->opts = newOptions; never executed (the execution status of this line is deduced): d->opts = newOptions; | - |
| 324 | } | 0 |
| 325 | } | 0 |
| 326 | | - |
| 327 | /*! | - |
| 328 | Returns true if format option \a opt is set; otherwise returns false. | - |
| 329 | | - |
| 330 | \sa setOption() | - |
| 331 | */ | - |
| 332 | bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const | - |
| 333 | { | - |
| 334 | return d->opts & opt; executed: return d->opts & opt;Execution Count:15486 | 15486 |
| 335 | } | - |
| 336 | | - |
| 337 | /*! | - |
| 338 | Set the minimum depth buffer size to \a size. | - |
| 339 | | - |
| 340 | \sa depthBufferSize(), setDepth(), depth() | - |
| 341 | */ | - |
| 342 | void QSurfaceFormat::setDepthBufferSize(int size) | - |
| 343 | { | - |
| 344 | if (d->depthSize != size) { never evaluated: d->depthSize != size | 0 |
| 345 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 346 | d->depthSize = size; never executed (the execution status of this line is deduced): d->depthSize = size; | - |
| 347 | } | 0 |
| 348 | } | 0 |
| 349 | | - |
| 350 | /*! | - |
| 351 | Returns the depth buffer size. | - |
| 352 | | - |
| 353 | \sa setDepthBufferSize(), setDepth(), depth() | - |
| 354 | */ | - |
| 355 | int QSurfaceFormat::depthBufferSize() const | - |
| 356 | { | - |
| 357 | return d->depthSize; executed: return d->depthSize;Execution Count:20640 | 20640 |
| 358 | } | - |
| 359 | | - |
| 360 | /*! | - |
| 361 | Set the swap \a behavior of the surface. | - |
| 362 | | - |
| 363 | The swap behavior specifies whether single, double, or triple | - |
| 364 | buffering is desired. The default, SwapBehavior::DefaultSwapBehavior, | - |
| 365 | gives the default swap behavior of the platform. | - |
| 366 | */ | - |
| 367 | void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior) | - |
| 368 | { | - |
| 369 | if (d->swapBehavior != behavior) { partially evaluated: d->swapBehavior != behavior| yes Evaluation Count:5158 | no Evaluation Count:0 |
| 0-5158 |
| 370 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 371 | d->swapBehavior = behavior; executed (the execution status of this line is deduced): d->swapBehavior = behavior; | - |
| 372 | } executed: }Execution Count:5158 | 5158 |
| 373 | } executed: }Execution Count:5158 | 5158 |
| 374 | | - |
| 375 | /*! | - |
| 376 | Returns the configured swap behaviour. | - |
| 377 | | - |
| 378 | \sa setSwapBehavior() | - |
| 379 | */ | - |
| 380 | QSurfaceFormat::SwapBehavior QSurfaceFormat::swapBehavior() const | - |
| 381 | { | - |
| 382 | return d->swapBehavior; executed: return d->swapBehavior;Execution Count:20640 | 20640 |
| 383 | } | - |
| 384 | | - |
| 385 | /*! | - |
| 386 | Returns true if the alpha buffer size is greater than zero. | - |
| 387 | | - |
| 388 | This means that the surface might be used with per pixel | - |
| 389 | translucency effects. | - |
| 390 | */ | - |
| 391 | bool QSurfaceFormat::hasAlpha() const | - |
| 392 | { | - |
| 393 | return d->alphaBufferSize > 0; executed: return d->alphaBufferSize > 0;Execution Count:15486 | 15486 |
| 394 | } | - |
| 395 | | - |
| 396 | /*! | - |
| 397 | Set the preferred stencil buffer size to \a size bits. | - |
| 398 | | - |
| 399 | \sa stencilBufferSize(), setStencil(), stencil() | - |
| 400 | */ | - |
| 401 | void QSurfaceFormat::setStencilBufferSize(int size) | - |
| 402 | { | - |
| 403 | if (d->stencilSize != size) { never evaluated: d->stencilSize != size | 0 |
| 404 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 405 | d->stencilSize = size; never executed (the execution status of this line is deduced): d->stencilSize = size; | - |
| 406 | } | 0 |
| 407 | } | 0 |
| 408 | | - |
| 409 | /*! | - |
| 410 | Returns the stencil buffer size in bits. | - |
| 411 | | - |
| 412 | \sa stencil(), setStencil(), setStencilBufferSize() | - |
| 413 | */ | - |
| 414 | int QSurfaceFormat::stencilBufferSize() const | - |
| 415 | { | - |
| 416 | return d->stencilSize; executed: return d->stencilSize;Execution Count:20648 | 20648 |
| 417 | } | - |
| 418 | | - |
| 419 | /*! | - |
| 420 | Get the size in bits of the red channel of the color buffer. | - |
| 421 | */ | - |
| 422 | int QSurfaceFormat::redBufferSize() const | - |
| 423 | { | - |
| 424 | return d->redBufferSize; executed: return d->redBufferSize;Execution Count:20648 | 20648 |
| 425 | } | - |
| 426 | | - |
| 427 | /*! | - |
| 428 | Get the size in bits of the green channel of the color buffer. | - |
| 429 | */ | - |
| 430 | int QSurfaceFormat::greenBufferSize() const | - |
| 431 | { | - |
| 432 | return d->greenBufferSize; executed: return d->greenBufferSize;Execution Count:20648 | 20648 |
| 433 | } | - |
| 434 | | - |
| 435 | /*! | - |
| 436 | Get the size in bits of the blue channel of the color buffer. | - |
| 437 | */ | - |
| 438 | int QSurfaceFormat::blueBufferSize() const | - |
| 439 | { | - |
| 440 | return d->blueBufferSize; executed: return d->blueBufferSize;Execution Count:20648 | 20648 |
| 441 | } | - |
| 442 | | - |
| 443 | /*! | - |
| 444 | Get the size in bits of the alpha channel of the color buffer. | - |
| 445 | */ | - |
| 446 | int QSurfaceFormat::alphaBufferSize() const | - |
| 447 | { | - |
| 448 | return d->alphaBufferSize; executed: return d->alphaBufferSize;Execution Count:14 | 14 |
| 449 | } | - |
| 450 | | - |
| 451 | /*! | - |
| 452 | Set the desired \a size in bits of the red channel of the color buffer. | - |
| 453 | */ | - |
| 454 | void QSurfaceFormat::setRedBufferSize(int size) | - |
| 455 | { | - |
| 456 | if (d->redBufferSize != size) { never evaluated: d->redBufferSize != size | 0 |
| 457 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 458 | d->redBufferSize = size; never executed (the execution status of this line is deduced): d->redBufferSize = size; | - |
| 459 | } | 0 |
| 460 | } | 0 |
| 461 | | - |
| 462 | /*! | - |
| 463 | Set the desired \a size in bits of the green channel of the color buffer. | - |
| 464 | */ | - |
| 465 | void QSurfaceFormat::setGreenBufferSize(int size) | - |
| 466 | { | - |
| 467 | if (d->greenBufferSize != size) { never evaluated: d->greenBufferSize != size | 0 |
| 468 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 469 | d->greenBufferSize = size; never executed (the execution status of this line is deduced): d->greenBufferSize = size; | - |
| 470 | } | 0 |
| 471 | } | 0 |
| 472 | | - |
| 473 | /*! | - |
| 474 | Set the desired \a size in bits of the blue channel of the color buffer. | - |
| 475 | */ | - |
| 476 | void QSurfaceFormat::setBlueBufferSize(int size) | - |
| 477 | { | - |
| 478 | if (d->blueBufferSize != size) { never evaluated: d->blueBufferSize != size | 0 |
| 479 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 480 | d->blueBufferSize = size; never executed (the execution status of this line is deduced): d->blueBufferSize = size; | - |
| 481 | } | 0 |
| 482 | } | 0 |
| 483 | | - |
| 484 | /*! | - |
| 485 | Set the desired \a size in bits of the alpha channel of the color buffer. | - |
| 486 | */ | - |
| 487 | void QSurfaceFormat::setAlphaBufferSize(int size) | - |
| 488 | { | - |
| 489 | if (d->alphaBufferSize != size) { partially evaluated: d->alphaBufferSize != size| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 490 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 491 | d->alphaBufferSize = size; executed (the execution status of this line is deduced): d->alphaBufferSize = size; | - |
| 492 | } executed: }Execution Count:22 | 22 |
| 493 | } executed: }Execution Count:22 | 22 |
| 494 | | - |
| 495 | /*! | - |
| 496 | Sets the desired renderable \a type. | - |
| 497 | | - |
| 498 | Chooses between desktop OpenGL, OpenGL ES, and OpenVG. | - |
| 499 | */ | - |
| 500 | void QSurfaceFormat::setRenderableType(RenderableType type) | - |
| 501 | { | - |
| 502 | if (d->renderableType != type) { never evaluated: d->renderableType != type | 0 |
| 503 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 504 | d->renderableType = type; never executed (the execution status of this line is deduced): d->renderableType = type; | - |
| 505 | } | 0 |
| 506 | } | 0 |
| 507 | | - |
| 508 | /*! | - |
| 509 | Gets the renderable type. | - |
| 510 | | - |
| 511 | Chooses between desktop OpenGL, OpenGL ES, and OpenVG. | - |
| 512 | */ | - |
| 513 | QSurfaceFormat::RenderableType QSurfaceFormat::renderableType() const | - |
| 514 | { | - |
| 515 | return d->renderableType; never executed: return d->renderableType; | 0 |
| 516 | } | - |
| 517 | | - |
| 518 | /*! | - |
| 519 | Sets the desired OpenGL context \a profile. | - |
| 520 | | - |
| 521 | This setting is ignored if the requested OpenGL version is | - |
| 522 | less than 3.2. | - |
| 523 | */ | - |
| 524 | void QSurfaceFormat::setProfile(OpenGLContextProfile profile) | - |
| 525 | { | - |
| 526 | if (d->profile != profile) { never evaluated: d->profile != profile | 0 |
| 527 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 528 | d->profile = profile; never executed (the execution status of this line is deduced): d->profile = profile; | - |
| 529 | } | 0 |
| 530 | } | 0 |
| 531 | | - |
| 532 | /*! | - |
| 533 | Get the configured OpenGL context profile. | - |
| 534 | | - |
| 535 | This setting is ignored if the requested OpenGL version is | - |
| 536 | less than 3.2. | - |
| 537 | */ | - |
| 538 | QSurfaceFormat::OpenGLContextProfile QSurfaceFormat::profile() const | - |
| 539 | { | - |
| 540 | return d->profile; never executed: return d->profile; | 0 |
| 541 | } | - |
| 542 | | - |
| 543 | /*! | - |
| 544 | Sets the desired \a major OpenGL version. | - |
| 545 | */ | - |
| 546 | void QSurfaceFormat::setMajorVersion(int major) | - |
| 547 | { | - |
| 548 | if (d->major != major) { never evaluated: d->major != major | 0 |
| 549 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 550 | d->major = major; never executed (the execution status of this line is deduced): d->major = major; | - |
| 551 | } | 0 |
| 552 | } | 0 |
| 553 | | - |
| 554 | /*! | - |
| 555 | Returns the major OpenGL version. | - |
| 556 | | - |
| 557 | The default version is 2.0. | - |
| 558 | */ | - |
| 559 | int QSurfaceFormat::majorVersion() const | - |
| 560 | { | - |
| 561 | return d->major; never executed: return d->major; | 0 |
| 562 | } | - |
| 563 | | - |
| 564 | /*! | - |
| 565 | Sets the desired \a minor OpenGL version. | - |
| 566 | | - |
| 567 | The default version is 2.0. | - |
| 568 | */ | - |
| 569 | void QSurfaceFormat::setMinorVersion(int minor) | - |
| 570 | { | - |
| 571 | if (d->minor != minor) { never evaluated: d->minor != minor | 0 |
| 572 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 573 | d->minor = minor; never executed (the execution status of this line is deduced): d->minor = minor; | - |
| 574 | } | 0 |
| 575 | } | 0 |
| 576 | | - |
| 577 | /*! | - |
| 578 | Returns the minor OpenGL version. | - |
| 579 | */ | - |
| 580 | int QSurfaceFormat::minorVersion() const | - |
| 581 | { | - |
| 582 | return d->minor; never executed: return d->minor; | 0 |
| 583 | } | - |
| 584 | | - |
| 585 | /*! | - |
| 586 | Returns true if all the options of the two QSurfaceFormat objects | - |
| 587 | \a a and \a b are equal. | - |
| 588 | | - |
| 589 | \relates QSurfaceFormat | - |
| 590 | */ | - |
| 591 | bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b) | - |
| 592 | { | - |
| 593 | 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 |
| 594 | && 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 |
| 595 | && 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 |
| 596 | && 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 |
| 597 | && 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 |
| 598 | && 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 |
| 599 | && 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 |
| 600 | && 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 |
| 601 | && 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 |
| 602 | && 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 |
| 603 | && 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 |
| 604 | && 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 |
| 605 | } | - |
| 606 | | - |
| 607 | /*! | - |
| 608 | Returns false if all the options of the two QSurfaceFormat objects | - |
| 609 | \a a and \a b are equal; otherwise returns true. | - |
| 610 | | - |
| 611 | \relates QSurfaceFormat | - |
| 612 | */ | - |
| 613 | bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b) | - |
| 614 | { | - |
| 615 | return !(a == b); never executed: return !(a == b); | 0 |
| 616 | } | - |
| 617 | | - |
| 618 | #ifndef QT_NO_DEBUG_STREAM | - |
| 619 | QDebug operator<<(QDebug dbg, const QSurfaceFormat &f) | - |
| 620 | { | - |
| 621 | const QSurfaceFormatPrivate * const d = f.d; never executed (the execution status of this line is deduced): const QSurfaceFormatPrivate * const d = f.d; | - |
| 622 | | - |
| 623 | dbg.nospace() << "QSurfaceFormat(" never executed (the execution status of this line is deduced): dbg.nospace() << "QSurfaceFormat(" | - |
| 624 | << "version " << d->major << '.' << d->minor never executed (the execution status of this line is deduced): << "version " << d->major << '.' << d->minor | - |
| 625 | << ", options " << d->opts never executed (the execution status of this line is deduced): << ", options " << d->opts | - |
| 626 | << ", depthBufferSize " << d->depthSize never executed (the execution status of this line is deduced): << ", depthBufferSize " << d->depthSize | - |
| 627 | << ", redBufferSize " << d->redBufferSize never executed (the execution status of this line is deduced): << ", redBufferSize " << d->redBufferSize | - |
| 628 | << ", greenBufferSize " << d->greenBufferSize never executed (the execution status of this line is deduced): << ", greenBufferSize " << d->greenBufferSize | - |
| 629 | << ", blueBufferSize " << d->blueBufferSize never executed (the execution status of this line is deduced): << ", blueBufferSize " << d->blueBufferSize | - |
| 630 | << ", alphaBufferSize " << d->alphaBufferSize never executed (the execution status of this line is deduced): << ", alphaBufferSize " << d->alphaBufferSize | - |
| 631 | << ", stencilBufferSize " << d->stencilSize never executed (the execution status of this line is deduced): << ", stencilBufferSize " << d->stencilSize | - |
| 632 | << ", samples " << d->numSamples never executed (the execution status of this line is deduced): << ", samples " << d->numSamples | - |
| 633 | << ", swapBehavior " << d->swapBehavior never executed (the execution status of this line is deduced): << ", swapBehavior " << d->swapBehavior | - |
| 634 | << ", profile " << d->profile never executed (the execution status of this line is deduced): << ", profile " << d->profile | - |
| 635 | << ')'; never executed (the execution status of this line is deduced): << ')'; | - |
| 636 | | - |
| 637 | return dbg.space(); never executed: return dbg.space(); | 0 |
| 638 | } | - |
| 639 | #endif | - |
| 640 | | - |
| 641 | QT_END_NAMESPACE | - |
| 642 | | - |
| | |