summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2018-06-25 18:08:38 +0900
committersubhransu mohanty <sub.mohanty@samsung.com>2018-06-25 18:08:38 +0900
commit16748c155feda0249ee4ccc58b0666ce412a0e2c (patch)
tree1c87485e9e5662c7664beab94bee1e871f53f222
parentf82ce1c74e360633d7332da2efbbf311c3b53df4 (diff)
lottie: fixed scaling issue in composition item
-rw-r--r--example/lottieview.cpp16
-rw-r--r--src/lottie/lottieitem.cpp10
2 files changed, 12 insertions, 14 deletions
diff --git a/example/lottieview.cpp b/example/lottieview.cpp
index 4356d4e..c337773 100644
--- a/example/lottieview.cpp
+++ b/example/lottieview.cpp
@@ -49,16 +49,16 @@ void LottieView::createVgNode(LOTNode *node, Efl_VG *parent)
49 } 49 }
50 // update paint info 50 // update paint info
51 if (node->mType == LOTNode::Type::TypeFill) { 51 if (node->mType == LOTNode::Type::TypeFill) {
52 int r = (node->mColor.r * node->mColor.a)/node->mColor.a; 52 int r = (node->mColor.r * node->mColor.a)/255;
53 int g = (node->mColor.g * node->mColor.a)/node->mColor.a; 53 int g = (node->mColor.g * node->mColor.a)/255;
54 int b = (node->mColor.b * node->mColor.a)/node->mColor.a; 54 int b = (node->mColor.b * node->mColor.a)/255;
55 int a = (node->mColor.a * node->mColor.a)/node->mColor.a; 55 int a = node->mColor.a;
56 evas_vg_node_color_set(shape, r, g, b, a); 56 evas_vg_node_color_set(shape, r, g, b, a);
57 } else if (node->mType == LOTNode::Type::TypeStroke) { 57 } else if (node->mType == LOTNode::Type::TypeStroke) {
58 int r = (node->mColor.r * node->mColor.a)/node->mColor.a; 58 int r = (node->mColor.r * node->mColor.a)/255;
59 int g = (node->mColor.g * node->mColor.a)/node->mColor.a; 59 int g = (node->mColor.g * node->mColor.a)/255;
60 int b = (node->mColor.b * node->mColor.a)/node->mColor.a; 60 int b = (node->mColor.b * node->mColor.a)/255;
61 int a = (node->mColor.a * node->mColor.a)/node->mColor.a; 61 int a = node->mColor.a;
62 evas_vg_shape_stroke_color_set(shape, r, g, b, a); 62 evas_vg_shape_stroke_color_set(shape, r, g, b, a);
63 evas_vg_shape_stroke_width_set(shape, node->mStroke.width); 63 evas_vg_shape_stroke_width_set(shape, node->mStroke.width);
64 } 64 }
diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp
index f3e9d09..6c4a260 100644
--- a/src/lottie/lottieitem.cpp
+++ b/src/lottie/lottieitem.cpp
@@ -73,12 +73,9 @@ void LOTCompItem::update(int frameNo)
73 // check if cached frame is same as requested frame. 73 // check if cached frame is same as requested frame.
74 if (!mUpdateViewBox && (mCurFrameNo == frameNo)) return; 74 if (!mUpdateViewBox && (mCurFrameNo == frameNo)) return;
75 75
76 if (mUpdateViewBox) { 76 sx = mViewSize.width() / float(mCompData->size().width());
77 sx = mViewSize.width() / float(mCompData->size().width()); 77 sy = mViewSize.height() / float(mCompData->size().height());
78 sy = mViewSize.height() / float(mCompData->size().height()); 78 m.scale(sx, sy);
79 m.scale(sx, sy);
80 mUpdateViewBox = false;
81 }
82 79
83 // update the layer from back to front 80 // update the layer from back to front
84 for (auto i = mLayers.rbegin(); i != mLayers.rend(); ++i) { 81 for (auto i = mLayers.rbegin(); i != mLayers.rend(); ++i) {
@@ -87,6 +84,7 @@ void LOTCompItem::update(int frameNo)
87 } 84 }
88 buildRenderList(); 85 buildRenderList();
89 mCurFrameNo = frameNo; 86 mCurFrameNo = frameNo;
87 mUpdateViewBox = false;
90} 88}
91 89
92void LOTCompItem::buildRenderList() 90void LOTCompItem::buildRenderList()