float parentAlpha, const DirtyFlag &/*flag*/)
{
if (mData->mShape.isStatic()) {
- if (mLocalPath.isEmpty()) {
+ if (mLocalPath.empty()) {
mData->mShape.value(frameNo).toPath(mLocalPath);
}
} else {
matteRle = matteRle + i->rle();
}
- if (!inheritMatte.isEmpty())
+ if (!inheritMatte.empty())
matteRle = matteRle & inheritMatte;
} else {
matteRle = inheritMatte;
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;
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 {
break;
}
case LOTMaskData::Mode::Substarct: {
- if (rle.isEmpty() && !clipRect.empty())
+ if (rle.empty() && !clipRect.empty())
rle = VRle::toRle(clipRect);
rle = rle - i->rle();
break;
matteRle = matteRle + i->rle();
}
- if (!inheritMatte.isEmpty())
+ if (!inheritMatte.empty())
matteRle = matteRle & inheritMatte;
} else {
matteRle = inheritMatte;
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;
VPath VDasher::dashed(const VPath &path)
{
- if (path.isEmpty()) return VPath();
+ if (path.empty()) return VPath();
mResult = VPath();
mIndex = 0;
void VPainterImpl::drawRle(const VPoint &pos, const VRle &rle)
{
- if (rle.isEmpty()) return;
+ if (rle.empty()) return;
// mSpanData.updateSpanFunc();
if (!mSpanData.mUnclippedBlendFunc) return;
void VPath::VPathData::close()
{
- if (isEmpty()) return;
+ if (empty()) return;
const VPointF &lastPt = m_points.back();
if (!fuzzyCompare(mStartPoint, lastPt)) {
void VPath::VPathData::reset()
{
- if (isEmpty()) return;
+ if (empty()) return;
m_elements.clear();
m_points.clear();
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());
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);
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);
vcow_ptr<VPathData> d;
};
-inline bool VPath::isEmpty() const
+inline bool VPath::empty() const
{
- return d->isEmpty();
+ return d->empty();
}
inline void VPath::moveTo(const VPointF &p)
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());
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; }
std::future<VRle> VRaster::generateFillInfo(VPath &&path, VRle &&rle,
FillRule fillRule)
{
- if (path.isEmpty()) {
+ if (path.empty()) {
std::promise<VRle> promise;
promise.set_value(VRle());
return promise.get_future();
JoinStyle join, float width,
float meterLimit)
{
- if (path.isEmpty()) {
+ if (path.empty()) {
std::promise<VRle> promise;
promise.set_value(VRle());
return promise.get_future();
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());
VRegion VRegion::united(const VRect &r) const
{
- if (isEmpty()) return r;
+ if (empty()) return r;
if (contains(r)) {
return *this;
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();
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;
VRegion VRegion::intersected(const VRegion &r) const
{
- if (isEmpty() || r.isEmpty()) return VRegion();
+ if (empty() || r.empty()) return VRegion();
VRegion result;
result.detach();
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;
int VRegion::rectCount() const
{
- if (isEmpty()) return 0;
+ if (empty()) return 0;
return PREFIX(_n_rects)(d->rgn);
}
VRegion &VRegion::operator+=(const VRect &r)
{
- if (isEmpty()) return *this = r;
+ if (empty()) return *this = r;
if (r.empty()) return *this;
if (contains(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();
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;
VRect VRegion::boundingRect() const noexcept
{
- if (isEmpty()) return {};
+ if (empty()) return {};
return box_to_rect(&d->rgn->extents);
}
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);
}
~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;
};
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);
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;
vcow_ptr<VRleData> 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)
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());
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);
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);
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());
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());