check for wide-open inside quickContains
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2263373002 Review-Url: https://codereview.chromium.org/2263373002
This commit is contained in:
parent
d331742d27
commit
4d2cce442d
@ -333,8 +333,13 @@ public:
|
||||
* by the clip. A return value of false does not guarantee that the (r)rect
|
||||
* is not contained by the clip.
|
||||
*/
|
||||
bool quickContains(const SkRect& devRect) const;
|
||||
bool quickContains(const SkRRect& devRRect) const;
|
||||
bool quickContains(const SkRect& devRect) const {
|
||||
return this->isWideOpen() || this->internalQuickContains(devRect);
|
||||
}
|
||||
|
||||
bool quickContains(const SkRRect& devRRect) const {
|
||||
return this->isWideOpen() || this->internalQuickContains(devRRect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattens the clip stack into a single SkPath. Returns true if any of
|
||||
@ -357,7 +362,7 @@ public:
|
||||
* isWideOpen returns true if the clip state corresponds to the infinite
|
||||
* plane (i.e., draws are not limited at all)
|
||||
*/
|
||||
bool isWideOpen() const;
|
||||
bool isWideOpen() const { return this->getTopmostGenID() == kWideOpenGenID; }
|
||||
|
||||
/**
|
||||
* The generation ID has three reserved values to indicate special
|
||||
@ -479,6 +484,9 @@ private:
|
||||
// invalid ID.
|
||||
static int32_t gGenID;
|
||||
|
||||
bool internalQuickContains(const SkRect& devRect) const;
|
||||
bool internalQuickContains(const SkRRect& devRRect) const;
|
||||
|
||||
/**
|
||||
* Helper for clipDevPath, etc.
|
||||
*/
|
||||
|
@ -621,7 +621,7 @@ void SkClipStack::getBounds(SkRect* canvFiniteBound,
|
||||
}
|
||||
}
|
||||
|
||||
bool SkClipStack::quickContains(const SkRect& rect) const {
|
||||
bool SkClipStack::internalQuickContains(const SkRect& rect) const {
|
||||
|
||||
Iter iter(*this, Iter::kTop_IterStart);
|
||||
const Element* element = iter.prev();
|
||||
@ -646,7 +646,7 @@ bool SkClipStack::quickContains(const SkRect& rect) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SkClipStack::quickContains(const SkRRect& rrect) const {
|
||||
bool SkClipStack::internalQuickContains(const SkRRect& rrect) const {
|
||||
|
||||
Iter iter(*this, Iter::kTop_IterStart);
|
||||
const Element* element = iter.prev();
|
||||
@ -771,10 +771,6 @@ void SkClipStack::clipEmpty() {
|
||||
((Element*)fDeque.back())->fGenID = kEmptyGenID;
|
||||
}
|
||||
|
||||
bool SkClipStack::isWideOpen() const {
|
||||
return this->getTopmostGenID() == kWideOpenGenID;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SkClipStack::Iter::Iter() : fStack(nullptr) {
|
||||
|
@ -26,7 +26,7 @@ typedef GrReducedClip::ElementList ElementList;
|
||||
static const int kMaxAnalyticElements = 4;
|
||||
|
||||
bool GrClipStackClip::quickContains(const SkRect& rect) const {
|
||||
if (!fStack) {
|
||||
if (!fStack || fStack->isWideOpen()) {
|
||||
return true;
|
||||
}
|
||||
return fStack->quickContains(rect.makeOffset(SkIntToScalar(fOrigin.x()),
|
||||
@ -34,7 +34,7 @@ bool GrClipStackClip::quickContains(const SkRect& rect) const {
|
||||
}
|
||||
|
||||
bool GrClipStackClip::quickContains(const SkRRect& rrect) const {
|
||||
if (!fStack) {
|
||||
if (!fStack || fStack->isWideOpen()) {
|
||||
return true;
|
||||
}
|
||||
return fStack->quickContains(rrect.makeOffset(SkIntToScalar(fOrigin.fX),
|
||||
|
Loading…
Reference in New Issue
Block a user