From 79af60fc2f4733210ea039e511cfd6e5eaea3326 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Wed, 1 Aug 2018 11:43:37 +0900 Subject: [PATCH] lottie/vector: added reset() api to VRle class. Change-Id: Iace73912f6ab4510c0adb15387029e2038ad15be --- src/vector/vrle.cpp | 15 +++++++++++++++ src/vector/vrle.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/vector/vrle.cpp b/src/vector/vrle.cpp index 7fd4004..0fedea0 100644 --- a/src/vector/vrle.cpp +++ b/src/vector/vrle.cpp @@ -291,6 +291,7 @@ public: void translate(const VPoint &pt); void opAdd(const VRleImpl &other, VRleImpl &res); VRect bbox(); + void reset(); public: VRect m_bbox; @@ -327,6 +328,14 @@ VRect VRleImpl::bbox() return m_bbox; } +void VRleImpl::reset() +{ + m_spans.clear(); + m_bbox = VRect(); + mOffset = VPoint(); + mBboxDirty = false; +} + void VRleImpl::translate(const VPoint &pt) { // take care of last offset if applied @@ -759,6 +768,12 @@ const VRle::Span *VRle::data() const return d->impl.m_spans.data(); } +void VRle::reset() +{ + detach(); + d->impl.reset(); +} + VRle VRle::toRle(const VRect &rect) { if (rect.isEmpty()) return VRle(); diff --git a/src/vector/vrle.h b/src/vector/vrle.h index 5b0e003..5e2bc1b 100644 --- a/src/vector/vrle.h +++ b/src/vector/vrle.h @@ -35,6 +35,7 @@ public: VRle &intersect(const VRect &r); int size() const; const VRle::Span * data() const; + void reset(); VRle operator~() const; VRle operator+(const VRle &o) const; VRle operator-(const VRle &o) const; -- 2.34.1