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>bb10
parent
24c0ba13fd
commit
74adb1900a
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue