QtLottie: Fix UB in last keyframe easing point.

Example: https://lottiefiles.com/427-happy-birthday

The present box top was rendered below the body or not depending on
the uninitialized bytes from QBezier.
This commit is contained in:
John Preston 2019-04-29 19:08:00 +04:00
parent f073963582
commit 2fae2278f7
2 changed files with 9 additions and 4 deletions

@ -1 +1 @@
Subproject commit 553ec1bc799f344a12e34c91720e13a469d85365
Subproject commit 92c5c182fd6578a4f9b2036dc86791da82c2ad6f

View File

@ -112,9 +112,14 @@ public:
int adjustedFrame = qBound(m_startFrame, frame, m_endFrame);
if (const EasingSegment<QPointF> *easing = getEasingSegment(adjustedFrame)) {
qreal progress = ((adjustedFrame - m_startFrame) * 1.0) / (m_endFrame - m_startFrame);
qreal easedValue = easing->easing.valueForProgress(progress);
m_value = m_bezierPath.pointAtPercent(easedValue);
if (easing->complete) {
qreal progress = ((adjustedFrame - m_startFrame) * 1.0) / (m_endFrame - m_startFrame);
qreal easedValue = easing->easing.valueForProgress(progress);
m_value = m_bezierPath.pointAtPercent(easedValue);
} else {
// In case of incomplete easing we should just take the final point.
m_value = m_bezierPath.pointAtPercent(1.);
}
}
return true;