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:
parent
f073963582
commit
2fae2278f7
|
@ -1 +1 @@
|
||||||
Subproject commit 553ec1bc799f344a12e34c91720e13a469d85365
|
Subproject commit 92c5c182fd6578a4f9b2036dc86791da82c2ad6f
|
|
@ -112,9 +112,14 @@ public:
|
||||||
|
|
||||||
int adjustedFrame = qBound(m_startFrame, frame, m_endFrame);
|
int adjustedFrame = qBound(m_startFrame, frame, m_endFrame);
|
||||||
if (const EasingSegment<QPointF> *easing = getEasingSegment(adjustedFrame)) {
|
if (const EasingSegment<QPointF> *easing = getEasingSegment(adjustedFrame)) {
|
||||||
|
if (easing->complete) {
|
||||||
qreal progress = ((adjustedFrame - m_startFrame) * 1.0) / (m_endFrame - m_startFrame);
|
qreal progress = ((adjustedFrame - m_startFrame) * 1.0) / (m_endFrame - m_startFrame);
|
||||||
qreal easedValue = easing->easing.valueForProgress(progress);
|
qreal easedValue = easing->easing.valueForProgress(progress);
|
||||||
m_value = m_bezierPath.pointAtPercent(easedValue);
|
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;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue