Chromium Code Reviews| 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; } |