OpenCoverage

qgl.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/opengl/qgl.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18class QGLDefaultExtensions-
19{-
20public:-
21 QGLDefaultExtensions() : extensions(0) {-
22 QGLTemporaryContext tempContext;-
23 ((!(QOpenGLContext::currentContext())) ? qt_assert("QOpenGLContext::currentContext()",__FILE__,89) : qt_noop());-
24 QOpenGLExtensions *ext = qgl_extensions();-
25 ((!(ext)) ? qt_assert("ext",__FILE__,91) : qt_noop());-
26 extensions = ext->openGLExtensions();-
27 features = ext->openGLFeatures();-
28 }
never executed: end of block
0
29-
30 QOpenGLFunctions::OpenGLFeatures features;-
31 QOpenGLExtensions::OpenGLExtensions extensions;-
32};-
33-
34namespace { namespace Q_QGS_qtDefaultExtensions { typedef QGLDefaultExtensions Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QGLDefaultExtensions, Q_QGS_qtDefaultExtensions::innerFunction, Q_QGS_qtDefaultExtensions::guard> qtDefaultExtensions;
0
35-
36bool qgl_hasFeature(QOpenGLFunctions::OpenGLFeature feature)-
37{-
38 if (QOpenGLContext::currentContext()
QOpenGLContext...rrentContext()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
39 return
never executed: return QOpenGLContext::currentContext()->functions()->hasOpenGLFeature(feature);
QOpenGLContext::currentContext()->functions()->hasOpenGLFeature(feature);
never executed: return QOpenGLContext::currentContext()->functions()->hasOpenGLFeature(feature);
0
40 return
never executed: return qtDefaultExtensions()->features & feature;
qtDefaultExtensions()->features & feature;
never executed: return qtDefaultExtensions()->features & feature;
0
41}-
42-
43bool qgl_hasExtension(QOpenGLExtensions::OpenGLExtension extension)-
44{-
45 if (QOpenGLContext::currentContext()
QOpenGLContext...rrentContext()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
46 return
never executed: return qgl_extensions()->hasOpenGLExtension(extension);
qgl_extensions()->hasOpenGLExtension(extension);
never executed: return qgl_extensions()->hasOpenGLExtension(extension);
0
47 return
never executed: return qtDefaultExtensions()->extensions & extension;
qtDefaultExtensions()->extensions & extension;
never executed: return qtDefaultExtensions()->extensions & extension;
0
48}-
49-
50QOpenGLExtensions::OpenGLExtensions extensions;-
51-
52-
53-
54-
55-
56-
57QOpenGLExtensions* qgl_extensions()-
58{-
59 if (QOpenGLContext *context = QOpenGLContext::currentContext()
QOpenGLContext...rrentContext()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
)
0-1
60 return
executed 1 time by 1 test: return static_cast<QOpenGLExtensions *>(context->functions());
Executed by:
  • tst_qglfunctions - unknown status
static_cast<QOpenGLExtensions *>(context->functions());
executed 1 time by 1 test: return static_cast<QOpenGLExtensions *>(context->functions());
Executed by:
  • tst_qglfunctions - unknown status
1
61-
62 ((!(false)) ? qt_assert("false",__FILE__,128) : qt_noop());-
63 return
never executed: return 0;
0;
never executed: return 0;
0
64}-
65-
66QOpenGLFunctions *qgl_functions()-
67{-
68 return
executed 1 time by 1 test: return qgl_extensions();
Executed by:
  • tst_qglfunctions - unknown status
qgl_extensions();
executed 1 time by 1 test: return qgl_extensions();
Executed by:
  • tst_qglfunctions - unknown status
1
69}-
70-
71-
72QOpenGLFunctions_1_1 *qgl1_functions()-
73{-
74 QOpenGLFunctions_1_1 *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_1>();-
75 f->initializeOpenGLFunctions();-
76 return
never executed: return f;
f;
never executed: return f;
0
77}-
78-
79-
80struct QGLThreadContext {-
81 ~QGLThreadContext() {-
82 if (context
contextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
83 context->doneCurrent();
never executed: context->doneCurrent();
0
84 }
never executed: end of block
0
85 QGLContext *context;-
86};-
87-
88namespace { namespace Q_QGS_qgl_default_format { typedef QGLFormat Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 3 times by 3 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}
executed 3 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 12 times by 3 tests: return &holder.value;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
&holder.value;
executed 12 times by 3 tests: return &holder.value;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
} } } static QGlobalStatic<QGLFormat, Q_QGS_qgl_default_format::innerFunction, Q_QGS_qgl_default_format::guard> qgl_default_format;
0-12
89-
90class QGLDefaultOverlayFormat: public QGLFormat-
91{-
92public:-
93 inline QGLDefaultOverlayFormat()-
94 {-
95 setOption(QGL::FormatOption(0xffff << 16));-
96 setOption(QGL::DirectRendering);-
97 setPlane(1);-
98 }
never executed: end of block
0
99};-
100namespace { namespace Q_QGS_defaultOverlayFormatInstance { typedef QGLDefaultOverlayFormat Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QGLDefaultOverlayFormat, Q_QGS_defaultOverlayFormatInstance::innerFunction, Q_QGS_defaultOverlayFormatInstance::guard> defaultOverlayFormatInstance;
0
101-
102namespace { namespace Q_QGS_theSignalProxy { typedef QGLSignalProxy Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 3 times by 3 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}
executed 3 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 12 times by 3 tests: return &holder.value;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
&holder.value;
executed 12 times by 3 tests: return &holder.value;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
} } } static QGlobalStatic<QGLSignalProxy, Q_QGS_theSignalProxy::innerFunction, Q_QGS_theSignalProxy::guard> theSignalProxy;
0-12
103QGLSignalProxy *QGLSignalProxy::instance()-
104{-
105 QGLSignalProxy *proxy = theSignalProxy();-
106 if (proxy
proxyDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
&& (static_cast<
(static_cast<Q...::instance()))Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
QApplication *>(QCoreApplication::instance()))
(static_cast<Q...::instance()))Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
&& proxy->thread() != (static_cast<QApplication *>(QCoreApplication::instance()))->thread()
proxy->thread(...()))->thread()Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
107 if (proxy->thread() == QThread::currentThread()
proxy->thread(...urrentThread()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
108 proxy->moveToThread((static_cast<QApplication *>(QCoreApplication::instance()))->thread());
never executed: proxy->moveToThread((static_cast<QApplication *>(QCoreApplication::instance()))->thread());
0
109 }
never executed: end of block
0
110 return
executed 12 times by 3 tests: return proxy;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
proxy;
executed 12 times by 3 tests: return proxy;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
111}-
112static inline void transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4])-
113{-
114-
115 out[0] =-
116 m[0*4+0] * in[0] + m[1*4+0] * in[1] + m[2*4+0] * in[2] + m[3*4+0] * in[3];-
117 out[1] =-
118 m[0*4+1] * in[0] + m[1*4+1] * in[1] + m[2*4+1] * in[2] + m[3*4+1] * in[3];-
119 out[2] =-
120 m[0*4+2] * in[0] + m[1*4+2] * in[1] + m[2*4+2] * in[2] + m[3*4+2] * in[3];-
121 out[3] =-
122 m[0*4+3] * in[0] + m[1*4+3] * in[1] + m[2*4+3] * in[2] + m[3*4+3] * in[3];-
123-
124}
never executed: end of block
0
125-
126static inline GLint qgluProject(GLdouble objx, GLdouble objy, GLdouble objz,-
127 const GLdouble model[16], const GLdouble proj[16],-
128 const GLint viewport[4],-
129 GLdouble * winx, GLdouble * winy, GLdouble * winz)-
130{-
131 GLdouble in[4], out[4];-
132-
133 in[0] = objx;-
134 in[1] = objy;-
135 in[2] = objz;-
136 in[3] = 1.0;-
137 transform_point(out, model, in);-
138 transform_point(in, proj, out);-
139-
140 if (in[3] == 0.0
in[3] == 0.0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
141 return
never executed: return 0;
0;
never executed: return 0;
0
142-
143 in[0] /= in[3];-
144 in[1] /= in[3];-
145 in[2] /= in[3];-
146-
147 *winx = viewport[0] + (1 + in[0]) * viewport[2] / 2;-
148 *winy = viewport[1] + (1 + in[1]) * viewport[3] / 2;-
149-
150 *winz = (1 + in[2]) / 2;-
151 return
never executed: return 1;
1;
never executed: return 1;
0
152}-
153QGLFormat::QGLFormat()-
154{-
155 d = new QGLFormatPrivate;-
156}
executed 39 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
39
157QGLFormat::QGLFormat(QGL::FormatOptions options, int plane)-
158{-
159 d = new QGLFormatPrivate;-
160 QGL::FormatOptions newOpts = options;-
161 d->opts = defaultFormat().d->opts;-
162 d->opts |= (newOpts & 0xffff);-
163 d->opts &= ~(newOpts >> 16);-
164 d->pln = plane;-
165}
never executed: end of block
0
166-
167-
168-
169-
170void QGLFormat::detach()-
171{-
172 if (d->ref.load() != 1
d->ref.load() != 1Description
TRUEnever evaluated
FALSEevaluated 180 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-180
173 QGLFormatPrivate *newd = new QGLFormatPrivate(d);-
174 if (!d->ref.deref()
!d->ref.deref()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
175 delete d;
never executed: delete d;
0
176 d = newd;-
177 }
never executed: end of block
0
178}
executed 180 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
180
179-
180-
181-
182-
183-
184QGLFormat::QGLFormat(const QGLFormat &other)-
185{-
186 d = other.d;-
187 d->ref.ref();-
188}
executed 24 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
24
189-
190-
191-
192-
193-
194QGLFormat &QGLFormat::operator=(const QGLFormat &other)-
195{-
196 if (d != other.d
d != other.dDescription
TRUEevaluated 36 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) {
0-36
197 other.d->ref.ref();-
198 if (!d->ref.deref()
!d->ref.deref()Description
TRUEevaluated 24 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
12-24
199 delete d;
executed 24 times by 3 tests: delete d;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
24
200 d = other.d;-
201 }
executed 36 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
36
202 return
executed 36 times by 3 tests: return *this;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
*this;
executed 36 times by 3 tests: return *this;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
36
203}-
204-
205-
206-
207-
208QGLFormat::~QGLFormat()-
209{-
210 if (!d->ref.deref()
!d->ref.deref()Description
TRUEevaluated 15 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEevaluated 48 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
15-48
211 delete d;
executed 15 times by 3 tests: delete d;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
15
212}
executed 63 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
63
213-
214-
215-
216-
217QGLFormat QGLFormat::fromSurfaceFormat(const QSurfaceFormat &format)-
218{-
219 QGLFormat retFormat;-
220 if (format.alphaBufferSize() >= 0
format.alphaBufferSize() >= 0Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
221 retFormat.setAlphaBufferSize(format.alphaBufferSize());
executed 12 times by 3 tests: retFormat.setAlphaBufferSize(format.alphaBufferSize());
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
222 if (format.blueBufferSize() >= 0
format.blueBufferSize() >= 0Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
223 retFormat.setBlueBufferSize(format.blueBufferSize());
executed 12 times by 3 tests: retFormat.setBlueBufferSize(format.blueBufferSize());
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
224 if (format.greenBufferSize() >= 0
format.greenBufferSize() >= 0Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
225 retFormat.setGreenBufferSize(format.greenBufferSize());
executed 12 times by 3 tests: retFormat.setGreenBufferSize(format.greenBufferSize());
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
226 if (format.redBufferSize() >= 0
format.redBufferSize() >= 0Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
227 retFormat.setRedBufferSize(format.redBufferSize());
executed 12 times by 3 tests: retFormat.setRedBufferSize(format.redBufferSize());
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
228 if (format.depthBufferSize() >= 0
format.depthBufferSize() >= 0Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
229 retFormat.setDepthBufferSize(format.depthBufferSize());
executed 12 times by 3 tests: retFormat.setDepthBufferSize(format.depthBufferSize());
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
230 if (format.samples() > 1
format.samples() > 1Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
231 retFormat.setSampleBuffers(true);-
232 retFormat.setSamples(format.samples());-
233 }
never executed: end of block
0
234 if (format.stencilBufferSize() > 0
format.stencilBufferSize() > 0Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) {
0-12
235 retFormat.setStencil(true);-
236 retFormat.setStencilBufferSize(format.stencilBufferSize());-
237 }
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
238 retFormat.setSwapInterval(format.swapInterval());-
239 retFormat.setDoubleBuffer(format.swapBehavior() != QSurfaceFormat::SingleBuffer);-
240 retFormat.setStereo(format.stereo());-
241 retFormat.setVersion(format.majorVersion(), format.minorVersion());-
242 retFormat.setProfile(static_cast<QGLFormat::OpenGLContextProfile>(format.profile()));-
243 return
executed 12 times by 3 tests: return retFormat;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
retFormat;
executed 12 times by 3 tests: return retFormat;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
244}-
245-
246-
247-
248-
249QSurfaceFormat QGLFormat::toSurfaceFormat(const QGLFormat &format)-
250{-
251 QSurfaceFormat retFormat;-
252 if (format.alpha()
format.alpha()Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
253 retFormat.setAlphaBufferSize(format.alphaBufferSize() == -1 ? 1 : format.alphaBufferSize());
never executed: retFormat.setAlphaBufferSize(format.alphaBufferSize() == -1 ? 1 : format.alphaBufferSize());
0
254 if (format.blueBufferSize() >= 0
format.blueBufferSize() >= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
255 retFormat.setBlueBufferSize(format.blueBufferSize());
never executed: retFormat.setBlueBufferSize(format.blueBufferSize());
0
256 if (format.greenBufferSize() >= 0
format.greenBufferSize() >= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
257 retFormat.setGreenBufferSize(format.greenBufferSize());
never executed: retFormat.setGreenBufferSize(format.greenBufferSize());
0
258 if (format.redBufferSize() >= 0
format.redBufferSize() >= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
259 retFormat.setRedBufferSize(format.redBufferSize());
never executed: retFormat.setRedBufferSize(format.redBufferSize());
0
260 if (format.depth()
format.depth()Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
261 retFormat.setDepthBufferSize(format.depthBufferSize() == -1 ? 1 : format.depthBufferSize());
executed 12 times by 3 tests: retFormat.setDepthBufferSize(format.depthBufferSize() == -1 ? 1 : format.depthBufferSize());
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
262 retFormat.setSwapBehavior(format.doubleBuffer() ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::SingleBuffer);-
263 if (format.sampleBuffers()
format.sampleBuffers()Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
264 retFormat.setSamples(format.samples() == -1 ? 4 : format.samples());
never executed: retFormat.setSamples(format.samples() == -1 ? 4 : format.samples());
0
265 if (format.stencil()
format.stencil()Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
266 retFormat.setStencilBufferSize(format.stencilBufferSize() == -1 ? 1 : format.stencilBufferSize());
executed 12 times by 3 tests: retFormat.setStencilBufferSize(format.stencilBufferSize() == -1 ? 1 : format.stencilBufferSize());
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
267 retFormat.setSwapInterval(format.swapInterval());-
268 retFormat.setStereo(format.stereo());-
269 retFormat.setMajorVersion(format.majorVersion());-
270 retFormat.setMinorVersion(format.minorVersion());-
271 retFormat.setProfile(static_cast<QSurfaceFormat::OpenGLContextProfile>(format.profile()));-
272-
273-
274-
275 if (format.profile() == QGLFormat::CompatibilityProfile
format.profile...ibilityProfileDescription
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
276 retFormat.setOption(QSurfaceFormat::DeprecatedFunctions);
never executed: retFormat.setOption(QSurfaceFormat::DeprecatedFunctions);
0
277 return
executed 12 times by 3 tests: return retFormat;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
retFormat;
executed 12 times by 3 tests: return retFormat;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
278}-
279-
280void QGLContextPrivate::setupSharing() {-
281 QGLContext * const q = q_func();-
282 QOpenGLContext *sharedContext = guiGlContext->shareContext();-
283 if (sharedContext
sharedContextDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglbuffer - unknown status
FALSEevaluated 11 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
1-11
284 QGLContext *actualSharedContext = QGLContext::fromOpenGLContext(sharedContext);-
285 sharing = true;-
286 QGLContextGroup::addShare(q, actualSharedContext);-
287 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_qglbuffer - unknown status
1
288}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
289-
290void QGLContextPrivate::refreshCurrentFbo()-
291{-
292 QOpenGLContextPrivate *guiGlContextPrivate =-
293 guiGlContext
guiGlContextDescription
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEnever evaluated
? QOpenGLContextPrivate::get(guiGlContext) : 0;
0-48
294-
295-
296 if (guiGlContextPrivate
guiGlContextPrivateDescription
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEnever evaluated
&& guiGlContextPrivate->qgl_current_fbo_invalid
guiGlContextPr...nt_fbo_invalidDescription
TRUEnever evaluated
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
) {
0-48
297 GLint current;-
298 QOpenGLFunctions *funcs = qgl_functions();-
299 funcs->glGetIntegerv(0x8CA6, &current);-
300-
301 current_fbo = current;-
302-
303 guiGlContextPrivate->qgl_current_fbo_invalid = false;-
304 }
never executed: end of block
0
305}
executed 48 times by 1 test: end of block
Executed by:
  • tst_qmdiarea - unknown status
48
306-
307void QGLContextPrivate::setCurrentFbo(GLuint fbo)-
308{-
309 current_fbo = fbo;-
310-
311 QOpenGLContextPrivate *guiGlContextPrivate =-
312 guiGlContext
guiGlContextDescription
TRUEnever evaluated
FALSEnever evaluated
? QOpenGLContextPrivate::get(guiGlContext) : 0;
0
313-
314 if (guiGlContextPrivate
guiGlContextPrivateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
315 guiGlContextPrivate->qgl_current_fbo_invalid = false;
never executed: guiGlContextPrivate->qgl_current_fbo_invalid = false;
0
316}
never executed: end of block
0
317void QGLFormat::setDoubleBuffer(bool enable)-
318{-
319 setOption(enable ? QGL::DoubleBuffer : QGL::SingleBuffer);-
320}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
321void QGLFormat::setDepth(bool enable)-
322{-
323 setOption(enable ? QGL::DepthBuffer : QGL::NoDepthBuffer);-
324}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
325void QGLFormat::setRgba(bool enable)-
326{-
327 setOption(enable ? QGL::Rgba : QGL::ColorIndex);-
328}
never executed: end of block
0
329void QGLFormat::setAlpha(bool enable)-
330{-
331 setOption(enable ? QGL::AlphaChannel : QGL::NoAlphaChannel);-
332}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
333void QGLFormat::setAccum(bool enable)-
334{-
335 setOption(enable ? QGL::AccumBuffer : QGL::NoAccumBuffer);-
336}
never executed: end of block
0
337void QGLFormat::setStencil(bool enable)-
338{-
339 setOption(enable ? QGL::StencilBuffer: QGL::NoStencilBuffer);-
340}
executed 24 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
24
341void QGLFormat::setStereo(bool enable)-
342{-
343 setOption(enable ? QGL::StereoBuffers : QGL::NoStereoBuffers);-
344}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
345void QGLFormat::setDirectRendering(bool enable)-
346{-
347 setOption(enable ? QGL::DirectRendering : QGL::IndirectRendering);-
348}
never executed: end of block
0
349void QGLFormat::setSampleBuffers(bool enable)-
350{-
351 setOption(enable ? QGL::SampleBuffers : QGL::NoSampleBuffers);-
352}
never executed: end of block
0
353int QGLFormat::samples() const-
354{-
355 return
never executed: return d->numSamples;
d->numSamples;
never executed: return d->numSamples;
0
356}-
357void QGLFormat::setSamples(int numSamples)-
358{-
359 detach();-
360 if (numSamples < 0
numSamples < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
361 QMessageLogger(__FILE__, 826, __PRETTY_FUNCTION__).warning("QGLFormat::setSamples: Cannot have negative number of samples per pixel %d", numSamples);-
362 return;
never executed: return;
0
363 }-
364 d->numSamples = numSamples;-
365 setSampleBuffers(numSamples > 0);-
366}
never executed: end of block
0
367void QGLFormat::setSwapInterval(int interval)-
368{-
369 detach();-
370 d->swapInterval = interval;-
371}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
372-
373-
374-
375-
376-
377-
378-
379int QGLFormat::swapInterval() const-
380{-
381 return
executed 12 times by 3 tests: return d->swapInterval;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->swapInterval;
executed 12 times by 3 tests: return d->swapInterval;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
382}-
383void QGLFormat::setOverlay(bool enable)-
384{-
385 setOption(enable ? QGL::HasOverlay : QGL::NoOverlay);-
386}
never executed: end of block
0
387int QGLFormat::plane() const-
388{-
389 return
never executed: return d->pln;
d->pln;
never executed: return d->pln;
0
390}-
391void QGLFormat::setPlane(int plane)-
392{-
393 detach();-
394 d->pln = plane;-
395}
never executed: end of block
0
396-
397-
398-
399-
400-
401-
402-
403void QGLFormat::setOption(QGL::FormatOptions opt)-
404{-
405 detach();-
406 if (opt & 0xffff
opt & 0xffffDescription
TRUEevaluated 48 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
24-48
407 d->opts |= opt;
executed 48 times by 3 tests: d->opts |= opt;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
48
408 else-
409 d->opts &= ~(opt >> 16);
executed 24 times by 3 tests: d->opts &= ~(opt >> 16);
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
24
410}-
411bool QGLFormat::testOption(QGL::FormatOptions opt) const-
412{-
413 if (opt & 0xffff
opt & 0xffffDescription
TRUEevaluated 84 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-84
414 return
executed 84 times by 3 tests: return (d->opts & opt) != 0;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
(d->opts & opt) != 0;
executed 84 times by 3 tests: return (d->opts & opt) != 0;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
84
415 else-
416 return
never executed: return (d->opts & (opt >> 16)) == 0;
(d->opts & (opt >> 16)) == 0;
never executed: return (d->opts & (opt >> 16)) == 0;
0
417}-
418-
419-
420-
421-
422-
423-
424void QGLFormat::setDepthBufferSize(int size)-
425{-
426 detach();-
427 if (size < 0
size < 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
428 QMessageLogger(__FILE__, 965, __PRETTY_FUNCTION__).warning("QGLFormat::setDepthBufferSize: Cannot set negative depth buffer size %d", size);-
429 return;
never executed: return;
0
430 }-
431 d->depthSize = size;-
432 setDepth(size > 0);-
433}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
434-
435-
436-
437-
438-
439-
440int QGLFormat::depthBufferSize() const-
441{-
442 return
executed 12 times by 3 tests: return d->depthSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->depthSize;
executed 12 times by 3 tests: return d->depthSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
443}-
444void QGLFormat::setRedBufferSize(int size)-
445{-
446 detach();-
447 if (size < 0
size < 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
448 QMessageLogger(__FILE__, 993, __PRETTY_FUNCTION__).warning("QGLFormat::setRedBufferSize: Cannot set negative red buffer size %d", size);-
449 return;
never executed: return;
0
450 }-
451 d->redSize = size;-
452}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
453int QGLFormat::redBufferSize() const-
454{-
455 return
executed 12 times by 3 tests: return d->redSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->redSize;
executed 12 times by 3 tests: return d->redSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
456}-
457void QGLFormat::setGreenBufferSize(int size)-
458{-
459 detach();-
460 if (size < 0
size < 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
461 QMessageLogger(__FILE__, 1022, __PRETTY_FUNCTION__).warning("QGLFormat::setGreenBufferSize: Cannot set negative green buffer size %d", size);-
462 return;
never executed: return;
0
463 }-
464 d->greenSize = size;-
465}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
466int QGLFormat::greenBufferSize() const-
467{-
468 return
executed 12 times by 3 tests: return d->greenSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->greenSize;
executed 12 times by 3 tests: return d->greenSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
469}-
470void QGLFormat::setBlueBufferSize(int size)-
471{-
472 detach();-
473 if (size < 0
size < 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
474 QMessageLogger(__FILE__, 1051, __PRETTY_FUNCTION__).warning("QGLFormat::setBlueBufferSize: Cannot set negative blue buffer size %d", size);-
475 return;
never executed: return;
0
476 }-
477 d->blueSize = size;-
478}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
479int QGLFormat::blueBufferSize() const-
480{-
481 return
executed 12 times by 3 tests: return d->blueSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->blueSize;
executed 12 times by 3 tests: return d->blueSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
482}-
483-
484-
485-
486-
487-
488-
489-
490void QGLFormat::setAlphaBufferSize(int size)-
491{-
492 detach();-
493 if (size < 0
size < 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
494 QMessageLogger(__FILE__, 1079, __PRETTY_FUNCTION__).warning("QGLFormat::setAlphaBufferSize: Cannot set negative alpha buffer size %d", size);-
495 return;
never executed: return;
0
496 }-
497 d->alphaSize = size;-
498 setAlpha(size > 0);-
499}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
500-
501-
502-
503-
504-
505-
506int QGLFormat::alphaBufferSize() const-
507{-
508 return
never executed: return d->alphaSize;
d->alphaSize;
never executed: return d->alphaSize;
0
509}-
510-
511-
512-
513-
514-
515-
516-
517void QGLFormat::setAccumBufferSize(int size)-
518{-
519 detach();-
520 if (size < 0
size < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
521 QMessageLogger(__FILE__, 1106, __PRETTY_FUNCTION__).warning("QGLFormat::setAccumBufferSize: Cannot set negative accumulate buffer size %d", size);-
522 return;
never executed: return;
0
523 }-
524 d->accumSize = size;-
525 setAccum(size > 0);-
526}
never executed: end of block
0
527-
528-
529-
530-
531-
532-
533int QGLFormat::accumBufferSize() const-
534{-
535 return
never executed: return d->accumSize;
d->accumSize;
never executed: return d->accumSize;
0
536}-
537-
538-
539-
540-
541-
542-
543void QGLFormat::setStencilBufferSize(int size)-
544{-
545 detach();-
546 if (size < 0
size < 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
547 QMessageLogger(__FILE__, 1132, __PRETTY_FUNCTION__).warning("QGLFormat::setStencilBufferSize: Cannot set negative stencil buffer size %d", size);-
548 return;
never executed: return;
0
549 }-
550 d->stencilSize = size;-
551 setStencil(size > 0);-
552}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
553-
554-
555-
556-
557-
558-
559int QGLFormat::stencilBufferSize() const-
560{-
561 return
executed 12 times by 3 tests: return d->stencilSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->stencilSize;
executed 12 times by 3 tests: return d->stencilSize;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
562}-
563void QGLFormat::setVersion(int major, int minor)-
564{-
565 if (major < 1
major < 1Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
|| minor < 0
minor < 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
566 QMessageLogger(__FILE__, 1161, __PRETTY_FUNCTION__).warning("QGLFormat::setVersion: Cannot set zero or negative version number %d.%d", major, minor);-
567 return;
never executed: return;
0
568 }-
569 detach();-
570 d->majorVersion = major;-
571 d->minorVersion = minor;-
572}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
573int QGLFormat::majorVersion() const-
574{-
575 return
executed 12 times by 3 tests: return d->majorVersion;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->majorVersion;
executed 12 times by 3 tests: return d->majorVersion;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
576}-
577int QGLFormat::minorVersion() const-
578{-
579 return
executed 12 times by 3 tests: return d->minorVersion;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->minorVersion;
executed 12 times by 3 tests: return d->minorVersion;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
580}-
581void QGLFormat::setProfile(OpenGLContextProfile profile)-
582{-
583 detach();-
584 d->profile = profile;-
585}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
586QGLFormat::OpenGLContextProfile QGLFormat::profile() const-
587{-
588 return
executed 24 times by 3 tests: return d->profile;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->profile;
executed 24 times by 3 tests: return d->profile;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
24
589}-
590bool QGLFormat::hasOpenGL()-
591{-
592 return
executed 1 time by 1 test: return QApplicationPrivate::platformIntegration() ->hasCapability(QPlatformIntegration::OpenGL);
Executed by:
  • tst_qmdiarea - unknown status
QApplicationPrivate::platformIntegration()
executed 1 time by 1 test: return QApplicationPrivate::platformIntegration() ->hasCapability(QPlatformIntegration::OpenGL);
Executed by:
  • tst_qmdiarea - unknown status
1
593 ->hasCapability(QPlatformIntegration::OpenGL);
executed 1 time by 1 test: return QApplicationPrivate::platformIntegration() ->hasCapability(QPlatformIntegration::OpenGL);
Executed by:
  • tst_qmdiarea - unknown status
1
594}-
595bool QGLFormat::hasOpenGLOverlays()-
596{-
597 return
never executed: return false;
false;
never executed: return false;
0
598}-
599-
600QGLFormat::OpenGLVersionFlags __attribute__((visibility("default"))) qOpenGLVersionFlagsFromString(const QString &versionString)-
601{-
602 QGLFormat::OpenGLVersionFlags versionFlags = QGLFormat::OpenGL_Version_None;-
603-
604 if (versionString.startsWith(QLatin1String("OpenGL ES"))
versionString....("OpenGL ES"))Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
) {
0-1
605 const auto parts = versionString.splitRef(QLatin1Char(' '));-
606 if (parts.size() >= 3
parts.size() >= 3Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
607 if (parts[2].startsWith(QLatin1String("1."))
parts[2].start...1String("1."))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
608 if (parts[1].endsWith(QLatin1String("-CM"))
parts[1].endsW...String("-CM"))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
609 versionFlags |= QGLFormat::OpenGL_ES_Common_Version_1_0 |-
610 QGLFormat::OpenGL_ES_CommonLite_Version_1_0;-
611 if (parts[2].startsWith(QLatin1String("1.1"))
parts[2].start...String("1.1"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
612 versionFlags |= QGLFormat::OpenGL_ES_Common_Version_1_1 |
never executed: versionFlags |= QGLFormat::OpenGL_ES_Common_Version_1_1 | QGLFormat::OpenGL_ES_CommonLite_Version_1_1;
0
613 QGLFormat::OpenGL_ES_CommonLite_Version_1_1;
never executed: versionFlags |= QGLFormat::OpenGL_ES_Common_Version_1_1 | QGLFormat::OpenGL_ES_CommonLite_Version_1_1;
0
614 }
never executed: end of block
else {
0
615-
616 versionFlags |= QGLFormat::OpenGL_ES_CommonLite_Version_1_0;-
617 if (parts[2].startsWith(QLatin1String("1.1"))
parts[2].start...String("1.1"))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
618 versionFlags |= QGLFormat::OpenGL_ES_CommonLite_Version_1_1;
never executed: versionFlags |= QGLFormat::OpenGL_ES_CommonLite_Version_1_1;
0
619 }
never executed: end of block
0
620 } else {-
621-
622 versionFlags |= QGLFormat::OpenGL_ES_Version_2_0;-
623 }
never executed: end of block
0
624 } else {-
625-
626 QMessageLogger(__FILE__, 1288, __PRETTY_FUNCTION__).warning("Unrecognised OpenGL ES version");-
627 }
never executed: end of block
0
628 } else {-
629-
630 if (versionString.startsWith(QLatin1String("1."))
versionString....1String("1."))Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
) {
0-1
631 switch (versionString[2].toLatin1()) {-
632 case
never executed: case '5':
'5':
never executed: case '5':
0
633 versionFlags |= QGLFormat::OpenGL_Version_1_5;-
634-
635 case
never executed: case '4':
'4':
never executed: case '4':
code before this statement never executed: case '4':
0
636 versionFlags |= QGLFormat::OpenGL_Version_1_4;-
637-
638 case
never executed: case '3':
'3':
never executed: case '3':
code before this statement never executed: case '3':
0
639 versionFlags |= QGLFormat::OpenGL_Version_1_3;-
640-
641 case
never executed: case '2':
'2':
never executed: case '2':
code before this statement never executed: case '2':
0
642 versionFlags |= QGLFormat::OpenGL_Version_1_2;-
643-
644 case
never executed: case '1':
'1':
never executed: case '1':
code before this statement never executed: case '1':
0
645 versionFlags |= QGLFormat::OpenGL_Version_1_1;-
646-
647 default
never executed: default:
:
never executed: default:
code before this statement never executed: default:
0
648 break;
never executed: break;
0
649 }-
650 } else if (versionString.startsWith(QLatin1String("2."))
versionString....1String("2."))Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
) {
0-1
651 versionFlags |= QGLFormat::OpenGL_Version_1_1 |-
652 QGLFormat::OpenGL_Version_1_2 |-
653 QGLFormat::OpenGL_Version_1_3 |-
654 QGLFormat::OpenGL_Version_1_4 |-
655 QGLFormat::OpenGL_Version_1_5 |-
656 QGLFormat::OpenGL_Version_2_0;-
657 if (versionString[2].toLatin1() == '1'
versionString[...atin1() == '1'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
658 versionFlags |= QGLFormat::OpenGL_Version_2_1;
never executed: versionFlags |= QGLFormat::OpenGL_Version_2_1;
0
659 }
never executed: end of block
else if (versionString.startsWith(QLatin1String("3."))
versionString....1String("3."))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
) {
0-1
660 versionFlags |= QGLFormat::OpenGL_Version_1_1 |-
661 QGLFormat::OpenGL_Version_1_2 |-
662 QGLFormat::OpenGL_Version_1_3 |-
663 QGLFormat::OpenGL_Version_1_4 |-
664 QGLFormat::OpenGL_Version_1_5 |-
665 QGLFormat::OpenGL_Version_2_0 |-
666 QGLFormat::OpenGL_Version_2_1 |-
667 QGLFormat::OpenGL_Version_3_0;-
668 switch (versionString[2].toLatin1()) {-
669 case
never executed: case '3':
'3':
never executed: case '3':
0
670 versionFlags |= QGLFormat::OpenGL_Version_3_3;-
671-
672 case
never executed: case '2':
'2':
never executed: case '2':
code before this statement never executed: case '2':
0
673 versionFlags |= QGLFormat::OpenGL_Version_3_2;-
674-
675 case
never executed: case '1':
'1':
never executed: case '1':
code before this statement never executed: case '1':
0
676 versionFlags |= QGLFormat::OpenGL_Version_3_1;-
677-
678 case
executed 1 time by 1 test: case '0':
Executed by:
  • tst_qglfunctions - unknown status
code before this statement never executed: case '0':
executed 1 time by 1 test: case '0':
Executed by:
  • tst_qglfunctions - unknown status
'0':
code before this statement never executed: case '0':
executed 1 time by 1 test: case '0':
Executed by:
  • tst_qglfunctions - unknown status
0-1
679 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_qglfunctions - unknown status
1
680 default
never executed: default:
:
never executed: default:
0
681 versionFlags |= QGLFormat::OpenGL_Version_3_1 |-
682 QGLFormat::OpenGL_Version_3_2 |-
683 QGLFormat::OpenGL_Version_3_3;-
684 break;
never executed: break;
0
685 }-
686 } else if (versionString.startsWith(QLatin1String("4."))
versionString....1String("4."))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
687 versionFlags |= QGLFormat::OpenGL_Version_1_1 |-
688 QGLFormat::OpenGL_Version_1_2 |-
689 QGLFormat::OpenGL_Version_1_3 |-
690 QGLFormat::OpenGL_Version_1_4 |-
691 QGLFormat::OpenGL_Version_1_5 |-
692 QGLFormat::OpenGL_Version_2_0 |-
693 QGLFormat::OpenGL_Version_2_1 |-
694 QGLFormat::OpenGL_Version_3_0 |-
695 QGLFormat::OpenGL_Version_3_1 |-
696 QGLFormat::OpenGL_Version_3_2 |-
697 QGLFormat::OpenGL_Version_3_3 |-
698 QGLFormat::OpenGL_Version_4_0;-
699 switch (versionString[2].toLatin1()) {-
700 case
never executed: case '3':
'3':
never executed: case '3':
0
701 versionFlags |= QGLFormat::OpenGL_Version_4_3;-
702-
703 case
never executed: case '2':
'2':
never executed: case '2':
code before this statement never executed: case '2':
0
704 versionFlags |= QGLFormat::OpenGL_Version_4_2;-
705-
706 case
never executed: case '1':
'1':
never executed: case '1':
code before this statement never executed: case '1':
0
707 versionFlags |= QGLFormat::OpenGL_Version_4_1;-
708-
709 case
never executed: case '0':
'0':
never executed: case '0':
code before this statement never executed: case '0':
0
710 break;
never executed: break;
0
711 default
never executed: default:
:
never executed: default:
0
712 versionFlags |= QGLFormat::OpenGL_Version_4_1 |-
713 QGLFormat::OpenGL_Version_4_2 |-
714 QGLFormat::OpenGL_Version_4_3;-
715 break;
never executed: break;
0
716 }-
717 } else {-
718 versionFlags |= QGLFormat::OpenGL_Version_1_1 |-
719 QGLFormat::OpenGL_Version_1_2 |-
720 QGLFormat::OpenGL_Version_1_3 |-
721 QGLFormat::OpenGL_Version_1_4 |-
722 QGLFormat::OpenGL_Version_1_5 |-
723 QGLFormat::OpenGL_Version_2_0 |-
724 QGLFormat::OpenGL_Version_2_1 |-
725 QGLFormat::OpenGL_Version_3_0 |-
726 QGLFormat::OpenGL_Version_3_1 |-
727 QGLFormat::OpenGL_Version_3_2 |-
728 QGLFormat::OpenGL_Version_3_3 |-
729 QGLFormat::OpenGL_Version_4_0 |-
730 QGLFormat::OpenGL_Version_4_1 |-
731 QGLFormat::OpenGL_Version_4_2 |-
732 QGLFormat::OpenGL_Version_4_3;-
733 }
never executed: end of block
0
734 }-
735 return
executed 1 time by 1 test: return versionFlags;
Executed by:
  • tst_qglfunctions - unknown status
versionFlags;
executed 1 time by 1 test: return versionFlags;
Executed by:
  • tst_qglfunctions - unknown status
1
736}-
737QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags()-
738{-
739 static bool cachedDefault = false;-
740 static OpenGLVersionFlags defaultVersionFlags = OpenGL_Version_None;-
741 QGLContext *currentCtx = const_cast<QGLContext *>(QGLContext::currentContext());-
742 QGLTemporaryContext *tmpContext = 0;-
743-
744 if (currentCtx
currentCtxDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
&& currentCtx->d_func()->version_flags_cached
currentCtx->d_...n_flags_cachedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
)
0-2
745 return
executed 1 time by 1 test: return currentCtx->d_func()->version_flags;
Executed by:
  • tst_qglfunctions - unknown status
currentCtx->d_func()->version_flags;
executed 1 time by 1 test: return currentCtx->d_func()->version_flags;
Executed by:
  • tst_qglfunctions - unknown status
1
746-
747 if (!currentCtx
!currentCtxDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
) {
0-1
748 if (cachedDefault
cachedDefaultDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
749 return
never executed: return defaultVersionFlags;
defaultVersionFlags;
never executed: return defaultVersionFlags;
0
750 } else {-
751 if (!hasOpenGL()
!hasOpenGL()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
752 return
never executed: return defaultVersionFlags;
defaultVersionFlags;
never executed: return defaultVersionFlags;
0
753 tmpContext = new QGLTemporaryContext;-
754 cachedDefault = true;-
755 }
never executed: end of block
0
756 }-
757-
758 QString versionString(QLatin1String(reinterpret_cast<const char*>(qgl_functions()->glGetString(0x1F02))));-
759 OpenGLVersionFlags versionFlags = qOpenGLVersionFlagsFromString(versionString);-
760 if (currentCtx
currentCtxDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
FALSEnever evaluated
) {
0-1
761 currentCtx->d_func()->version_flags_cached = true;-
762 currentCtx->d_func()->version_flags = versionFlags;-
763 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_qglfunctions - unknown status
1
764 if (tmpContext
tmpContextDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglfunctions - unknown status
) {
0-1
765 defaultVersionFlags = versionFlags;-
766 delete tmpContext;-
767 }
never executed: end of block
0
768-
769 return
executed 1 time by 1 test: return versionFlags;
Executed by:
  • tst_qglfunctions - unknown status
versionFlags;
executed 1 time by 1 test: return versionFlags;
Executed by:
  • tst_qglfunctions - unknown status
1
770}-
771QGLFormat QGLFormat::defaultFormat()-
772{-
773 return
executed 12 times by 3 tests: return *qgl_default_format();
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
*qgl_default_format();
executed 12 times by 3 tests: return *qgl_default_format();
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
774}-
775void QGLFormat::setDefaultFormat(const QGLFormat &f)-
776{-
777 *qgl_default_format() = f;-
778}
never executed: end of block
0
779QGLFormat QGLFormat::defaultOverlayFormat()-
780{-
781 return
never executed: return *defaultOverlayFormatInstance();
*defaultOverlayFormatInstance();
never executed: return *defaultOverlayFormatInstance();
0
782}-
783void QGLFormat::setDefaultOverlayFormat(const QGLFormat &f)-
784{-
785 QGLFormat *defaultFormat = defaultOverlayFormatInstance();-
786 *defaultFormat = f;-
787-
788-
789-
790 defaultFormat->setOverlay(false);-
791}
never executed: end of block
0
792bool operator==(const QGLFormat& a, const QGLFormat& b)-
793{-
794 return
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
(a.d == b.d) || ((int) a.d->opts == (int) b.d->opts
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
795 && a.d->pln == b.d->pln
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
796 && a.d->alphaSize == b.d->alphaSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
797 && a.d->accumSize == b.d->accumSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
798 && a.d->stencilSize == b.d->stencilSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
799 && a.d->depthSize == b.d->depthSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
800 && a.d->redSize == b.d->redSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
801 && a.d->greenSize == b.d->greenSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
802 && a.d->blueSize == b.d->blueSize
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
803 && a.d->numSamples == b.d->numSamples
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
804 && a.d->swapInterval == b.d->swapInterval
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
805 && a.d->majorVersion == b.d->majorVersion
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
806 && a.d->minorVersion == b.d->minorVersion
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
807 && a.d->profile == b.d->profile);
never executed: return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts && a.d->pln == b.d->pln && a.d->alphaSize == b.d->alphaSize && a.d->accumSize == b.d->accumSize && a.d->stencilSize == b.d->stencilSize && a.d->depthSize == b.d->depthSize && a.d->redSize == b.d->...nSize == b.d->greenSize && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion && a.d->profile == b.d->profile);
0
808}-
809-
810-
811QDebug operator<<(QDebug dbg, const QGLFormat &f)-
812{-
813 const QGLFormatPrivate * const d = f.d;-
814-
815 QDebugStateSaver saver(dbg);-
816 dbg.nospace() << "QGLFormat("-
817 << "options " << d->opts-
818 << ", plane " << d->pln-
819 << ", depthBufferSize " << d->depthSize-
820 << ", accumBufferSize " << d->accumSize-
821 << ", stencilBufferSize " << d->stencilSize-
822 << ", redBufferSize " << d->redSize-
823 << ", greenBufferSize " << d->greenSize-
824 << ", blueBufferSize " << d->blueSize-
825 << ", alphaBufferSize " << d->alphaSize-
826 << ", samples " << d->numSamples-
827 << ", swapInterval " << d->swapInterval-
828 << ", majorVersion " << d->majorVersion-
829 << ", minorVersion " << d->minorVersion-
830 << ", profile " << d->profile-
831 << ')';-
832-
833 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
834}-
835bool operator!=(const QGLFormat& a, const QGLFormat& b)-
836{-
837 return
never executed: return !(a == b);
!(a == b);
never executed: return !(a == b);
0
838}-
839-
840struct QGLContextGroupList {-
841 QGLContextGroupList()-
842 : m_mutex(QMutex::Recursive)-
843 {-
844 }
executed 3 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
3
845-
846 void append(QGLContextGroup *group) {-
847 QMutexLocker locker(&m_mutex);-
848 m_list.append(group);-
849 }
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
850-
851 void remove(QGLContextGroup *group) {-
852 QMutexLocker locker(&m_mutex);-
853 m_list.removeOne(group);-
854 }
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
855-
856 QList<QGLContextGroup *> m_list;-
857 QMutex m_mutex;-
858};-
859-
860namespace { namespace Q_QGS_qt_context_groups { typedef QGLContextGroupList Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 3 times by 3 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}
executed 3 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 24 times by 3 tests: return &holder.value;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
&holder.value;
executed 24 times by 3 tests: return &holder.value;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
} } } static QGlobalStatic<QGLContextGroupList, Q_QGS_qt_context_groups::innerFunction, Q_QGS_qt_context_groups::guard> qt_context_groups;
0-24
861-
862-
863-
864-
865-
866QGLContextGroup::QGLContextGroup(const QGLContext *context)-
867 : m_context(context), m_refs(1)-
868{-
869 qt_context_groups()->append(this);-
870}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
871-
872QGLContextGroup::~QGLContextGroup()-
873{-
874 qt_context_groups()->remove(this);-
875}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
876-
877const QGLContext *qt_gl_transfer_context(const QGLContext *ctx)-
878{-
879 if (!ctx
!ctxDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
880 return
never executed: return 0;
0;
never executed: return 0;
0
881 QList<const QGLContext *> shares-
882 (QGLContextPrivate::contextGroup(ctx)->shares());-
883 if (shares.size() >= 2
shares.size() >= 2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
884 return
never executed: return (ctx == shares.at(0)) ? shares.at(1) : shares.at(0);
(ctx == shares.at(0)) ? shares.at(1) : shares.at(0);
never executed: return (ctx == shares.at(0)) ? shares.at(1) : shares.at(0);
0
885 else-
886 return
never executed: return 0;
0;
never executed: return 0;
0
887}-
888-
889QGLContextPrivate::QGLContextPrivate(QGLContext *context)-
890 : internal_context(false)-
891 , q_ptr(context)-
892 , texture_destroyer(0)-
893 , functions(0)-
894{-
895 group = new QGLContextGroup(context);-
896-
897 texture_destroyer = new QGLTextureDestroyer;-
898}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
899-
900QGLContextPrivate::~QGLContextPrivate()-
901{-
902 delete functions;-
903-
904 if (!group->m_refs.deref()
!group->m_refs.deref()Description
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglbuffer - unknown status
) {
1-11
905 ((!(group->context() == q_ptr)) ? qt_assert("group->context() == q_ptr",__FILE__,1735) : qt_noop());-
906 delete group;-
907 }
executed 11 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
11
908-
909 delete texture_destroyer;-
910}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
911-
912void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)-
913{-
914 QGLContext * const q = q_func();-
915 glFormat = reqFormat = format;-
916 valid = false;-
917 q->setDevice(dev);-
918-
919 guiGlContext = 0;-
920 ownContext = false;-
921 fbo = 0;-
922 crWin = false;-
923 initDone = false;-
924 sharing = false;-
925 max_texture_size = -1;-
926 version_flags_cached = false;-
927 version_flags = QGLFormat::OpenGL_Version_None;-
928 current_fbo = 0;-
929 default_fbo = 0;-
930 active_engine = 0;-
931 workaround_needsFullClearOnEveryFrame = false;-
932 workaround_brokenFBOReadBack = false;-
933 workaround_brokenTexSubImage = false;-
934 workaroundsCached = false;-
935-
936 workaround_brokenTextureFromPixmap = false;-
937 workaround_brokenTextureFromPixmap_init = false;-
938-
939 workaround_brokenAlphaTexSubImage = false;-
940 workaround_brokenAlphaTexSubImage_init = false;-
941-
942 for (int i = 0; i < 3
i < 3Description
TRUEevaluated 36 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
; ++i)
12-36
943 vertexAttributeArraysEnabledState[i] = false;
executed 36 times by 3 tests: vertexAttributeArraysEnabledState[i] = false;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
36
944}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
945-
946QGLContext* QGLContext::currentCtx = 0;-
947-
948-
949-
950-
951class QGLTemporaryContextPrivate-
952{-
953public:-
954 QWindow *window;-
955 QOpenGLContext *context;-
956-
957 QGLContext *oldContext;-
958};-
959-
960QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)-
961 : d(new QGLTemporaryContextPrivate)-
962{-
963 d->oldContext = const_cast<QGLContext *>(QGLContext::currentContext());-
964-
965 d->window = new QWindow;-
966 d->window->setSurfaceType(QWindow::OpenGLSurface);-
967 d->window->setGeometry(QRect(0, 0, 3, 3));-
968 d->window->create();-
969-
970 d->context = new QOpenGLContext;-
971-
972 if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL
QOpenGLContext...Context::LibGLDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
973-
974 QSurfaceFormat format;-
975 format.setMajorVersion(4);-
976 format.setMinorVersion(3);-
977-
978 d->context->setFormat(format);-
979 }
never executed: end of block
0
980-
981 d->context->create();-
982 d->context->makeCurrent(d->window);-
983}
never executed: end of block
0
984-
985QGLTemporaryContext::~QGLTemporaryContext()-
986{-
987 if (d->oldContext
d->oldContextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
988 d->oldContext->makeCurrent();
never executed: d->oldContext->makeCurrent();
0
989-
990 delete d->context;-
991 delete d->window;-
992}
never executed: end of block
0
993-
994-
995-
996-
997-
998-
999-
1000static void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, bool include_alpha)-
1001{-
1002 ((!(!img.isNull())) ? qt_assert("!img.isNull()",__FILE__,1840) : qt_noop());-
1003 if (QSysInfo::ByteOrder == QSysInfo::BigEndian
QSysInfo::Byte...nfo::BigEndianDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1004-
1005 uint *p = (uint*)img.bits();-
1006 uint *end = p + w*h;-
1007 if (alpha_format
alpha_formatDescription
TRUEnever evaluated
FALSEnever evaluated
&& include_alpha
include_alphaDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1008 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1009 uint a = *p << 24;-
1010 *p = (*p >> 8) | a;-
1011 p++;-
1012 }
never executed: end of block
0
1013 }
never executed: end of block
else {
0
1014-
1015-
1016 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1017 *p = 0xff000000 | (*p>>8);-
1018 ++p;-
1019 }
never executed: end of block
0
1020 }
never executed: end of block
0
1021 } else {-
1022-
1023 for (int y = 0; y < h
y < hDescription
TRUEnever evaluated
FALSEnever evaluated
; y++) {
0
1024 uint *q = (uint*)img.scanLine(y);-
1025 for (int x=0; x < w
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
1026 const uint pixel = *q;-
1027 if (alpha_format
alpha_formatDescription
TRUEnever evaluated
FALSEnever evaluated
&& include_alpha
include_alphaDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1028 *q = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff)-
1029 | (pixel & 0xff00ff00);-
1030 }
never executed: end of block
else {
0
1031 *q = 0xff000000 | ((pixel << 16) & 0xff0000)-
1032 | ((pixel >> 16) & 0xff) | (pixel & 0x00ff00);-
1033 }
never executed: end of block
0
1034-
1035 q++;-
1036 }
never executed: end of block
0
1037 }
never executed: end of block
0
1038-
1039 }
never executed: end of block
0
1040 img = img.mirrored();-
1041}
never executed: end of block
0
1042-
1043QImage qt_gl_read_frame_buffer(const QSize &size, bool alpha_format, bool include_alpha)-
1044{-
1045 QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied-
1046 : QImage::Format_RGB32);-
1047 if (img.isNull()
img.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1048 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1049 int w = size.width();-
1050 int h = size.height();-
1051 qgl_functions()->glReadPixels(0, 0, w, h, 0x1908, 0x1401, img.bits());-
1052 convertFromGLImage(img, w, h, alpha_format, include_alpha);-
1053 return
never executed: return img;
img;
never executed: return img;
0
1054}-
1055-
1056QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha)-
1057{-
1058 QImage img(size, alpha_format ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);-
1059 if (img.isNull()
img.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1060 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1061 int w = size.width();-
1062 int h = size.height();-
1063-
1064 if (!QOpenGLContext::currentContext()->isOpenGLES()
!QOpenGLContex...->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1065-
1066 qgl1_functions()->glGetTexImage(0x0DE1, 0, 0x1908, 0x1401, img.bits());-
1067 }
never executed: end of block
0
1068-
1069 convertFromGLImage(img, w, h, alpha_format, include_alpha);-
1070 return
never executed: return img;
img;
never executed: return img;
0
1071}-
1072-
1073namespace { namespace Q_QGS_qt_gl_texture_cache { typedef QGLTextureCache Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 3 times by 3 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}
executed 3 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 12 times by 3 tests: return &holder.value;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
&holder.value;
executed 12 times by 3 tests: return &holder.value;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
} } } static QGlobalStatic<QGLTextureCache, Q_QGS_qt_gl_texture_cache::innerFunction, Q_QGS_qt_gl_texture_cache::guard> qt_gl_texture_cache;
0-12
1074-
1075QGLTextureCache::QGLTextureCache()-
1076 : m_cache(64*1024)-
1077{-
1078 QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(cleanupTexturesForPixampData);-
1079 QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(cleanupBeforePixmapDestruction);-
1080 QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey);-
1081}
executed 3 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
3
1082-
1083QGLTextureCache::~QGLTextureCache()-
1084{-
1085 QImagePixmapCleanupHooks::instance()->removePlatformPixmapModificationHook(cleanupTexturesForPixampData);-
1086 QImagePixmapCleanupHooks::instance()->removePlatformPixmapDestructionHook(cleanupBeforePixmapDestruction);-
1087 QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey);-
1088}
executed 3 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
3
1089-
1090void QGLTextureCache::insert(QGLContext* ctx, qint64 key, QGLTexture* texture, int cost)-
1091{-
1092 QWriteLocker locker(&m_lock);-
1093 const QGLTextureCacheKey cacheKey = {key, QGLContextPrivate::contextGroup(ctx)};-
1094 m_cache.insert(cacheKey, texture, cost);-
1095}
never executed: end of block
0
1096-
1097void QGLTextureCache::remove(qint64 key)-
1098{-
1099 QWriteLocker locker(&m_lock);-
1100 QMutexLocker groupLocker(&qt_context_groups()->m_mutex);-
1101 QList<QGLContextGroup *>::const_iterator it = qt_context_groups()->m_list.constBegin();-
1102 while (it != qt_context_groups()->m_list.constEnd()
it != qt_conte...ist.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1103 const QGLTextureCacheKey cacheKey = {key, *it};-
1104 m_cache.remove(cacheKey);-
1105 ++it;-
1106 }
never executed: end of block
0
1107}
never executed: end of block
0
1108-
1109bool QGLTextureCache::remove(QGLContext* ctx, GLuint textureId)-
1110{-
1111 QWriteLocker locker(&m_lock);-
1112 QList<QGLTextureCacheKey> keys = m_cache.keys();-
1113 for (int i = 0; i < keys.size()
i < keys.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1114 QGLTexture *tex = m_cache.object(keys.at(i));-
1115 if (tex->id == textureId
tex->id == textureIdDescription
TRUEnever evaluated
FALSEnever evaluated
&& tex->context == ctx
tex->context == ctxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1116 tex->options |= QGLContext::MemoryManagedBindOption;-
1117 m_cache.remove(keys.at(i));-
1118 return
never executed: return true;
true;
never executed: return true;
0
1119 }-
1120 }
never executed: end of block
0
1121 return
never executed: return false;
false;
never executed: return false;
0
1122}-
1123-
1124void QGLTextureCache::removeContextTextures(QGLContext* ctx)-
1125{-
1126 QWriteLocker locker(&m_lock);-
1127 QList<QGLTextureCacheKey> keys = m_cache.keys();-
1128 for (int i = 0; i < keys.size()
i < keys.size()Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
; ++i) {
0-12
1129 const QGLTextureCacheKey &key = keys.at(i);-
1130 if (m_cache.object(key)->context == ctx
m_cache.object...context == ctxDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1131 m_cache.remove(key);
never executed: m_cache.remove(key);
0
1132 }
never executed: end of block
0
1133}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
1134-
1135-
1136-
1137-
1138-
1139void QGLTextureCache::cleanupTexturesForCacheKey(qint64 cacheKey)-
1140{-
1141 qt_gl_texture_cache()->remove(cacheKey);-
1142}
never executed: end of block
0
1143-
1144-
1145void QGLTextureCache::cleanupTexturesForPixampData(QPlatformPixmap* pmd)-
1146{-
1147 cleanupTexturesForCacheKey(pmd->cacheKey());-
1148}
never executed: end of block
0
1149-
1150void QGLTextureCache::cleanupBeforePixmapDestruction(QPlatformPixmap* pmd)-
1151{-
1152-
1153 cleanupTexturesForPixampData(pmd);-
1154}
never executed: end of block
0
1155-
1156QGLTextureCache *QGLTextureCache::instance()-
1157{-
1158 return
executed 12 times by 3 tests: return qt_gl_texture_cache();
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
qt_gl_texture_cache();
executed 12 times by 3 tests: return qt_gl_texture_cache();
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
1159}-
1160-
1161-
1162struct DDSFormat {-
1163 quint32 dwSize;-
1164 quint32 dwFlags;-
1165 quint32 dwHeight;-
1166 quint32 dwWidth;-
1167 quint32 dwLinearSize;-
1168 quint32 dummy1;-
1169 quint32 dwMipMapCount;-
1170 quint32 dummy2[11];-
1171 struct {-
1172 quint32 dummy3[2];-
1173 quint32 dwFourCC;-
1174 quint32 dummy4[5];-
1175 } ddsPixelFormat;-
1176};-
1177QGLContext::QGLContext(const QGLFormat &format, QPaintDevice *device)-
1178 : d_ptr(new QGLContextPrivate(this))-
1179{-
1180 QGLContextPrivate * const d = d_func();-
1181 d->init(device, format);-
1182}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
1183QGLContext::QGLContext(const QGLFormat &format)-
1184 : d_ptr(new QGLContextPrivate(this))-
1185{-
1186 QGLContextPrivate * const d = d_func();-
1187 d->init(0, format);-
1188}
never executed: end of block
0
1189-
1190static void qDeleteQGLContext(void *handle)-
1191{-
1192 QGLContext *context = static_cast<QGLContext *>(handle);-
1193 delete context;-
1194}
never executed: end of block
0
1195-
1196QGLContext::QGLContext(QOpenGLContext *context)-
1197 : d_ptr(new QGLContextPrivate(this))-
1198{-
1199 QGLContextPrivate * const d = d_func();-
1200 d->init(0, QGLFormat::fromSurfaceFormat(context->format()));-
1201 d->guiGlContext = context;-
1202 d->guiGlContext->setQGLContextHandle(this, qDeleteQGLContext);-
1203 d->ownContext = false;-
1204 d->valid = context->isValid();-
1205 d->setupSharing();-
1206}
never executed: end of block
0
1207-
1208-
1209-
1210-
1211QOpenGLContext *QGLContext::contextHandle() const-
1212{-
1213 const QGLContextPrivate * const d = d_func();-
1214 return
executed 102 times by 3 tests: return d->guiGlContext;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->guiGlContext;
executed 102 times by 3 tests: return d->guiGlContext;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
102
1215}-
1216-
1217-
1218-
1219-
1220-
1221QGLContext *QGLContext::fromOpenGLContext(QOpenGLContext *context)-
1222{-
1223 if (!context
!contextDescription
TRUEnever evaluated
FALSEevaluated 80 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-80
1224 return
never executed: return 0;
0;
never executed: return 0;
0
1225 if (context->qGLContextHandle()
context->qGLContextHandle()Description
TRUEevaluated 80 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) {
0-80
1226 return
executed 80 times by 3 tests: return reinterpret_cast<QGLContext *>(context->qGLContextHandle());
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
reinterpret_cast<QGLContext *>(context->qGLContextHandle());
executed 80 times by 3 tests: return reinterpret_cast<QGLContext *>(context->qGLContextHandle());
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
80
1227 }-
1228 QGLContext *glContext = new QGLContext(context);-
1229-
1230-
1231 return
never executed: return glContext;
glContext;
never executed: return glContext;
0
1232}-
1233-
1234-
1235-
1236-
1237-
1238QGLContext::~QGLContext()-
1239{-
1240-
1241 QGLTextureCache::instance()->removeContextTextures(this);-
1242-
1243-
1244 d_ptr->cleanup();-
1245-
1246 QGLSignalProxy::instance()->emitAboutToDestroyContext(this);-
1247 reset();-
1248}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
1249-
1250void QGLContextPrivate::cleanup()-
1251{-
1252}-
1253-
1254-
1255void QGLContextPrivate::setVertexAttribArrayEnabled(int arrayIndex, bool enabled)-
1256{-
1257 QGLContext * const q = q_func();-
1258 ((!(arrayIndex < 3)) ? qt_assert("arrayIndex < QT_GL_VERTEX_ARRAY_TRACKED_COUNT",__FILE__,2238) : qt_noop());-
1259-
1260-
1261-
1262-
1263 if (vertexAttributeArraysEnabledState[arrayIndex]
vertexAttribut...te[arrayIndex]Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
&& !enabled
!enabledDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
)
3-27
1264 q->functions()->glDisableVertexAttribArray(arrayIndex);
executed 3 times by 1 test: q->functions()->glDisableVertexAttribArray(arrayIndex);
Executed by:
  • tst_qmdiarea - unknown status
3
1265-
1266 if (!vertexAttributeArraysEnabledState[arrayIndex]
!vertexAttribu...te[arrayIndex]Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
&& enabled
enabledDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
)
3-27
1267 q->functions()->glEnableVertexAttribArray(arrayIndex);
executed 3 times by 1 test: q->functions()->glEnableVertexAttribArray(arrayIndex);
Executed by:
  • tst_qmdiarea - unknown status
3
1268-
1269 vertexAttributeArraysEnabledState[arrayIndex] = enabled;-
1270}
executed 36 times by 1 test: end of block
Executed by:
  • tst_qmdiarea - unknown status
36
1271-
1272void QGLContextPrivate::syncGlState()-
1273{-
1274 QGLContext * const q = q_func();-
1275-
1276-
1277-
1278 for (int i = 0; i < 3
i < 3Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
; ++i) {
3-9
1279 if (vertexAttributeArraysEnabledState[i]
vertexAttribut...nabledState[i]Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
)
0-9
1280 q->functions()->glEnableVertexAttribArray(i);
never executed: q->functions()->glEnableVertexAttribArray(i);
0
1281 else-
1282 q->functions()->glDisableVertexAttribArray(i);
executed 9 times by 1 test: q->functions()->glDisableVertexAttribArray(i);
Executed by:
  • tst_qmdiarea - unknown status
9
1283 }-
1284-
1285}
executed 3 times by 1 test: end of block
Executed by:
  • tst_qmdiarea - unknown status
3
1286-
1287-
1288void QGLContextPrivate::swapRegion(const QRegion &)-
1289{-
1290 QGLContext * const q = q_func();-
1291 q->swapBuffers();-
1292}
never executed: end of block
0
1293GLuint QGLContext::bindTexture(const QString &fileName)-
1294{-
1295 QGLTexture texture(this);-
1296 QSize size = texture.bindCompressedTexture(fileName);-
1297 if (!size.isValid()
!size.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1298 return
never executed: return 0;
0;
never executed: return 0;
0
1299 return
never executed: return texture.id;
texture.id;
never executed: return texture.id;
0
1300}-
1301-
1302static inline QRgb qt_gl_convertToGLFormatHelper(QRgb src_pixel, GLenum texture_format)-
1303{-
1304 if (texture_format == 0x80E1
texture_format == 0x80E1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1305 if (QSysInfo::ByteOrder == QSysInfo::BigEndian
QSysInfo::Byte...nfo::BigEndianDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1306 return
never executed: return ((src_pixel << 24) & 0xff000000) | ((src_pixel >> 24) & 0x000000ff) | ((src_pixel << 8) & 0x00ff0000) | ((src_pixel >> 8) & 0x0000ff00);
((src_pixel << 24) & 0xff000000)
never executed: return ((src_pixel << 24) & 0xff000000) | ((src_pixel >> 24) & 0x000000ff) | ((src_pixel << 8) & 0x00ff0000) | ((src_pixel >> 8) & 0x0000ff00);
0
1307 | ((src_pixel >> 24) & 0x000000ff)
never executed: return ((src_pixel << 24) & 0xff000000) | ((src_pixel >> 24) & 0x000000ff) | ((src_pixel << 8) & 0x00ff0000) | ((src_pixel >> 8) & 0x0000ff00);
0
1308 | ((src_pixel << 8) & 0x00ff0000)
never executed: return ((src_pixel << 24) & 0xff000000) | ((src_pixel >> 24) & 0x000000ff) | ((src_pixel << 8) & 0x00ff0000) | ((src_pixel >> 8) & 0x0000ff00);
0
1309 | ((src_pixel >> 8) & 0x0000ff00);
never executed: return ((src_pixel << 24) & 0xff000000) | ((src_pixel >> 24) & 0x000000ff) | ((src_pixel << 8) & 0x00ff0000) | ((src_pixel >> 8) & 0x0000ff00);
0
1310 } else {-
1311 return
never executed: return src_pixel;
src_pixel;
never executed: return src_pixel;
0
1312 }-
1313 } else {-
1314 if (QSysInfo::ByteOrder == QSysInfo::BigEndian
QSysInfo::Byte...nfo::BigEndianDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1315 return
never executed: return (src_pixel << 8) | ((src_pixel >> 24) & 0xff);
(src_pixel << 8) | ((src_pixel >> 24) & 0xff);
never executed: return (src_pixel << 8) | ((src_pixel >> 24) & 0xff);
0
1316 } else {-
1317 return
never executed: return ((src_pixel << 16) & 0xff0000) | ((src_pixel >> 16) & 0xff) | (src_pixel & 0xff00ff00);
((src_pixel << 16) & 0xff0000)
never executed: return ((src_pixel << 16) & 0xff0000) | ((src_pixel >> 16) & 0xff) | (src_pixel & 0xff00ff00);
0
1318 | ((src_pixel >> 16) & 0xff)
never executed: return ((src_pixel << 16) & 0xff0000) | ((src_pixel >> 16) & 0xff) | (src_pixel & 0xff00ff00);
0
1319 | (src_pixel & 0xff00ff00);
never executed: return ((src_pixel << 16) & 0xff0000) | ((src_pixel >> 16) & 0xff) | (src_pixel & 0xff00ff00);
0
1320 }-
1321 }-
1322}-
1323-
1324static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum texture_format)-
1325{-
1326 ((!(dst.depth() == 32)) ? qt_assert("dst.depth() == 32",__FILE__,2326) : qt_noop());-
1327 ((!(img.depth() == 32)) ? qt_assert("img.depth() == 32",__FILE__,2327) : qt_noop());-
1328-
1329 if (dst.size() != img.size()
dst.size() != img.size()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1330 int target_width = dst.width();-
1331 int target_height = dst.height();-
1332 qreal sx = target_width / qreal(img.width());-
1333 qreal sy = target_height / qreal(img.height());-
1334-
1335 quint32 *dest = (quint32 *) dst.scanLine(0);-
1336 const uchar *srcPixels = img.constScanLine(img.height() - 1);-
1337 int sbpl = img.bytesPerLine();-
1338 int dbpl = dst.bytesPerLine();-
1339-
1340 int ix = int(0x00010000 / sx);-
1341 int iy = int(0x00010000 / sy);-
1342-
1343 quint32 basex = int(0.5 * ix);-
1344 quint32 srcy = int(0.5 * iy);-
1345-
1346-
1347 while (target_height--
target_height--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1348 const uint *src = (const quint32 *) (srcPixels - (srcy >> 16) * sbpl);-
1349 int srcx = basex;-
1350 for (int x=0; x<target_width
x<target_widthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
1351 dest[x] = qt_gl_convertToGLFormatHelper(src[srcx >> 16], texture_format);-
1352 srcx += ix;-
1353 }
never executed: end of block
0
1354 dest = (quint32 *)(((uchar *) dest) + dbpl);-
1355 srcy += iy;-
1356 }
never executed: end of block
0
1357 }
never executed: end of block
else {
0
1358 const int width = img.width();-
1359 const int height = img.height();-
1360 const uint *p = (const uint*) img.scanLine(img.height() - 1);-
1361 uint *q = (uint*) dst.scanLine(0);-
1362-
1363 if (texture_format == 0x80E1
texture_format == 0x80E1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1364 if (QSysInfo::ByteOrder == QSysInfo::BigEndian
QSysInfo::Byte...nfo::BigEndianDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1365-
1366 for (int i=0; i < height
i < heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1367 const uint *end = p + width;-
1368 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1369 *q = ((*p << 24) & 0xff000000)-
1370 | ((*p >> 24) & 0x000000ff)-
1371 | ((*p << 8) & 0x00ff0000)-
1372 | ((*p >> 8) & 0x0000ff00);-
1373 p++;-
1374 q++;-
1375 }
never executed: end of block
0
1376 p -= 2 * width;-
1377 }
never executed: end of block
0
1378 }
never executed: end of block
else {
0
1379 const uint bytesPerLine = img.bytesPerLine();-
1380 for (int i=0; i < height
i < heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1381 memcpy(q, p, bytesPerLine);-
1382 q += width;-
1383 p -= width;-
1384 }
never executed: end of block
0
1385 }
never executed: end of block
0
1386 } else {-
1387 if (QSysInfo::ByteOrder == QSysInfo::BigEndian
QSysInfo::Byte...nfo::BigEndianDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1388 for (int i=0; i < height
i < heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1389 const uint *end = p + width;-
1390 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1391 *q = (*p << 8) | ((*p >> 24) & 0xff);-
1392 p++;-
1393 q++;-
1394 }
never executed: end of block
0
1395 p -= 2 * width;-
1396 }
never executed: end of block
0
1397 }
never executed: end of block
else {
0
1398 for (int i=0; i < height
i < heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1399 const uint *end = p + width;-
1400 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1401 *q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | (*p & 0xff00ff00);-
1402 p++;-
1403 q++;-
1404 }
never executed: end of block
0
1405 p -= 2 * width;-
1406 }
never executed: end of block
0
1407 }
never executed: end of block
0
1408 }-
1409 }-
1410}-
1411-
1412-
1413QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format,-
1414 QGLContext::BindOptions options)-
1415{-
1416 QGLContext * const q = q_func();-
1417-
1418 const qint64 key = image.cacheKey();-
1419 QGLTexture *texture = textureCacheLookup(key, target);-
1420 if (texture
textureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1421 if (image.paintingActive()
image.paintingActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1422-
1423 q->deleteTexture(texture->id);-
1424 texture = 0;-
1425 }
never executed: end of block
else {
0
1426 qgl_functions()->glBindTexture(target, texture->id);-
1427 return
never executed: return texture;
texture;
never executed: return texture;
0
1428 }-
1429 }-
1430-
1431 if (!texture
!textureDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1432 texture = bindTexture(image, target, format, key, options);
never executed: texture = bindTexture(image, target, format, key, options);
0
1433-
1434 ((!(texture)) ? qt_assert("texture",__FILE__,2434) : qt_noop());-
1435-
1436-
1437-
1438 QImagePixmapCleanupHooks::enableCleanupHooks(image);-
1439-
1440 return
never executed: return texture;
texture;
never executed: return texture;
0
1441}-
1442static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type)-
1443{-
1444 const int width = img.width();-
1445 const int height = img.height();-
1446-
1447 if (pixel_type == 0x8367
pixel_type == 0x8367Description
TRUEnever evaluated
FALSEnever evaluated
0
1448 || (pixel_type == 0x1401
pixel_type == 0x1401Description
TRUEnever evaluated
FALSEnever evaluated
&& QSysInfo::ByteOrder == QSysInfo::LittleEndian
QSysInfo::Byte...::LittleEndianDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
1449 {-
1450 for (int i = 0; i < height
i < heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1451 uint *p = (uint *) img.scanLine(i);-
1452 for (int x = 0; x < width
x < widthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
1453 p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
never executed: p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
0
1454 }
never executed: end of block
0
1455 }
never executed: end of block
else {
0
1456 for (int i = 0; i < height
i < heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1457 uint *p = (uint *) img.scanLine(i);-
1458 for (int x = 0; x < width
x < widthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
1459 p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff);
never executed: p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff);
0
1460 }
never executed: end of block
0
1461 }
never executed: end of block
0
1462}-
1463-
1464QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint internalFormat,-
1465 const qint64 key, QGLContext::BindOptions options)-
1466{-
1467 QGLContext * const q = q_func();-
1468 QOpenGLFunctions *funcs = qgl_functions();-
1469 while (funcs->glGetError() != 0
funcs->glGetError() != 0Description
TRUEnever evaluated
FALSEnever evaluated
) ;
never executed: ;
0
1470-
1471-
1472-
1473-
1474-
1475 int tx_w = qNextPowerOfTwo(image.width() - 1);-
1476 int tx_h = qNextPowerOfTwo(image.height() - 1);-
1477-
1478 QImage img = image;-
1479-
1480 if (!qgl_extensions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextures)
!qgl_extension...:NPOTTextures)Description
TRUEnever evaluated
FALSEnever evaluated
0
1481 && !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0)
!(QGLFormat::o...S_Version_2_0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1482 && (target == 0x0DE1
target == 0x0DE1Description
TRUEnever evaluated
FALSEnever evaluated
&& (tx_w != image.width()
tx_w != image.width()Description
TRUEnever evaluated
FALSEnever evaluated
|| tx_h != image.height()
tx_h != image.height()Description
TRUEnever evaluated
FALSEnever evaluated
)))
0
1483 {-
1484 img = img.scaled(tx_w, tx_h);-
1485-
1486-
1487-
1488-
1489 }
never executed: end of block
0
1490-
1491 GLuint filtering = options & QGLContext::LinearFilteringBindOption
options & QGLC...ringBindOptionDescription
TRUEnever evaluated
FALSEnever evaluated
? 0x2601 : 0x2600;
0
1492-
1493 GLuint tx_id;-
1494 funcs->glGenTextures(1, &tx_id);-
1495 funcs->glBindTexture(target, tx_id);-
1496 funcs->glTexParameteri(target, 0x2800, filtering);-
1497-
1498 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
1499 bool genMipmap = !ctx->isOpenGLES();-
1500 if (glFormat.directRendering()
glFormat.directRendering()Description
TRUEnever evaluated
FALSEnever evaluated
0
1501 && (
(qgl_extension...nerateMipmap))Description
TRUEnever evaluated
FALSEnever evaluated
qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::GenerateMipmap))
(qgl_extension...nerateMipmap))Description
TRUEnever evaluated
FALSEnever evaluated
0
1502 && target == 0x0DE1
target == 0x0DE1Description
TRUEnever evaluated
FALSEnever evaluated
0
1503 && (
(options & QGL...mapBindOption)Description
TRUEnever evaluated
FALSEnever evaluated
options & QGLContext::MipmapBindOption)
(options & QGL...mapBindOption)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1504 {-
1505-
1506 if (genMipmap
genMipmapDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1507 funcs->glHint(0x8192, 0x1102);-
1508 funcs->glTexParameteri(target, 0x8191, 1);-
1509 }
never executed: end of block
else {
0
1510 funcs->glHint(0x8192, 0x1102);-
1511 genMipmap = true;-
1512 }
never executed: end of block
0
1513-
1514-
1515-
1516-
1517 funcs->glTexParameteri(target, 0x2801, options & QGLContext::LinearFilteringBindOption-
1518 ? 0x2703 : 0x2700);-
1519-
1520-
1521-
1522 }
never executed: end of block
else {
0
1523 funcs->glTexParameteri(target, 0x2801, filtering);-
1524 }
never executed: end of block
0
1525-
1526 QImage::Format target_format = img.format();-
1527 bool premul = options & QGLContext::PremultipliedAlphaBindOption;-
1528 bool needsbyteswap = true;-
1529 GLenum externalFormat;-
1530 GLuint pixel_type;-
1531 if (target_format == QImage::Format_RGBA8888
target_format ...ormat_RGBA8888Description
TRUEnever evaluated
FALSEnever evaluated
0
1532 || target_format == QImage::Format_RGBA8888_Premultiplied
target_format ..._PremultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1533 || target_format == QImage::Format_RGBX8888
target_format ...ormat_RGBX8888Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1534 externalFormat = 0x1908;-
1535 pixel_type = 0x1401;-
1536 needsbyteswap = false;-
1537 }
never executed: end of block
else if (qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat)
qgl_extensions...TextureFormat)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1538 externalFormat = 0x80E1;-
1539 needsbyteswap = false;-
1540 if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2
QGLFormat::ope...GL_Version_1_2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1541 pixel_type = 0x8367;
never executed: pixel_type = 0x8367;
0
1542 else-
1543 pixel_type = 0x1401;
never executed: pixel_type = 0x1401;
0
1544 } else {-
1545 externalFormat = 0x1908;-
1546 pixel_type = 0x1401;-
1547 }
never executed: end of block
0
1548-
1549 switch (target_format) {-
1550 case
never executed: case QImage::Format_ARGB32:
QImage::Format_ARGB32:
never executed: case QImage::Format_ARGB32:
0
1551 if (premul
premulDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1552 img = img.convertToFormat(target_format = QImage::Format_ARGB32_Premultiplied);-
1553-
1554-
1555-
1556 }
never executed: end of block
0
1557 break;
never executed: break;
0
1558 case
never executed: case QImage::Format_ARGB32_Premultiplied:
QImage::Format_ARGB32_Premultiplied:
never executed: case QImage::Format_ARGB32_Premultiplied:
0
1559 if (!premul
!premulDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1560 img = img.convertToFormat(target_format = QImage::Format_ARGB32);-
1561-
1562-
1563-
1564 }
never executed: end of block
0
1565 break;
never executed: break;
0
1566 case
never executed: case QImage::Format_RGBA8888:
QImage::Format_RGBA8888:
never executed: case QImage::Format_RGBA8888:
0
1567 if (premul
premulDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1568 img = img.convertToFormat(target_format = QImage::Format_RGBA8888_Premultiplied);-
1569-
1570-
1571-
1572 }
never executed: end of block
0
1573 break;
never executed: break;
0
1574 case
never executed: case QImage::Format_RGBA8888_Premultiplied:
QImage::Format_RGBA8888_Premultiplied:
never executed: case QImage::Format_RGBA8888_Premultiplied:
0
1575 if (!premul
!premulDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1576 img = img.convertToFormat(target_format = QImage::Format_RGBA8888);-
1577-
1578-
1579-
1580 }
never executed: end of block
0
1581 break;
never executed: break;
0
1582 case
never executed: case QImage::Format_RGB16:
QImage::Format_RGB16:
never executed: case QImage::Format_RGB16:
0
1583 pixel_type = 0x8363;-
1584 externalFormat = 0x1907;-
1585 internalFormat = 0x1907;-
1586 needsbyteswap = false;-
1587 break;
never executed: break;
0
1588 case
never executed: case QImage::Format_RGB32:
QImage::Format_RGB32:
never executed: case QImage::Format_RGB32:
0
1589 case
never executed: case QImage::Format_RGBX8888:
QImage::Format_RGBX8888:
never executed: case QImage::Format_RGBX8888:
0
1590 break;
never executed: break;
0
1591 default
never executed: default:
:
never executed: default:
0
1592-
1593-
1594 if (img.hasAlphaChannel()
img.hasAlphaChannel()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1595 img = img.convertToFormat(premul-
1596 ? QImage::Format_ARGB32_Premultiplied-
1597 : QImage::Format_ARGB32);-
1598-
1599-
1600-
1601 }
never executed: end of block
else {
0
1602 img = img.convertToFormat(QImage::Format_RGB32);-
1603-
1604-
1605-
1606 }
never executed: end of block
0
1607 }-
1608-
1609 if (options & QGLContext::InvertedYBindOption
options & QGLC...tedYBindOptionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1610 if (img.isDetached()
img.isDetached()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1611 int ipl = img.bytesPerLine() / 4;-
1612 int h = img.height();-
1613 for (int y=0; y<h/2
y<h/2Description
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
1614 int *a = (int *) img.scanLine(y);-
1615 int *b = (int *) img.scanLine(h - y - 1);-
1616 for (int x=0; x<ipl
x<iplDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
1617 qSwap(a[x], b[x]);
never executed: qSwap(a[x], b[x]);
0
1618 }
never executed: end of block
0
1619 }
never executed: end of block
else {
0
1620-
1621-
1622-
1623-
1624 img = img.mirrored();-
1625 }
never executed: end of block
0
1626-
1627-
1628-
1629 }-
1630-
1631 if (needsbyteswap
needsbyteswapDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1632-
1633-
1634-
1635 ((!(img.depth() == 32)) ? qt_assert("img.depth() == 32",__FILE__,2655) : qt_noop());-
1636 qgl_byteSwapImage(img, pixel_type);-
1637-
1638-
1639-
1640 }
never executed: end of block
0
1641 if (ctx->isOpenGLES()
ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1642-
1643-
1644 internalFormat = externalFormat;-
1645 }
never executed: end of block
0
1646-
1647-
1648-
1649-
1650-
1651 const QImage &constRef = img;-
1652 funcs->glTexImage2D(target, 0, internalFormat, img.width(), img.height(), 0, externalFormat,-
1653 pixel_type, constRef.bits());-
1654 if (genMipmap
genMipmapDescription
TRUEnever evaluated
FALSEnever evaluated
&& ctx->isOpenGLES()
ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1655 q->functions()->glGenerateMipmap(target);
never executed: q->functions()->glGenerateMipmap(target);
0
1656-
1657 GLenum error = funcs->glGetError();-
1658 if (error != 0
error != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1659 QMessageLogger(__FILE__, 2679, __PRETTY_FUNCTION__).warning(" - texture upload failed, error code 0x%x, enum: %d (%x)\n", error, target, target);-
1660 }
never executed: end of block
0
1661 int cost = img.width()*img.height()*4/1024;-
1662 QGLTexture *texture = new QGLTexture(q, tx_id, target, options);-
1663 QGLTextureCache::instance()->insert(q, key, texture, cost);-
1664-
1665 return
never executed: return texture;
texture;
never executed: return texture;
0
1666}-
1667-
1668QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum target)-
1669{-
1670 QGLContext * const q = q_func();-
1671 QGLTexture *texture = QGLTextureCache::instance()->getTexture(q, key);-
1672 if (texture
textureDescription
TRUEnever evaluated
FALSEnever evaluated
&& texture->target == target
texture->target == targetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1673 && (texture->context == q
texture->context == qDescription
TRUEnever evaluated
FALSEnever evaluated
|| QGLContext::areSharing(q, texture->context)
QGLContext::ar...ture->context)Description
TRUEnever evaluated
FALSEnever evaluated
))
0
1674 {-
1675 return
never executed: return texture;
texture;
never executed: return texture;
0
1676 }-
1677 return
never executed: return 0;
0;
never executed: return 0;
0
1678}-
1679-
1680-
1681QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options)-
1682{-
1683 QGLContext * const q = q_func();-
1684 QPlatformPixmap *pd = pixmap.handle();-
1685 (void)pd;;-
1686-
1687 const qint64 key = pixmap.cacheKey();-
1688 QGLTexture *texture = textureCacheLookup(key, target);-
1689 if (texture
textureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1690 if (pixmap.paintingActive()
pixmap.paintingActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1691-
1692 q->deleteTexture(texture->id);-
1693 texture = 0;-
1694 }
never executed: end of block
else {
0
1695 qgl_functions()->glBindTexture(target, texture->id);-
1696 return
never executed: return texture;
texture;
never executed: return texture;
0
1697 }-
1698 }-
1699-
1700 if (!texture
!textureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1701 QImage image;-
1702 QPaintEngine* paintEngine = pixmap.paintEngine();-
1703 if (!paintEngine
!paintEngineDescription
TRUEnever evaluated
FALSEnever evaluated
|| paintEngine->type() != QPaintEngine::Raster
paintEngine->t...Engine::RasterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1704 image = pixmap.toImage();
never executed: image = pixmap.toImage();
0
1705 else {-
1706-
1707-
1708 QPaintDevice* currentPaintDevice = paintEngine->paintDevice();-
1709 paintEngine->setPaintDevice(0);-
1710 image = pixmap.toImage();-
1711 paintEngine->setPaintDevice(currentPaintDevice);-
1712 }
never executed: end of block
0
1713-
1714-
1715-
1716-
1717 if (pixmap.depth() == 16
pixmap.depth() == 16Description
TRUEnever evaluated
FALSEnever evaluated
&& !image.hasAlphaChannel()
!image.hasAlphaChannel()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1718 image = image.convertToFormat(QImage::Format_RGB16);
never executed: image = image.convertToFormat(QImage::Format_RGB16);
0
1719 texture = bindTexture(image, target, format, key, options);-
1720 }
never executed: end of block
0
1721-
1722 ((!(texture)) ? qt_assert("texture",__FILE__,2752) : qt_noop());-
1723-
1724 if (texture->id > 0
texture->id > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1725 QImagePixmapCleanupHooks::enableCleanupHooks(pixmap);
never executed: QImagePixmapCleanupHooks::enableCleanupHooks(pixmap);
0
1726-
1727 return
never executed: return texture;
texture;
never executed: return texture;
0
1728}-
1729-
1730-
1731int QGLContextPrivate::maxTextureSize()-
1732{-
1733 if (max_texture_size != -1
max_texture_size != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1734 return
never executed: return max_texture_size;
max_texture_size;
never executed: return max_texture_size;
0
1735-
1736 QOpenGLFunctions *funcs = qgl_functions();-
1737 funcs->glGetIntegerv(0x0D33, &max_texture_size);-
1738-
1739-
1740 QGLContext * const q = q_func();-
1741 if (!q->contextHandle()->isOpenGLES()
!q->contextHan...->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1742 GLenum proxy = 0x8064;-
1743-
1744 GLint size;-
1745 GLint next = 64;-
1746 funcs->glTexImage2D(proxy, 0, 0x1908, next, next, 0, 0x1908, 0x1401, 0);-
1747 QOpenGLFunctions_1_1 *gl1funcs = qgl1_functions();-
1748 gl1funcs->glGetTexLevelParameteriv(proxy, 0, 0x1000, &size);-
1749 if (size == 0
size == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1750 return
never executed: return max_texture_size;
max_texture_size;
never executed: return max_texture_size;
0
1751 }-
1752 do {-
1753 size = next;-
1754 next = size * 2;-
1755-
1756 if (next > max_texture_size
next > max_texture_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1757 break;
never executed: break;
0
1758 funcs->glTexImage2D(proxy, 0, 0x1908, next, next, 0, 0x1908, 0x1401, 0);-
1759 gl1funcs->glGetTexLevelParameteriv(proxy, 0, 0x1000, &next);-
1760 }
never executed: end of block
while (next > size
next > sizeDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
1761-
1762 max_texture_size = size;-
1763 }
never executed: end of block
0
1764-
1765-
1766 return
never executed: return max_texture_size;
max_texture_size;
never executed: return max_texture_size;
0
1767}-
1768-
1769-
1770-
1771-
1772QGLFunctions *QGLContext::functions() const-
1773{-
1774 QGLContextPrivate *d = const_cast<QGLContextPrivate *>(d_func());-
1775 if (!d->functions
!d->functionsDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
) {
1-14
1776 d->functions = new QGLFunctions(this);-
1777 d->functions->initializeGLFunctions(this);-
1778 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_qmdiarea - unknown status
1
1779 return
executed 15 times by 1 test: return d->functions;
Executed by:
  • tst_qmdiarea - unknown status
d->functions;
executed 15 times by 1 test: return d->functions;
Executed by:
  • tst_qmdiarea - unknown status
15
1780}-
1781GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format)-
1782{-
1783 if (image.isNull()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1784 return
never executed: return 0;
0;
never executed: return 0;
0
1785-
1786 QGLContextPrivate * const d = d_func();-
1787 QGLTexture *texture = d->bindTexture(image, target, format, DefaultBindOption);-
1788 return
never executed: return texture->id;
texture->id;
never executed: return texture->id;
0
1789}-
1790GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options)-
1791{-
1792 if (image.isNull()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1793 return
never executed: return 0;
0;
never executed: return 0;
0
1794-
1795 QGLContextPrivate * const d = d_func();-
1796 QGLTexture *texture = d->bindTexture(image, target, format, options);-
1797 return
never executed: return texture->id;
texture->id;
never executed: return texture->id;
0
1798}-
1799-
1800-
1801-
1802-
1803-
1804GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format)-
1805{-
1806 if (pixmap.isNull()
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1807 return
never executed: return 0;
0;
never executed: return 0;
0
1808-
1809 QGLContextPrivate * const d = d_func();-
1810 QGLTexture *texture = d->bindTexture(pixmap, target, format, DefaultBindOption);-
1811 return
never executed: return texture->id;
texture->id;
never executed: return texture->id;
0
1812}-
1813GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, BindOptions options)-
1814{-
1815 if (pixmap.isNull()
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1816 return
never executed: return 0;
0;
never executed: return 0;
0
1817-
1818 QGLContextPrivate * const d = d_func();-
1819 QGLTexture *texture = d->bindTexture(pixmap, target, format, options);-
1820 return
never executed: return texture->id;
texture->id;
never executed: return texture->id;
0
1821}-
1822void QGLContext::deleteTexture(GLuint id)-
1823{-
1824 if (QGLTextureCache::instance()->remove(this, id)
QGLTextureCach...move(this, id)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1825 return;
never executed: return;
0
1826 qgl_functions()->glDeleteTextures(1, &id);-
1827}
never executed: end of block
0
1828-
1829void qt_add_rect_to_array(const QRectF &r, GLfloat *array)-
1830{-
1831 qreal left = r.left();-
1832 qreal right = r.right();-
1833 qreal top = r.top();-
1834 qreal bottom = r.bottom();-
1835-
1836 array[0] = left;-
1837 array[1] = top;-
1838 array[2] = right;-
1839 array[3] = top;-
1840 array[4] = right;-
1841 array[5] = bottom;-
1842 array[6] = left;-
1843 array[7] = bottom;-
1844}
never executed: end of block
0
1845-
1846void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, GLfloat *array)-
1847{-
1848 array[0] = x1;-
1849 array[1] = y1;-
1850 array[2] = x2;-
1851 array[3] = y1;-
1852 array[4] = x2;-
1853 array[5] = y2;-
1854 array[6] = x1;-
1855 array[7] = y2;-
1856}
never executed: end of block
0
1857-
1858-
1859-
1860static void qDrawTextureRect(const QRectF &target, GLint textureWidth, GLint textureHeight, GLenum textureTarget)-
1861{-
1862 QOpenGLFunctions *funcs = qgl_functions();-
1863 GLfloat tx = 1.0f;-
1864 GLfloat ty = 1.0f;-
1865-
1866-
1867-
1868-
1869-
1870-
1871 if (textureTarget != 0x0DE1
textureTarget != 0x0DE1Description
TRUEnever evaluated
FALSEnever evaluated
&& !QOpenGLContext::currentContext()->isOpenGLES()
!QOpenGLContex...->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1872 if (textureWidth == -1
textureWidth == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| textureHeight == -1
textureHeight == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1873 QOpenGLFunctions_1_1 *gl1funcs = qgl1_functions();-
1874 gl1funcs->glGetTexLevelParameteriv(textureTarget, 0, 0x1000, &textureWidth);-
1875 gl1funcs->glGetTexLevelParameteriv(textureTarget, 0, 0x1001, &textureHeight);-
1876 }
never executed: end of block
0
1877-
1878 tx = GLfloat(textureWidth);-
1879 ty = GLfloat(textureHeight);-
1880 }
never executed: end of block
0
1881-
1882-
1883 GLfloat texCoordArray[4*2] = {-
1884 0, ty, tx, ty, tx, 0, 0, 0-
1885 };-
1886-
1887 GLfloat vertexArray[4*2];-
1888 qt_add_rect_to_array(target, vertexArray);-
1889-
1890 QOpenGLFunctions_1_1 *gl1funcs = qgl1_functions();-
1891 gl1funcs->glVertexPointer(2, 0x1406, 0, vertexArray);-
1892 gl1funcs->glTexCoordPointer(2, 0x1406, 0, texCoordArray);-
1893-
1894 gl1funcs->glEnableClientState(0x8074);-
1895 gl1funcs->glEnableClientState(0x8078);-
1896 funcs->glDrawArrays(0x0006, 0, 4);-
1897-
1898 gl1funcs->glDisableClientState(0x8074);-
1899 gl1funcs->glDisableClientState(0x8078);-
1900}
never executed: end of block
0
1901void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget)-
1902{-
1903-
1904 if (d_ptr->active_engine
d_ptr->active_engineDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
1905 d_ptr->active_engine->type() == QPaintEngine::OpenGL2
d_ptr->active_...ngine::OpenGL2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1906 QGL2PaintEngineEx *eng = static_cast<QGL2PaintEngineEx*>(d_ptr->active_engine);-
1907 if (!eng->isNativePaintingActive()
!eng->isNativePaintingActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1908 QRectF src(0, 0, target.width(), target.height());-
1909 QSize size(target.width(), target.height());-
1910 if (eng->drawTexture(target, textureId, size, src)
eng->drawTextu...Id, size, src)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1911 return;
never executed: return;
0
1912 }
never executed: end of block
0
1913 }
never executed: end of block
0
1914-
1915-
1916-
1917 QOpenGLFunctions *funcs = qgl_functions();-
1918 if (!contextHandle()->isOpenGLES()
!contextHandle()->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1919-
1920-
1921-
1922-
1923-
1924-
1925 const bool wasEnabled = funcs->glIsEnabled(0x0DE1);-
1926 GLint oldTexture;-
1927 funcs->glGetIntegerv(0x8069, &oldTexture);-
1928-
1929-
1930 funcs->glEnable(textureTarget);-
1931 funcs->glBindTexture(textureTarget, textureId);-
1932-
1933 qDrawTextureRect(target, -1, -1, textureTarget);-
1934-
1935-
1936-
1937-
1938 if (!wasEnabled
!wasEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1939 funcs->glDisable(textureTarget);
never executed: funcs->glDisable(textureTarget);
0
1940 funcs->glBindTexture(textureTarget, oldTexture);-
1941-
1942 return;
never executed: return;
0
1943 }-
1944-
1945-
1946-
1947-
1948-
1949 QMessageLogger(__FILE__, 3052, __PRETTY_FUNCTION__).warning("drawTexture() with OpenGL ES 2.0 requires an active OpenGL2 paint engine");-
1950}
never executed: end of block
0
1951void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget)-
1952{-
1953-
1954-
1955-
1956-
1957-
1958 if (!contextHandle()->isOpenGLES()
!contextHandle()->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1959 QOpenGLFunctions *funcs = qgl_functions();-
1960 const bool wasEnabled = funcs->glIsEnabled(0x0DE1);-
1961 GLint oldTexture;-
1962 funcs->glGetIntegerv(0x8069, &oldTexture);-
1963-
1964 funcs->glEnable(textureTarget);-
1965 funcs->glBindTexture(textureTarget, textureId);-
1966-
1967 GLint textureWidth;-
1968 GLint textureHeight;-
1969-
1970 QOpenGLFunctions_1_1 *gl1funcs = qgl1_functions();-
1971 gl1funcs->glGetTexLevelParameteriv(textureTarget, 0, 0x1000, &textureWidth);-
1972 gl1funcs->glGetTexLevelParameteriv(textureTarget, 0, 0x1001, &textureHeight);-
1973-
1974 if (d_ptr->active_engine
d_ptr->active_engineDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
1975 d_ptr->active_engine->type() == QPaintEngine::OpenGL2
d_ptr->active_...ngine::OpenGL2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1976 QGL2PaintEngineEx *eng = static_cast<QGL2PaintEngineEx*>(d_ptr->active_engine);-
1977 if (!eng->isNativePaintingActive()
!eng->isNativePaintingActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1978 QRectF dest(point, QSizeF(textureWidth, textureHeight));-
1979 QRectF src(0, 0, textureWidth, textureHeight);-
1980 QSize size(textureWidth, textureHeight);-
1981 if (eng->drawTexture(dest, textureId, size, src)
eng->drawTextu...Id, size, src)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1982 return;
never executed: return;
0
1983 }
never executed: end of block
0
1984 }
never executed: end of block
0
1985-
1986 qDrawTextureRect(QRectF(point, QSizeF(textureWidth, textureHeight)), textureWidth, textureHeight, textureTarget);-
1987-
1988 if (!wasEnabled
!wasEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1989 funcs->glDisable(textureTarget);
never executed: funcs->glDisable(textureTarget);
0
1990 funcs->glBindTexture(textureTarget, oldTexture);-
1991 return;
never executed: return;
0
1992 }-
1993-
1994 QMessageLogger(__FILE__, 3119, __PRETTY_FUNCTION__).warning("drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget) not supported with OpenGL ES, use rect version instead");-
1995}
never executed: end of block
0
1996void QGLContext::setTextureCacheLimit(int size)-
1997{-
1998 QGLTextureCache::instance()->setMaxCost(size);-
1999}
never executed: end of block
0
2000-
2001-
2002-
2003-
2004-
2005-
2006int QGLContext::textureCacheLimit()-
2007{-
2008 return
never executed: return QGLTextureCache::instance()->maxCost();
QGLTextureCache::instance()->maxCost();
never executed: return QGLTextureCache::instance()->maxCost();
0
2009}-
2010void QGLContext::setFormat(const QGLFormat &format)-
2011{-
2012 QGLContextPrivate * const d = d_func();-
2013 reset();-
2014 d->glFormat = d->reqFormat = format;-
2015}
never executed: end of block
0
2016-
2017-
2018-
2019-
2020void QGLContext::setDevice(QPaintDevice *pDev)-
2021{-
2022 QGLContextPrivate * const d = d_func();-
2023-
2024-
2025-
2026 d->paintDevice = pDev;-
2027 if (d->paintDevice
d->paintDeviceDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
&& (d->paintDevice->devType() != QInternal::Widget
d->paintDevice...ternal::WidgetDescription
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
0-12
2028 && d->paintDevice->devType() != QInternal::Pixmap
d->paintDevice...ternal::PixmapDescription
TRUEnever evaluated
FALSEnever evaluated
0
2029 && d->paintDevice->devType() != QInternal::Pbuffer
d->paintDevice...ernal::PbufferDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
2030 QMessageLogger(__FILE__, 3195, __PRETTY_FUNCTION__).warning("QGLContext: Unsupported paint device type");-
2031 }
never executed: end of block
0
2032}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2033bool QGLContext::areSharing(const QGLContext *context1, const QGLContext *context2)-
2034{-
2035 if (!context1
!context1Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
|| !context2
!context2Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
)
0-4
2036 return
never executed: return false;
false;
never executed: return false;
0
2037 return
executed 4 times by 1 test: return context1->d_ptr->group == context2->d_ptr->group;
Executed by:
  • tst_qmdiarea - unknown status
context1->d_ptr->group == context2->d_ptr->group;
executed 4 times by 1 test: return context1->d_ptr->group == context2->d_ptr->group;
Executed by:
  • tst_qmdiarea - unknown status
4
2038}-
2039uint QGLContext::colorIndex(const QColor&) const-
2040{-
2041 return
never executed: return 0;
0;
never executed: return 0;
0
2042}-
2043QColor QGLContext::overlayTransparentColor() const-
2044{-
2045 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
2046}-
2047bool QGLContext::create(const QGLContext* shareContext)-
2048{-
2049 QGLContextPrivate * const d = d_func();-
2050 if (!d->paintDevice
!d->paintDeviceDescription
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
&& !d->guiGlContext
!d->guiGlContextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0-12
2051 return
never executed: return false;
false;
never executed: return false;
0
2052-
2053 reset();-
2054 d->valid = chooseContext(shareContext);-
2055 if (d->valid
d->validDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
&& d->paintDevice
d->paintDeviceDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
&& d->paintDevice->devType() == QInternal::Widget
d->paintDevice...ternal::WidgetDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) {
0-12
2056 QWidgetPrivate *wd = qt_widget_private(static_cast<QWidget *>(d->paintDevice));-
2057 wd->usesDoubleBufferedGLContext = d->glFormat.doubleBuffer();-
2058 }
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2059 return
executed 12 times by 3 tests: return d->valid;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->valid;
executed 12 times by 3 tests: return d->valid;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2060}-
2061-
2062bool QGLContext::isValid() const-
2063{-
2064 const QGLContextPrivate * const d = d_func();-
2065 return
executed 16 times by 3 tests: return d->valid;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->valid;
executed 16 times by 3 tests: return d->valid;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
16
2066}-
2067-
2068void QGLContext::setValid(bool valid)-
2069{-
2070 QGLContextPrivate * const d = d_func();-
2071 d->valid = valid;-
2072}
never executed: end of block
0
2073-
2074bool QGLContext::isSharing() const-
2075{-
2076 const QGLContextPrivate * const d = d_func();-
2077 return
executed 1 time by 1 test: return d->group->isSharing();
Executed by:
  • tst_qglbuffer - unknown status
d->group->isSharing();
executed 1 time by 1 test: return d->group->isSharing();
Executed by:
  • tst_qglbuffer - unknown status
1
2078}-
2079-
2080QGLFormat QGLContext::format() const-
2081{-
2082 const QGLContextPrivate * const d = d_func();-
2083 return
executed 12 times by 3 tests: return d->glFormat;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->glFormat;
executed 12 times by 3 tests: return d->glFormat;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2084}-
2085-
2086QGLFormat QGLContext::requestedFormat() const-
2087{-
2088 const QGLContextPrivate * const d = d_func();-
2089 return
never executed: return d->reqFormat;
d->reqFormat;
never executed: return d->reqFormat;
0
2090}-
2091-
2092 QPaintDevice* QGLContext::device() const-
2093{-
2094 const QGLContextPrivate * const d = d_func();-
2095 return
executed 24 times by 3 tests: return d->paintDevice;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->paintDevice;
executed 24 times by 3 tests: return d->paintDevice;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
24
2096}-
2097-
2098bool QGLContext::deviceIsPixmap() const-
2099{-
2100 const QGLContextPrivate * const d = d_func();-
2101 return
never executed: return !d->readback_target_size.isEmpty();
!d->readback_target_size.isEmpty();
never executed: return !d->readback_target_size.isEmpty();
0
2102}-
2103-
2104-
2105bool QGLContext::windowCreated() const-
2106{-
2107 const QGLContextPrivate * const d = d_func();-
2108 return
never executed: return d->crWin;
d->crWin;
never executed: return d->crWin;
0
2109}-
2110-
2111-
2112void QGLContext::setWindowCreated(bool on)-
2113{-
2114 QGLContextPrivate * const d = d_func();-
2115 d->crWin = on;-
2116}
never executed: end of block
0
2117-
2118bool QGLContext::initialized() const-
2119{-
2120 const QGLContextPrivate * const d = d_func();-
2121 return
never executed: return d->initDone;
d->initDone;
never executed: return d->initDone;
0
2122}-
2123-
2124void QGLContext::setInitialized(bool on)-
2125{-
2126 QGLContextPrivate * const d = d_func();-
2127 d->initDone = on;-
2128}
never executed: end of block
0
2129-
2130const QGLContext* QGLContext::currentContext()-
2131{-
2132 if (const
const QOpenGLC...rrentContext()Description
TRUEevaluated 70 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
QOpenGLContext *threadContext = QOpenGLContext::currentContext()
const QOpenGLC...rrentContext()Description
TRUEevaluated 70 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) {
0-70
2133 return
executed 70 times by 3 tests: return QGLContext::fromOpenGLContext(const_cast<QOpenGLContext *>(threadContext));
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
QGLContext::fromOpenGLContext(const_cast<QOpenGLContext *>(threadContext));
executed 70 times by 3 tests: return QGLContext::fromOpenGLContext(const_cast<QOpenGLContext *>(threadContext));
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
70
2134 }-
2135 return
never executed: return 0;
0;
never executed: return 0;
0
2136}-
2137-
2138void QGLContextPrivate::setCurrentContext(QGLContext *context)-
2139{-
2140 (void)context;;-
2141}
never executed: end of block
0
2142-
2143-
2144-
2145-
2146-
2147-
2148-
2149void QGLContext::moveToThread(QThread *thread)-
2150{-
2151 QGLContextPrivate * const d = d_func();-
2152 if (d->guiGlContext
d->guiGlContextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2153 d->guiGlContext->moveToThread(thread);
never executed: d->guiGlContext->moveToThread(thread);
0
2154}
never executed: end of block
0
2155bool QGLContext::chooseContext(const QGLContext* shareContext)-
2156{-
2157 QGLContextPrivate * const d = d_func();-
2158 if(!d->paintDevice
!d->paintDeviceDescription
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
|| d->paintDevice->devType() != QInternal::Widget
d->paintDevice...ternal::WidgetDescription
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
2159-
2160-
2161-
2162 d->valid = false;-
2163 }
never executed: end of block
else {
0
2164 QWidget *widget = static_cast<QWidget *>(d->paintDevice);-
2165 QGLFormat glformat = format();-
2166 QSurfaceFormat winFormat = QGLFormat::toSurfaceFormat(glformat);-
2167 if (widget->testAttribute(Qt::WA_TranslucentBackground)
widget->testAt...entBackground)Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
2168 winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
never executed: winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
0
2169-
2170 QWindow *window = widget->windowHandle();-
2171 if (!window->handle()
!window->handle()Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
0-12
2172 || window->surfaceType() != QWindow::OpenGLSurface
window->surfac...:OpenGLSurfaceDescription
TRUEnever evaluated
FALSEnever evaluated
0
2173 || window->requestedFormat() != winFormat
window->reques...) != winFormatDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2174 {-
2175 window->setSurfaceType(QWindow::OpenGLSurface);-
2176 window->setFormat(winFormat);-
2177 window->destroy();-
2178 window->create();-
2179 }
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2180-
2181 if (d->ownContext
d->ownContextDescription
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
2182 delete d->guiGlContext;
never executed: delete d->guiGlContext;
0
2183 d->ownContext = true;-
2184 QOpenGLContext *shareGlContext = shareContext
shareContextDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglbuffer - unknown status
FALSEevaluated 11 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
? shareContext->d_func()->guiGlContext : 0;
1-11
2185 d->guiGlContext = new QOpenGLContext;-
2186 d->guiGlContext->setFormat(winFormat);-
2187 d->guiGlContext->setShareContext(shareGlContext);-
2188 d->valid = d->guiGlContext->create();-
2189-
2190 if (d->valid
d->validDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
2191 d->guiGlContext->setQGLContextHandle(this, 0);
executed 12 times by 3 tests: d->guiGlContext->setQGLContextHandle(this, 0);
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2192-
2193 d->glFormat = QGLFormat::fromSurfaceFormat(d->guiGlContext->format());-
2194 d->setupSharing();-
2195 }
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2196-
2197-
2198 return
executed 12 times by 3 tests: return d->valid;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
d->valid;
executed 12 times by 3 tests: return d->valid;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2199}-
2200void QGLContext::reset()-
2201{-
2202 QGLContextPrivate * const d = d_func();-
2203 if (!d->valid
!d->validDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
12
2204 return;
executed 12 times by 3 tests: return;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2205 d->cleanup();-
2206-
2207 d->crWin = false;-
2208 d->sharing = false;-
2209 d->valid = false;-
2210 d->transpColor = QColor();-
2211 d->initDone = false;-
2212 QGLContextGroup::removeShare(this);-
2213 if (d->guiGlContext
d->guiGlContextDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) {
0-12
2214 if (QOpenGLContext::currentContext() == d->guiGlContext
QOpenGLContext...->guiGlContextDescription
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglbuffer - unknown status
)
1-11
2215 doneCurrent();
executed 11 times by 3 tests: doneCurrent();
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
11
2216 if (d->ownContext
d->ownContextDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) {
0-12
2217 if (d->guiGlContext->thread() == QThread::currentThread()
d->guiGlContex...urrentThread()Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
2218 delete d->guiGlContext;
executed 12 times by 3 tests: delete d->guiGlContext;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2219 else-
2220 d->guiGlContext->deleteLater();
never executed: d->guiGlContext->deleteLater();
0
2221 } else-
2222 d->guiGlContext->setQGLContextHandle(0,0);
never executed: d->guiGlContext->setQGLContextHandle(0,0);
0
2223 d->guiGlContext = 0;-
2224 }
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2225 d->ownContext = false;-
2226}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2227void QGLContext::makeCurrent()-
2228{-
2229 QGLContextPrivate * const d = d_func();-
2230 if (!d->paintDevice
!d->paintDeviceDescription
TRUEnever evaluated
FALSEevaluated 15 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
|| d->paintDevice->devType() != QInternal::Widget
d->paintDevice...ternal::WidgetDescription
TRUEnever evaluated
FALSEevaluated 15 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-15
2231 return;
never executed: return;
0
2232-
2233 QWidget *widget = static_cast<QWidget *>(d->paintDevice);-
2234 if (!widget->windowHandle()
!widget->windowHandle()Description
TRUEnever evaluated
FALSEevaluated 15 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-15
2235 return;
never executed: return;
0
2236-
2237 if (d->guiGlContext->makeCurrent(widget->windowHandle())
d->guiGlContex...indowHandle())Description
TRUEevaluated 15 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) {
0-15
2238 if (!d->workaroundsCached
!d->workaroundsCachedDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qmdiarea - unknown status
) {
3-12
2239 d->workaroundsCached = true;-
2240 const char *renderer = reinterpret_cast<const char *>(d->guiGlContext->functions()->glGetString(0x1F01));-
2241 if (renderer
rendererDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
&& strstr(renderer, "Mali")
strstr(renderer, "Mali")Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
2242 d->workaround_brokenFBOReadBack = true;-
2243 }
never executed: end of block
0
2244 }
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2245 }
executed 15 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
15
2246}
executed 15 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
15
2247-
2248-
2249-
2250-
2251-
2252-
2253-
2254void QGLContext::swapBuffers() const-
2255{-
2256 const QGLContextPrivate * const d = d_func();-
2257 if (!d->paintDevice
!d->paintDeviceDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
|| d->paintDevice->devType() != QInternal::Widget
d->paintDevice...ternal::WidgetDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
)
0-3
2258 return;
never executed: return;
0
2259-
2260 QWidget *widget = static_cast<QWidget *>(d->paintDevice);-
2261 if (!widget->windowHandle()
!widget->windowHandle()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
)
0-3
2262 return;
never executed: return;
0
2263-
2264 d->guiGlContext->swapBuffers(widget->windowHandle());-
2265}
executed 3 times by 1 test: end of block
Executed by:
  • tst_qmdiarea - unknown status
3
2266-
2267-
2268-
2269-
2270-
2271-
2272-
2273void QGLContext::doneCurrent()-
2274{-
2275 QGLContextPrivate * const d = d_func();-
2276 d->guiGlContext->doneCurrent();-
2277}
executed 11 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
11
2278QGLWidget::QGLWidget(QWidget *parent, const QGLWidget* shareWidget, Qt::WindowFlags f)-
2279 : QWidget(*(new QGLWidgetPrivate), parent, f | Qt::MSWindowsOwnDC)-
2280{-
2281 QGLWidgetPrivate * const d = d_func();-
2282 setAttribute(Qt::WA_PaintOnScreen);-
2283 setAttribute(Qt::WA_NoSystemBackground);-
2284 setAutoFillBackground(true);-
2285 d->init(new QGLContext(QGLFormat::defaultFormat(), this), shareWidget);-
2286}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2287-
2288-
2289-
2290-
2291QGLWidget::QGLWidget(QGLWidgetPrivate &dd, const QGLFormat &format, QWidget *parent, const QGLWidget *shareWidget, Qt::WindowFlags f)-
2292 : QWidget(dd, parent, f | Qt::MSWindowsOwnDC)-
2293{-
2294 QGLWidgetPrivate * const d = d_func();-
2295 setAttribute(Qt::WA_PaintOnScreen);-
2296 setAttribute(Qt::WA_NoSystemBackground);-
2297 setAutoFillBackground(true);-
2298 d->init(new QGLContext(format, this), shareWidget);-
2299-
2300}
never executed: end of block
0
2301QGLWidget::QGLWidget(const QGLFormat &format, QWidget *parent, const QGLWidget* shareWidget,-
2302 Qt::WindowFlags f)-
2303 : QWidget(*(new QGLWidgetPrivate), parent, f | Qt::MSWindowsOwnDC)-
2304{-
2305 QGLWidgetPrivate * const d = d_func();-
2306 setAttribute(Qt::WA_PaintOnScreen);-
2307 setAttribute(Qt::WA_NoSystemBackground);-
2308 setAutoFillBackground(true);-
2309 d->init(new QGLContext(format, this), shareWidget);-
2310}
never executed: end of block
0
2311QGLWidget::QGLWidget(QGLContext *context, QWidget *parent, const QGLWidget *shareWidget,-
2312 Qt::WindowFlags f)-
2313 : QWidget(*(new QGLWidgetPrivate), parent, f | Qt::MSWindowsOwnDC)-
2314{-
2315 QGLWidgetPrivate * const d = d_func();-
2316 setAttribute(Qt::WA_PaintOnScreen);-
2317 setAttribute(Qt::WA_NoSystemBackground);-
2318 setAutoFillBackground(true);-
2319 d->init(context, shareWidget);-
2320}
never executed: end of block
0
2321-
2322-
2323-
2324-
2325-
2326QGLWidget::~QGLWidget()-
2327{-
2328 QGLWidgetPrivate * const d = d_func();-
2329 delete d->glcx;-
2330 d->glcx = 0;-
2331 d->cleanupColormaps();-
2332}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2333QFunctionPointer QGLContext::getProcAddress(const QString &procName) const-
2334{-
2335 const QGLContextPrivate * const d = d_func();-
2336 return
never executed: return d->guiGlContext->getProcAddress(procName.toLatin1());
d->guiGlContext->getProcAddress(procName.toLatin1());
never executed: return d->guiGlContext->getProcAddress(procName.toLatin1());
0
2337}-
2338bool QGLWidget::isValid() const-
2339{-
2340 const QGLWidgetPrivate * const d = d_func();-
2341 return
executed 3 times by 1 test: return d->glcx && d->glcx->isValid();
Executed by:
  • tst_qglfunctions - unknown status
d->glcx && d->glcx->isValid();
executed 3 times by 1 test: return d->glcx && d->glcx->isValid();
Executed by:
  • tst_qglfunctions - unknown status
3
2342}-
2343bool QGLWidget::isSharing() const-
2344{-
2345 const QGLWidgetPrivate * const d = d_func();-
2346 return
executed 1 time by 1 test: return d->glcx->isSharing();
Executed by:
  • tst_qglbuffer - unknown status
d->glcx->isSharing();
executed 1 time by 1 test: return d->glcx->isSharing();
Executed by:
  • tst_qglbuffer - unknown status
1
2347}-
2348void QGLWidget::makeCurrent()-
2349{-
2350 QGLWidgetPrivate * const d = d_func();-
2351 d->glcx->makeCurrent();-
2352}
executed 12 times by 2 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
12
2353void QGLWidget::doneCurrent()-
2354{-
2355 QGLWidgetPrivate * const d = d_func();-
2356 d->glcx->doneCurrent();-
2357}
never executed: end of block
0
2358void QGLWidget::swapBuffers()-
2359{-
2360 QGLWidgetPrivate * const d = d_func();-
2361 d->glcx->swapBuffers();-
2362}
executed 3 times by 1 test: end of block
Executed by:
  • tst_qmdiarea - unknown status
3
2363const QGLContext* QGLWidget::overlayContext() const-
2364{-
2365 return
never executed: return 0;
0;
never executed: return 0;
0
2366}-
2367void QGLWidget::makeOverlayCurrent()-
2368{-
2369}-
2370void QGLWidget::setFormat(const QGLFormat &format)-
2371{-
2372 setContext(new QGLContext(format,this));-
2373}
never executed: end of block
0
2374void QGLWidget::setContext(QGLContext *context,-
2375 const QGLContext* shareContext,-
2376 bool deleteOldContext)-
2377{-
2378 QGLWidgetPrivate * const d = d_func();-
2379 if (context == 0
context == 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
) {
0-12
2380 QMessageLogger(__FILE__, 4232, __PRETTY_FUNCTION__).warning("QGLWidget::setContext: Cannot set null context");-
2381 return;
never executed: return;
0
2382 }-
2383-
2384 if (context->device() == 0
context->device() == 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
2385 context->setDevice(this);
never executed: context->setDevice(this);
0
2386-
2387 QGLContext* oldcx = d->glcx;-
2388 d->glcx = context;-
2389-
2390 if (!d->glcx->isValid()
!d->glcx->isValid()Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
2391 d->glcx->create(shareContext ? shareContext : oldcx);
executed 12 times by 3 tests: d->glcx->create(shareContext ? shareContext : oldcx);
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2392-
2393 if (deleteOldContext
deleteOldContextDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
)
0-12
2394 delete oldcx;
executed 12 times by 3 tests: delete oldcx;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2395}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2396-
2397-
2398-
2399-
2400-
2401-
2402-
2403void QGLWidget::updateGL()-
2404{-
2405 QGLWidgetPrivate * const d = d_func();-
2406 const bool targetIsOffscreen = !d->glcx->d_ptr->readback_target_size.isEmpty();-
2407 if (updatesEnabled()
updatesEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
&& (testAttribute(Qt::WA_Mapped)
testAttribute(Qt::WA_Mapped)Description
TRUEnever evaluated
FALSEnever evaluated
|| targetIsOffscreen
targetIsOffscreenDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
2408 glDraw();
never executed: glDraw();
0
2409}
never executed: end of block
0
2410void QGLWidget::updateOverlayGL()-
2411{-
2412}-
2413void QGLWidget::initializeGL()-
2414{-
2415}-
2416void QGLWidget::paintGL()-
2417{-
2418 qgl_functions()->glClear(0x00004000 | 0x00000100);-
2419}
never executed: end of block
0
2420void QGLWidget::resizeGL(int, int)-
2421{-
2422}-
2423void QGLWidget::initializeOverlayGL()-
2424{-
2425}-
2426void QGLWidget::paintOverlayGL()-
2427{-
2428}-
2429void QGLWidget::resizeOverlayGL(int, int)-
2430{-
2431}-
2432-
2433-
2434-
2435bool QGLWidget::event(QEvent *e)-
2436{-
2437 QGLWidgetPrivate * const d = d_func();-
2438-
2439-
2440 if (e->type() == QEvent::ParentAboutToChange
e->type() == Q...tAboutToChangeDescription
TRUEnever evaluated
FALSEevaluated 29 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-29
2441 d->parent_changing = true;
never executed: d->parent_changing = true;
0
2442-
2443 if (e->type() == QEvent::ParentChange
e->type() == Q...::ParentChangeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEevaluated 28 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
1-28
2444 d->parent_changing = false;
executed 1 time by 1 test: d->parent_changing = false;
Executed by:
  • tst_qmdiarea - unknown status
1
2445-
2446 return
executed 29 times by 3 tests: return QWidget::event(e);
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
QWidget::event(e);
executed 29 times by 3 tests: return QWidget::event(e);
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
29
2447}-
2448void QGLWidget::paintEvent(QPaintEvent *)-
2449{-
2450 if (updatesEnabled()
updatesEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2451 glDraw();-
2452 updateOverlayGL();-
2453 }
never executed: end of block
0
2454}
never executed: end of block
0
2455void QGLWidget::resizeEvent(QResizeEvent *e)-
2456{-
2457 QGLWidgetPrivate * const d = d_func();-
2458-
2459 QWidget::resizeEvent(e);-
2460 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2461 return;
never executed: return;
0
2462 makeCurrent();-
2463 if (!d->glcx->initialized()
!d->glcx->initialized()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2464 glInit();
never executed: glInit();
0
2465 const qreal scaleFactor = (window()
window()Description
TRUEnever evaluated
FALSEnever evaluated
&& window()->windowHandle()
window()->windowHandle()Description
TRUEnever evaluated
FALSEnever evaluated
) ?
0
2466 window()->windowHandle()->devicePixelRatio() : 1.0;-
2467-
2468 resizeGL(width() * scaleFactor, height() * scaleFactor);-
2469}
never executed: end of block
0
2470QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext)-
2471{-
2472 (void)useContext;;-
2473 QGLWidgetPrivate * const d = d_func();-
2474-
2475 QSize sz = size();-
2476 if ((
(w > 0)Description
TRUEnever evaluated
FALSEnever evaluated
w > 0)
(w > 0)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(h > 0)Description
TRUEnever evaluated
FALSEnever evaluated
h > 0)
(h > 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2477 sz = QSize(w, h);
never executed: sz = QSize(w, h);
0
2478-
2479 QPixmap pm;-
2480 if (d->glcx->isValid()
d->glcx->isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2481 d->glcx->makeCurrent();-
2482 QGLFramebufferObject fbo(sz, QGLFramebufferObject::CombinedDepthStencil);-
2483 fbo.bind();-
2484 d->glcx->setInitialized(false);-
2485 uint prevDefaultFbo = d->glcx->d_ptr->default_fbo;-
2486 d->glcx->d_ptr->default_fbo = fbo.handle();-
2487 d->glcx->d_ptr->readback_target_size = sz;-
2488 updateGL();-
2489 fbo.release();-
2490 pm = QPixmap::fromImage(fbo.toImage());-
2491 d->glcx->d_ptr->default_fbo = prevDefaultFbo;-
2492 d->glcx->setInitialized(false);-
2493 d->glcx->d_ptr->readback_target_size = QSize();-
2494 }
never executed: end of block
0
2495-
2496 return
never executed: return pm;
pm;
never executed: return pm;
0
2497}-
2498QImage QGLWidget::grabFrameBuffer(bool withAlpha)-
2499{-
2500 makeCurrent();-
2501 QImage res;-
2502 qreal pixelRatio = devicePixelRatioF();-
2503 int w = pixelRatio * width();-
2504 int h = pixelRatio * height();-
2505 if (format().rgba()
format().rgba()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2506 res = qt_gl_read_frame_buffer(QSize(w, h), format().alpha(), withAlpha);
never executed: res = qt_gl_read_frame_buffer(QSize(w, h), format().alpha(), withAlpha);
0
2507 res.setDevicePixelRatio(pixelRatio);-
2508 return
never executed: return res;
res;
never executed: return res;
0
2509}-
2510void QGLWidget::glInit()-
2511{-
2512 QGLWidgetPrivate * const d = d_func();-
2513 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2514 return;
never executed: return;
0
2515 makeCurrent();-
2516 initializeGL();-
2517 d->glcx->setInitialized(true);-
2518}
never executed: end of block
0
2519void QGLWidget::glDraw()-
2520{-
2521 QGLWidgetPrivate * const d = d_func();-
2522 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2523 return;
never executed: return;
0
2524 makeCurrent();-
2525-
2526 if (d->glcx->deviceIsPixmap()
d->glcx->deviceIsPixmap()Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->glcx->contextHandle()->isOpenGLES()
!d->glcx->cont...->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2527 qgl1_functions()->glDrawBuffer(0x0404);
never executed: qgl1_functions()->glDrawBuffer(0x0404);
0
2528-
2529 QSize readback_target_size = d->glcx->d_ptr->readback_target_size;-
2530 if (!d->glcx->initialized()
!d->glcx->initialized()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2531 glInit();-
2532 const qreal scaleFactor = (window()
window()Description
TRUEnever evaluated
FALSEnever evaluated
&& window()->windowHandle()
window()->windowHandle()Description
TRUEnever evaluated
FALSEnever evaluated
) ?
0
2533 window()->windowHandle()->devicePixelRatio() : 1.0;-
2534 int w, h;-
2535 if (readback_target_size.isEmpty()
readback_target_size.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2536 w = d->glcx->device()->width() * scaleFactor;-
2537 h = d->glcx->device()->height() * scaleFactor;-
2538 }
never executed: end of block
else {
0
2539 w = readback_target_size.width();-
2540 h = readback_target_size.height();-
2541 }
never executed: end of block
0
2542 resizeGL(w, h);-
2543 }
never executed: end of block
0
2544 paintGL();-
2545 if (doubleBuffer()
doubleBuffer()Description
TRUEnever evaluated
FALSEnever evaluated
&& readback_target_size.isEmpty()
readback_target_size.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2546 if (d->autoSwap
d->autoSwapDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2547 swapBuffers();
never executed: swapBuffers();
0
2548 }
never executed: end of block
else {
0
2549 qgl_functions()->glFlush();-
2550 }
never executed: end of block
0
2551}-
2552void QGLWidget::qglColor(const QColor& c) const-
2553{-
2554-
2555-
2556-
2557-
2558 const QGLWidgetPrivate * const d = d_func();-
2559 const QGLContext *ctx = QGLContext::currentContext();-
2560 if (ctx
ctxDescription
TRUEnever evaluated
FALSEnever evaluated
&& !ctx->contextHandle()->isOpenGLES()
!ctx->contextH...->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2561 if (ctx->format().rgba()
ctx->format().rgba()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2562 qgl1_functions()->glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF());
never executed: qgl1_functions()->glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF());
0
2563 else if (!d->cmap.isEmpty()
!d->cmap.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2564 int i = d->cmap.find(c.rgb());-
2565 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2566 i = d->cmap.findNearest(c.rgb());
never executed: i = d->cmap.findNearest(c.rgb());
0
2567 qgl1_functions()->glIndexi(i);-
2568 }
never executed: end of block
else
0
2569 qgl1_functions()->glIndexi(ctx->colorIndex(c));
never executed: qgl1_functions()->glIndexi(ctx->colorIndex(c));
0
2570 }-
2571-
2572-
2573-
2574-
2575}
never executed: end of block
0
2576void QGLWidget::qglClearColor(const QColor& c) const-
2577{-
2578-
2579-
2580-
2581 const QGLWidgetPrivate * const d = d_func();-
2582 const QGLContext *ctx = QGLContext::currentContext();-
2583 if (ctx
ctxDescription
TRUEnever evaluated
FALSEnever evaluated
&& !ctx->contextHandle()->isOpenGLES()
!ctx->contextH...->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2584 if (ctx->format().rgba()
ctx->format().rgba()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2585 qgl_functions()->glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF());
never executed: qgl_functions()->glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF());
0
2586 else if (!d->cmap.isEmpty()
!d->cmap.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2587 int i = d->cmap.find(c.rgb());-
2588 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2589 i = d->cmap.findNearest(c.rgb());
never executed: i = d->cmap.findNearest(c.rgb());
0
2590 qgl1_functions()->glClearIndex(i);-
2591 }
never executed: end of block
else {
0
2592 qgl1_functions()->glClearIndex(ctx->colorIndex(c));-
2593 }
never executed: end of block
0
2594 } else {-
2595 qgl_functions()->glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF());-
2596 }
never executed: end of block
0
2597-
2598}-
2599QImage QGLWidget::convertToGLFormat(const QImage& img)-
2600{-
2601 QImage res(img.size(), QImage::Format_ARGB32);-
2602 convertToGLFormatHelper(res, img.convertToFormat(QImage::Format_ARGB32), 0x1908);-
2603 return
never executed: return res;
res;
never executed: return res;
0
2604}-
2605const QGLColormap & QGLWidget::colormap() const-
2606{-
2607 const QGLWidgetPrivate * const d = d_func();-
2608 return
never executed: return d->cmap;
d->cmap;
never executed: return d->cmap;
0
2609}-
2610void QGLWidget::setColormap(const QGLColormap & c)-
2611{-
2612 (void)c;;-
2613}
never executed: end of block
0
2614-
2615-
2616-
2617static void qt_save_gl_state()-
2618{-
2619 QOpenGLFunctions *funcs = qgl_functions();-
2620 QOpenGLFunctions_1_1 *gl1funcs = qgl1_functions();-
2621-
2622 gl1funcs->glPushClientAttrib(0xFFFFFFFF);-
2623 gl1funcs->glPushAttrib(0xFFFFFFFF);-
2624 gl1funcs->glMatrixMode(0x1702);-
2625 gl1funcs->glPushMatrix();-
2626 gl1funcs->glLoadIdentity();-
2627 gl1funcs->glMatrixMode(0x1701);-
2628 gl1funcs->glPushMatrix();-
2629 gl1funcs->glMatrixMode(0x1700);-
2630 gl1funcs->glPushMatrix();-
2631-
2632 gl1funcs->glShadeModel(0x1D00);-
2633 funcs->glDisable(0x0B44);-
2634 funcs->glDisable(0x0B50);-
2635 funcs->glDisable(0x0B90);-
2636 funcs->glDisable(0x0B71);-
2637 funcs->glEnable(0x0BE2);-
2638 funcs->glBlendFunc(1, 0x0303);-
2639}
never executed: end of block
0
2640-
2641static void qt_restore_gl_state()-
2642{-
2643 QOpenGLFunctions_1_1 *gl1funcs = qgl1_functions();-
2644-
2645 gl1funcs->glMatrixMode(0x1702);-
2646 gl1funcs->glPopMatrix();-
2647 gl1funcs->glMatrixMode(0x1701);-
2648 gl1funcs->glPopMatrix();-
2649 gl1funcs->glMatrixMode(0x1700);-
2650 gl1funcs->glPopMatrix();-
2651 gl1funcs->glPopAttrib();-
2652 gl1funcs->glPopClientAttrib();-
2653}
never executed: end of block
0
2654-
2655static void qt_gl_draw_text(QPainter *p, int x, int y, const QString &str,-
2656 const QFont &font)-
2657{-
2658 GLfloat color[4];-
2659 qgl_functions()->glGetFloatv(0x0B00, &color[0]);-
2660-
2661 QColor col;-
2662 col.setRgbF(color[0], color[1], color[2],color[3]);-
2663 QPen old_pen = p->pen();-
2664 QFont old_font = p->font();-
2665-
2666 p->setPen(col);-
2667 p->setFont(font);-
2668 p->drawText(x, y, str);-
2669-
2670 p->setPen(old_pen);-
2671 p->setFont(old_font);-
2672}
never executed: end of block
0
2673void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font)-
2674{-
2675-
2676 QGLWidgetPrivate * const d = d_func();-
2677 if (!d->glcx->contextHandle()->isOpenGLES()
!d->glcx->cont...->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2678 QGLWidgetPrivate * const d = d_func();-
2679 if (str.isEmpty()
str.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2680 return;
never executed: return;
0
2681-
2682 QOpenGLFunctions *funcs = qgl_functions();-
2683 GLint view[4];-
2684 bool use_scissor_testing = funcs->glIsEnabled(0x0C11);-
2685 if (!use_scissor_testing
!use_scissor_testingDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2686 funcs->glGetIntegerv(0x0BA2, &view[0]);
never executed: funcs->glGetIntegerv(0x0BA2, &view[0]);
0
2687 int width = d->glcx->device()->width();-
2688 int height = d->glcx->device()->height();-
2689 bool auto_swap = autoBufferSwap();-
2690-
2691 QPaintEngine *engine = paintEngine();-
2692-
2693 qt_save_gl_state();-
2694-
2695 QPainter *p;-
2696 bool reuse_painter = false;-
2697 if (engine->isActive()
engine->isActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2698 reuse_painter = true;-
2699 p = engine->painter();-
2700-
2701 funcs->glDisable(0x0B71);-
2702 funcs->glViewport(0, 0, width, height);-
2703 }
never executed: end of block
else {
0
2704 setAutoBufferSwap(false);-
2705-
2706 d->disable_clear_on_painter_begin = true;-
2707 p = new QPainter(this);-
2708 }
never executed: end of block
0
2709-
2710 QRect viewport(view[0], view[1], view[2], view[3]);-
2711 if (!use_scissor_testing
!use_scissor_testingDescription
TRUEnever evaluated
FALSEnever evaluated
&& viewport != rect()
viewport != rect()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2712-
2713-
2714 funcs->glScissor(view[0], view[1], view[2], view[3]);-
2715 funcs->glEnable(0x0C11);-
2716 }
never executed: end of block
else if (use_scissor_testing
use_scissor_testingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2717-
2718 funcs->glEnable(0x0C11);-
2719 }
never executed: end of block
0
2720-
2721 qt_gl_draw_text(p, x, y, str, font);-
2722-
2723 if (!reuse_painter
!reuse_painterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2724 p->end();-
2725 delete p;-
2726 setAutoBufferSwap(auto_swap);-
2727 d->disable_clear_on_painter_begin = false;-
2728 }
never executed: end of block
0
2729-
2730 qt_restore_gl_state();-
2731-
2732 return;
never executed: return;
0
2733 }-
2734-
2735-
2736-
2737-
2738-
2739-
2740 QMessageLogger(__FILE__, 4887, __PRETTY_FUNCTION__).warning("QGLWidget::renderText is not supported under OpenGL/ES");-
2741}
never executed: end of block
0
2742void QGLWidget::renderText(double x, double y, double z, const QString &str, const QFont &font)-
2743{-
2744-
2745 QGLWidgetPrivate * const d = d_func();-
2746 if (!d->glcx->contextHandle()->isOpenGLES()
!d->glcx->cont...->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2747 QGLWidgetPrivate * const d = d_func();-
2748 if (str.isEmpty()
str.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2749 return;
never executed: return;
0
2750-
2751 QOpenGLFunctions *funcs = qgl_functions();-
2752 bool auto_swap = autoBufferSwap();-
2753-
2754 int width = d->glcx->device()->width();-
2755 int height = d->glcx->device()->height();-
2756 GLdouble model[4 * 4], proj[4 * 4];-
2757 GLint view[4];-
2758 QOpenGLFunctions_1_1 *gl1funcs = qgl1_functions();-
2759 gl1funcs->glGetDoublev(0x0BA6, &model[0]);-
2760 gl1funcs->glGetDoublev(0x0BA7, &proj[0]);-
2761 funcs->glGetIntegerv(0x0BA2, &view[0]);-
2762 GLdouble win_x = 0, win_y = 0, win_z = 0;-
2763 qgluProject(x, y, z, &model[0], &proj[0], &view[0],-
2764 &win_x, &win_y, &win_z);-
2765 const int dpr = d->glcx->device()->devicePixelRatioF();-
2766 win_x /= dpr;-
2767 win_y /= dpr;-
2768 win_y = height - win_y;-
2769-
2770 QPaintEngine *engine = paintEngine();-
2771-
2772 QPainter *p;-
2773 bool reuse_painter = false;-
2774 bool use_depth_testing = funcs->glIsEnabled(0x0B71);-
2775 bool use_scissor_testing = funcs->glIsEnabled(0x0C11);-
2776-
2777 qt_save_gl_state();-
2778-
2779 if (engine->isActive()
engine->isActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2780 reuse_painter = true;-
2781 p = engine->painter();-
2782 }
never executed: end of block
else {
0
2783 setAutoBufferSwap(false);-
2784-
2785 d->disable_clear_on_painter_begin = true;-
2786 p = new QPainter(this);-
2787 }
never executed: end of block
0
2788-
2789 QRect viewport(view[0], view[1], view[2], view[3]);-
2790 if (!use_scissor_testing
!use_scissor_testingDescription
TRUEnever evaluated
FALSEnever evaluated
&& viewport != rect()
viewport != rect()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2791 funcs->glScissor(view[0], view[1], view[2], view[3]);-
2792 funcs->glEnable(0x0C11);-
2793 }
never executed: end of block
else if (use_scissor_testing
use_scissor_testingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2794 funcs->glEnable(0x0C11);-
2795 }
never executed: end of block
0
2796 funcs->glViewport(0, 0, width * dpr, height * dpr);-
2797 gl1funcs->glAlphaFunc(0x0204, 0.0);-
2798 funcs->glEnable(0x0BC0);-
2799 if (use_depth_testing
use_depth_testingDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2800 funcs->glEnable(0x0B71);
never executed: funcs->glEnable(0x0B71);
0
2801-
2802-
2803-
2804-
2805 static_cast<QGL2PaintEngineEx *>(p->paintEngine())->setTranslateZ(-win_z);-
2806-
2807 qt_gl_draw_text(p, qRound(win_x), qRound(win_y), str, font);-
2808-
2809 static_cast<QGL2PaintEngineEx *>(p->paintEngine())->setTranslateZ(0);-
2810-
2811 if (!reuse_painter
!reuse_painterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2812 p->end();-
2813 delete p;-
2814 setAutoBufferSwap(auto_swap);-
2815 d->disable_clear_on_painter_begin = false;-
2816 }
never executed: end of block
0
2817-
2818 qt_restore_gl_state();-
2819-
2820 return;
never executed: return;
0
2821 }-
2822-
2823-
2824-
2825-
2826-
2827-
2828-
2829 QMessageLogger(__FILE__, 4996, __PRETTY_FUNCTION__).warning("QGLWidget::renderText is not supported under OpenGL/ES");-
2830}
never executed: end of block
0
2831-
2832QGLFormat QGLWidget::format() const-
2833{-
2834 const QGLWidgetPrivate * const d = d_func();-
2835 return
never executed: return d->glcx->format();
d->glcx->format();
never executed: return d->glcx->format();
0
2836}-
2837-
2838QGLContext *QGLWidget::context() const-
2839{-
2840 const QGLWidgetPrivate * const d = d_func();-
2841 return
executed 56 times by 2 tests: return d->glcx;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qmdiarea - unknown status
d->glcx;
executed 56 times by 2 tests: return d->glcx;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qmdiarea - unknown status
56
2842}-
2843-
2844bool QGLWidget::doubleBuffer() const-
2845{-
2846 const QGLWidgetPrivate * const d = d_func();-
2847 return
never executed: return d->glcx->d_ptr->glFormat.testOption(QGL::DoubleBuffer);
d->glcx->d_ptr->glFormat.testOption(QGL::DoubleBuffer);
never executed: return d->glcx->d_ptr->glFormat.testOption(QGL::DoubleBuffer);
0
2848}-
2849-
2850void QGLWidget::setAutoBufferSwap(bool on)-
2851{-
2852 QGLWidgetPrivate * const d = d_func();-
2853 d->autoSwap = on;-
2854}
never executed: end of block
0
2855-
2856bool QGLWidget::autoBufferSwap() const-
2857{-
2858 const QGLWidgetPrivate * const d = d_func();-
2859 return
executed 3 times by 1 test: return d->autoSwap;
Executed by:
  • tst_qmdiarea - unknown status
d->autoSwap;
executed 3 times by 1 test: return d->autoSwap;
Executed by:
  • tst_qmdiarea - unknown status
3
2860}-
2861-
2862-
2863-
2864-
2865-
2866-
2867-
2868GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format)-
2869{-
2870 if (image.isNull()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2871 return
never executed: return 0;
0;
never executed: return 0;
0
2872-
2873 QGLWidgetPrivate * const d = d_func();-
2874 return
never executed: return d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption);
d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption);
never executed: return d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption);
0
2875}-
2876GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options)-
2877{-
2878 if (image.isNull()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2879 return
never executed: return 0;
0;
never executed: return 0;
0
2880-
2881 QGLWidgetPrivate * const d = d_func();-
2882 return
never executed: return d->glcx->bindTexture(image, target, format, options);
d->glcx->bindTexture(image, target, format, options);
never executed: return d->glcx->bindTexture(image, target, format, options);
0
2883}-
2884GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format)-
2885{-
2886 if (pixmap.isNull()
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2887 return
never executed: return 0;
0;
never executed: return 0;
0
2888-
2889 QGLWidgetPrivate * const d = d_func();-
2890 return
never executed: return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption);
d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption);
never executed: return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption);
0
2891}-
2892GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format,-
2893 QGLContext::BindOptions options)-
2894{-
2895 QGLWidgetPrivate * const d = d_func();-
2896 return
never executed: return d->glcx->bindTexture(pixmap, target, format, options);
d->glcx->bindTexture(pixmap, target, format, options);
never executed: return d->glcx->bindTexture(pixmap, target, format, options);
0
2897}-
2898-
2899-
2900-
2901-
2902-
2903-
2904-
2905GLuint QGLWidget::bindTexture(const QString &fileName)-
2906{-
2907 QGLWidgetPrivate * const d = d_func();-
2908 return
never executed: return d->glcx->bindTexture(fileName);
d->glcx->bindTexture(fileName);
never executed: return d->glcx->bindTexture(fileName);
0
2909}-
2910-
2911-
2912-
2913-
2914-
2915-
2916-
2917void QGLWidget::deleteTexture(GLuint id)-
2918{-
2919 QGLWidgetPrivate * const d = d_func();-
2920 d->glcx->deleteTexture(id);-
2921}
never executed: end of block
0
2922void QGLWidget::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget)-
2923{-
2924 QGLWidgetPrivate * const d = d_func();-
2925 d->glcx->drawTexture(target, textureId, textureTarget);-
2926}
never executed: end of block
0
2927void QGLWidget::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget)-
2928{-
2929 QGLWidgetPrivate * const d = d_func();-
2930 d->glcx->drawTexture(point, textureId, textureTarget);-
2931}
never executed: end of block
0
2932-
2933namespace { namespace Q_QGS_qt_gl_2_engine { typedef QGLEngineThreadStorage<QGL2PaintEngineEx> Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qmdiarea - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 1 time by 1 test: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qmdiarea - unknown status
}
executed 1 time by 1 test: end of block
Executed by:
  • tst_qmdiarea - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 15 times by 1 test: return &holder.value;
Executed by:
  • tst_qmdiarea - unknown status
&holder.value;
executed 15 times by 1 test: return &holder.value;
Executed by:
  • tst_qmdiarea - unknown status
} } } static QGlobalStatic<QGLEngineThreadStorage<QGL2PaintEngineEx>, Q_QGS_qt_gl_2_engine::innerFunction, Q_QGS_qt_gl_2_engine::guard> qt_gl_2_engine;
0-15
2934-
2935__attribute__((visibility("default"))) QPaintEngine* qt_qgl_paint_engine()-
2936{-
2937 return
executed 15 times by 1 test: return qt_gl_2_engine()->engine();
Executed by:
  • tst_qmdiarea - unknown status
qt_gl_2_engine()->engine();
executed 15 times by 1 test: return qt_gl_2_engine()->engine();
Executed by:
  • tst_qmdiarea - unknown status
15
2938}-
2939-
2940-
2941-
2942-
2943-
2944-
2945QPaintEngine *QGLWidget::paintEngine() const-
2946{-
2947 return
executed 15 times by 1 test: return qt_qgl_paint_engine();
Executed by:
  • tst_qmdiarea - unknown status
qt_qgl_paint_engine();
executed 15 times by 1 test: return qt_qgl_paint_engine();
Executed by:
  • tst_qmdiarea - unknown status
15
2948}-
2949-
2950void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget)-
2951{-
2952 initContext(context, shareWidget);-
2953}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2954-
2955-
2956-
2957-
2958void QGLWidgetPrivate::initContext(QGLContext *context, const QGLWidget* shareWidget)-
2959{-
2960 QGLWidget * const q = q_func();-
2961-
2962 glDevice.setWidget(q);-
2963-
2964 glcx = 0;-
2965 autoSwap = true;-
2966-
2967 if (context
contextDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEnever evaluated
&& !context->device()
!context->device()Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
2968 context->setDevice(q);
never executed: context->setDevice(q);
0
2969 q->setContext(context, shareWidget ? shareWidget->context() : 0);-
2970-
2971 if (!glcx
!glcxDescription
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
)
0-12
2972 glcx = new QGLContext(QGLFormat::defaultFormat(), q);
never executed: glcx = new QGLContext(QGLFormat::defaultFormat(), q);
0
2973}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
12
2974-
2975bool QGLWidgetPrivate::renderCxPm(QPixmap*)-
2976{-
2977 return
never executed: return false;
false;
never executed: return false;
0
2978}-
2979-
2980-
2981-
2982-
2983-
2984void QGLWidgetPrivate::cleanupColormaps()-
2985{-
2986}-
2987-
2988namespace { namespace Q_QGS_qt_gl_lib_name { typedef QString Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QString, Q_QGS_qt_gl_lib_name::innerFunction, Q_QGS_qt_gl_lib_name::guard> qt_gl_lib_name;
0
2989-
2990void qt_set_gl_library_name(const QString& name)-
2991{-
2992 qt_gl_lib_name()->operator=(name);-
2993}
never executed: end of block
0
2994-
2995const QString qt_gl_library_name()-
2996{-
2997 if (qt_gl_lib_name()->isNull()
qt_gl_lib_name()->isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2998-
2999-
3000-
3001 return
never executed: return QLatin1String("GL");
QLatin1String("GL");
never executed: return QLatin1String("GL");
0
3002-
3003 }-
3004 return
never executed: return *qt_gl_lib_name();
*qt_gl_lib_name();
never executed: return *qt_gl_lib_name();
0
3005}-
3006-
3007void QGLContextGroup::addShare(const QGLContext *context, const QGLContext *share) {-
3008 ((!(context && share)) ? qt_assert("context && share",__FILE__,5218) : qt_noop());-
3009 if (context->d_ptr->group == share->d_ptr->group
context->d_ptr...->d_ptr->groupDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglbuffer - unknown status
)
0-1
3010 return;
never executed: return;
0
3011-
3012-
3013 ((!(context->d_ptr->group->m_refs.load() == 1)) ? qt_assert("context->d_ptr->group->m_refs.load() == 1",__FILE__,5223) : qt_noop());-
3014-
3015-
3016 QGLContextGroup *group = share->d_ptr->group;-
3017 delete context->d_ptr->group;-
3018 context->d_ptr->group = group;-
3019 group->m_refs.ref();-
3020-
3021-
3022-
3023 if (group->m_shares.isEmpty()
group->m_shares.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglbuffer - unknown status
FALSEnever evaluated
)
0-1
3024 group->m_shares.append(share);
executed 1 time by 1 test: group->m_shares.append(share);
Executed by:
  • tst_qglbuffer - unknown status
1
3025 group->m_shares.append(context);-
3026}
executed 1 time by 1 test: end of block
Executed by:
  • tst_qglbuffer - unknown status
1
3027-
3028void QGLContextGroup::removeShare(const QGLContext *context) {-
3029-
3030 QGLContextGroup *group = context->d_ptr->group;-
3031 if (group->m_shares.isEmpty()
group->m_shares.isEmpty()Description
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglbuffer - unknown status
)
1-11
3032 return;
executed 11 times by 3 tests: return;
Executed by:
  • tst_qglbuffer - unknown status
  • tst_qglfunctions - unknown status
  • tst_qmdiarea - unknown status
11
3033 group->m_shares.removeAll(context);-
3034-
3035-
3036 ((!(group->m_shares.size() != 0)) ? qt_assert("group->m_shares.size() != 0",__FILE__,5246) : qt_noop());-
3037 if (group->m_context == context
group->m_context == contextDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglbuffer - unknown status
FALSEnever evaluated
)
0-1
3038 group->m_context = group->m_shares.at(0);
executed 1 time by 1 test: group->m_context = group->m_shares.at(0);
Executed by:
  • tst_qglbuffer - unknown status
1
3039-
3040-
3041 if (group->m_shares.size() == 1
group->m_shares.size() == 1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qglbuffer - unknown status
FALSEnever evaluated
)
0-1
3042 group->m_shares.clear();
executed 1 time by 1 test: group->m_shares.clear();
Executed by:
  • tst_qglbuffer - unknown status
1
3043}
executed 1 time by 1 test: end of block
Executed by:
  • tst_qglbuffer - unknown status
1
3044-
3045QSize QGLTexture::bindCompressedTexture-
3046 (const QString& fileName, const char *format)-
3047{-
3048 QFile file(fileName);-
3049 if (!file.open(QIODevice::ReadOnly)
!file.open(QIO...ice::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3050 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3051 QByteArray contents = file.readAll();-
3052 file.close();-
3053 return
never executed: return bindCompressedTexture (contents.constData(), contents.size(), format);
bindCompressedTexture
never executed: return bindCompressedTexture (contents.constData(), contents.size(), format);
0
3054 (contents.constData(), contents.size(), format);
never executed: return bindCompressedTexture (contents.constData(), contents.size(), format);
0
3055}-
3056-
3057-
3058-
3059-
3060-
3061struct PvrHeader-
3062{-
3063 quint32 headerSize;-
3064 quint32 height;-
3065 quint32 width;-
3066 quint32 mipMapCount;-
3067 quint32 flags;-
3068 quint32 dataSize;-
3069 quint32 bitsPerPixel;-
3070 quint32 redMask;-
3071 quint32 greenMask;-
3072 quint32 blueMask;-
3073 quint32 alphaMask;-
3074 quint32 magic;-
3075 quint32 surfaceCount;-
3076};-
3077bool QGLTexture::canBindCompressedTexture-
3078 (const char *buf, int len, const char *format, bool *hasAlpha)-
3079{-
3080 if (QSysInfo::ByteOrder != QSysInfo::LittleEndian
QSysInfo::Byte...::LittleEndianDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3081-
3082-
3083 return
never executed: return false;
false;
never executed: return false;
0
3084 }-
3085 if (!format
!formatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3086-
3087 if (len >= 4
len >= 4Description
TRUEnever evaluated
FALSEnever evaluated
&& !qstrncmp(buf, "DDS ", 4)
!qstrncmp(buf, "DDS ", 4)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3088 *hasAlpha = true;-
3089 return
never executed: return true;
true;
never executed: return true;
0
3090 } else if (len >= 52
len >= 52Description
TRUEnever evaluated
FALSEnever evaluated
&& !qstrncmp(buf + 44, "PVR!", 4)
!qstrncmp(buf + 44, "PVR!", 4)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3091 const PvrHeader *pvrHeader =-
3092 reinterpret_cast<const PvrHeader *>(buf);-
3093 *hasAlpha = (pvrHeader->alphaMask != 0);-
3094 return
never executed: return true;
true;
never executed: return true;
0
3095 }-
3096 }
never executed: end of block
else {
0
3097-
3098 if (!qstricmp(format, "DDS")
!qstricmp(format, "DDS")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3099 if (len >= 4
len >= 4Description
TRUEnever evaluated
FALSEnever evaluated
&& !qstrncmp(buf, "DDS ", 4)
!qstrncmp(buf, "DDS ", 4)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3100 *hasAlpha = true;-
3101 return
never executed: return true;
true;
never executed: return true;
0
3102 }-
3103 }
never executed: end of block
else if (!qstricmp(format, "PVR")
!qstricmp(format, "PVR")Description
TRUEnever evaluated
FALSEnever evaluated
|| !qstricmp(format, "ETC1")
!qstricmp(format, "ETC1")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3104 if (len >= 52
len >= 52Description
TRUEnever evaluated
FALSEnever evaluated
&& !qstrncmp(buf + 44, "PVR!", 4)
!qstrncmp(buf + 44, "PVR!", 4)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3105 const PvrHeader *pvrHeader =-
3106 reinterpret_cast<const PvrHeader *>(buf);-
3107 *hasAlpha = (pvrHeader->alphaMask != 0);-
3108 return
never executed: return true;
true;
never executed: return true;
0
3109 }-
3110 }
never executed: end of block
0
3111 }
never executed: end of block
0
3112 return
never executed: return false;
false;
never executed: return false;
0
3113}-
3114-
3115-
3116-
3117QSize QGLTexture::bindCompressedTexture-
3118 (const char *buf, int len, const char *format)-
3119{-
3120 if (QSysInfo::ByteOrder != QSysInfo::LittleEndian
QSysInfo::Byte...::LittleEndianDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3121-
3122-
3123 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3124 }-
3125 if (!format
!formatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3126-
3127 if (len >= 4
len >= 4Description
TRUEnever evaluated
FALSEnever evaluated
&& !qstrncmp(buf, "DDS ", 4)
!qstrncmp(buf, "DDS ", 4)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3128 return
never executed: return bindCompressedTextureDDS(buf, len);
bindCompressedTextureDDS(buf, len);
never executed: return bindCompressedTextureDDS(buf, len);
0
3129 else if (len >= 52
len >= 52Description
TRUEnever evaluated
FALSEnever evaluated
&& !qstrncmp(buf + 44, "PVR!", 4)
!qstrncmp(buf + 44, "PVR!", 4)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3130 return
never executed: return bindCompressedTexturePVR(buf, len);
bindCompressedTexturePVR(buf, len);
never executed: return bindCompressedTexturePVR(buf, len);
0
3131 }
never executed: end of block
else {
0
3132-
3133 if (!qstricmp(format, "DDS")
!qstricmp(format, "DDS")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3134 if (len >= 4
len >= 4Description
TRUEnever evaluated
FALSEnever evaluated
&& !qstrncmp(buf, "DDS ", 4)
!qstrncmp(buf, "DDS ", 4)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3135 return
never executed: return bindCompressedTextureDDS(buf, len);
bindCompressedTextureDDS(buf, len);
never executed: return bindCompressedTextureDDS(buf, len);
0
3136 }
never executed: end of block
else if (!qstricmp(format, "PVR")
!qstricmp(format, "PVR")Description
TRUEnever evaluated
FALSEnever evaluated
|| !qstricmp(format, "ETC1")
!qstricmp(format, "ETC1")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3137 if (len >= 52
len >= 52Description
TRUEnever evaluated
FALSEnever evaluated
&& !qstrncmp(buf + 44, "PVR!", 4)
!qstrncmp(buf + 44, "PVR!", 4)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3138 return
never executed: return bindCompressedTexturePVR(buf, len);
bindCompressedTexturePVR(buf, len);
never executed: return bindCompressedTexturePVR(buf, len);
0
3139 }
never executed: end of block
0
3140 }
never executed: end of block
0
3141 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3142}-
3143-
3144QSize QGLTexture::bindCompressedTextureDDS(const char *buf, int len)-
3145{-
3146-
3147 if (target != 0x0DE1
target != 0x0DE1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3148 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3149-
3150-
3151 if (!qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::DDSTextureCompression)
!qgl_extension...reCompression)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3152 QMessageLogger(__FILE__, 5391, __PRETTY_FUNCTION__).warning("QGLContext::bindTexture(): DDS texture compression is not supported.");-
3153 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3154 }-
3155-
3156 const DDSFormat *ddsHeader = reinterpret_cast<const DDSFormat *>(buf + 4);-
3157 if (!ddsHeader->dwLinearSize
!ddsHeader->dwLinearSizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3158 QMessageLogger(__FILE__, 5397, __PRETTY_FUNCTION__).warning("QGLContext::bindTexture(): DDS image size is not valid.");-
3159 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3160 }-
3161-
3162 int blockSize = 16;-
3163 GLenum format;-
3164-
3165 switch(ddsHeader->ddsPixelFormat.dwFourCC) {-
3166 case
never executed: case 0x31545844:
0x31545844:
never executed: case 0x31545844:
0
3167 format = 0x83F1;-
3168 blockSize = 8;-
3169 break;
never executed: break;
0
3170 case
never executed: case 0x33545844:
0x33545844:
never executed: case 0x33545844:
0
3171 format = 0x83F2;-
3172 break;
never executed: break;
0
3173 case
never executed: case 0x35545844:
0x35545844:
never executed: case 0x35545844:
0
3174 format = 0x83F3;-
3175 break;
never executed: break;
0
3176 default
never executed: default:
:
never executed: default:
0
3177 QMessageLogger(__FILE__, 5416, __PRETTY_FUNCTION__).warning("QGLContext::bindTexture(): DDS image format not supported.");-
3178 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3179 }-
3180-
3181 const GLubyte *pixels =-
3182 reinterpret_cast<const GLubyte *>(buf + ddsHeader->dwSize + 4);-
3183-
3184 QOpenGLFunctions *funcs = qgl_functions();-
3185 funcs->glGenTextures(1, &id);-
3186 funcs->glBindTexture(0x0DE1, id);-
3187 funcs->glTexParameteri(0x0DE1, 0x2800, 0x2601);-
3188 funcs->glTexParameteri(0x0DE1, 0x2801, 0x2601);-
3189-
3190 int size;-
3191 int offset = 0;-
3192 int available = len - int(ddsHeader->dwSize + 4);-
3193 int w = ddsHeader->dwWidth;-
3194 int h = ddsHeader->dwHeight;-
3195-
3196-
3197 for(int i = 0; i < (int) ddsHeader->dwMipMapCount
i < (int) ddsH...>dwMipMapCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
3198 if (w == 0
w == 0Description
TRUEnever evaluated
FALSEnever evaluated
) w = 1;
never executed: w = 1;
0
3199 if (h == 0
h == 0Description
TRUEnever evaluated
FALSEnever evaluated
) h = 1;
never executed: h = 1;
0
3200-
3201 size = ((w+3)/4) * ((h+3)/4) * blockSize;-
3202 if (size > available
size > availableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3203 break;
never executed: break;
0
3204 qgl_extensions()->glCompressedTexImage2D(0x0DE1, i, format, w, h, 0,-
3205 size, pixels + offset);-
3206 offset += size;-
3207 available -= size;-
3208-
3209-
3210 w = w/2;-
3211 h = h/2;-
3212 }
never executed: end of block
0
3213-
3214-
3215 options &= ~QGLContext::InvertedYBindOption;-
3216-
3217 return
never executed: return QSize(ddsHeader->dwWidth, ddsHeader->dwHeight);
QSize(ddsHeader->dwWidth, ddsHeader->dwHeight);
never executed: return QSize(ddsHeader->dwWidth, ddsHeader->dwHeight);
0
3218}-
3219-
3220QSize QGLTexture::bindCompressedTexturePVR(const char *buf, int len)-
3221{-
3222-
3223 if (target != 0x0DE1
target != 0x0DE1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3224 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3225-
3226-
3227 const PvrHeader *pvrHeader = reinterpret_cast<const PvrHeader *>(buf);-
3228 GLenum textureFormat;-
3229 quint32 minWidth, minHeight;-
3230 switch (pvrHeader->flags & 0x000000FF) {-
3231 case
never executed: case 0x00000018:
0x00000018:
never executed: case 0x00000018:
0
3232 if (pvrHeader->alphaMask
pvrHeader->alphaMaskDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3233 textureFormat = 0x8C03;
never executed: textureFormat = 0x8C03;
0
3234 else-
3235 textureFormat = 0x8C01;
never executed: textureFormat = 0x8C01;
0
3236 minWidth = 16;-
3237 minHeight = 8;-
3238 break;
never executed: break;
0
3239-
3240 case
never executed: case 0x00000019:
0x00000019:
never executed: case 0x00000019:
0
3241 if (pvrHeader->alphaMask
pvrHeader->alphaMaskDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3242 textureFormat = 0x8C02;
never executed: textureFormat = 0x8C02;
0
3243 else-
3244 textureFormat = 0x8C00;
never executed: textureFormat = 0x8C00;
0
3245 minWidth = 8;-
3246 minHeight = 8;-
3247 break;
never executed: break;
0
3248-
3249 case
never executed: case 0x00000036:
0x00000036:
never executed: case 0x00000036:
0
3250 textureFormat = 0x8D64;-
3251 minWidth = 4;-
3252 minHeight = 4;-
3253 break;
never executed: break;
0
3254-
3255 default
never executed: default:
:
never executed: default:
0
3256 QMessageLogger(__FILE__, 5495, __PRETTY_FUNCTION__).warning("QGLContext::bindTexture(): PVR image format 0x%x not supported.", int(pvrHeader->flags & 0x000000FF));-
3257 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3258 }-
3259-
3260-
3261 if (textureFormat == 0x8D64
textureFormat == 0x8D64Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3262 if (!qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::ETC1TextureCompression)
!qgl_extension...reCompression)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3263 QMessageLogger(__FILE__, 5502, __PRETTY_FUNCTION__).warning("QGLContext::bindTexture(): ETC1 texture compression is not supported.");-
3264 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3265 }-
3266 }
never executed: end of block
else {
0
3267 if (!qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::PVRTCTextureCompression)
!qgl_extension...reCompression)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3268 QMessageLogger(__FILE__, 5507, __PRETTY_FUNCTION__).warning("QGLContext::bindTexture(): PVRTC texture compression is not supported.");-
3269 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3270 }-
3271 }
never executed: end of block
0
3272-
3273-
3274 quint32 bufferSize = pvrHeader->headerSize + pvrHeader->dataSize;-
3275 if (bufferSize > quint32(len)
bufferSize > quint32(len)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3276 QMessageLogger(__FILE__, 5515, __PRETTY_FUNCTION__).warning("QGLContext::bindTexture(): PVR image size is not valid.");-
3277 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
3278 }-
3279-
3280-
3281 QOpenGLFunctions *funcs = qgl_functions();-
3282 funcs->glPixelStorei(0x0CF5, 1);-
3283 funcs->glGenTextures(1, &id);-
3284 funcs->glBindTexture(0x0DE1, id);-
3285 if (pvrHeader->mipMapCount
pvrHeader->mipMapCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3286 if ((
(options & QGL...ndOption) != 0Description
TRUEnever evaluated
FALSEnever evaluated
options & QGLContext::LinearFilteringBindOption) != 0
(options & QGL...ndOption) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3287 funcs->glTexParameteri(0x0DE1, 0x2800, 0x2601);-
3288 funcs->glTexParameteri(0x0DE1, 0x2801, 0x2703);-
3289 }
never executed: end of block
else {
0
3290 funcs->glTexParameteri(0x0DE1, 0x2800, 0x2600);-
3291 funcs->glTexParameteri(0x0DE1, 0x2801, 0x2700);-
3292 }
never executed: end of block
0
3293 } else if ((
(options & QGL...ndOption) != 0Description
TRUEnever evaluated
FALSEnever evaluated
options & QGLContext::LinearFilteringBindOption) != 0
(options & QGL...ndOption) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3294 funcs->glTexParameteri(0x0DE1, 0x2800, 0x2601);-
3295 funcs->glTexParameteri(0x0DE1, 0x2801, 0x2601);-
3296 }
never executed: end of block
else {
0
3297 funcs->glTexParameteri(0x0DE1, 0x2800, 0x2600);-
3298 funcs->glTexParameteri(0x0DE1, 0x2801, 0x2600);-
3299 }
never executed: end of block
0
3300-
3301-
3302 const GLubyte *buffer =-
3303 reinterpret_cast<const GLubyte *>(buf + pvrHeader->headerSize);-
3304 bufferSize = pvrHeader->dataSize;-
3305 quint32 level = 0;-
3306 quint32 width = pvrHeader->width;-
3307 quint32 height = pvrHeader->height;-
3308 while (bufferSize > 0
bufferSize > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& level <= pvrHeader->mipMapCount
level <= pvrHe...r->mipMapCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
3309 quint32 size =-
3310 (qMax(width, minWidth) * qMax(height, minHeight) *-
3311 pvrHeader->bitsPerPixel) / 8;-
3312 if (size > bufferSize
size > bufferSizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3313 break;
never executed: break;
0
3314 qgl_extensions()->glCompressedTexImage2D(0x0DE1, GLint(level), textureFormat,-
3315 GLsizei(width), GLsizei(height), 0,-
3316 GLsizei(size), buffer);-
3317 width /= 2;-
3318 height /= 2;-
3319 buffer += size;-
3320 ++level;-
3321 }
never executed: end of block
0
3322-
3323-
3324 funcs->glPixelStorei(0x0CF5, 4);-
3325-
3326-
3327-
3328 options.setFlag(QGLContext::InvertedYBindOption, !(pvrHeader->flags & 0x00010000));-
3329-
3330 return
never executed: return QSize(pvrHeader->width, pvrHeader->height);
QSize(pvrHeader->width, pvrHeader->height);
never executed: return QSize(pvrHeader->width, pvrHeader->height);
0
3331}-
3332-
3333-
3334-
3335-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9