lottie: --type casting warning in MSVC

This commit is contained in:
Hermet Park 2024-09-19 23:13:26 +09:00
parent 1daf6a010c
commit d2c89a5f2d
3 changed files with 6 additions and 6 deletions

View file

@ -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;

View file

@ -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<float>(random % int(len - range));
end = start + range;
}

View file

@ -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);
};