From f88c5415ffac69d51c82489908a18f9b88190f59 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 9 Sep 2014 11:45:38 +0200 Subject: [PATCH] eglconvenience: use qEnvironmentVariableIntValue() It doesn't allocate memory, so cannot throw and is a lot faster than qgetenv(). Change-Id: Id50609c1f3511287d99e24b03e48c0a254893194 Reviewed-by: Gunnar Sletta --- src/platformsupport/eglconvenience/qeglconvenience.cpp | 10 +++++----- .../eglconvenience/qeglplatformcontext.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index 5eed47050f..ca8f1bc333 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -465,8 +465,8 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize if (size.isEmpty()) { // Note: in millimeters - int width = qgetenv("QT_QPA_EGLFS_PHYSICAL_WIDTH").toInt(); - int height = qgetenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT").toInt(); + int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH"); + int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT"); if (width && height) { size.setWidth(width); @@ -507,8 +507,8 @@ QSize q_screenSizeFromFb(int framebufferDevice) static QSize size; if (size.isEmpty()) { - int width = qgetenv("QT_QPA_EGLFS_WIDTH").toInt(); - int height = qgetenv("QT_QPA_EGLFS_HEIGHT").toInt(); + int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_WIDTH"); + int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_HEIGHT"); if (width && height) { size.setWidth(width); @@ -539,7 +539,7 @@ QSize q_screenSizeFromFb(int framebufferDevice) int q_screenDepthFromFb(int framebufferDevice) { const int defaultDepth = 32; - static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt(); + static int depth = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEPTH"); if (depth == 0) { struct fb_var_screeninfo vinfo; diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index dce8bd888c..7a10ba172a 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -189,7 +189,7 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont return; } - static const bool printConfig = qgetenv("QT_QPA_EGLFS_DEBUG").toInt(); + static const bool printConfig = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEBUG"); if (printConfig) { qDebug() << "Created context for format" << format << "with config:"; q_printEglConfig(m_eglDisplay, m_eglConfig);