From: Youngbok Shin Date: Mon, 20 Aug 2018 11:39:46 +0000 (+0900) Subject: lottie: apply matte feature to LOTCompLayerItem X-Git-Tag: submit/tizen/20180917.042405~95 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F77%2F187177%2F2;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie: apply matte feature to LOTCompLayerItem The LOTCompLayerItem's MatteRle has to be inherited to its all children layers. You can test it with "personal_character.json". Change-Id: I225e16397441f9771286c6fcc821b5050b165ecc --- diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 7b34854..cab0264 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -120,8 +120,7 @@ bool LOTCompItem::render(const LOTBuffer &buffer) } VPainter painter(&bitmap); - VRle mask; - mRootLayer->render(&painter, mask, nullptr); + mRootLayer->render(&painter, {}, {}, nullptr); return true; } @@ -158,7 +157,7 @@ VRle LOTMaskItem::rle() return mRle; } -void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLayerItem *matteSource) +void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle &inheritMatte, LOTLayerItem *matteSource) { VRle matteRle; if (matteSource) { @@ -167,6 +166,11 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLayerIt for (auto &i : mDrawableList) { matteRle = matteRle + i->rle(); } + + if (!inheritMatte.isEmpty()) + matteRle = matteRle & inheritMatte; + } else { + matteRle = inheritMatte; } mDrawableList.clear(); renderList(mDrawableList); @@ -344,7 +348,7 @@ void LOTCompLayerItem::updateStaticProperty() } } -void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLayerItem *matteSource) +void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle &inheritMatte, LOTLayerItem *matteSource) { VRle matteRle; if (matteSource) { @@ -353,6 +357,11 @@ void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLay for (auto &i : mDrawableList) { matteRle = matteRle + i->rle(); } + + if (!inheritMatte.isEmpty()) + matteRle = matteRle & inheritMatte; + } else { + matteRle = inheritMatte; } VRle mask; @@ -377,10 +386,10 @@ void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, LOTLay } if (matteLayer) { - matteLayer->render(painter, mask, layer); + matteLayer->render(painter, mask, matteRle, layer); matteLayer = nullptr; } else { - layer->render(painter, mask, nullptr); + layer->render(painter, mask, matteRle, nullptr); } } } diff --git a/src/lottie/lottieitem.h b/src/lottie/lottieitem.h index 57da07e..a29875f 100644 --- a/src/lottie/lottieitem.h +++ b/src/lottie/lottieitem.h @@ -64,7 +64,7 @@ public: VMatrix matrix(int frameNo) const; virtual void renderList(std::vector &list){} virtual void updateStaticProperty(); - virtual void render(VPainter *painter, const VRle &mask, LOTLayerItem *matteSource); + virtual void render(VPainter *painter, const VRle &mask, const VRle &inheritMatte, LOTLayerItem *matteSource); bool hasMatte() { if (mLayerData->mMatteType == MatteType::None) return false; return true; } protected: @@ -98,7 +98,7 @@ public: LOTCompLayerItem(LOTLayerData *layerData); void renderList(std::vector &list)final; void updateStaticProperty() final; - void render(VPainter *painter, const VRle &mask, LOTLayerItem *matteSource) final; + void render(VPainter *painter, const VRle &mask, const VRle &inheritMatte, LOTLayerItem *matteSource) final; protected: void updateContent() final; private: