lottie: handle trim path edge cases

According to the definition of trim path elements,
the begin and end values are specified as percentages
in the range of 0-100% (this is also confirmed by AE,
where it's not possible to exceed this range).
Added clamping to align with spec.
This commit is contained in:
Mira Grudzinska 2024-08-28 16:47:57 +02:00 committed by Hermet Park
parent 59f950e71b
commit ac2b5c86e6

View file

@ -141,7 +141,9 @@ void LottieImage::prepare()
void LottieTrimpath::segment(float frameNo, float& start, float& end, LottieExpressions* exps) void LottieTrimpath::segment(float frameNo, float& start, float& end, LottieExpressions* exps)
{ {
start = this->start(frameNo, exps) * 0.01f; start = this->start(frameNo, exps) * 0.01f;
tvg::clamp(start, 0.0f, 1.0f);
end = this->end(frameNo, exps) * 0.01f; end = this->end(frameNo, exps) * 0.01f;
tvg::clamp(end, 0.0f, 1.0f);
auto o = fmodf(this->offset(frameNo, exps), 360.0f) / 360.0f; //0 ~ 1 auto o = fmodf(this->offset(frameNo, exps), 360.0f) / 360.0f; //0 ~ 1