Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: include/core/SkClipStack.h

Issue 2241273003: Attempt to throw away rrect clips of rrects. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix int to scalar warnings Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/core/SkRRect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkClipStack.h
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index 3156941125b4a77f066464a5be5b63fc9c4df4fd..2f2e940c8c6c74b6ad1e8c80d08ff746ab7a1943 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -158,6 +158,23 @@ public:
}
}
+ bool contains(const SkRRect& rrect) const {
+ switch (fType) {
+ case kRect_Type:
+ return this->getRect().contains(rrect.getBounds());
+ case kRRect_Type:
+ // We don't currently have a generalized rrect-rrect containment.
+ return fRRect.contains(rrect.getBounds()) || rrect == fRRect;
+ case kPath_Type:
+ return fPath.get()->conservativelyContainsRect(rrect.getBounds());
+ case kEmpty_Type:
+ return false;
+ default:
+ SkDEBUGFAIL("Unexpected type.");
+ return false;
+ }
+ }
+
/**
* Is the clip shape inverse filled.
*/
@@ -312,11 +329,12 @@ public:
bool* isIntersectionOfRects = NULL) const;
/**
- * Returns true if the input rect in device space is entirely contained
- * by the clip. A return value of false does not guarantee that the rect
+ * Returns true if the input (r)rect in device space is entirely contained
+ * 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;
/**
* Flattens the clip stack into a single SkPath. Returns true if any of
« no previous file with comments | « no previous file | include/core/SkRRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698