lottie: fixed a regression bug

reverted stroke optimization from the previous cullting stragtegy.
introduced by d386a5654a
This commit is contained in:
Hermet Park 2025-03-26 18:56:52 +09:00
parent 3b5b0e7eaa
commit fba861cb4f

View file

@ -236,8 +236,7 @@ static void _updateStroke(LottieStroke* stroke, float frameNo, RenderContext* ct
bool LottieBuilder::fragmented(LottieGroup* parent, LottieObject** child, Inlist<RenderContext>& 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<RenderContext>& contexts, RenderContext* ctx)
{
auto stroke = static_cast<LottieSolidStroke*>(*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<RenderContext>& contexts, RenderContext* ctx)
{
auto stroke = static_cast<LottieGradientStroke*>(*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<LottieStroke*>(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);