lottie: correct the array reserved size

The color input will contain at least colorStops.count * 4
elements (not including alpha). Since the alpha offset values
don't have to much colorStops, estimation is used.
This commit is contained in:
Mira Grudzinska 2024-10-17 20:17:32 +07:00 committed by Hermet Park
parent 78285e1cfd
commit d9bbd433e8

View file

@ -254,7 +254,7 @@ void LottieParser::getValue(ColorStop& color)
{ {
if (peekType() == kArrayType) enterArray(); if (peekType() == kArrayType) enterArray();
if (!color.input) color.input = new Array<float>(static_cast<LottieGradient*>(context.parent)->colorStops.count); if (!color.input) color.input = new Array<float>(static_cast<LottieGradient*>(context.parent)->colorStops.count * 6);
else color.input->clear(); else color.input->clear();
while (nextArrayValue()) color.input->push(getFloat()); while (nextArrayValue()) color.input->push(getFloat());