}
void clipDevRect(const SkRect&, SkRegion::Op, bool doAA);
void clipDevPath(const SkPath&, SkRegion::Op, bool doAA);
+ // An optimized version of clipDevRect(emptyRect, kIntersect, ...)
+ void clipEmpty();
/**
* isWideOpen returns true if the clip state corresponds to the infinite
int fGenID;
+ Rec(int saveCount)
+ : fGenID(kInvalidGenID) {
+ fSaveCount = saveCount;
+ this->setEmpty();
+ }
+
Rec(int saveCount, const SkRect& rect, SkRegion::Op op, bool doAA)
: fRect(rect)
, fGenID(kInvalidGenID) {
}
} else {
+ SkASSERT(kPath_State == fState);
+
fFiniteBound = fPath.getBounds();
if (fPath.isInverseFillType()) {
}
}
+void SkClipStack::clipEmpty() {
+
+ SkDeque::Iter iter(fDeque, SkDeque::Iter::kBack_IterStart);
+ Rec* rec = (Rec*) iter.prev();
+
+ if (rec && rec->canBeIntersectedInPlace(fSaveCount, SkRegion::kIntersect_Op)) {
+ switch (rec->fState) {
+ case Rec::kEmpty_State:
+ rec->checkEmpty();
+ return;
+ case Rec::kRect_State:
+ case Rec::kPath_State:
+ this->purgeClip(rec);
+ rec->setEmpty();
+ return;
+ }
+ }
+ new (fDeque.push_back()) Rec(fSaveCount);
+
+ if (rec && rec->fSaveCount == fSaveCount) {
+ this->purgeClip(rec);
+ }
+}
+
bool SkClipStack::isWideOpen() const {
if (0 == fDeque.count()) {
return true;