QEasingCurve: return QVector for cubic spline representation
QEasingCurve internally holds the spline data in a QVector<QPointF>. For the return from cubicBezierSpline(), the vector is transformed into a QList<QPointF>. This involves copying, and into an inefficient (for QPointF payloads) container at that, so deprecate cubicBezierSpline() in favour of a new toCubicSpline() returning the QVector directly. Change-Id: Ie4827fe7c6e289ad97a0b09772e47298779c76ca Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
1703558330
commit
f63b23afda
@ -1303,14 +1303,20 @@ void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qre
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\fn QList<QPointF> QEasingCurve::cubicBezierSpline() const
|
||||||
|
\obsolete Use toCubicSpline() instead.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\since 5.0
|
||||||
|
|
||||||
Returns the cubicBezierSpline that defines a custom easing curve.
|
Returns the cubicBezierSpline that defines a custom easing curve.
|
||||||
If the easing curve does not have a custom bezier easing curve the list
|
If the easing curve does not have a custom bezier easing curve the list
|
||||||
is empty.
|
is empty.
|
||||||
*/
|
*/
|
||||||
QList<QPointF> QEasingCurve::cubicBezierSpline() const
|
QVector<QPointF> QEasingCurve::toCubicSpline() const
|
||||||
{
|
{
|
||||||
return d_ptr->config ? d_ptr->config->_bezierCurves.toList() : QList<QPointF>();
|
return d_ptr->config ? d_ptr->config->_bezierCurves : QVector<QPointF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -44,7 +44,11 @@
|
|||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
#include <QtCore/qobjectdefs.h>
|
#include <QtCore/qobjectdefs.h>
|
||||||
#include <QtCore/qlist.h>
|
#include <QtCore/qvector.h>
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 0)
|
||||||
|
# include <QtCore/qlist.h>
|
||||||
|
# include <QtCore/qpoint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_HEADER
|
QT_BEGIN_HEADER
|
||||||
|
|
||||||
@ -94,7 +98,10 @@ public:
|
|||||||
|
|
||||||
void addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint);
|
void addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint);
|
||||||
void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b);
|
void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b);
|
||||||
QList<QPointF> cubicBezierSpline() const;
|
QVector<QPointF> toCubicSpline() const;
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 0)
|
||||||
|
QT_DEPRECATED QList<QPointF> cubicBezierSpline() const { return toCubicSpline().toList(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
Type type() const;
|
Type type() const;
|
||||||
void setType(Type type);
|
void setType(Type type);
|
||||||
|
Loading…
Reference in New Issue
Block a user