rlottie/vector: Added unique(), refcount and clone api to VRle class
authorsubhransu mohanty <sub.mohanty@samsung.com>
Fri, 24 May 2019 07:00:15 +0000 (16:00 +0900)
committerHermet Park <hermetpark@gmail.com>
Wed, 19 Jun 2019 04:29:16 +0000 (13:29 +0900)
src/vector/vrle.cpp
src/vector/vrle.h

index bcf1c49..84e2758 100644 (file)
@@ -83,6 +83,11 @@ void VRle::VRleData::reset()
     mBboxDirty = false;
 }
 
+void VRle::VRleData::clone(const VRle::VRleData &o)
+{
+    *this = o;
+}
+
 void VRle::VRleData::translate(const VPoint &p)
 {
     // take care of last offset if applied
index b91e935..4de7f14 100644 (file)
@@ -58,6 +58,10 @@ public:
 
     static VRle toRle(const VRect &rect);
 
+    bool unique() const {return d.unique();}
+    int refCount() const { return d.refCount();}
+    void clone(const VRle &o);
+
 private:
     struct VRleData {
         enum class OpCode {
@@ -78,6 +82,7 @@ private:
         void  opSubstract(const VRle::VRleData &, const VRle::VRleData &);
         void  opIntersect(const VRle::VRleData &, const VRle::VRleData &);
         void  addRect(const VRect &rect);
+        void  clone(const VRle::VRleData &);
         std::vector<VRle::Span> mSpans;
         VPoint                  mOffset;
         mutable VRect           mBbox;
@@ -167,6 +172,11 @@ inline void VRle::reset()
     d.write().reset();
 }
 
+inline void VRle::clone(const VRle &o)
+{
+    d.write().clone(o.d.read());
+}
+
 inline void VRle::translate(const VPoint &p)
 {
     d.write().translate(p);