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 <gunnar@sletta.org>
bb10
Marc Mutz 2014-09-09 11:45:38 +02:00
parent 9f0d5b3b6c
commit f88c5415ff
2 changed files with 6 additions and 6 deletions

View File

@ -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;

View File

@ -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);