loader/lottie: properly handle graident opacity attributes.

That property has been missed in the implementation.
This commit is contained in:
Hermet Park 2023-09-18 19:28:43 +09:00
parent 8aa12ca468
commit 549f4b1308
3 changed files with 4 additions and 1 deletions

View file

@ -241,6 +241,7 @@ static Shape* _updateFill(LottieGradientFill* fill, int32_t frameNo, RenderConte
//TODO: reuse the fill instance?
ctx.propagator->fill(unique_ptr<Fill>(fill->fill(frameNo)));
ctx.propagator->fill(fill->rule);
ctx.propagator->opacity(MULTIPLY(fill->opacity(frameNo), PP(ctx.propagator)->opacity));
if (ctx.propagator->strokeWidth() > 0) ctx.propagator->order(true);
@ -595,7 +596,7 @@ static void _updateImage(LottieGroup* parent, LottieImage* image, int32_t frameN
if (auto matrix = PP(ctx.propagator)->transform()) {
picture->transform(*matrix);
}
picture->opacity(ctx.propagator->opacity());
picture->opacity(PP(ctx.propagator)->opacity);
}
//TODO: remove duplicate.

View file

@ -94,6 +94,7 @@ struct LottieGradient
LottiePoint end = Point{0.0f, 0.0f};
LottieFloat height = 0.0f;
LottieFloat angle = 0.0f;
LottieOpacity opacity = 255;
LottieColorStop colorStops;
uint8_t id = 0; //1: linear, 2: radial
};

View file

@ -684,6 +684,7 @@ LottieRoundedCorner* LottieParser::parseRoundedCorner()
void LottieParser::parseGradient(LottieGradient* gradient, const char* key)
{
if (!strcmp(key, "t")) gradient->id = getInt();
else if (!strcmp(key, "o")) parseProperty(gradient->opacity);
else if (!strcmp(key, "g"))
{
enterObject();