| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qopenglwidget.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | class QOpenGLWidgetPaintDevicePrivate : public QOpenGLPaintDevicePrivate | - | ||||||||||||||||||||||||
| 4 | { | - | ||||||||||||||||||||||||
| 5 | public: | - | ||||||||||||||||||||||||
| 6 | QOpenGLWidgetPaintDevicePrivate(QOpenGLWidget *widget) | - | ||||||||||||||||||||||||
| 7 | : QOpenGLPaintDevicePrivate(QSize()), | - | ||||||||||||||||||||||||
| 8 |           w(widget) { } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | void beginPaint() override; | - | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | QOpenGLWidget *w; | - | ||||||||||||||||||||||||
| 13 | }; | - | ||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | class QOpenGLWidgetPaintDevice : public QOpenGLPaintDevice | - | ||||||||||||||||||||||||
| 16 | { | - | ||||||||||||||||||||||||
| 17 | public: | - | ||||||||||||||||||||||||
| 18 | QOpenGLWidgetPaintDevice(QOpenGLWidget *widget) | - | ||||||||||||||||||||||||
| 19 |         : QOpenGLPaintDevice(*new QOpenGLWidgetPaintDevicePrivate(widget)) { } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 20 | void ensureActiveTarget() override; | - | ||||||||||||||||||||||||
| 21 | }; | - | ||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | class QOpenGLWidgetPrivate : public QWidgetPrivate | - | ||||||||||||||||||||||||
| 24 | { | - | ||||||||||||||||||||||||
| 25 | inline QOpenGLWidget* q_func() { return static_cast<QOpenGLWidget *>(q_ptr); } inline const QOpenGLWidget* q_func() const { return static_cast<const QOpenGLWidget *>(q_ptr); } friend class QOpenGLWidget; | - | ||||||||||||||||||||||||
| 26 | public: | - | ||||||||||||||||||||||||
| 27 | QOpenGLWidgetPrivate() | - | ||||||||||||||||||||||||
| 28 | : context(0), | - | ||||||||||||||||||||||||
| 29 | fbo(0), | - | ||||||||||||||||||||||||
| 30 | resolvedFbo(0), | - | ||||||||||||||||||||||||
| 31 | surface(0), | - | ||||||||||||||||||||||||
| 32 | initialized(false), | - | ||||||||||||||||||||||||
| 33 | fakeHidden(false), | - | ||||||||||||||||||||||||
| 34 | inBackingStorePaint(false), | - | ||||||||||||||||||||||||
| 35 | hasBeenComposed(false), | - | ||||||||||||||||||||||||
| 36 | flushPending(false), | - | ||||||||||||||||||||||||
| 37 | paintDevice(0), | - | ||||||||||||||||||||||||
| 38 | updateBehavior(QOpenGLWidget::NoPartialUpdate), | - | ||||||||||||||||||||||||
| 39 | requestedSamples(0), | - | ||||||||||||||||||||||||
| 40 | inPaintGL(false) | - | ||||||||||||||||||||||||
| 41 | { | - | ||||||||||||||||||||||||
| 42 | requestedFormat = QSurfaceFormat::defaultFormat(); | - | ||||||||||||||||||||||||
| 43 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||
| 45 | void reset(); | - | ||||||||||||||||||||||||
| 46 | void recreateFbo(); | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | GLuint textureId() const override; | - | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | void initialize(); | - | ||||||||||||||||||||||||
| 51 | void invokeUserPaint(); | - | ||||||||||||||||||||||||
| 52 | void render(); | - | ||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | void invalidateFbo(); | - | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | QImage grabFramebuffer() override; | - | ||||||||||||||||||||||||
| 57 |     void beginBackingStorePainting() override { inBackingStorePaint = true; } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 58 |     void endBackingStorePainting() override { inBackingStorePaint = false; } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 59 | void beginCompose() override; | - | ||||||||||||||||||||||||
| 60 | void endCompose() override; | - | ||||||||||||||||||||||||
| 61 | void initializeViewportFramebuffer() override; | - | ||||||||||||||||||||||||
| 62 | void resizeViewportFramebuffer() override; | - | ||||||||||||||||||||||||
| 63 | void resolveSamples() override; | - | ||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | QOpenGLContext *context; | - | ||||||||||||||||||||||||
| 66 | QOpenGLFramebufferObject *fbo; | - | ||||||||||||||||||||||||
| 67 | QOpenGLFramebufferObject *resolvedFbo; | - | ||||||||||||||||||||||||
| 68 | QOffscreenSurface *surface; | - | ||||||||||||||||||||||||
| 69 | bool initialized; | - | ||||||||||||||||||||||||
| 70 | bool fakeHidden; | - | ||||||||||||||||||||||||
| 71 | bool inBackingStorePaint; | - | ||||||||||||||||||||||||
| 72 | bool hasBeenComposed; | - | ||||||||||||||||||||||||
| 73 | bool flushPending; | - | ||||||||||||||||||||||||
| 74 | QOpenGLPaintDevice *paintDevice; | - | ||||||||||||||||||||||||
| 75 | QSurfaceFormat requestedFormat; | - | ||||||||||||||||||||||||
| 76 | QOpenGLWidget::UpdateBehavior updateBehavior; | - | ||||||||||||||||||||||||
| 77 | int requestedSamples; | - | ||||||||||||||||||||||||
| 78 | bool inPaintGL; | - | ||||||||||||||||||||||||
| 79 | }; | - | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | void QOpenGLWidgetPaintDevicePrivate::beginPaint() | - | ||||||||||||||||||||||||
| 82 | { | - | ||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 |     if (w->autoFillBackground()
  | 0 | ||||||||||||||||||||||||
| 88 | QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); | - | ||||||||||||||||||||||||
| 89 |         if (w->format().hasAlpha()
  | 0 | ||||||||||||||||||||||||
| 90 | f->glClearColor(0, 0, 0, 0); | - | ||||||||||||||||||||||||
| 91 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 92 | QColor c = w->palette().brush(w->backgroundRole()).color(); | - | ||||||||||||||||||||||||
| 93 | float alpha = c.alphaF(); | - | ||||||||||||||||||||||||
| 94 | f->glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); | - | ||||||||||||||||||||||||
| 95 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 96 | f->glClear(0x00004000 | 0x00000100 | 0x00000400); | - | ||||||||||||||||||||||||
| 97 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 98 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | void QOpenGLWidgetPaintDevice::ensureActiveTarget() | - | ||||||||||||||||||||||||
| 101 | { | - | ||||||||||||||||||||||||
| 102 | QOpenGLWidgetPaintDevicePrivate *d = static_cast<QOpenGLWidgetPaintDevicePrivate *>(d_ptr.data()); | - | ||||||||||||||||||||||||
| 103 | QOpenGLWidgetPrivate *wd = static_cast<QOpenGLWidgetPrivate *>(QWidgetPrivate::get(d->w)); | - | ||||||||||||||||||||||||
| 104 |     if (!wd->initialized
  | 0 | ||||||||||||||||||||||||
| 105 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 |     if (QOpenGLContext::currentContext() != wd->context
  | 0 | ||||||||||||||||||||||||
| 108 |         d->w->makeCurrent(); never executed:  d->w->makeCurrent(); | 0 | ||||||||||||||||||||||||
| 109 | else | - | ||||||||||||||||||||||||
| 110 |         wd->fbo->bind(); never executed:  wd->fbo->bind(); | 0 | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||
| 115 | wd->flushPending = true; | - | ||||||||||||||||||||||||
| 116 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | GLuint QOpenGLWidgetPrivate::textureId() const | - | ||||||||||||||||||||||||
| 119 | { | - | ||||||||||||||||||||||||
| 120 |     return never executed:   resolvedFboreturn resolvedFbo ? resolvedFbo->texture() : (fbo ? fbo->texture() : 0);
 
 never executed:  return resolvedFbo ? resolvedFbo->texture() : (fbo ? fbo->texture() : 0); | 0 | ||||||||||||||||||||||||
| 121 | } | - | ||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | void QOpenGLWidgetPrivate::reset() | - | ||||||||||||||||||||||||
| 124 | { | - | ||||||||||||||||||||||||
| 125 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 |     if (initialized
  | 0 | ||||||||||||||||||||||||
| 129 |         q->makeCurrent(); never executed:  q->makeCurrent(); | 0 | ||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | delete paintDevice; | - | ||||||||||||||||||||||||
| 132 | paintDevice = 0; | - | ||||||||||||||||||||||||
| 133 | delete fbo; | - | ||||||||||||||||||||||||
| 134 | fbo = 0; | - | ||||||||||||||||||||||||
| 135 | delete resolvedFbo; | - | ||||||||||||||||||||||||
| 136 | resolvedFbo = 0; | - | ||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 |     if (initialized
  | 0 | ||||||||||||||||||||||||
| 139 |         q->doneCurrent(); never executed:  q->doneCurrent(); | 0 | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||
| 144 | delete context; | - | ||||||||||||||||||||||||
| 145 | context = 0; | - | ||||||||||||||||||||||||
| 146 | delete surface; | - | ||||||||||||||||||||||||
| 147 | surface = 0; | - | ||||||||||||||||||||||||
| 148 | initialized = fakeHidden = inBackingStorePaint = false; | - | ||||||||||||||||||||||||
| 149 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | void QOpenGLWidgetPrivate::recreateFbo() | - | ||||||||||||||||||||||||
| 152 | { | - | ||||||||||||||||||||||||
| 153 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||
| 155 | q->aboutToResize(); | - | ||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | context->makeCurrent(surface); | - | ||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||
| 159 | delete fbo; | - | ||||||||||||||||||||||||
| 160 | fbo = 0; | - | ||||||||||||||||||||||||
| 161 | delete resolvedFbo; | - | ||||||||||||||||||||||||
| 162 | resolvedFbo = 0; | - | ||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | int samples = requestedSamples; | - | ||||||||||||||||||||||||
| 165 | QOpenGLExtensions *extfuncs = static_cast<QOpenGLExtensions *>(context->functions()); | - | ||||||||||||||||||||||||
| 166 |     if (!extfuncs->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
  | 0 | ||||||||||||||||||||||||
| 167 |         samples = 0; never executed:  samples = 0; | 0 | ||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||
| 169 | QOpenGLFramebufferObjectFormat format; | - | ||||||||||||||||||||||||
| 170 | format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); | - | ||||||||||||||||||||||||
| 171 | format.setSamples(samples); | - | ||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | const QSize deviceSize = q->size() * q->devicePixelRatioF(); | - | ||||||||||||||||||||||||
| 174 | fbo = new QOpenGLFramebufferObject(deviceSize, format); | - | ||||||||||||||||||||||||
| 175 |     if (samples > 0
  | 0 | ||||||||||||||||||||||||
| 176 |         resolvedFbo = new QOpenGLFramebufferObject(deviceSize); never executed:  resolvedFbo = new QOpenGLFramebufferObject(deviceSize); | 0 | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | fbo->bind(); | - | ||||||||||||||||||||||||
| 179 | context->functions()->glClear(0x00004000 | 0x00000100 | 0x00000400); | - | ||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | paintDevice->setSize(deviceSize); | - | ||||||||||||||||||||||||
| 182 | paintDevice->setDevicePixelRatio(q->devicePixelRatioF()); | - | ||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | q->resized(); | - | ||||||||||||||||||||||||
| 185 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 186 | - | |||||||||||||||||||||||||
| 187 | void QOpenGLWidgetPrivate::beginCompose() | - | ||||||||||||||||||||||||
| 188 | { | - | ||||||||||||||||||||||||
| 189 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 190 |     if (flushPending
  | 0 | ||||||||||||||||||||||||
| 191 | flushPending = false; | - | ||||||||||||||||||||||||
| 192 | q->makeCurrent(); | - | ||||||||||||||||||||||||
| 193 | static_cast<QOpenGLExtensions *>(context->functions())->flushShared(); | - | ||||||||||||||||||||||||
| 194 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 195 | hasBeenComposed = true; | - | ||||||||||||||||||||||||
| 196 | q->aboutToCompose(); | - | ||||||||||||||||||||||||
| 197 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||
| 199 | void QOpenGLWidgetPrivate::endCompose() | - | ||||||||||||||||||||||||
| 200 | { | - | ||||||||||||||||||||||||
| 201 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 202 | q->frameSwapped(); | - | ||||||||||||||||||||||||
| 203 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | void QOpenGLWidgetPrivate::initialize() | - | ||||||||||||||||||||||||
| 206 | { | - | ||||||||||||||||||||||||
| 207 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 208 |     if (initialized
  | 0 | ||||||||||||||||||||||||
| 209 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | QWidget *tlw = q->window(); | - | ||||||||||||||||||||||||
| 214 | QOpenGLContext *shareContext = get(tlw)->shareContext(); | - | ||||||||||||||||||||||||
| 215 |     if (!shareContext
  | 0 | ||||||||||||||||||||||||
| 216 | QMessageLogger(__FILE__, 739, __PRETTY_FUNCTION__).warning("QOpenGLWidget: Cannot be used without a context shared with the toplevel."); | - | ||||||||||||||||||||||||
| 217 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 218 | } | - | ||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | requestedSamples = requestedFormat.samples(); | - | ||||||||||||||||||||||||
| 225 | requestedFormat.setSamples(0); | - | ||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | QScopedPointer<QOpenGLContext> ctx(new QOpenGLContext); | - | ||||||||||||||||||||||||
| 228 | ctx->setShareContext(shareContext); | - | ||||||||||||||||||||||||
| 229 | ctx->setFormat(requestedFormat); | - | ||||||||||||||||||||||||
| 230 | ctx->setScreen(shareContext->screen()); | - | ||||||||||||||||||||||||
| 231 |     if (!ctx->create()
  | 0 | ||||||||||||||||||||||||
| 232 | QMessageLogger(__FILE__, 755, __PRETTY_FUNCTION__).warning("QOpenGLWidget: Failed to create context"); | - | ||||||||||||||||||||||||
| 233 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 234 | } | - | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | QSurfaceFormat tlwFormat = tlw->windowHandle()->format(); | - | ||||||||||||||||||||||||
| 238 |     if (requestedFormat.swapInterval() != tlwFormat.swapInterval()
  | 0 | ||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | tlwFormat.setSwapInterval(requestedFormat.swapInterval()); | - | ||||||||||||||||||||||||
| 242 | tlw->windowHandle()->setFormat(tlwFormat); | - | ||||||||||||||||||||||||
| 243 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 244 |     if (requestedFormat.swapBehavior() != tlwFormat.swapBehavior()
  | 0 | ||||||||||||||||||||||||
| 245 | tlwFormat.setSwapBehavior(requestedFormat.swapBehavior()); | - | ||||||||||||||||||||||||
| 246 | tlw->windowHandle()->setFormat(tlwFormat); | - | ||||||||||||||||||||||||
| 247 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | - | |||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | surface = new QOffscreenSurface; | - | ||||||||||||||||||||||||
| 253 | surface->setFormat(ctx->format()); | - | ||||||||||||||||||||||||
| 254 | surface->setScreen(ctx->screen()); | - | ||||||||||||||||||||||||
| 255 | surface->create(); | - | ||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 |     if (!ctx->makeCurrent(surface)
  | 0 | ||||||||||||||||||||||||
| 258 | QMessageLogger(__FILE__, 781, __PRETTY_FUNCTION__).warning("QOpenGLWidget: Failed to make context current"); | - | ||||||||||||||||||||||||
| 259 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 260 | } | - | ||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | paintDevice = new QOpenGLWidgetPaintDevice(q); | - | ||||||||||||||||||||||||
| 263 | paintDevice->setSize(q->size() * q->devicePixelRatioF()); | - | ||||||||||||||||||||||||
| 264 | paintDevice->setDevicePixelRatio(q->devicePixelRatioF()); | - | ||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | context = ctx.take(); | - | ||||||||||||||||||||||||
| 267 | initialized = true; | - | ||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | q->initializeGL(); | - | ||||||||||||||||||||||||
| 270 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||
| 272 | void QOpenGLWidgetPrivate::resolveSamples() | - | ||||||||||||||||||||||||
| 273 | { | - | ||||||||||||||||||||||||
| 274 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 275 |     if (resolvedFbo
  | 0 | ||||||||||||||||||||||||
| 276 | q->makeCurrent(); | - | ||||||||||||||||||||||||
| 277 | QRect rect(QPoint(0, 0), fbo->size()); | - | ||||||||||||||||||||||||
| 278 | QOpenGLFramebufferObject::blitFramebuffer(resolvedFbo, rect, fbo, rect); | - | ||||||||||||||||||||||||
| 279 | flushPending = true; | - | ||||||||||||||||||||||||
| 280 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 281 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | void QOpenGLWidgetPrivate::invokeUserPaint() | - | ||||||||||||||||||||||||
| 284 | { | - | ||||||||||||||||||||||||
| 285 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||||||||
| 288 | ((!(ctx && fbo)) ? qt_assert("ctx && fbo",__FILE__,811) : qt_noop()); | - | ||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||
| 290 | QOpenGLFunctions *f = ctx->functions(); | - | ||||||||||||||||||||||||
| 291 | QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = fbo->handle(); | - | ||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||
| 293 | f->glViewport(0, 0, q->width() * q->devicePixelRatioF(), q->height() * q->devicePixelRatioF()); | - | ||||||||||||||||||||||||
| 294 | inPaintGL = true; | - | ||||||||||||||||||||||||
| 295 | q->paintGL(); | - | ||||||||||||||||||||||||
| 296 | inPaintGL = false; | - | ||||||||||||||||||||||||
| 297 | flushPending = true; | - | ||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 | QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = 0; | - | ||||||||||||||||||||||||
| 300 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||
| 302 | void QOpenGLWidgetPrivate::render() | - | ||||||||||||||||||||||||
| 303 | { | - | ||||||||||||||||||||||||
| 304 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||
| 306 |     if (fakeHidden
 
  | 0 | ||||||||||||||||||||||||
| 307 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 308 | - | |||||||||||||||||||||||||
| 309 | q->makeCurrent(); | - | ||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||
| 311 |     if (updateBehavior == QOpenGLWidget::NoPartialUpdate
 
  | 0 | ||||||||||||||||||||||||
| 312 | invalidateFbo(); | - | ||||||||||||||||||||||||
| 313 | hasBeenComposed = false; | - | ||||||||||||||||||||||||
| 314 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | invokeUserPaint(); | - | ||||||||||||||||||||||||
| 317 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | void QOpenGLWidgetPrivate::invalidateFbo() | - | ||||||||||||||||||||||||
| 320 | { | - | ||||||||||||||||||||||||
| 321 | QOpenGLExtensions *f = static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions()); | - | ||||||||||||||||||||||||
| 322 |     if (f->hasOpenGLExtension(QOpenGLExtensions::DiscardFramebuffer)
  | 0 | ||||||||||||||||||||||||
| 323 | const int gl_color_attachment0 = 0x8CE0; | - | ||||||||||||||||||||||||
| 324 | const int gl_depth_attachment = 0x8D00; | - | ||||||||||||||||||||||||
| 325 | const int gl_stencil_attachment = 0x8D20; | - | ||||||||||||||||||||||||
| 326 | const GLenum attachments[] = { | - | ||||||||||||||||||||||||
| 327 | gl_color_attachment0, gl_depth_attachment, gl_stencil_attachment | - | ||||||||||||||||||||||||
| 328 | }; | - | ||||||||||||||||||||||||
| 329 | f->glDiscardFramebufferEXT(0x8D40, sizeof attachments / sizeof *attachments, attachments); | - | ||||||||||||||||||||||||
| 330 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 331 | f->glClear(0x00004000 | 0x00000100 | 0x00000400); | - | ||||||||||||||||||||||||
| 332 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 333 | } | - | ||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | extern __attribute__((visibility("default"))) QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); | - | ||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | QImage QOpenGLWidgetPrivate::grabFramebuffer() | - | ||||||||||||||||||||||||
| 338 | { | - | ||||||||||||||||||||||||
| 339 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 340 |     if (!initialized
  | 0 | ||||||||||||||||||||||||
| 341 |         return never executed:   QImage();return QImage();never executed:  return QImage(); | 0 | ||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 |     if (!inPaintGL
  | 0 | ||||||||||||||||||||||||
| 344 |         render(); never executed:  render(); | 0 | ||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||
| 346 |     if (resolvedFbo
  | 0 | ||||||||||||||||||||||||
| 347 | resolveSamples(); | - | ||||||||||||||||||||||||
| 348 | resolvedFbo->bind(); | - | ||||||||||||||||||||||||
| 349 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 350 | q->makeCurrent(); | - | ||||||||||||||||||||||||
| 351 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatioF(), false, false); | - | ||||||||||||||||||||||||
| 354 | res.setDevicePixelRatio(q->devicePixelRatioF()); | - | ||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 |     if (resolvedFbo
  | 0 | ||||||||||||||||||||||||
| 360 |         q->makeCurrent(); never executed:  q->makeCurrent(); | 0 | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 |     return never executed:   res;return res;never executed:  return res; | 0 | ||||||||||||||||||||||||
| 363 | } | - | ||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | void QOpenGLWidgetPrivate::initializeViewportFramebuffer() | - | ||||||||||||||||||||||||
| 366 | { | - | ||||||||||||||||||||||||
| 367 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||
| 369 | - | |||||||||||||||||||||||||
| 370 | q->setAutoFillBackground(true); | - | ||||||||||||||||||||||||
| 371 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||
| 373 | void QOpenGLWidgetPrivate::resizeViewportFramebuffer() | - | ||||||||||||||||||||||||
| 374 | { | - | ||||||||||||||||||||||||
| 375 | QOpenGLWidget * const q = q_func(); | - | ||||||||||||||||||||||||
| 376 |     if (!initialized
  | 0 | ||||||||||||||||||||||||
| 377 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 |     if (!fbo
 
  | 0 | ||||||||||||||||||||||||
| 380 | recreateFbo(); | - | ||||||||||||||||||||||||
| 381 | q->update(); | - | ||||||||||||||||||||||||
| 382 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 383 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 384 | - | |||||||||||||||||||||||||
| 385 | - | |||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||
| 388 | QOpenGLWidget::QOpenGLWidget(QWidget *parent, Qt::WindowFlags f) | - | ||||||||||||||||||||||||
| 389 | : QWidget(*(new QOpenGLWidgetPrivate), parent, f) | - | ||||||||||||||||||||||||
| 390 | { | - | ||||||||||||||||||||||||
| 391 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 392 |     if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface)
  | 0 | ||||||||||||||||||||||||
| 393 |         d->setRenderToTexture(); never executed:  d->setRenderToTexture(); | 0 | ||||||||||||||||||||||||
| 394 | else | - | ||||||||||||||||||||||||
| 395 |         QMessageLogger(__FILE__, 918, __PRETTY_FUNCTION__).warning("QOpenGLWidget is not supported on this platform."); never executed:  QMessageLogger(__FILE__, 918, __PRETTY_FUNCTION__).warning("QOpenGLWidget is not supported on this platform."); | 0 | ||||||||||||||||||||||||
| 396 | } | - | ||||||||||||||||||||||||
| 397 | QOpenGLWidget::~QOpenGLWidget() | - | ||||||||||||||||||||||||
| 398 | { | - | ||||||||||||||||||||||||
| 399 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 400 | d->reset(); | - | ||||||||||||||||||||||||
| 401 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||
| 403 | - | |||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | void QOpenGLWidget::setUpdateBehavior(UpdateBehavior updateBehavior) | - | ||||||||||||||||||||||||
| 408 | { | - | ||||||||||||||||||||||||
| 409 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 410 | d->updateBehavior = updateBehavior; | - | ||||||||||||||||||||||||
| 411 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 412 | - | |||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||
| 416 | - | |||||||||||||||||||||||||
| 417 | QOpenGLWidget::UpdateBehavior QOpenGLWidget::updateBehavior() const | - | ||||||||||||||||||||||||
| 418 | { | - | ||||||||||||||||||||||||
| 419 | const QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 420 |     return never executed:   d->updateBehavior;return d->updateBehavior;never executed:  return d->updateBehavior; | 0 | ||||||||||||||||||||||||
| 421 | } | - | ||||||||||||||||||||||||
| 422 | void QOpenGLWidget::setFormat(const QSurfaceFormat &format) | - | ||||||||||||||||||||||||
| 423 | { | - | ||||||||||||||||||||||||
| 424 | (void)format;; | - | ||||||||||||||||||||||||
| 425 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 426 |     if (d->initialized
  | 0 | ||||||||||||||||||||||||
| 427 | QMessageLogger(__FILE__, 986, __PRETTY_FUNCTION__).warning("QOpenGLWidget: Already initialized, setting the format has no effect"); | - | ||||||||||||||||||||||||
| 428 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 429 | } | - | ||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||
| 431 | d->requestedFormat = format; | - | ||||||||||||||||||||||||
| 432 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 433 | QSurfaceFormat QOpenGLWidget::format() const | - | ||||||||||||||||||||||||
| 434 | { | - | ||||||||||||||||||||||||
| 435 | const QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 436 |     return never executed:   d->initializedreturn d->initialized ? d->context->format() : d->requestedFormat;
 never executed:  return d->initialized ? d->context->format() : d->requestedFormat; | 0 | ||||||||||||||||||||||||
| 437 | } | - | ||||||||||||||||||||||||
| 438 | - | |||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||
| 442 | - | |||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||
| 444 | bool QOpenGLWidget::isValid() const | - | ||||||||||||||||||||||||
| 445 | { | - | ||||||||||||||||||||||||
| 446 | const QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 447 |     return never executed:   d->initializedreturn d->initialized && d->context->isValid();
 
 never executed:  return d->initialized && d->context->isValid(); | 0 | ||||||||||||||||||||||||
| 448 | } | - | ||||||||||||||||||||||||
| 449 | void QOpenGLWidget::makeCurrent() | - | ||||||||||||||||||||||||
| 450 | { | - | ||||||||||||||||||||||||
| 451 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 452 |     if (!d->initialized
  | 0 | ||||||||||||||||||||||||
| 453 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||
| 455 | d->context->makeCurrent(d->surface); | - | ||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 |     if (d->fbo
  | 0 | ||||||||||||||||||||||||
| 458 |         d->fbo->bind(); never executed:  d->fbo->bind(); | 0 | ||||||||||||||||||||||||
| 459 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 460 | void QOpenGLWidget::doneCurrent() | - | ||||||||||||||||||||||||
| 461 | { | - | ||||||||||||||||||||||||
| 462 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 463 |     if (!d->initialized
  | 0 | ||||||||||||||||||||||||
| 464 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | d->context->doneCurrent(); | - | ||||||||||||||||||||||||
| 467 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 468 | QOpenGLContext *QOpenGLWidget::context() const | - | ||||||||||||||||||||||||
| 469 | { | - | ||||||||||||||||||||||||
| 470 | const QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 471 |     return never executed:   d->context;return d->context;never executed:  return d->context; | 0 | ||||||||||||||||||||||||
| 472 | } | - | ||||||||||||||||||||||||
| 473 | GLuint QOpenGLWidget::defaultFramebufferObject() const | - | ||||||||||||||||||||||||
| 474 | { | - | ||||||||||||||||||||||||
| 475 | const QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 476 |     return never executed:   d->fboreturn d->fbo ? d->fbo->handle() : 0;
 never executed:  return d->fbo ? d->fbo->handle() : 0; | 0 | ||||||||||||||||||||||||
| 477 | } | - | ||||||||||||||||||||||||
| 478 | void QOpenGLWidget::initializeGL() | - | ||||||||||||||||||||||||
| 479 | { | - | ||||||||||||||||||||||||
| 480 | } | - | ||||||||||||||||||||||||
| 481 | void QOpenGLWidget::resizeGL(int w, int h) | - | ||||||||||||||||||||||||
| 482 | { | - | ||||||||||||||||||||||||
| 483 | (void)w;; | - | ||||||||||||||||||||||||
| 484 | (void)h;; | - | ||||||||||||||||||||||||
| 485 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 486 | void QOpenGLWidget::paintGL() | - | ||||||||||||||||||||||||
| 487 | { | - | ||||||||||||||||||||||||
| 488 | } | - | ||||||||||||||||||||||||
| 489 | void QOpenGLWidget::resizeEvent(QResizeEvent *e) | - | ||||||||||||||||||||||||
| 490 | { | - | ||||||||||||||||||||||||
| 491 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||
| 493 |     if (e->size().isEmpty()
  | 0 | ||||||||||||||||||||||||
| 494 | d->fakeHidden = true; | - | ||||||||||||||||||||||||
| 495 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 496 | } | - | ||||||||||||||||||||||||
| 497 | d->fakeHidden = false; | - | ||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | d->initialize(); | - | ||||||||||||||||||||||||
| 500 |     if (!d->initialized
  | 0 | ||||||||||||||||||||||||
| 501 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 502 | - | |||||||||||||||||||||||||
| 503 | d->recreateFbo(); | - | ||||||||||||||||||||||||
| 504 | resizeGL(width(), height()); | - | ||||||||||||||||||||||||
| 505 | d->sendPaintEvent(QRect(QPoint(0, 0), size())); | - | ||||||||||||||||||||||||
| 506 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 507 | void QOpenGLWidget::paintEvent(QPaintEvent *e) | - | ||||||||||||||||||||||||
| 508 | { | - | ||||||||||||||||||||||||
| 509 | (void)e;; | - | ||||||||||||||||||||||||
| 510 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 511 |     if (!d->initialized
  | 0 | ||||||||||||||||||||||||
| 512 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 |     if (updatesEnabled()
  | 0 | ||||||||||||||||||||||||
| 515 |         d->render(); never executed:  d->render(); | 0 | ||||||||||||||||||||||||
| 516 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 517 | - | |||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||
| 519 | - | |||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | QImage QOpenGLWidget::grabFramebuffer() | - | ||||||||||||||||||||||||
| 525 | { | - | ||||||||||||||||||||||||
| 526 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 527 |     return never executed:   d->grabFramebuffer();return d->grabFramebuffer();never executed:  return d->grabFramebuffer(); | 0 | ||||||||||||||||||||||||
| 528 | } | - | ||||||||||||||||||||||||
| 529 | - | |||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||
| 533 | int QOpenGLWidget::metric(QPaintDevice::PaintDeviceMetric metric) const | - | ||||||||||||||||||||||||
| 534 | { | - | ||||||||||||||||||||||||
| 535 | const QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 536 |     if (d->inBackingStorePaint
  | 0 | ||||||||||||||||||||||||
| 537 |         return never executed:   QWidget::metric(metric);return QWidget::metric(metric);never executed:  return QWidget::metric(metric); | 0 | ||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | QWidget *tlw = window(); | - | ||||||||||||||||||||||||
| 540 |     QWindow *window = tlw
  | 0 | ||||||||||||||||||||||||
| 541 |     QScreen *screen = tlw
 
  | 0 | ||||||||||||||||||||||||
| 542 |     if (!screen
 
  | 0 | ||||||||||||||||||||||||
| 543 |         screen = QGuiApplication::primaryScreen(); never executed:  screen = QGuiApplication::primaryScreen(); | 0 | ||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||
| 545 | const float dpmx = qt_defaultDpiX() * 100. / 2.54; | - | ||||||||||||||||||||||||
| 546 | const float dpmy = qt_defaultDpiY() * 100. / 2.54; | - | ||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||
| 548 | switch (metric) { | - | ||||||||||||||||||||||||
| 549 |     case never executed:   PdmWidth:case PdmWidth:never executed:  case PdmWidth: | 0 | ||||||||||||||||||||||||
| 550 |         return never executed:   width();return width();never executed:  return width(); | 0 | ||||||||||||||||||||||||
| 551 |     case never executed:   PdmHeight:case PdmHeight:never executed:  case PdmHeight: | 0 | ||||||||||||||||||||||||
| 552 |         return never executed:   height();return height();never executed:  return height(); | 0 | ||||||||||||||||||||||||
| 553 |     case never executed:   PdmDepth:case PdmDepth:never executed:  case PdmDepth: | 0 | ||||||||||||||||||||||||
| 554 |         return never executed:   32;return 32;never executed:  return 32; | 0 | ||||||||||||||||||||||||
| 555 |     case never executed:   PdmWidthMM:case PdmWidthMM:never executed:  case PdmWidthMM: | 0 | ||||||||||||||||||||||||
| 556 |         if (screen
  | 0 | ||||||||||||||||||||||||
| 557 |             return never executed:   width() * screen->physicalSize().width() / screen->geometry().width();return width() * screen->physicalSize().width() / screen->geometry().width();never executed:  return width() * screen->physicalSize().width() / screen->geometry().width(); | 0 | ||||||||||||||||||||||||
| 558 | else | - | ||||||||||||||||||||||||
| 559 |             return never executed:   width() * 1000 / dpmx;return width() * 1000 / dpmx;never executed:  return width() * 1000 / dpmx; | 0 | ||||||||||||||||||||||||
| 560 |     case never executed:   PdmHeightMM:case PdmHeightMM:never executed:  case PdmHeightMM: | 0 | ||||||||||||||||||||||||
| 561 |         if (screen
  | 0 | ||||||||||||||||||||||||
| 562 |             return never executed:   height() * screen->physicalSize().height() / screen->geometry().height();return height() * screen->physicalSize().height() / screen->geometry().height();never executed:  return height() * screen->physicalSize().height() / screen->geometry().height(); | 0 | ||||||||||||||||||||||||
| 563 | else | - | ||||||||||||||||||||||||
| 564 |             return never executed:   height() * 1000 / dpmy;return height() * 1000 / dpmy;never executed:  return height() * 1000 / dpmy; | 0 | ||||||||||||||||||||||||
| 565 |     case never executed:   PdmNumColors:case PdmNumColors:never executed:  case PdmNumColors: | 0 | ||||||||||||||||||||||||
| 566 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 567 |     case never executed:   PdmDpiX:case PdmDpiX:never executed:  case PdmDpiX: | 0 | ||||||||||||||||||||||||
| 568 |         if (screen
  | 0 | ||||||||||||||||||||||||
| 569 |             return never executed:   qRound(screen->logicalDotsPerInchX());return qRound(screen->logicalDotsPerInchX());never executed:  return qRound(screen->logicalDotsPerInchX()); | 0 | ||||||||||||||||||||||||
| 570 | else | - | ||||||||||||||||||||||||
| 571 |             return never executed:   qRound(dpmx * 0.0254);return qRound(dpmx * 0.0254);never executed:  return qRound(dpmx * 0.0254); | 0 | ||||||||||||||||||||||||
| 572 |     case never executed:   PdmDpiY:case PdmDpiY:never executed:  case PdmDpiY: | 0 | ||||||||||||||||||||||||
| 573 |         if (screen
  | 0 | ||||||||||||||||||||||||
| 574 |             return never executed:   qRound(screen->logicalDotsPerInchY());return qRound(screen->logicalDotsPerInchY());never executed:  return qRound(screen->logicalDotsPerInchY()); | 0 | ||||||||||||||||||||||||
| 575 | else | - | ||||||||||||||||||||||||
| 576 |             return never executed:   qRound(dpmy * 0.0254);return qRound(dpmy * 0.0254);never executed:  return qRound(dpmy * 0.0254); | 0 | ||||||||||||||||||||||||
| 577 |     case never executed:   PdmPhysicalDpiX:case PdmPhysicalDpiX:never executed:  case PdmPhysicalDpiX: | 0 | ||||||||||||||||||||||||
| 578 |         if (screen
  | 0 | ||||||||||||||||||||||||
| 579 |             return never executed:   qRound(screen->physicalDotsPerInchX());return qRound(screen->physicalDotsPerInchX());never executed:  return qRound(screen->physicalDotsPerInchX()); | 0 | ||||||||||||||||||||||||
| 580 | else | - | ||||||||||||||||||||||||
| 581 |             return never executed:   qRound(dpmx * 0.0254);return qRound(dpmx * 0.0254);never executed:  return qRound(dpmx * 0.0254); | 0 | ||||||||||||||||||||||||
| 582 |     case never executed:   PdmPhysicalDpiY:case PdmPhysicalDpiY:never executed:  case PdmPhysicalDpiY: | 0 | ||||||||||||||||||||||||
| 583 |         if (screen
  | 0 | ||||||||||||||||||||||||
| 584 |             return never executed:   qRound(screen->physicalDotsPerInchY());return qRound(screen->physicalDotsPerInchY());never executed:  return qRound(screen->physicalDotsPerInchY()); | 0 | ||||||||||||||||||||||||
| 585 | else | - | ||||||||||||||||||||||||
| 586 |             return never executed:   qRound(dpmy * 0.0254);return qRound(dpmy * 0.0254);never executed:  return qRound(dpmy * 0.0254); | 0 | ||||||||||||||||||||||||
| 587 |     case never executed:   PdmDevicePixelRatio:case PdmDevicePixelRatio:never executed:  case PdmDevicePixelRatio: | 0 | ||||||||||||||||||||||||
| 588 |         if (window
  | 0 | ||||||||||||||||||||||||
| 589 |             return never executed:   int(window->devicePixelRatio());return int(window->devicePixelRatio());never executed:  return int(window->devicePixelRatio()); | 0 | ||||||||||||||||||||||||
| 590 | else | - | ||||||||||||||||||||||||
| 591 |             return never executed:   1.0;return 1.0;never executed:  return 1.0; | 0 | ||||||||||||||||||||||||
| 592 |     case never executed:   PdmDevicePixelRatioScaled:case PdmDevicePixelRatioScaled:never executed:  case PdmDevicePixelRatioScaled: | 0 | ||||||||||||||||||||||||
| 593 |         if (window
  | 0 | ||||||||||||||||||||||||
| 594 |             return never executed:   int(window->devicePixelRatio() * devicePixelRatioFScale());return int(window->devicePixelRatio() * devicePixelRatioFScale());never executed:  return int(window->devicePixelRatio() * devicePixelRatioFScale()); | 0 | ||||||||||||||||||||||||
| 595 | else | - | ||||||||||||||||||||||||
| 596 |             return never executed:   1.0;return 1.0;never executed:  return 1.0; | 0 | ||||||||||||||||||||||||
| 597 |     default never executed:  :default:never executed:  default: | 0 | ||||||||||||||||||||||||
| 598 | QMessageLogger(__FILE__, 1278, __PRETTY_FUNCTION__).warning("QOpenGLWidget::metric(): unknown metric %d", metric); | - | ||||||||||||||||||||||||
| 599 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 600 | } | - | ||||||||||||||||||||||||
| 601 | } | - | ||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||
| 606 | QPaintDevice *QOpenGLWidget::redirected(QPoint *p) const | - | ||||||||||||||||||||||||
| 607 | { | - | ||||||||||||||||||||||||
| 608 | const QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 609 |     if (d->inBackingStorePaint
  | 0 | ||||||||||||||||||||||||
| 610 |         return never executed:   QWidget::redirected(p);return QWidget::redirected(p);never executed:  return QWidget::redirected(p); | 0 | ||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||
| 612 |     return never executed:   d->paintDevice;return d->paintDevice;never executed:  return d->paintDevice; | 0 | ||||||||||||||||||||||||
| 613 | } | - | ||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||
| 616 | - | |||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||
| 618 | QPaintEngine *QOpenGLWidget::paintEngine() const | - | ||||||||||||||||||||||||
| 619 | { | - | ||||||||||||||||||||||||
| 620 | const QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||
| 623 | - | |||||||||||||||||||||||||
| 624 |     if (d->inBackingStorePaint
  | 0 | ||||||||||||||||||||||||
| 625 |         return never executed:   QWidget::paintEngine();return QWidget::paintEngine();never executed:  return QWidget::paintEngine(); | 0 | ||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||
| 627 |     if (!d->initialized
  | 0 | ||||||||||||||||||||||||
| 628 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||
| 630 |     return never executed:   d->paintDevice->paintEngine();return d->paintDevice->paintEngine();never executed:  return d->paintDevice->paintEngine(); | 0 | ||||||||||||||||||||||||
| 631 | } | - | ||||||||||||||||||||||||
| 632 | - | |||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||
| 636 | bool QOpenGLWidget::event(QEvent *e) | - | ||||||||||||||||||||||||
| 637 | { | - | ||||||||||||||||||||||||
| 638 | QOpenGLWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 639 | switch (e->type()) { | - | ||||||||||||||||||||||||
| 640 |     case never executed:   QEvent::WindowChangeInternal:case QEvent::WindowChangeInternal:never executed:  case QEvent::WindowChangeInternal: | 0 | ||||||||||||||||||||||||
| 641 |         if ((static_cast<
 
  | 0 | ||||||||||||||||||||||||
| 642 |             break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 643 |         if (d->initialized
  | 0 | ||||||||||||||||||||||||
| 644 |             d->reset(); never executed:  d->reset(); | 0 | ||||||||||||||||||||||||
| 645 | - | |||||||||||||||||||||||||
| 646 |     case never executed:   QEvent::Show:case QEvent::Show:never executed:  case QEvent::Show:code before this statement never executed:  case QEvent::Show: | 0 | ||||||||||||||||||||||||
| 647 |         if (!d->initialized
 
 
 
  | 0 | ||||||||||||||||||||||||
| 648 | d->initialize(); | - | ||||||||||||||||||||||||
| 649 |             if (d->initialized
  | 0 | ||||||||||||||||||||||||
| 650 |                 d->recreateFbo(); never executed:  d->recreateFbo(); | 0 | ||||||||||||||||||||||||
| 651 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 652 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 653 |     case never executed:   QEvent::ScreenChangeInternal:case QEvent::ScreenChangeInternal:never executed:  case QEvent::ScreenChangeInternal: | 0 | ||||||||||||||||||||||||
| 654 |         if (d->initialized
 
  | 0 | ||||||||||||||||||||||||
| 655 |             d->recreateFbo(); never executed:  d->recreateFbo(); | 0 | ||||||||||||||||||||||||
| 656 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 657 |     default never executed:  :default:never executed:  default: | 0 | ||||||||||||||||||||||||
| 658 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 659 | } | - | ||||||||||||||||||||||||
| 660 |     return never executed:   QWidget::event(e);return QWidget::event(e);never executed:  return QWidget::event(e); | 0 | ||||||||||||||||||||||||
| 661 | } | - | ||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |