lottie/render: fixed Mask substarct implementation. 06/184406/2
authorsubhransu mohanty <sub.mohanty@samsung.com>
Wed, 18 Jul 2018 00:40:04 +0000 (09:40 +0900)
committerSubhransu Mohanty <sub.mohanty@samsung.com>
Thu, 19 Jul 2018 04:05:34 +0000 (04:05 +0000)
Change-Id: I1fcf0a9da76dc027b0c8b397ae8655cfbff24b00

src/lottie/lottieitem.cpp
src/lottie/lottieitem.h
src/vector/vpainter.cpp
src/vector/vpainter.h
src/vector/vrle.cpp
src/vector/vrle.h

index 54fe487..0d62d4d 100644 (file)
@@ -332,7 +332,7 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask)
     VRle mask = inheritMask;
     if (hasMask()) {
         if (mask.isEmpty())
-            mask = maskRle();
+            mask = maskRle(painter->clipBoundingRect());
         else
             mask = mask & inheritMask;
     }
@@ -348,7 +348,7 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask)
     }
 }
 
-VRle LOTLayerItem::maskRle()
+VRle LOTLayerItem::maskRle(const VRect &clipRect)
 {
     VRle rle;
     for (auto &i : mMasks) {
@@ -358,8 +358,8 @@ VRle LOTLayerItem::maskRle()
                 break;
             }
             case LOTMaskData::Mode::Substarct: {
-                if (rle.isEmpty() && !mBoundingRect.isEmpty())
-                    rle = VRle::toRle(mBoundingRect);
+                if (rle.isEmpty() && !clipRect.isEmpty())
+                    rle = VRle::toRle(clipRect);
                 rle = rle - i->mRle;
                 break;
             }
@@ -501,7 +501,7 @@ void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask)
 
     if (hasMask()) {
         if (mask.isEmpty())
-            mask = maskRle();
+            mask = maskRle(painter->clipBoundingRect());
         else
             mask = mask & inheritMask;
     }
index 88d0b25..72b7b23 100644 (file)
@@ -74,7 +74,7 @@ protected:
    float opacity(int frameNo) const;
    bool visible() const;
    inline DirtyFlag flag() const {return mDirtyFlag;}
-   VRle maskRle();
+   VRle maskRle(const VRect &clipRect);
    bool hasMask() const {return !mMasks.empty();}
 protected:
    std::vector<std::unique_ptr<LOTMaskItem>>   mMasks;
@@ -85,7 +85,6 @@ protected:
    float                                       mCombinedAlpha;
    int                                         mFrameNo;
    DirtyFlag                                   mDirtyFlag;
-   VRectF                                      mBoundingRect;
    bool                                        mVisible;
    bool                                        mStatic;
 };
index 56fbf41..64d0790 100644 (file)
@@ -65,4 +65,9 @@ void VPainter::drawRle(const VPoint &pos, const VRle &rle)
     mImpl->drawRle(pos, rle);
 }
 
+VRect VPainter::clipBoundingRect() const
+{
+    return mImpl->mSpanData.mSystemClip;
+}
+
 V_END_NAMESPACE
index d7977fb..f488446 100644 (file)
@@ -22,6 +22,7 @@ public:
     void end();
     void setBrush(const VBrush &brush);
     void drawRle(const VPoint &pos, const VRle &rle);
+    VRect clipBoundingRect() const;
 private:
     VPainterImpl  *mImpl;
 };
index b8aecca..c41871f 100644 (file)
@@ -780,7 +780,7 @@ const VRle::Span* VRle::data() const
     return d->impl.m_spans.data();
 }
 
-VRle VRle::toRle(const VRectF &rect)
+VRle VRle::toRle(const VRect &rect)
 {
     if (rect.isEmpty()) return VRle();
 
index 0fe3bcf..e10919b 100644 (file)
@@ -40,7 +40,7 @@ public:
     VRle operator+(const VRle &o) const;
     VRle operator-(const VRle &o) const;
     VRle operator&(const VRle &o) const;
-    static VRle toRle(const VRectF &rect);
+    static VRle toRle(const VRect &rect);
     friend VRle operator*(const VRle &, int alpha);
     inline friend VRle operator*(int alpha, const VRle &);
     friend VDebug& operator<<(VDebug& os, const VRle& object);