Revert "lottie: ++ scene composing optimization"

This reverts commit bfdc8e4de7.

hotfix due to a memoy corruption. please see asan test.
This commit is contained in:
Hermet Park 2024-07-12 11:28:13 +09:00
parent 774d366dc2
commit 8c3586a7c4
3 changed files with 10 additions and 15 deletions

View file

@ -1027,21 +1027,18 @@ static void _updatePrecomp(LottieLayer* precomp, float frameNo, LottieExpression
if (!child->matteSrc) _updateLayer(precomp, child, frameNo, exps); if (!child->matteSrc) _updateLayer(precomp, child, frameNo, exps);
} }
//TODO: remove the intermediate scene....
if (precomp->scene->composite(nullptr) != tvg::CompositeMethod::None) {
auto cscene = Scene::gen().release();
cscene->push(cast(precomp->scene));
precomp->scene = cscene;
}
//clip the layer viewport //clip the layer viewport
if (!precomp->clipper) { if (precomp->w > 0 && precomp->h > 0) {
precomp->clipper = Shape::gen().release(); auto clipper = Shape::gen().release();
precomp->clipper->appendRect(0, 0, static_cast<float>(precomp->w), static_cast<float>(precomp->h)); clipper->appendRect(0, 0, static_cast<float>(precomp->w), static_cast<float>(precomp->h));
PP(precomp->clipper)->ref(); clipper->transform(precomp->cache.matrix);
//TODO: remove the intermediate scene....
auto cscene = Scene::gen();
cscene->composite(cast(clipper), CompositeMethod::ClipPath);
cscene->push(cast(precomp->scene));
precomp->scene = cscene.release();
} }
precomp->clipper->transform(precomp->cache.matrix);
precomp->scene->composite(cast(precomp->clipper), CompositeMethod::ClipPath);
} }

View file

@ -333,7 +333,6 @@ LottieLayer::~LottieLayer()
//Remove tvg render paints //Remove tvg render paints
if (solidFill && PP(solidFill)->unref() == 0) delete(solidFill); if (solidFill && PP(solidFill)->unref() == 0) delete(solidFill);
if (clipper && PP(clipper)->unref() == 0) delete(clipper);
delete(transform); delete(transform);
free(name); free(name);

View file

@ -594,7 +594,6 @@ struct LottieLayer : LottieGroup
LottieLayer* matteTarget = nullptr; LottieLayer* matteTarget = nullptr;
tvg::Shape* solidFill = nullptr; tvg::Shape* solidFill = nullptr;
tvg::Shape* clipper = nullptr;
float timeStretch = 1.0f; float timeStretch = 1.0f;
float w = 0.0f, h = 0.0f; float w = 0.0f, h = 0.0f;