summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-02-24 15:53:59 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-02-25 04:56:31 +0000
commit97965a0908b8fbf7f01d0880410929a4ea61b48d (patch)
tree4acb6d2c10e7f0816cb57540aabdbb84502806e2 /src/gui/kernel
parent8dc024adc64ba667ede2854b2411775a9e18cafc (diff)
QtGui: use reserve to optimize memory allocation.
Change-Id: I34a571b67840557de19ab496cadebd698c7f4f6a Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index 60e8dcf562..fe71de6c27 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -473,6 +473,7 @@ QVector<T> fromNativePixels(const QVector<T> &pixelValues, const QWindow *window
return pixelValues;
QVector<T> pointValues;
+ pointValues.reserve(pixelValues.size());
for (const T &pixelValue : pixelValues)
pointValues.append(pixelValue / QHighDpiScaling::factor(window));
return pointValues;
@@ -486,6 +487,7 @@ QVector<T> toNativePixels(const QVector<T> &pointValues, const QWindow *window)
return pointValues;
QVector<T> pixelValues;
+ pixelValues.reserve(pointValues.size());
for (const T &pointValue : pointValues)
pixelValues.append(pointValue * QHighDpiScaling::factor(window));
return pixelValues;
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index c76721f89b..39bc161a7c 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -928,7 +928,7 @@ static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoi
static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
{
QList<struct QWindowSystemInterface::TouchPoint> newList;
-
+ newList.reserve(pointList.size());
for (const QTouchEvent::TouchPoint &p : pointList)
newList.append(touchPoint(p));