mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-04 13:45:17 +00:00
lottie: prevent mem leak
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
Masks of pooled shapes were not unrefed, filling up the memory pool.
This commit is contained in:
parent
5e17fe0034
commit
ea8abe8912
1 changed files with 2 additions and 4 deletions
|
@ -1203,7 +1203,7 @@ void LottieBuilder::updateMasks(LottieLayer* layer, float frameNo)
|
||||||
//the first mask
|
//the first mask
|
||||||
if (!pShape) {
|
if (!pShape) {
|
||||||
pShape = layer->pooling();
|
pShape = layer->pooling();
|
||||||
pShape->reset();
|
SHAPE(pShape)->reset();
|
||||||
auto compMethod = (method == MaskMethod::Subtract || method == MaskMethod::InvAlpha) ? MaskMethod::InvAlpha : MaskMethod::Alpha;
|
auto compMethod = (method == MaskMethod::Subtract || method == MaskMethod::InvAlpha) ? MaskMethod::InvAlpha : MaskMethod::Alpha;
|
||||||
//Cheaper. Replace the masking with a clipper
|
//Cheaper. Replace the masking with a clipper
|
||||||
if (layer->masks.count == 1 && compMethod == MaskMethod::Alpha) {
|
if (layer->masks.count == 1 && compMethod == MaskMethod::Alpha) {
|
||||||
|
@ -1215,13 +1215,11 @@ void LottieBuilder::updateMasks(LottieLayer* layer, float frameNo)
|
||||||
//Chain mask composition
|
//Chain mask composition
|
||||||
} else if (pMethod != method || pOpacity != opacity || (method != MaskMethod::Subtract && method != MaskMethod::Difference)) {
|
} else if (pMethod != method || pOpacity != opacity || (method != MaskMethod::Subtract && method != MaskMethod::Difference)) {
|
||||||
auto shape = layer->pooling();
|
auto shape = layer->pooling();
|
||||||
shape->reset();
|
SHAPE(shape)->reset();
|
||||||
pShape->mask(shape, method);
|
pShape->mask(shape, method);
|
||||||
pShape = shape;
|
pShape = shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
pShape->trimpath(0.0f, 1.0f);
|
|
||||||
pShape->strokeWidth(0.0f);
|
|
||||||
pShape->fill(255, 255, 255, opacity);
|
pShape->fill(255, 255, 255, opacity);
|
||||||
pShape->transform(layer->cache.matrix);
|
pShape->transform(layer->cache.matrix);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue