QWidgetBackingStore: simplify reading of an env-var in {move,scroll}Rect()

Instead of initializing accelEnv to -1 (thus forcing the variable
into the data segment), and then overwriting the -1 with a read
from the env-var, dynamically initialize the variable from the
env-var directly, thus allowing the variable back into the bss
segment (which doesn't occupy storage in the executable).

There may have been a reason to do it this way when the old code
could fail due to the memory allocation involved, but now with
qEnvironmentVariableIntValue(), that is no longer a reason.

Change-Id: I619fe45d8eb2a50515f5fb255cabd23a5966b11e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
bb10
Marc Mutz 2014-09-07 21:44:19 +02:00
parent 8e8d1095e9
commit d00dbb1bf2
1 changed files with 2 additions and 8 deletions

View File

@ -780,10 +780,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy)
if (x->inTopLevelResize)
return;
static int accelEnv = -1;
if (accelEnv == -1) {
accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_MOVE") == 0;
}
static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_MOVE") == 0;
QWidget *pw = q->parentWidget();
QPoint toplevelOffset = pw->mapTo(tlw, QPoint());
@ -862,10 +859,7 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy)
if (!wbs)
return;
static int accelEnv = -1;
if (accelEnv == -1) {
accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_SCROLL") == 0;
}
static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_SCROLL") == 0;
QRect scrollRect = rect & clipRect();
bool overlapped = false;