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 1793373002: Add asRRect method to SkClipStack::Element (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | no next file » | 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 38d6d6751d7506aad3b797bcd6a121b752459003..e4f2563adea072ee523da8cd80ec5c3ce7df1e57 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -98,6 +98,19 @@ public:
//!< Call to get the element as a path, regardless of its type.
void asPath(SkPath* path) const;
+ //!< Call to get the element as a round rect. Returns nullptr if this is not satisfiable.
+ const SkRRect* asRRect() const {
bsalomon 2016/03/16 13:17:11 Maybe we should just loosen the restrictions on wh
Chris Dalton 2016/03/16 15:17:56 Right, I gave it the "as" name because they both h
+ switch (fType) {
+ case kRect_Type:
+ SkASSERT(SkRRect::kRect_Type == fRRect.getType());
+ // fallthrough
+ case kRRect_Type:
+ return &fRRect;
+ default:
+ return nullptr;
+ }
+ }
+
/** If getType() is not kEmpty this indicates whether the clip shape should be anti-aliased
when it is rasterized. */
bool isAA() const { return fDoAA; }
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698