diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-02-08 01:47:00 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-08 10:21:55 +0000 |
commit | 74adb1900a7f6f219339bd4ed2a74b5816b63d64 (patch) | |
tree | 1828878150127238cfd440d3a9134a77e7abc606 | |
parent | 24c0ba13fd7973a5a9007d4bb651efe714a3c518 (diff) |
QEasingCurve: add some strategic std::move()
Move instead of copy the bezierCurves and tcbPoints
containers when updating 'config' in setType_helper().
In Qt 5, we still have the unsharable container
issue which causes code for deep copies to be
emitted for most copy operations.
A move is always just re-seating a pointer.
Change-Id: Icff7415dd0ce44df0602273ff42370b26d831b85
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
-rw-r--r-- | src/corelib/tools/qeasingcurve.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index f1ad27b4c9..2851dc81d6 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1333,8 +1333,8 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) amp = config->_a; period = config->_p; overshoot = config->_o; - bezierCurves = config->_bezierCurves; - tcbPoints = config->_tcbPoints; + bezierCurves = std::move(config->_bezierCurves); + tcbPoints = std::move(config->_tcbPoints); delete config; config = 0; @@ -1349,8 +1349,8 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) config->_p = period; if (overshoot != -1.0) config->_o = overshoot; - config->_bezierCurves = bezierCurves; - config->_tcbPoints = tcbPoints; + config->_bezierCurves = std::move(bezierCurves); + config->_tcbPoints = std::move(tcbPoints); func = 0; } else if (newType != QEasingCurve::Custom) { func = curveToFunc(newType); |