From fba861cb4ff00e42c413c27f1315b974e4cf91cb Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Wed, 26 Mar 2025 18:56:52 +0900 Subject: [PATCH] lottie: fixed a regression bug reverted stroke optimization from the previous cullting stragtegy. introduced by d386a5654a238bde2209a6fb07f94a87baeab256 --- src/loaders/lottie/tvgLottieBuilder.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 48a47a85..05e4b45e 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -236,8 +236,7 @@ static void _updateStroke(LottieStroke* stroke, float frameNo, RenderContext* ct bool LottieBuilder::fragmented(LottieGroup* parent, LottieObject** child, Inlist& contexts, RenderContext* ctx, RenderFragment fragment) { if (ctx->fragment) return true; - - if (!ctx->reqFragment || ctx->fragment == RenderFragment::ByNone) return false; + if (!ctx->reqFragment) return false; contexts.back(new RenderContext(*ctx, (Shape*)(PAINT(ctx->propagator)->duplicate(parent->pooling())))); @@ -251,12 +250,9 @@ bool LottieBuilder::fragmented(LottieGroup* parent, LottieObject** child, Inlist bool LottieBuilder::updateSolidStroke(LottieGroup* parent, LottieObject** child, float frameNo, Inlist& contexts, RenderContext* ctx) { auto stroke = static_cast(*child); - auto opacity = stroke->opacity(frameNo, tween, exps); - - //interrupted by fully opaque, stop the current rendering - if (ctx->fragment == RenderFragment::ByStroke && opacity == 255) return true; - if (fragmented(parent, child, contexts, ctx, RenderFragment::ByStroke)) return false; + + auto opacity = stroke->opacity(frameNo, tween, exps); if (opacity == 0) return false; ctx->merging = nullptr; @@ -271,13 +267,11 @@ bool LottieBuilder::updateSolidStroke(LottieGroup* parent, LottieObject** child, bool LottieBuilder::updateGradientStroke(LottieGroup* parent, LottieObject** child, float frameNo, Inlist& contexts, RenderContext* ctx) { auto stroke = static_cast(*child); - auto opacity = stroke->opacity(frameNo, tween, exps); - - //interrupted by fully opaque, stop the current rendering - if (ctx->fragment == RenderFragment::ByStroke && stroke->opaque && opacity == 255) return true; - if (fragmented(parent, child, contexts, ctx, RenderFragment::ByStroke)) return false; + auto opacity = stroke->opacity(frameNo, tween, exps); + if (opacity == 0 && !stroke->opaque) return false; + ctx->merging = nullptr; if (auto val = stroke->fill(frameNo, opacity, tween, exps)) ctx->propagator->strokeFill(val); _updateStroke(static_cast(stroke), frameNo, ctx, tween, exps); @@ -293,12 +287,11 @@ bool LottieBuilder::updateSolidFill(LottieGroup* parent, LottieObject** child, f //interrupted by fully opaque, stop the current rendering if (ctx->fragment == RenderFragment::ByFill && opacity == 255) return true; - - if (fragmented(parent, child, contexts, ctx, RenderFragment::ByFill)) return false; if (opacity == 0) return false; - ctx->merging = nullptr; + if (fragmented(parent, child, contexts, ctx, RenderFragment::ByFill)) return false; + ctx->merging = nullptr; auto color = fill->color(frameNo, tween, exps); ctx->propagator->fill(color.rgb[0], color.rgb[1], color.rgb[2], opacity); ctx->propagator->fill(fill->rule);