| Line | Source Code | Coverage |
|---|
| 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 | { | - |
| 23 | } executed: }Execution Count:6249 | 6249 |
| 24 | | - |
| 25 | QSurfaceFormatPrivate(const QSurfaceFormatPrivate *other) | - |
| 26 | : ref(1), | - |
| 27 | opts(other->opts), | - |
| 28 | redBufferSize(other->redBufferSize), | - |
| 29 | greenBufferSize(other->greenBufferSize), | - |
| 30 | blueBufferSize(other->blueBufferSize), | - |
| 31 | alphaBufferSize(other->alphaBufferSize), | - |
| 32 | depthSize(other->depthSize), | - |
| 33 | stencilSize(other->stencilSize), | - |
| 34 | swapBehavior(other->swapBehavior), | - |
| 35 | numSamples(other->numSamples), | - |
| 36 | renderableType(other->renderableType), | - |
| 37 | profile(other->profile), | - |
| 38 | major(other->major), | - |
| 39 | minor(other->minor) | - |
| 40 | { | - |
| 41 | } executed: }Execution Count:5176 | 5176 |
| 42 | | - |
| 43 | QAtomicInt ref; | - |
| 44 | QSurfaceFormat::FormatOptions opts; | - |
| 45 | int redBufferSize; | - |
| 46 | int greenBufferSize; | - |
| 47 | int blueBufferSize; | - |
| 48 | int alphaBufferSize; | - |
| 49 | int depthSize; | - |
| 50 | int stencilSize; | - |
| 51 | QSurfaceFormat::SwapBehavior swapBehavior; | - |
| 52 | int numSamples; | - |
| 53 | QSurfaceFormat::RenderableType renderableType; | - |
| 54 | QSurfaceFormat::OpenGLContextProfile profile; | - |
| 55 | int major; | - |
| 56 | int minor; | - |
| 57 | }; | - |
| 58 | QSurfaceFormat::QSurfaceFormat() : d(new QSurfaceFormatPrivate) | - |
| 59 | { | - |
| 60 | } executed: }Execution Count:6249 | 6249 |
| 61 | | - |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) : | - |
| 66 | d(new QSurfaceFormatPrivate(options)) | - |
| 67 | { | - |
| 68 | } | 0 |
| 69 | | - |
| 70 | | - |
| 71 | | - |
| 72 | | - |
| 73 | void QSurfaceFormat::detach() | - |
| 74 | { | - |
| 75 | if (d->ref.load() != 1) { evaluated: d->ref.load() != 1| yes Evaluation Count:5176 | yes Evaluation Count:4 |
| 4-5176 |
| 76 | QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d); | - |
| 77 | if (!d->ref.deref()) partially evaluated: !d->ref.deref()| no Evaluation Count:0 | yes Evaluation Count:5176 |
| 0-5176 |
| 78 | delete d; never executed: delete d; | 0 |
| 79 | d = newd; | - |
| 80 | } executed: }Execution Count:5176 | 5176 |
| 81 | } executed: }Execution Count:5180 | 5180 |
| 82 | | - |
| 83 | | - |
| 84 | | - |
| 85 | | - |
| 86 | QSurfaceFormat::QSurfaceFormat(const QSurfaceFormat &other) | - |
| 87 | { | - |
| 88 | d = other.d; | - |
| 89 | d->ref.ref(); | - |
| 90 | } executed: }Execution Count:18071 | 18071 |
| 91 | | - |
| 92 | | - |
| 93 | | - |
| 94 | | - |
| 95 | QSurfaceFormat &QSurfaceFormat::operator=(const QSurfaceFormat &other) | - |
| 96 | { | - |
| 97 | if (d != other.d) { evaluated: d != other.d| yes Evaluation Count:7759 | yes Evaluation Count:5158 |
| 5158-7759 |
| 98 | other.d->ref.ref(); | - |
| 99 | if (!d->ref.deref()) evaluated: !d->ref.deref()| yes Evaluation Count:2596 | yes Evaluation Count:5163 |
| 2596-5163 |
| 100 | delete d; executed: delete d;Execution Count:2596 | 2596 |
| 101 | d = other.d; | - |
| 102 | } executed: }Execution Count:7759 | 7759 |
| 103 | return *this; executed: return *this;Execution Count:12917 | 12917 |
| 104 | } | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | QSurfaceFormat::~QSurfaceFormat() | - |
| 110 | { | - |
| 111 | if (!d->ref.deref()) evaluated: !d->ref.deref()| yes Evaluation Count:8821 | yes Evaluation Count:15491 |
| 8821-15491 |
| 112 | delete d; executed: delete d;Execution Count:8821 | 8821 |
| 113 | } executed: }Execution Count:24312 | 24312 |
| 114 | void QSurfaceFormat::setStereo(bool enable) | - |
| 115 | { | - |
| 116 | QSurfaceFormat::FormatOptions newOptions = d->opts; | - |
| 117 | if (enable) { | 0 |
| 118 | newOptions |= QSurfaceFormat::StereoBuffers; | - |
| 119 | } else { | 0 |
| 120 | newOptions &= ~QSurfaceFormat::StereoBuffers; | - |
| 121 | } | 0 |
| 122 | if (int(newOptions) != int(d->opts)) { never evaluated: int(newOptions) != int(d->opts) | 0 |
| 123 | detach(); | - |
| 124 | d->opts = newOptions; | - |
| 125 | } | 0 |
| 126 | } | 0 |
| 127 | | - |
| 128 | | - |
| 129 | | - |
| 130 | | - |
| 131 | | - |
| 132 | | - |
| 133 | | - |
| 134 | int QSurfaceFormat::samples() const | - |
| 135 | { | - |
| 136 | return d->numSamples; executed: return d->numSamples;Execution Count:15486 | 15486 |
| 137 | } | - |
| 138 | | - |
| 139 | | - |
| 140 | | - |
| 141 | | - |
| 142 | | - |
| 143 | | - |
| 144 | | - |
| 145 | void QSurfaceFormat::setSamples(int numSamples) | - |
| 146 | { | - |
| 147 | if (d->numSamples != numSamples) { never evaluated: d->numSamples != numSamples | 0 |
| 148 | detach(); | - |
| 149 | d->numSamples = numSamples; | - |
| 150 | } | 0 |
| 151 | } | 0 |
| 152 | | - |
| 153 | | - |
| 154 | | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| 158 | void QSurfaceFormat::setOption(QSurfaceFormat::FormatOptions opt) | - |
| 159 | { | - |
| 160 | const QSurfaceFormat::FormatOptions newOptions = d->opts | opt; | - |
| 161 | if (int(newOptions) != int(d->opts)) { never evaluated: int(newOptions) != int(d->opts) | 0 |
| 162 | detach(); | - |
| 163 | d->opts = newOptions; | - |
| 164 | } | 0 |
| 165 | } | 0 |
| 166 | | - |
| 167 | | - |
| 168 | | - |
| 169 | | - |
| 170 | | - |
| 171 | | - |
| 172 | bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const | - |
| 173 | { | - |
| 174 | return d->opts & opt; executed: return d->opts & opt;Execution Count:15486 | 15486 |
| 175 | } | - |
| 176 | | - |
| 177 | | - |
| 178 | | - |
| 179 | | - |
| 180 | | - |
| 181 | | - |
| 182 | void QSurfaceFormat::setDepthBufferSize(int size) | - |
| 183 | { | - |
| 184 | if (d->depthSize != size) { never evaluated: d->depthSize != size | 0 |
| 185 | detach(); | - |
| 186 | d->depthSize = size; | - |
| 187 | } | 0 |
| 188 | } | 0 |
| 189 | | - |
| 190 | | - |
| 191 | | - |
| 192 | | - |
| 193 | | - |
| 194 | | - |
| 195 | int QSurfaceFormat::depthBufferSize() const | - |
| 196 | { | - |
| 197 | return d->depthSize; executed: return d->depthSize;Execution Count:20640 | 20640 |
| 198 | } | - |
| 199 | void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior) | - |
| 200 | { | - |
| 201 | if (d->swapBehavior != behavior) { partially evaluated: d->swapBehavior != behavior| yes Evaluation Count:5158 | no Evaluation Count:0 |
| 0-5158 |
| 202 | detach(); | - |
| 203 | d->swapBehavior = behavior; | - |
| 204 | } executed: }Execution Count:5158 | 5158 |
| 205 | } executed: }Execution Count:5158 | 5158 |
| 206 | | - |
| 207 | | - |
| 208 | | - |
| 209 | | - |
| 210 | | - |
| 211 | | - |
| 212 | QSurfaceFormat::SwapBehavior QSurfaceFormat::swapBehavior() const | - |
| 213 | { | - |
| 214 | return d->swapBehavior; executed: return d->swapBehavior;Execution Count:20640 | 20640 |
| 215 | } | - |
| 216 | | - |
| 217 | | - |
| 218 | | - |
| 219 | | - |
| 220 | | - |
| 221 | | - |
| 222 | | - |
| 223 | bool QSurfaceFormat::hasAlpha() const | - |
| 224 | { | - |
| 225 | return d->alphaBufferSize > 0; executed: return d->alphaBufferSize > 0;Execution Count:15486 | 15486 |
| 226 | } | - |
| 227 | | - |
| 228 | | - |
| 229 | | - |
| 230 | | - |
| 231 | | - |
| 232 | | - |
| 233 | void QSurfaceFormat::setStencilBufferSize(int size) | - |
| 234 | { | - |
| 235 | if (d->stencilSize != size) { never evaluated: d->stencilSize != size | 0 |
| 236 | detach(); | - |
| 237 | d->stencilSize = size; | - |
| 238 | } | 0 |
| 239 | } | 0 |
| 240 | | - |
| 241 | | - |
| 242 | | - |
| 243 | | - |
| 244 | | - |
| 245 | | - |
| 246 | int QSurfaceFormat::stencilBufferSize() const | - |
| 247 | { | - |
| 248 | return d->stencilSize; executed: return d->stencilSize;Execution Count:20648 | 20648 |
| 249 | } | - |
| 250 | | - |
| 251 | | - |
| 252 | | - |
| 253 | | - |
| 254 | int QSurfaceFormat::redBufferSize() const | - |
| 255 | { | - |
| 256 | return d->redBufferSize; executed: return d->redBufferSize;Execution Count:20648 | 20648 |
| 257 | } | - |
| 258 | | - |
| 259 | | - |
| 260 | | - |
| 261 | | - |
| 262 | int QSurfaceFormat::greenBufferSize() const | - |
| 263 | { | - |
| 264 | return d->greenBufferSize; executed: return d->greenBufferSize;Execution Count:20648 | 20648 |
| 265 | } | - |
| 266 | | - |
| 267 | | - |
| 268 | | - |
| 269 | | - |
| 270 | int QSurfaceFormat::blueBufferSize() const | - |
| 271 | { | - |
| 272 | return d->blueBufferSize; executed: return d->blueBufferSize;Execution Count:20648 | 20648 |
| 273 | } | - |
| 274 | | - |
| 275 | | - |
| 276 | | - |
| 277 | | - |
| 278 | int QSurfaceFormat::alphaBufferSize() const | - |
| 279 | { | - |
| 280 | return d->alphaBufferSize; executed: return d->alphaBufferSize;Execution Count:14 | 14 |
| 281 | } | - |
| 282 | | - |
| 283 | | - |
| 284 | | - |
| 285 | | - |
| 286 | void QSurfaceFormat::setRedBufferSize(int size) | - |
| 287 | { | - |
| 288 | if (d->redBufferSize != size) { never evaluated: d->redBufferSize != size | 0 |
| 289 | detach(); | - |
| 290 | d->redBufferSize = size; | - |
| 291 | } | 0 |
| 292 | } | 0 |
| 293 | | - |
| 294 | | - |
| 295 | | - |
| 296 | | - |
| 297 | void QSurfaceFormat::setGreenBufferSize(int size) | - |
| 298 | { | - |
| 299 | if (d->greenBufferSize != size) { never evaluated: d->greenBufferSize != size | 0 |
| 300 | detach(); | - |
| 301 | d->greenBufferSize = size; | - |
| 302 | } | 0 |
| 303 | } | 0 |
| 304 | | - |
| 305 | | - |
| 306 | | - |
| 307 | | - |
| 308 | void QSurfaceFormat::setBlueBufferSize(int size) | - |
| 309 | { | - |
| 310 | if (d->blueBufferSize != size) { never evaluated: d->blueBufferSize != size | 0 |
| 311 | detach(); | - |
| 312 | d->blueBufferSize = size; | - |
| 313 | } | 0 |
| 314 | } | 0 |
| 315 | | - |
| 316 | | - |
| 317 | | - |
| 318 | | - |
| 319 | void QSurfaceFormat::setAlphaBufferSize(int size) | - |
| 320 | { | - |
| 321 | if (d->alphaBufferSize != size) { partially evaluated: d->alphaBufferSize != size| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 322 | detach(); | - |
| 323 | d->alphaBufferSize = size; | - |
| 324 | } executed: }Execution Count:22 | 22 |
| 325 | } executed: }Execution Count:22 | 22 |
| 326 | | - |
| 327 | | - |
| 328 | | - |
| 329 | | - |
| 330 | | - |
| 331 | | - |
| 332 | void QSurfaceFormat::setRenderableType(RenderableType type) | - |
| 333 | { | - |
| 334 | if (d->renderableType != type) { never evaluated: d->renderableType != type | 0 |
| 335 | detach(); | - |
| 336 | d->renderableType = type; | - |
| 337 | } | 0 |
| 338 | } | 0 |
| 339 | | - |
| 340 | | - |
| 341 | | - |
| 342 | | - |
| 343 | | - |
| 344 | | - |
| 345 | QSurfaceFormat::RenderableType QSurfaceFormat::renderableType() const | - |
| 346 | { | - |
| 347 | return d->renderableType; never executed: return d->renderableType; | 0 |
| 348 | } | - |
| 349 | | - |
| 350 | | - |
| 351 | | - |
| 352 | | - |
| 353 | | - |
| 354 | | - |
| 355 | | - |
| 356 | void QSurfaceFormat::setProfile(OpenGLContextProfile profile) | - |
| 357 | { | - |
| 358 | if (d->profile != profile) { never evaluated: d->profile != profile | 0 |
| 359 | detach(); | - |
| 360 | d->profile = profile; | - |
| 361 | } | 0 |
| 362 | } | 0 |
| 363 | | - |
| 364 | | - |
| 365 | | - |
| 366 | | - |
| 367 | | - |
| 368 | | - |
| 369 | | - |
| 370 | QSurfaceFormat::OpenGLContextProfile QSurfaceFormat::profile() const | - |
| 371 | { | - |
| 372 | return d->profile; never executed: return d->profile; | 0 |
| 373 | } | - |
| 374 | | - |
| 375 | | - |
| 376 | | - |
| 377 | | - |
| 378 | void QSurfaceFormat::setMajorVersion(int major) | - |
| 379 | { | - |
| 380 | if (d->major != major) { never evaluated: d->major != major | 0 |
| 381 | detach(); | - |
| 382 | d->major = major; | - |
| 383 | } | 0 |
| 384 | } | 0 |
| 385 | | - |
| 386 | | - |
| 387 | | - |
| 388 | | - |
| 389 | | - |
| 390 | | - |
| 391 | int QSurfaceFormat::majorVersion() const | - |
| 392 | { | - |
| 393 | return d->major; never executed: return d->major; | 0 |
| 394 | } | - |
| 395 | | - |
| 396 | | - |
| 397 | | - |
| 398 | | - |
| 399 | | - |
| 400 | | - |
| 401 | void QSurfaceFormat::setMinorVersion(int minor) | - |
| 402 | { | - |
| 403 | if (d->minor != minor) { never evaluated: d->minor != minor | 0 |
| 404 | detach(); | - |
| 405 | d->minor = minor; | - |
| 406 | } | 0 |
| 407 | } | 0 |
| 408 | | - |
| 409 | | - |
| 410 | | - |
| 411 | | - |
| 412 | int QSurfaceFormat::minorVersion() const | - |
| 413 | { | - |
| 414 | return d->minor; never executed: return d->minor; | 0 |
| 415 | } | - |
| 416 | | - |
| 417 | | - |
| 418 | | - |
| 419 | | - |
| 420 | | - |
| 421 | | - |
| 422 | | - |
| 423 | bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b) | - |
| 424 | { | - |
| 425 | return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts | 0 |
| 426 | && a.d->stencilSize == b.d->stencilSize | 0 |
| 427 | && a.d->redBufferSize == b.d->redBufferSize | 0 |
| 428 | && a.d->greenBufferSize == b.d->greenBufferSize | 0 |
| 429 | && a.d->blueBufferSize == b.d->blueBufferSize | 0 |
| 430 | && a.d->alphaBufferSize == b.d->alphaBufferSize | 0 |
| 431 | && a.d->depthSize == b.d->depthSize | 0 |
| 432 | && a.d->numSamples == b.d->numSamples | 0 |
| 433 | && a.d->swapBehavior == b.d->swapBehavior | 0 |
| 434 | && a.d->profile == b.d->profile | 0 |
| 435 | && a.d->major == b.d->major | 0 |
| 436 | && 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 |
| 437 | } | - |
| 438 | | - |
| 439 | | - |
| 440 | | - |
| 441 | | - |
| 442 | | - |
| 443 | | - |
| 444 | | - |
| 445 | bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b) | - |
| 446 | { | - |
| 447 | return !(a == b); never executed: return !(a == b); | 0 |
| 448 | } | - |
| 449 | | - |
| 450 | | - |
| 451 | QDebug operator<<(QDebug dbg, const QSurfaceFormat &f) | - |
| 452 | { | - |
| 453 | const QSurfaceFormatPrivate * const d = f.d; | - |
| 454 | | - |
| 455 | dbg.nospace() << "QSurfaceFormat(" | - |
| 456 | << "version " << d->major << '.' << d->minor | - |
| 457 | << ", options " << d->opts | - |
| 458 | << ", depthBufferSize " << d->depthSize | - |
| 459 | << ", redBufferSize " << d->redBufferSize | - |
| 460 | << ", greenBufferSize " << d->greenBufferSize | - |
| 461 | << ", blueBufferSize " << d->blueBufferSize | - |
| 462 | << ", alphaBufferSize " << d->alphaBufferSize | - |
| 463 | << ", stencilBufferSize " << d->stencilSize | - |
| 464 | << ", samples " << d->numSamples | - |
| 465 | << ", swapBehavior " << d->swapBehavior | - |
| 466 | << ", profile " << d->profile | - |
| 467 | << ')'; | - |
| 468 | | - |
| 469 | return dbg.space(); never executed: return dbg.space(); | 0 |
| 470 | } | - |
| 471 | | - |
| 472 | | - |
| 473 | | - |
| 474 | | - |
| | |