From 3afcc781d9e7e1da539cf6077fc5369108e3a66e Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Tue, 4 Dec 2018 15:37:49 +0900 Subject: [PATCH] lottie/render: handle AlphaInverse matte for composition layer. Change-Id: Ia477287d71dc15466e42a267e385af4cec683020 --- src/lottie/lottieitem.cpp | 7 +++++-- src/lottie/lottieitem.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index e5f59aa..456eb66 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -217,7 +217,6 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle for (auto &i : mDrawableList) { matteRle = matteRle + i->rle(); } - if (!inheritMatte.empty()) matteRle = matteRle & inheritMatte; } else { @@ -246,7 +245,7 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle if (rle.empty()) continue; if (!matteRle.empty()) { - if (mLayerData->mMatteType == MatteType::AlphaInv) { + if (matteType() == MatteType::AlphaInv) { rle = rle - matteRle; } else { rle = rle & matteRle; @@ -427,6 +426,10 @@ void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, const matteRle = matteRle + i->rle(); } + if (matteType() == MatteType::AlphaInv ) { + matteRle = VRle::toRle(painter->clipBoundingRect()) - matteRle; + } + if (!inheritMatte.empty()) matteRle = matteRle & inheritMatte; } else { diff --git a/src/lottie/lottieitem.h b/src/lottie/lottieitem.h index 93a9966..d87f37a 100644 --- a/src/lottie/lottieitem.h +++ b/src/lottie/lottieitem.h @@ -69,6 +69,7 @@ public: virtual void updateStaticProperty(); virtual void render(VPainter *painter, const VRle &mask, const VRle &inheritMatte, LOTLayerItem *matteSource); bool hasMatte() { if (mLayerData->mMatteType == MatteType::None) return false; return true; } + MatteType matteType() const { return mLayerData->mMatteType;} bool visible() const; virtual void buildLayerNode(); LOTLayerNode * layerNode() const {return mLayerCNode.get();} -- 2.34.1