aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgrhisupport.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-03-19 16:40:31 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-20 00:41:26 +0000
commita6cfdca7bd97f750bc034ec772f8c42c5458a0ac (patch)
tree2adcc0bed60905005cc2d5ae2c17c378f374de9b /src/quick/scenegraph/qsgrhisupport.cpp
parent4ae76406515cb61b56f7a8c97529ce65bf21952b (diff)
Clean up QSGRhiSupport wrt static functions
Make static everything that can be static. At the same time, make configure() non-static. Does not change behavior in any way, but this is the more logical approach. Also more future proof. Change-Id: I601d59a0547106802f330a7551a97186cde481e0 Reviewed-by: Christian Strømme <christian.stromme@qt.io> (cherry picked from commit fb8ba3f7250f837dd29600d30108ba6f4470a727) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quick/scenegraph/qsgrhisupport.cpp')
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp
index 88bbf77e40..1ccca23596 100644
--- a/src/quick/scenegraph/qsgrhisupport.cpp
+++ b/src/quick/scenegraph/qsgrhisupport.cpp
@@ -252,12 +252,6 @@ void QSGRhiSupport::adjustToPlatformQuirks()
#endif
}
-QSGRhiSupport *QSGRhiSupport::staticInst()
-{
- static QSGRhiSupport inst;
- return &inst;
-}
-
void QSGRhiSupport::checkEnvQSgInfo()
{
// For compatibility with 5.3 and earlier's QSG_INFO environment variables
@@ -269,21 +263,25 @@ void QSGRhiSupport::configure(QSGRendererInterface::GraphicsApi api)
{
if (api == QSGRendererInterface::Unknown) {
// behave as if nothing was explicitly requested
- QSGRhiSupport *inst = staticInst();
- inst->m_requested.valid = false;
- inst->applySettings();
+ m_requested.valid = false;
+ applySettings();
} else {
Q_ASSERT(QSGRendererInterface::isApiRhiBased(api));
- QSGRhiSupport *inst = staticInst();
- inst->m_requested.valid = true;
- inst->m_requested.api = api;
- inst->applySettings();
+ m_requested.valid = true;
+ m_requested.api = api;
+ applySettings();
}
}
+QSGRhiSupport *QSGRhiSupport::instance_internal()
+{
+ static QSGRhiSupport inst;
+ return &inst;
+}
+
QSGRhiSupport *QSGRhiSupport::instance()
{
- QSGRhiSupport *inst = staticInst();
+ QSGRhiSupport *inst = instance_internal();
if (!inst->m_settingsApplied)
inst->applySettings();
return inst;