mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 06:34:01 +00:00
loader/lottie: fix the incorrect viewport clip condition.
the viewport clip should be applied when it has a precomposition reference but should not apply to image assets.
This commit is contained in:
parent
32d53f6a64
commit
2fab9fb7d9
2 changed files with 1 additions and 23 deletions
|
@ -682,7 +682,7 @@ static void _updateLayer(LottieLayer* root, LottieLayer* layer, int32_t frameNo)
|
||||||
_updateMaskings(layer, rFrameNo);
|
_updateMaskings(layer, rFrameNo);
|
||||||
|
|
||||||
//clip the layer viewport
|
//clip the layer viewport
|
||||||
if (layer->clipself) {
|
if (layer->refId && layer->w > 0 && layer->h > 0) {
|
||||||
//TODO: remove the intermediate scene....
|
//TODO: remove the intermediate scene....
|
||||||
auto cscene = Scene::gen();
|
auto cscene = Scene::gen();
|
||||||
auto clipper = Shape::gen();
|
auto clipper = Shape::gen();
|
||||||
|
@ -732,24 +732,6 @@ static void _bulidHierarchy(LottieGroup* parent, LottieLayer* child)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void _buildSize(LottieComposition* comp, LottieLayer* layer)
|
|
||||||
{
|
|
||||||
//should not clip?
|
|
||||||
if (layer->refId) return;
|
|
||||||
|
|
||||||
//default size is 0x0
|
|
||||||
if (layer->w == 0 || layer->h == 0) return;
|
|
||||||
|
|
||||||
//compact layer size
|
|
||||||
if (layer->w > comp->w) layer->w = comp->w;
|
|
||||||
if (layer->h > comp->h) layer->h = comp->h;
|
|
||||||
|
|
||||||
if (layer->w < comp->w || layer->h < comp->h) {
|
|
||||||
layer->clipself = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static bool _buildPrecomp(LottieComposition* comp, LottieGroup* parent)
|
static bool _buildPrecomp(LottieComposition* comp, LottieGroup* parent)
|
||||||
{
|
{
|
||||||
if (parent->children.count == 0) return false;
|
if (parent->children.count == 0) return false;
|
||||||
|
@ -757,9 +739,6 @@ static bool _buildPrecomp(LottieComposition* comp, LottieGroup* parent)
|
||||||
for (auto c = parent->children.data; c < parent->children.end(); ++c) {
|
for (auto c = parent->children.data; c < parent->children.end(); ++c) {
|
||||||
auto child = static_cast<LottieLayer*>(*c);
|
auto child = static_cast<LottieLayer*>(*c);
|
||||||
|
|
||||||
//compact layer size
|
|
||||||
_buildSize(comp, child);
|
|
||||||
|
|
||||||
//attach the referencing layer.
|
//attach the referencing layer.
|
||||||
if (child->refId) _buildReference(comp, child);
|
if (child->refId) _buildReference(comp, child);
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,6 @@ struct LottieLayer : LottieGroup
|
||||||
Type type = Null;
|
Type type = Null;
|
||||||
bool autoOrient = false;
|
bool autoOrient = false;
|
||||||
bool roundedCorner = false;
|
bool roundedCorner = false;
|
||||||
bool clipself = false; //clip the layer viewport
|
|
||||||
bool matteSrc = false;
|
bool matteSrc = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue