lottie/vector: optimize when the rle bounding rect is inside the clip rect. 14/193314/2
authorsubhransu mohanty <sub.mohanty@samsung.com>
Mon, 19 Nov 2018 07:23:49 +0000 (16:23 +0900)
committersubhransu mohanty <sub.mohanty@samsung.com>
Mon, 19 Nov 2018 07:25:21 +0000 (16:25 +0900)
Change-Id: I30c512af527fe8f34d3259b0ec9579aa50765716

src/vector/vrle.cpp

index 3d4393d..7db043b 100644 (file)
@@ -134,8 +134,14 @@ void VRle::VRleData::operator*=(int alpha)
 void VRle::VRleData::opIntersect(const VRect &r, VRle::VRleSpanCb cb,
                                  void *userData) const
 {
-    VRect clip = r;
+    if (empty()) return;
+
+    if (r.contains(bbox())) {
+        cb(mSpans.size(), mSpans.data(), userData);
+        return;
+    }
 
+    VRect clip = r;
     VRleHelper                  tresult, tmp_obj;
     std::array<VRle::Span, 256> array;