From 7e774a7bcdd00a60b54a82b3869d916c24be98c3 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Wed, 12 Dec 2018 15:19:28 +0900 Subject: [PATCH] lottie/render: add new drawRle() api with rle clip support. Change-Id: Ibcc16085e0df06da65f8a9f2367189d25c618a11 --- src/vector/vpainter.cpp | 18 ++++++++++++++++++ src/vector/vpainter.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/vector/vpainter.cpp b/src/vector/vpainter.cpp index 1249e38..3ff3e89 100644 --- a/src/vector/vpainter.cpp +++ b/src/vector/vpainter.cpp @@ -6,6 +6,7 @@ V_BEGIN_NAMESPACE class VPainterImpl { public: void drawRle(const VPoint &pos, const VRle &rle); + void drawRle(const VRle &rle, const VRle &clip); public: VRasterBuffer mBuffer; @@ -26,6 +27,17 @@ void VPainterImpl::drawRle(const VPoint &pos, const VRle &rle) &mSpanData); } +void VPainterImpl::drawRle(const VRle &rle, const VRle &clip) +{ + if (rle.empty() || clip.empty()) return; + + if (!mSpanData.mUnclippedBlendFunc) return; + + rle.intersect(clip, mSpanData.mUnclippedBlendFunc, + &mSpanData); +} + + VPainter::~VPainter() { delete mImpl; @@ -61,6 +73,12 @@ void VPainter::drawRle(const VPoint &pos, const VRle &rle) mImpl->drawRle(pos, rle); } +void VPainter::drawRle(const VRle &rle, const VRle &clip) +{ + mImpl->drawRle(rle, clip); +} + + VRect VPainter::clipBoundingRect() const { return mImpl->mSpanData.mSystemClip; diff --git a/src/vector/vpainter.h b/src/vector/vpainter.h index 67942a2..cb3ec4e 100644 --- a/src/vector/vpainter.h +++ b/src/vector/vpainter.h @@ -19,6 +19,7 @@ public: void end(); void setBrush(const VBrush &brush); void drawRle(const VPoint &pos, const VRle &rle); + void drawRle(const VRle &rle, const VRle &clip); VRect clipBoundingRect() const; private: -- 2.34.1