Index: src/gpu/GrShape.cpp |
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp |
index 8462d4d41db6c3365d9145d288f7fc4fc8bb8f26..e0ddc55e028e2a1b1ce24be5bd831dc9ea4d0620 100644 |
--- a/src/gpu/GrShape.cpp |
+++ b/src/gpu/GrShape.cpp |
@@ -37,6 +37,28 @@ GrShape& GrShape::operator=(const GrShape& that) { |
return *this; |
} |
+const SkRect& GrShape::bounds() const { |
+ static constexpr SkRect kEmpty = SkRect::MakeEmpty(); |
+ switch (fType) { |
+ case Type::kEmpty: |
+ return kEmpty; |
+ case Type::kRRect: |
+ return fRRect.getBounds(); |
+ case Type::kPath: |
+ return fPath.get()->getBounds(); |
+ } |
+ SkFAIL("Unknown shape type"); |
+ return kEmpty; |
+} |
+ |
+void GrShape::styledBounds(SkRect* bounds) const { |
+ if (Type::kEmpty == fType && !fStyle.hasNonDashPathEffect()) { |
+ *bounds = SkRect::MakeEmpty(); |
+ } else { |
+ fStyle.adjustBounds(bounds, this->bounds()); |
+ } |
+} |
+ |
int GrShape::unstyledKeySize() const { |
if (fInheritedKey.count()) { |
return fInheritedKey.count(); |