qgl_qpa.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
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 QtOpenGL 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 <QApplication> -
43#include <private/qapplication_p.h> -
44#include <QPixmap> -
45#include <QDebug> -
46 -
47#include <qpa/qplatformopenglcontext.h> -
48#include <qpa/qplatformwindow.h> -
49#include <QtGui/QSurfaceFormat> -
50 -
51#include "qgl.h" -
52#include "qgl_p.h" -
53 -
54QT_BEGIN_NAMESPACE -
55 -
56/*! -
57 Returns an OpenGL format for the window format specified by \a format. -
58*/ -
59QGLFormat QGLFormat::fromSurfaceFormat(const QSurfaceFormat &format) -
60{ -
61 QGLFormat retFormat;
never executed (the execution status of this line is deduced): QGLFormat retFormat;
-
62 if (format.alphaBufferSize() >= 0)
never evaluated: format.alphaBufferSize() >= 0
0
63 retFormat.setAlphaBufferSize(format.alphaBufferSize());
never executed: retFormat.setAlphaBufferSize(format.alphaBufferSize());
0
64 if (format.blueBufferSize() >= 0)
never evaluated: format.blueBufferSize() >= 0
0
65 retFormat.setBlueBufferSize(format.blueBufferSize());
never executed: retFormat.setBlueBufferSize(format.blueBufferSize());
0
66 if (format.greenBufferSize() >= 0)
never evaluated: format.greenBufferSize() >= 0
0
67 retFormat.setGreenBufferSize(format.greenBufferSize());
never executed: retFormat.setGreenBufferSize(format.greenBufferSize());
0
68 if (format.redBufferSize() >= 0)
never evaluated: format.redBufferSize() >= 0
0
69 retFormat.setRedBufferSize(format.redBufferSize());
never executed: retFormat.setRedBufferSize(format.redBufferSize());
0
70 if (format.depthBufferSize() >= 0)
never evaluated: format.depthBufferSize() >= 0
0
71 retFormat.setDepthBufferSize(format.depthBufferSize());
never executed: retFormat.setDepthBufferSize(format.depthBufferSize());
0
72 if (format.samples() > 1) {
never evaluated: format.samples() > 1
0
73 retFormat.setSampleBuffers(true);
never executed (the execution status of this line is deduced): retFormat.setSampleBuffers(true);
-
74 retFormat.setSamples(format.samples());
never executed (the execution status of this line is deduced): retFormat.setSamples(format.samples());
-
75 }
never executed: }
0
76 if (format.stencilBufferSize() > 0) {
never evaluated: format.stencilBufferSize() > 0
0
77 retFormat.setStencil(true);
never executed (the execution status of this line is deduced): retFormat.setStencil(true);
-
78 retFormat.setStencilBufferSize(format.stencilBufferSize());
never executed (the execution status of this line is deduced): retFormat.setStencilBufferSize(format.stencilBufferSize());
-
79 }
never executed: }
0
80 retFormat.setDoubleBuffer(format.swapBehavior() != QSurfaceFormat::SingleBuffer);
never executed (the execution status of this line is deduced): retFormat.setDoubleBuffer(format.swapBehavior() != QSurfaceFormat::SingleBuffer);
-
81 retFormat.setStereo(format.stereo());
never executed (the execution status of this line is deduced): retFormat.setStereo(format.stereo());
-
82 retFormat.setVersion(format.majorVersion(), format.minorVersion());
never executed (the execution status of this line is deduced): retFormat.setVersion(format.majorVersion(), format.minorVersion());
-
83 retFormat.setProfile(static_cast<QGLFormat::OpenGLContextProfile>(format.profile()));
never executed (the execution status of this line is deduced): retFormat.setProfile(static_cast<QGLFormat::OpenGLContextProfile>(format.profile()));
-
84 return retFormat;
never executed: return retFormat;
0
85} -
86 -
87/*! -
88 Returns a window format for the OpenGL format specified by \a format. -
89*/ -
90QSurfaceFormat QGLFormat::toSurfaceFormat(const QGLFormat &format) -
91{ -
92 QSurfaceFormat retFormat;
never executed (the execution status of this line is deduced): QSurfaceFormat retFormat;
-
93 if (format.alpha())
never evaluated: format.alpha()
0
94 retFormat.setAlphaBufferSize(format.alphaBufferSize() == -1 ? 1 : format.alphaBufferSize());
never executed: retFormat.setAlphaBufferSize(format.alphaBufferSize() == -1 ? 1 : format.alphaBufferSize());
0
95 if (format.blueBufferSize() >= 0)
never evaluated: format.blueBufferSize() >= 0
0
96 retFormat.setBlueBufferSize(format.blueBufferSize());
never executed: retFormat.setBlueBufferSize(format.blueBufferSize());
0
97 if (format.greenBufferSize() >= 0)
never evaluated: format.greenBufferSize() >= 0
0
98 retFormat.setGreenBufferSize(format.greenBufferSize());
never executed: retFormat.setGreenBufferSize(format.greenBufferSize());
0
99 if (format.redBufferSize() >= 0)
never evaluated: format.redBufferSize() >= 0
0
100 retFormat.setRedBufferSize(format.redBufferSize());
never executed: retFormat.setRedBufferSize(format.redBufferSize());
0
101 if (format.depth())
never evaluated: format.depth()
0
102 retFormat.setDepthBufferSize(format.depthBufferSize() == -1 ? 1 : format.depthBufferSize());
never executed: retFormat.setDepthBufferSize(format.depthBufferSize() == -1 ? 1 : format.depthBufferSize());
0
103 retFormat.setSwapBehavior(format.doubleBuffer() ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::SingleBuffer);
never executed (the execution status of this line is deduced): retFormat.setSwapBehavior(format.doubleBuffer() ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::SingleBuffer);
-
104 if (format.sampleBuffers())
never evaluated: format.sampleBuffers()
0
105 retFormat.setSamples(format.samples() == -1 ? 4 : format.samples());
never executed: retFormat.setSamples(format.samples() == -1 ? 4 : format.samples());
0
106 if (format.stencil())
never evaluated: format.stencil()
0
107 retFormat.setStencilBufferSize(format.stencilBufferSize() == -1 ? 1 : format.stencilBufferSize());
never executed: retFormat.setStencilBufferSize(format.stencilBufferSize() == -1 ? 1 : format.stencilBufferSize());
0
108 retFormat.setStereo(format.stereo());
never executed (the execution status of this line is deduced): retFormat.setStereo(format.stereo());
-
109 retFormat.setMajorVersion(format.majorVersion());
never executed (the execution status of this line is deduced): retFormat.setMajorVersion(format.majorVersion());
-
110 retFormat.setMinorVersion(format.minorVersion());
never executed (the execution status of this line is deduced): retFormat.setMinorVersion(format.minorVersion());
-
111 retFormat.setProfile(static_cast<QSurfaceFormat::OpenGLContextProfile>(format.profile()));
never executed (the execution status of this line is deduced): retFormat.setProfile(static_cast<QSurfaceFormat::OpenGLContextProfile>(format.profile()));
-
112 return retFormat;
never executed: return retFormat;
0
113} -
114 -
115void QGLContextPrivate::setupSharing() { -
116 Q_Q(QGLContext);
never executed (the execution status of this line is deduced): QGLContext * const q = q_func();
-
117 QOpenGLContext *sharedContext = guiGlContext->shareContext();
never executed (the execution status of this line is deduced): QOpenGLContext *sharedContext = guiGlContext->shareContext();
-
118 if (sharedContext) {
never evaluated: sharedContext
0
119 QGLContext *actualSharedContext = QGLContext::fromOpenGLContext(sharedContext);
never executed (the execution status of this line is deduced): QGLContext *actualSharedContext = QGLContext::fromOpenGLContext(sharedContext);
-
120 sharing = true;
never executed (the execution status of this line is deduced): sharing = true;
-
121 QGLContextGroup::addShare(q, actualSharedContext);
never executed (the execution status of this line is deduced): QGLContextGroup::addShare(q, actualSharedContext);
-
122 }
never executed: }
0
123}
never executed: }
0
124 -
125bool QGLFormat::hasOpenGL() -
126{ -
127 return QApplicationPrivate::platformIntegration()
never executed: return QApplicationPrivate::platformIntegration() ->hasCapability(QPlatformIntegration::OpenGL);
0
128 ->hasCapability(QPlatformIntegration::OpenGL);
never executed: return QApplicationPrivate::platformIntegration() ->hasCapability(QPlatformIntegration::OpenGL);
0
129} -
130 -
131void qDeleteQGLContext(void *handle) -
132{ -
133 QGLContext *context = static_cast<QGLContext *>(handle);
never executed (the execution status of this line is deduced): QGLContext *context = static_cast<QGLContext *>(handle);
-
134 delete context;
never executed (the execution status of this line is deduced): delete context;
-
135}
never executed: }
0
136 -
137bool QGLContext::chooseContext(const QGLContext* shareContext) -
138{ -
139 Q_D(QGLContext);
never executed (the execution status of this line is deduced): QGLContextPrivate * const d = d_func();
-
140 if(!d->paintDevice || d->paintDevice->devType() != QInternal::Widget) {
never evaluated: !d->paintDevice
never evaluated: d->paintDevice->devType() != QInternal::Widget
0
141 d->valid = false;
never executed (the execution status of this line is deduced): d->valid = false;
-
142 }else {
never executed: }
0
143 QWidget *widget = static_cast<QWidget *>(d->paintDevice);
never executed (the execution status of this line is deduced): QWidget *widget = static_cast<QWidget *>(d->paintDevice);
-
144 QGLFormat glformat = format();
never executed (the execution status of this line is deduced): QGLFormat glformat = format();
-
145 QSurfaceFormat winFormat = QGLFormat::toSurfaceFormat(glformat);
never executed (the execution status of this line is deduced): QSurfaceFormat winFormat = QGLFormat::toSurfaceFormat(glformat);
-
146 if (widget->testAttribute(Qt::WA_TranslucentBackground))
never evaluated: widget->testAttribute(Qt::WA_TranslucentBackground)
0
147 winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
never executed: winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
0
148 -
149 if (!widget->windowHandle()->handle()) {
never evaluated: !widget->windowHandle()->handle()
0
150 widget->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
never executed (the execution status of this line is deduced): widget->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
-
151 widget->windowHandle()->setFormat(winFormat);
never executed (the execution status of this line is deduced): widget->windowHandle()->setFormat(winFormat);
-
152 widget->winId();//make window
never executed (the execution status of this line is deduced): widget->winId();
-
153 }
never executed: }
0
154 -
155 if (d->ownContext)
never evaluated: d->ownContext
0
156 delete d->guiGlContext;
never executed: delete d->guiGlContext;
0
157 d->ownContext = true;
never executed (the execution status of this line is deduced): d->ownContext = true;
-
158 QOpenGLContext *shareGlContext = shareContext ? shareContext->d_func()->guiGlContext : 0;
never evaluated: shareContext
0
159 d->guiGlContext = new QOpenGLContext;
never executed (the execution status of this line is deduced): d->guiGlContext = new QOpenGLContext;
-
160 d->guiGlContext->setFormat(winFormat);
never executed (the execution status of this line is deduced): d->guiGlContext->setFormat(winFormat);
-
161 d->guiGlContext->setShareContext(shareGlContext);
never executed (the execution status of this line is deduced): d->guiGlContext->setShareContext(shareGlContext);
-
162 d->valid = d->guiGlContext->create();
never executed (the execution status of this line is deduced): d->valid = d->guiGlContext->create();
-
163 -
164 if (d->valid)
never evaluated: d->valid
0
165 d->guiGlContext->setQGLContextHandle(this,qDeleteQGLContext);
never executed: d->guiGlContext->setQGLContextHandle(this,qDeleteQGLContext);
0
166 -
167 d->glFormat = QGLFormat::fromSurfaceFormat(d->guiGlContext->format());
never executed (the execution status of this line is deduced): d->glFormat = QGLFormat::fromSurfaceFormat(d->guiGlContext->format());
-
168 d->setupSharing();
never executed (the execution status of this line is deduced): d->setupSharing();
-
169 }
never executed: }
0
170 -
171 -
172 return d->valid;
never executed: return d->valid;
0
173} -
174 -
175void QGLContext::reset() -
176{ -
177 Q_D(QGLContext);
never executed (the execution status of this line is deduced): QGLContextPrivate * const d = d_func();
-
178 if (!d->valid)
never evaluated: !d->valid
0
179 return;
never executed: return;
0
180 d->cleanup();
never executed (the execution status of this line is deduced): d->cleanup();
-
181 -
182 d->crWin = false;
never executed (the execution status of this line is deduced): d->crWin = false;
-
183 d->sharing = false;
never executed (the execution status of this line is deduced): d->sharing = false;
-
184 d->valid = false;
never executed (the execution status of this line is deduced): d->valid = false;
-
185 d->transpColor = QColor();
never executed (the execution status of this line is deduced): d->transpColor = QColor();
-
186 d->initDone = false;
never executed (the execution status of this line is deduced): d->initDone = false;
-
187 QGLContextGroup::removeShare(this);
never executed (the execution status of this line is deduced): QGLContextGroup::removeShare(this);
-
188 if (d->guiGlContext) {
never evaluated: d->guiGlContext
0
189 if (QOpenGLContext::currentContext() == d->guiGlContext)
never evaluated: QOpenGLContext::currentContext() == d->guiGlContext
0
190 doneCurrent();
never executed: doneCurrent();
0
191 if (d->ownContext) {
never evaluated: d->ownContext
0
192 if (d->guiGlContext->thread() == QThread::currentThread())
never evaluated: d->guiGlContext->thread() == QThread::currentThread()
0
193 delete d->guiGlContext;
never executed: delete d->guiGlContext;
0
194 else -
195 d->guiGlContext->deleteLater();
never executed: d->guiGlContext->deleteLater();
0
196 } else -
197 d->guiGlContext->setQGLContextHandle(0,0);
never executed: d->guiGlContext->setQGLContextHandle(0,0);
0
198 d->guiGlContext = 0;
never executed (the execution status of this line is deduced): d->guiGlContext = 0;
-
199 }
never executed: }
0
200 d->ownContext = false;
never executed (the execution status of this line is deduced): d->ownContext = false;
-
201}
never executed: }
0
202 -
203void QGLContext::makeCurrent() -
204{ -
205 Q_D(QGLContext);
never executed (the execution status of this line is deduced): QGLContextPrivate * const d = d_func();
-
206 if (!d->paintDevice || d->paintDevice->devType() != QInternal::Widget)
never evaluated: !d->paintDevice
never evaluated: d->paintDevice->devType() != QInternal::Widget
0
207 return;
never executed: return;
0
208 -
209 QWidget *widget = static_cast<QWidget *>(d->paintDevice);
never executed (the execution status of this line is deduced): QWidget *widget = static_cast<QWidget *>(d->paintDevice);
-
210 if (!widget->windowHandle())
never evaluated: !widget->windowHandle()
0
211 return;
never executed: return;
0
212 -
213 if (d->guiGlContext->makeCurrent(widget->windowHandle())) {
never evaluated: d->guiGlContext->makeCurrent(widget->windowHandle())
0
214 if (!d->workaroundsCached) {
never evaluated: !d->workaroundsCached
0
215 d->workaroundsCached = true;
never executed (the execution status of this line is deduced): d->workaroundsCached = true;
-
216 const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
never executed (the execution status of this line is deduced): const char *renderer = reinterpret_cast<const char *>(glGetString(0x1F01));
-
217 if (renderer && strstr(renderer, "Mali")) {
never evaluated: renderer
never evaluated: strstr(renderer, "Mali")
0
218 d->workaround_brokenFBOReadBack = true;
never executed (the execution status of this line is deduced): d->workaround_brokenFBOReadBack = true;
-
219 }
never executed: }
0
220 }
never executed: }
0
221 }
never executed: }
0
222}
never executed: }
0
223 -
224void QGLContext::doneCurrent() -
225{ -
226 Q_D(QGLContext);
never executed (the execution status of this line is deduced): QGLContextPrivate * const d = d_func();
-
227 d->guiGlContext->doneCurrent();
never executed (the execution status of this line is deduced): d->guiGlContext->doneCurrent();
-
228}
never executed: }
0
229 -
230void QGLContext::swapBuffers() const -
231{ -
232 Q_D(const QGLContext);
never executed (the execution status of this line is deduced): const QGLContextPrivate * const d = d_func();
-
233 if (!d->paintDevice || d->paintDevice->devType() != QInternal::Widget)
never evaluated: !d->paintDevice
never evaluated: d->paintDevice->devType() != QInternal::Widget
0
234 return;
never executed: return;
0
235 -
236 QWidget *widget = static_cast<QWidget *>(d->paintDevice);
never executed (the execution status of this line is deduced): QWidget *widget = static_cast<QWidget *>(d->paintDevice);
-
237 if (!widget->windowHandle())
never evaluated: !widget->windowHandle()
0
238 return;
never executed: return;
0
239 -
240 d->guiGlContext->swapBuffers(widget->windowHandle());
never executed (the execution status of this line is deduced): d->guiGlContext->swapBuffers(widget->windowHandle());
-
241}
never executed: }
0
242 -
243QFunctionPointer QGLContext::getProcAddress(const QString &procName) const -
244{ -
245 Q_D(const QGLContext);
never executed (the execution status of this line is deduced): const QGLContextPrivate * const d = d_func();
-
246 return d->guiGlContext->getProcAddress(procName.toLatin1());
never executed: return d->guiGlContext->getProcAddress(procName.toLatin1());
0
247} -
248 -
249void QGLWidget::setContext(QGLContext *context, -
250 const QGLContext* shareContext, -
251 bool deleteOldContext) -
252{ -
253 Q_D(QGLWidget);
never executed (the execution status of this line is deduced): QGLWidgetPrivate * const d = d_func();
-
254 if (context == 0) {
never evaluated: context == 0
0
255 qWarning("QGLWidget::setContext: Cannot set null context");
never executed (the execution status of this line is deduced): QMessageLogger("qgl_qpa.cpp", 255, __PRETTY_FUNCTION__).warning("QGLWidget::setContext: Cannot set null context");
-
256 return;
never executed: return;
0
257 } -
258 -
259 if (context->device() == 0) // a context may refere to more than 1 window.
never evaluated: context->device() == 0
0
260 context->setDevice(this); //but its better to point to 1 of them than none of them.
never executed: context->setDevice(this);
0
261 -
262 QGLContext* oldcx = d->glcx;
never executed (the execution status of this line is deduced): QGLContext* oldcx = d->glcx;
-
263 d->glcx = context;
never executed (the execution status of this line is deduced): d->glcx = context;
-
264 -
265 if (!d->glcx->isValid())
never evaluated: !d->glcx->isValid()
0
266 d->glcx->create(shareContext ? shareContext : oldcx);
never executed: d->glcx->create(shareContext ? shareContext : oldcx);
0
267 -
268 if (deleteOldContext)
never evaluated: deleteOldContext
0
269 delete oldcx;
never executed: delete oldcx;
0
270}
never executed: }
0
271 -
272void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) -
273{ -
274 initContext(context, shareWidget);
never executed (the execution status of this line is deduced): initContext(context, shareWidget);
-
275}
never executed: }
0
276 -
277bool QGLFormat::hasOpenGLOverlays() -
278{ -
279 return false;
never executed: return false;
0
280} -
281 -
282QColor QGLContext::overlayTransparentColor() const -
283{ -
284 return QColor(); // Invalid color
never executed: return QColor();
0
285} -
286 -
287uint QGLContext::colorIndex(const QColor&) const -
288{ -
289 return 0;
never executed: return 0;
0
290} -
291 -
292/* -
293 QGLTemporaryContext implementation -
294*/ -
295class QGLTemporaryContextPrivate -
296{ -
297public: -
298 QWindow *window; -
299 QOpenGLContext *context; -
300 -
301 QGLContext *oldContext; -
302}; -
303 -
304QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) -
305 : d(new QGLTemporaryContextPrivate) -
306{ -
307 d->oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
never executed (the execution status of this line is deduced): d->oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
-
308 -
309 d->window = new QWindow;
never executed (the execution status of this line is deduced): d->window = new QWindow;
-
310 d->window->setSurfaceType(QWindow::OpenGLSurface);
never executed (the execution status of this line is deduced): d->window->setSurfaceType(QWindow::OpenGLSurface);
-
311 d->window->setGeometry(QRect(0, 0, 3, 3));
never executed (the execution status of this line is deduced): d->window->setGeometry(QRect(0, 0, 3, 3));
-
312 d->window->create();
never executed (the execution status of this line is deduced): d->window->create();
-
313 -
314 d->context = new QOpenGLContext;
never executed (the execution status of this line is deduced): d->context = new QOpenGLContext;
-
315#if !defined(QT_OPENGL_ES) -
316 // On desktop, request latest released version -
317 QSurfaceFormat format;
never executed (the execution status of this line is deduced): QSurfaceFormat format;
-
318#if defined(Q_OS_MAC) -
319 // OS X is limited to OpenGL 3.2 Core Profile at present -
320 // so set that here. If we use compatibility profile it -
321 // only reports 2.x contexts. -
322 format.setMajorVersion(3); -
323 format.setMinorVersion(2); -
324 format.setProfile(QSurfaceFormat::CoreProfile); -
325#else -
326 format.setMajorVersion(4);
never executed (the execution status of this line is deduced): format.setMajorVersion(4);
-
327 format.setMinorVersion(3);
never executed (the execution status of this line is deduced): format.setMinorVersion(3);
-
328#endif -
329 d->context->setFormat(format);
never executed (the execution status of this line is deduced): d->context->setFormat(format);
-
330#endif -
331 d->context->create();
never executed (the execution status of this line is deduced): d->context->create();
-
332 d->context->makeCurrent(d->window);
never executed (the execution status of this line is deduced): d->context->makeCurrent(d->window);
-
333}
never executed: }
0
334 -
335QGLTemporaryContext::~QGLTemporaryContext() -
336{ -
337 if (d->oldContext)
never evaluated: d->oldContext
0
338 d->oldContext->makeCurrent();
never executed: d->oldContext->makeCurrent();
0
339 -
340 delete d->context;
never executed (the execution status of this line is deduced): delete d->context;
-
341 delete d->window;
never executed (the execution status of this line is deduced): delete d->window;
-
342}
never executed: }
0
343 -
344 -
345bool QGLWidgetPrivate::renderCxPm(QPixmap*) -
346{ -
347 return false;
never executed: return false;
0
348} -
349 -
350/*! \internal -
351 Free up any allocated colormaps. This fn is only called for -
352 top-level widgets. -
353*/ -
354void QGLWidgetPrivate::cleanupColormaps() -
355{ -
356} -
357 -
358bool QGLWidget::event(QEvent *e) -
359{ -
360 return QWidget::event(e);
never executed: return QWidget::event(e);
0
361} -
362 -
363void QGLWidget::resizeEvent(QResizeEvent *e) -
364{ -
365 Q_D(QGLWidget);
never executed (the execution status of this line is deduced): QGLWidgetPrivate * const d = d_func();
-
366 -
367 QWidget::resizeEvent(e);
never executed (the execution status of this line is deduced): QWidget::resizeEvent(e);
-
368 if (!isValid())
never evaluated: !isValid()
0
369 return;
never executed: return;
0
370 makeCurrent();
never executed (the execution status of this line is deduced): makeCurrent();
-
371 if (!d->glcx->initialized())
never evaluated: !d->glcx->initialized()
0
372 glInit();
never executed: glInit();
0
373 const qreal scaleFactor = (window() && window()->windowHandle()) ?
never evaluated: window()
never evaluated: window()->windowHandle()
0
374 window()->windowHandle()->devicePixelRatio() : 1.0;
never executed (the execution status of this line is deduced): window()->windowHandle()->devicePixelRatio() : 1.0;
-
375 -
376 resizeGL(width() * scaleFactor, height() * scaleFactor);
never executed (the execution status of this line is deduced): resizeGL(width() * scaleFactor, height() * scaleFactor);
-
377}
never executed: }
0
378 -
379 -
380const QGLContext* QGLWidget::overlayContext() const -
381{ -
382 return 0;
never executed: return 0;
0
383} -
384 -
385void QGLWidget::makeOverlayCurrent() -
386{ -
387} -
388 -
389 -
390void QGLWidget::updateOverlayGL() -
391{ -
392} -
393 -
394const QGLColormap & QGLWidget::colormap() const -
395{ -
396 Q_D(const QGLWidget);
never executed (the execution status of this line is deduced): const QGLWidgetPrivate * const d = d_func();
-
397 return d->cmap;
never executed: return d->cmap;
0
398} -
399 -
400void QGLWidget::setColormap(const QGLColormap & c) -
401{ -
402 Q_UNUSED(c);
never executed (the execution status of this line is deduced): (void)c;;
-
403}
never executed: }
0
404 -
405QGLContext::QGLContext(QOpenGLContext *context) -
406 : d_ptr(new QGLContextPrivate(this)) -
407{ -
408 Q_D(QGLContext);
never executed (the execution status of this line is deduced): QGLContextPrivate * const d = d_func();
-
409 d->init(0, QGLFormat::fromSurfaceFormat(context->format()));
never executed (the execution status of this line is deduced): d->init(0, QGLFormat::fromSurfaceFormat(context->format()));
-
410 d->guiGlContext = context;
never executed (the execution status of this line is deduced): d->guiGlContext = context;
-
411 d->guiGlContext->setQGLContextHandle(this,qDeleteQGLContext);
never executed (the execution status of this line is deduced): d->guiGlContext->setQGLContextHandle(this,qDeleteQGLContext);
-
412 d->ownContext = false;
never executed (the execution status of this line is deduced): d->ownContext = false;
-
413 d->valid = context->isValid();
never executed (the execution status of this line is deduced): d->valid = context->isValid();
-
414 d->setupSharing();
never executed (the execution status of this line is deduced): d->setupSharing();
-
415}
never executed: }
0
416 -
417QOpenGLContext *QGLContext::contextHandle() const -
418{ -
419 Q_D(const QGLContext);
never executed (the execution status of this line is deduced): const QGLContextPrivate * const d = d_func();
-
420 return d->guiGlContext;
never executed: return d->guiGlContext;
0
421} -
422 -
423/*! -
424 Returns a OpenGL context for the window context specified by the \a context -
425 parameter. -
426*/ -
427QGLContext *QGLContext::fromOpenGLContext(QOpenGLContext *context) -
428{ -
429 if (!context)
never evaluated: !context
0
430 return 0;
never executed: return 0;
0
431 if (context->qGLContextHandle()) {
never evaluated: context->qGLContextHandle()
0
432 return reinterpret_cast<QGLContext *>(context->qGLContextHandle());
never executed: return reinterpret_cast<QGLContext *>(context->qGLContextHandle());
0
433 } -
434 QGLContext *glContext = new QGLContext(context);
never executed (the execution status of this line is deduced): QGLContext *glContext = new QGLContext(context);
-
435 //Don't call create on context. This can cause the platformFormat to be set on the widget, which -
436 //will cause the platformWindow to be recreated. -
437 return glContext;
never executed: return glContext;
0
438} -
439 -
440QT_END_NAMESPACE -
441 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial