From 15429d2a7115207c79104412a7c7eab0616bfcde Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Thu, 3 Jan 2019 16:57:50 +0900 Subject: [PATCH] lottie/capi: updated cliper info in layernode. Change-Id: I338dc65c6ccf2a1952f2c457ba9168faa242e08c --- inc/lottiecommon.h | 7 +++++++ src/lottie/lottieitem.cpp | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/inc/lottiecommon.h b/inc/lottiecommon.h index df6552a..d35fcdf 100644 --- a/inc/lottiecommon.h +++ b/inc/lottiecommon.h @@ -195,6 +195,13 @@ typedef struct LOTLayerNode { } mMaskList; struct { + const float *ptPtr; + int ptCount; + const char* elmPtr; + int elmCount; + } mClipPath; + + struct { struct LOTLayerNode **ptr; unsigned int size; } mLayerList; diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 3a9bfbd..886b8c0 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -188,6 +188,10 @@ void LOTLayerItem::buildLayerNode() mLayerCNode->mNodeList.size = 0; mLayerCNode->mMatte = MatteNone; mLayerCNode->mVisible = 0; + mLayerCNode->mClipPath.ptPtr = nullptr; + mLayerCNode->mClipPath.elmPtr = nullptr; + mLayerCNode->mClipPath.ptCount = 0; + mLayerCNode->mClipPath.elmCount = 0; } mLayerCNode->mVisible = visible(); // update matte @@ -477,6 +481,16 @@ void LOTCompLayerItem::updateStaticProperty() void LOTCompLayerItem::buildLayerNode() { LOTLayerItem::buildLayerNode(); + if (mClipper) { + const std::vector &elm = mClipper->mPath.elements(); + const std::vector & pts = mClipper->mPath.points(); + const float *ptPtr = reinterpret_cast(pts.data()); + const char * elmPtr = reinterpret_cast(elm.data()); + layerNode()->mClipPath.ptPtr = ptPtr; + layerNode()->mClipPath.elmPtr = elmPtr; + layerNode()->mClipPath.ptCount = 2 * pts.size(); + layerNode()->mClipPath.elmCount = elm.size(); + } if (mLayers.size() != mLayersCNode.size()) { for (const auto &layer : mLayers) { layer->buildLayerNode(); -- 2.7.4