diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index b8c7f7b1..52b9c4b4 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -1064,7 +1064,7 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo) //text range process for (auto s = text->ranges.begin(); s < text->ranges.end(); ++s) { float start, end; - (*s)->range(frameNo, totalChars, start, end); + (*s)->range(frameNo, float(totalChars), start, end); auto basedIdx = idx; if ((*s)->based == LottieTextRange::Based::CharsExcludingSpaces) basedIdx = idx - space; diff --git a/src/loaders/lottie/tvgLottieModel.cpp b/src/loaders/lottie/tvgLottieModel.cpp index 7572c769..f3268ff2 100644 --- a/src/loaders/lottie/tvgLottieModel.cpp +++ b/src/loaders/lottie/tvgLottieModel.cpp @@ -110,9 +110,9 @@ void LottieSlot::assign(LottieObject* target) } -void LottieTextRange::range(float frameNo, size_t totalLen, float& start, float& end) +void LottieTextRange::range(float frameNo, float totalLen, float& start, float& end) { - float divisor = rangeUnit == Unit::Percent ? (100.0f / totalLen) : 1; + auto divisor = (rangeUnit == Unit::Percent) ? (100.0f / totalLen) : 1.0f; auto offset = this->offset(frameNo) / divisor; start = nearbyintf(this->start(frameNo) / divisor) + offset; end = nearbyintf(this->end(frameNo) / divisor) + offset; @@ -122,8 +122,8 @@ void LottieTextRange::range(float frameNo, size_t totalLen, float& start, float& if (random == 0) return; auto range = end - start; - auto len = rangeUnit == Unit::Percent ? 100 : totalLen; - start = random % int(len - range); + auto len = (rangeUnit == Unit::Percent) ? 100.0f : totalLen; + start = static_cast(random % int(len - range)); end = start + range; } diff --git a/src/loaders/lottie/tvgLottieModel.h b/src/loaders/lottie/tvgLottieModel.h index b22727a1..b23dcd0f 100644 --- a/src/loaders/lottie/tvgLottieModel.h +++ b/src/loaders/lottie/tvgLottieModel.h @@ -187,7 +187,7 @@ struct LottieTextRange uint8_t random = 0; bool expressible = false; - void range(float frameNo, size_t totalLen, float& start, float& end); + void range(float frameNo, float totalLen, float& start, float& end); };