summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qhighdpiscaling_p.h
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-02-25 12:41:35 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-03-13 17:00:31 +0000
commita3def2869da8ad9c17d44005c0d1fd70a903f855 (patch)
tree78a0a18223d8d6f9544c80f29dd9a6fcd06d9949 /src/gui/kernel/qhighdpiscaling_p.h
parent434f2b8968b7c41969cef06931bf6f09305550aa (diff)
QtGui: de-duplicate calls and cache results
Change-Id: Iaf232c31d6780b49dc6a3d0faafb9717f3c36e65 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/kernel/qhighdpiscaling_p.h')
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index 364dfaeaee..eb3a9d5545 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -474,8 +474,9 @@ QVector<T> fromNativePixels(const QVector<T> &pixelValues, const QWindow *window
QVector<T> pointValues;
pointValues.reserve(pixelValues.size());
+ const auto factor = QHighDpiScaling::factor(window);
for (const T &pixelValue : pixelValues)
- pointValues.append(pixelValue / QHighDpiScaling::factor(window));
+ pointValues.append(pixelValue / factor);
return pointValues;
}
@@ -488,8 +489,9 @@ QVector<T> toNativePixels(const QVector<T> &pointValues, const QWindow *window)
QVector<T> pixelValues;
pixelValues.reserve(pointValues.size());
+ const auto factor = QHighDpiScaling::factor(window);
for (const T &pointValue : pointValues)
- pixelValues.append(pointValue * QHighDpiScaling::factor(window));
+ pixelValues.append(pointValue * factor);
return pixelValues;
}