From 9a50268e2c467623bbefeb17fc5d837c2f7a723f Mon Sep 17 00:00:00 2001 From: "sub.mohanty@samsung.com" Date: Sun, 9 Sep 2018 11:57:30 +0900 Subject: [PATCH] lottie: rename all isEmpty() api to empty() for consistancy. Change-Id: Id3dddbd920ff00c7beafe0abd17f6da73442195b --- src/lottie/lottieitem.cpp | 22 +++++++++++----------- src/vector/vdasher.cpp | 2 +- src/vector/vpainter.cpp | 2 +- src/vector/vpath.cpp | 6 +++--- src/vector/vpath.h | 12 ++++++------ src/vector/vpoint.h | 2 +- src/vector/vraster.cpp | 4 ++-- src/vector/vregion.cpp | 32 ++++++++++++++++---------------- src/vector/vregion.h | 2 +- src/vector/vrle.h | 22 +++++++++++----------- test/testsgregion.cpp | 6 +++--- 11 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index f03ecce..80e655b 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -129,7 +129,7 @@ void LOTMaskItem::update(int frameNo, const VMatrix &parentMatrix, float parentAlpha, const DirtyFlag &/*flag*/) { if (mData->mShape.isStatic()) { - if (mLocalPath.isEmpty()) { + if (mLocalPath.empty()) { mData->mShape.value(frameNo).toPath(mLocalPath); } } else { @@ -167,7 +167,7 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle matteRle = matteRle + i->rle(); } - if (!inheritMatte.isEmpty()) + if (!inheritMatte.empty()) matteRle = matteRle & inheritMatte; } else { matteRle = inheritMatte; @@ -178,10 +178,10 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle VRle mask; if (hasMask()) { mask = maskRle(painter->clipBoundingRect()); - if (!inheritMask.isEmpty()) + if (!inheritMask.empty()) mask = mask & inheritMask; // if resulting mask is empty then return. - if (mask.isEmpty()) + if (mask.empty()) return; } else { mask = inheritMask; @@ -190,11 +190,11 @@ void LOTLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle for (auto &i : mDrawableList) { painter->setBrush(i->mBrush); VRle rle = i->rle(); - if (!mask.isEmpty()) rle = rle & mask; + if (!mask.empty()) rle = rle & mask; - if (rle.isEmpty()) continue; + if (rle.empty()) continue; - if (!matteRle.isEmpty()) { + if (!matteRle.empty()) { if (mLayerData->mMatteType == MatteType::AlphaInv) { rle = rle - matteRle; } else { @@ -215,7 +215,7 @@ VRle LOTLayerItem::maskRle(const VRect &clipRect) break; } case LOTMaskData::Mode::Substarct: { - if (rle.isEmpty() && !clipRect.empty()) + if (rle.empty() && !clipRect.empty()) rle = VRle::toRle(clipRect); rle = rle - i->rle(); break; @@ -359,7 +359,7 @@ void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, const matteRle = matteRle + i->rle(); } - if (!inheritMatte.isEmpty()) + if (!inheritMatte.empty()) matteRle = matteRle & inheritMatte; } else { matteRle = inheritMatte; @@ -368,10 +368,10 @@ void LOTCompLayerItem::render(VPainter *painter, const VRle &inheritMask, const VRle mask; if (hasMask()) { mask = maskRle(painter->clipBoundingRect()); - if (!inheritMask.isEmpty()) + if (!inheritMask.empty()) mask = mask & inheritMask; // if resulting mask is empty then return. - if (mask.isEmpty()) + if (mask.empty()) return; } else { mask = inheritMask; diff --git a/src/vector/vdasher.cpp b/src/vector/vdasher.cpp index eedae3a..987668e 100644 --- a/src/vector/vdasher.cpp +++ b/src/vector/vdasher.cpp @@ -160,7 +160,7 @@ void VDasher::cubicTo(const VPointF &cp1, const VPointF &cp2, const VPointF &e) VPath VDasher::dashed(const VPath &path) { - if (path.isEmpty()) return VPath(); + if (path.empty()) return VPath(); mResult = VPath(); mIndex = 0; diff --git a/src/vector/vpainter.cpp b/src/vector/vpainter.cpp index 064f634..1249e38 100644 --- a/src/vector/vpainter.cpp +++ b/src/vector/vpainter.cpp @@ -14,7 +14,7 @@ public: void VPainterImpl::drawRle(const VPoint &pos, const VRle &rle) { - if (rle.isEmpty()) return; + if (rle.empty()) return; // mSpanData.updateSpanFunc(); if (!mSpanData.mUnclippedBlendFunc) return; diff --git a/src/vector/vpath.cpp b/src/vector/vpath.cpp index 57d4b4b..efb8a6c 100644 --- a/src/vector/vpath.cpp +++ b/src/vector/vpath.cpp @@ -79,7 +79,7 @@ void VPath::VPathData::cubicTo(float cx1, float cy1, float cx2, float cy2, void VPath::VPathData::close() { - if (isEmpty()) return; + if (empty()) return; const VPointF &lastPt = m_points.back(); if (!fuzzyCompare(mStartPoint, lastPt)) { @@ -91,7 +91,7 @@ void VPath::VPathData::close() void VPath::VPathData::reset() { - if (isEmpty()) return; + if (empty()) return; m_elements.clear(); m_points.clear(); @@ -123,7 +123,7 @@ void VPath::VPathData::arcTo(const VRectF &rect, float startAngle, curvesForArc(rect, startAngle, sweepLength, pts, &point_count); reserve(point_count + 1, point_count / 3 + 1); - if (isEmpty() || forceMoveTo) { + if (empty() || forceMoveTo) { moveTo(curve_start.x(), curve_start.y()); } else { lineTo(curve_start.x(), curve_start.y()); diff --git a/src/vector/vpath.h b/src/vector/vpath.h index 24fce59..567d99c 100644 --- a/src/vector/vpath.h +++ b/src/vector/vpath.h @@ -14,7 +14,7 @@ public: enum class Direction { CCW, CW }; enum class Element : uchar { MoveTo, LineTo, CubicTo, Close }; - bool isEmpty() const; + bool empty() const; void moveTo(const VPointF &p); void moveTo(float x, float y); void lineTo(const VPointF &p); @@ -50,7 +50,7 @@ public: private: struct VPathData { - bool isEmpty() const { return m_elements.empty(); } + bool empty() const { return m_elements.empty(); } void moveTo(float x, float y); void lineTo(float x, float y); void cubicTo(float cx1, float cy1, float cx2, float cy2, float ex, float ey); @@ -89,9 +89,9 @@ private: vcow_ptr d; }; -inline bool VPath::isEmpty() const +inline bool VPath::empty() const { - return d->isEmpty(); + return d->empty(); } inline void VPath::moveTo(const VPointF &p) @@ -203,9 +203,9 @@ inline void VPath::addPolygon(float points, float radius, float roundness, inline void VPath::addPath(const VPath &path) { - if (path.isEmpty()) return; + if (path.empty()) return; - if (isEmpty()) { + if (empty()) { *this = path; } else { d.write().addPath(path.d.read()); diff --git a/src/vector/vpoint.h b/src/vector/vpoint.h index 3eb8ed5..22bd889 100644 --- a/src/vector/vpoint.h +++ b/src/vector/vpoint.h @@ -142,7 +142,7 @@ class VSize { public: VSize() = default; constexpr inline VSize(int w, int h) noexcept : mw(w), mh(h) {} - bool isEmpty() const {return (mw <= 0 || mh <= 0);} + bool empty() const {return (mw <= 0 || mh <= 0);} constexpr inline int width() const noexcept { return mw; } constexpr inline int height() const noexcept { return mh; } inline void setWidth(int w) { mw = w; } diff --git a/src/vector/vraster.cpp b/src/vector/vraster.cpp index 7d20723..b5e58f4 100644 --- a/src/vector/vraster.cpp +++ b/src/vector/vraster.cpp @@ -387,7 +387,7 @@ static RleTaskScheduler raster_scheduler; std::future VRaster::generateFillInfo(VPath &&path, VRle &&rle, FillRule fillRule) { - if (path.isEmpty()) { + if (path.empty()) { std::promise promise; promise.set_value(VRle()); return promise.get_future(); @@ -399,7 +399,7 @@ std::future VRaster::generateStrokeInfo(VPath &&path, VRle &&rle, CapStyle JoinStyle join, float width, float meterLimit) { - if (path.isEmpty()) { + if (path.empty()) { std::promise promise; promise.set_value(VRle()); return promise.get_future(); diff --git a/src/vector/vregion.cpp b/src/vector/vregion.cpp index b5eab50..5944b63 100644 --- a/src/vector/vregion.cpp +++ b/src/vector/vregion.cpp @@ -1868,14 +1868,14 @@ VRegion::~VRegion() if (!d->ref.deref()) cleanUp(d); } -bool VRegion::isEmpty() const +bool VRegion::empty() const { return d == &shared_empty || !PREFIX(_not_empty)(d->rgn); } void VRegion::translate(const VPoint &p) { - if (p == VPoint() || isEmpty()) return; + if (p == VPoint() || empty()) return; detach(); PREFIX(_translate)(d->rgn, p.x(), p.y()); @@ -1910,7 +1910,7 @@ bool VRegion::contains(const VRect &r) const VRegion VRegion::united(const VRect &r) const { - if (isEmpty()) return r; + if (empty()) return r; if (contains(r)) { return *this; @@ -1927,8 +1927,8 @@ VRegion VRegion::united(const VRect &r) const VRegion VRegion::united(const VRegion &r) const { - if (isEmpty()) return r; - if (r.isEmpty()) return *this; + if (empty()) return r; + if (r.empty()) return *this; if (d == r.d || PREFIX(_equal)(d->rgn, r.d->rgn)) return *this; VRegion result; result.detach(); @@ -1938,7 +1938,7 @@ VRegion VRegion::united(const VRegion &r) const VRegion VRegion::intersected(const VRect &r) const { - if (isEmpty() || r.empty()) return VRegion(); + if (empty() || r.empty()) return VRegion(); /* this is fully contained in r */ if (within(r)) return *this; @@ -1955,7 +1955,7 @@ VRegion VRegion::intersected(const VRect &r) const VRegion VRegion::intersected(const VRegion &r) const { - if (isEmpty() || r.isEmpty()) return VRegion(); + if (empty() || r.empty()) return VRegion(); VRegion result; result.detach(); @@ -1966,7 +1966,7 @@ VRegion VRegion::intersected(const VRegion &r) const VRegion VRegion::subtracted(const VRegion &r) const { - if (isEmpty() || r.isEmpty()) return *this; + if (empty() || r.empty()) return *this; if (d == r.d || PREFIX(_equal)(d->rgn, r.d->rgn)) return VRegion(); VRegion result; @@ -1977,7 +1977,7 @@ VRegion VRegion::subtracted(const VRegion &r) const int VRegion::rectCount() const { - if (isEmpty()) return 0; + if (empty()) return 0; return PREFIX(_n_rects)(d->rgn); } @@ -2008,7 +2008,7 @@ VRegion VRegion::operator-(const VRegion &r) const VRegion &VRegion::operator+=(const VRect &r) { - if (isEmpty()) return *this = r; + if (empty()) return *this = r; if (r.empty()) return *this; if (contains(r)) { @@ -2025,8 +2025,8 @@ VRegion &VRegion::operator+=(const VRect &r) VRegion &VRegion::operator+=(const VRegion &r) { - if (isEmpty()) return *this = r; - if (r.isEmpty()) return *this; + if (empty()) return *this = r; + if (r.empty()) return *this; if (d == r.d || PREFIX(_equal)(d->rgn, r.d->rgn)) return *this; detach(); @@ -2041,8 +2041,8 @@ VRegion &VRegion::operator-=(const VRegion &r) bool VRegion::operator==(const VRegion &r) const { - if (isEmpty()) return r.isEmpty(); - if (r.isEmpty()) return isEmpty(); + if (empty()) return r.empty(); + if (r.empty()) return empty(); if (d == r.d) return true; @@ -2052,7 +2052,7 @@ bool VRegion::operator==(const VRegion &r) const VRect VRegion::boundingRect() const noexcept { - if (isEmpty()) return {}; + if (empty()) return {}; return box_to_rect(&d->rgn->extents); } @@ -2064,7 +2064,7 @@ inline bool rect_intersects(const VRect &r1, const VRect &r2) bool VRegion::intersects(const VRegion &r) const { - if (isEmpty() || r.isEmpty()) return false; + if (empty() || r.empty()) return false; return PREFIX(_intersects)(d->rgn, r.d->rgn); } diff --git a/src/vector/vregion.h b/src/vector/vregion.h index b312e68..e341b35 100644 --- a/src/vector/vregion.h +++ b/src/vector/vregion.h @@ -20,7 +20,7 @@ public: ~VRegion(); VRegion & operator=(const VRegion &); VRegion & operator=(VRegion &&); - bool isEmpty() const; + bool empty() const; bool contains(const VRect &r) const; VRegion united(const VRect &r) const; VRegion united(const VRegion &r) const; diff --git a/src/vector/vrle.h b/src/vector/vrle.h index e5ecc36..8790497 100644 --- a/src/vector/vrle.h +++ b/src/vector/vrle.h @@ -19,7 +19,7 @@ public: }; typedef void (*VRleSpanCb)(int count, const VRle::Span *spans, void *userData); - bool isEmpty() const; + bool empty() const; VRect boundingRect() const; void addSpan(const VRle::Span *span, int count); @@ -44,7 +44,7 @@ private: Add, Xor }; - bool isEmpty() const { return mSpans.empty(); } + bool empty() const { return mSpans.empty(); } void addSpan(const VRle::Span *span, int count); void updateBbox() const; VRect bbox() const; @@ -66,9 +66,9 @@ private: vcow_ptr d; }; -inline bool VRle::isEmpty() const +inline bool VRle::empty() const { - return d->isEmpty(); + return d->empty(); } inline void VRle::addSpan(const VRle::Span *span, int count) @@ -93,7 +93,7 @@ inline void VRle::operator*=(int alpha) inline VRle VRle::operator&(const VRle &o) const { - if (isEmpty() || o.isEmpty()) return VRle(); + if (empty() || o.empty()) return VRle(); VRle result; result.d.write().opIntersect(d.read(), o.d.read()); @@ -103,8 +103,8 @@ inline VRle VRle::operator&(const VRle &o) const inline VRle VRle::operator+(const VRle &o) const { - if (isEmpty()) return o; - if (o.isEmpty()) return *this; + if (empty()) return o; + if (o.empty()) return *this; VRle result; result.d.write().opGeneric(d.read(), o.d.read(), VRleData::OpCode::Add); @@ -114,8 +114,8 @@ inline VRle VRle::operator+(const VRle &o) const inline VRle VRle::operator^(const VRle &o) const { - if (isEmpty()) return o; - if (o.isEmpty()) return *this; + if (empty()) return o; + if (o.empty()) return *this; VRle result; result.d.write().opGeneric(d.read(), o.d.read(), VRleData::OpCode::Xor); @@ -125,8 +125,8 @@ inline VRle VRle::operator^(const VRle &o) const inline VRle VRle::operator-(const VRle &o) const { - if (isEmpty()) return VRle(); - if (o.isEmpty()) return *this; + if (empty()) return VRle(); + if (o.empty()) return *this; VRle result; result.d.write().opSubstract(d.read(), o.d.read()); diff --git a/test/testsgregion.cpp b/test/testsgregion.cpp index ecaae0f..abdc422 100644 --- a/test/testsgregion.cpp +++ b/test/testsgregion.cpp @@ -42,16 +42,16 @@ TEST_F(VRegionTest, moveSemantics) { rgn1 = rect1; VRegion tmp; tmp = std::move(rgn1); - ASSERT_TRUE(rgn1.isEmpty()); + ASSERT_TRUE(rgn1.empty()); // move construction rgn1 = rect1; VRegion mvrgn = std::move(rgn1); - ASSERT_TRUE(rgn1.isEmpty()); + ASSERT_TRUE(rgn1.empty()); ASSERT_TRUE(mvrgn == rect1); } TEST_F(VRegionTest, isEmpty) { - ASSERT_TRUE(emptyRgn.isEmpty()); + ASSERT_TRUE(emptyRgn.empty()); ASSERT_TRUE(emptyRgn == VRegion()); ASSERT_TRUE(emptyRgn.rectCount() == 0); ASSERT_TRUE(emptyRgn.boundingRect() == VRect()); -- 2.7.4