Index: src/gpu/GrShape.cpp |
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp |
index 8462d4d41db6c3365d9145d288f7fc4fc8bb8f26..ef923cf8b9088c31d03328fa51c2927e2f8c4266 100644 |
--- a/src/gpu/GrShape.cpp |
+++ b/src/gpu/GrShape.cpp |
@@ -37,6 +37,26 @@ GrShape& GrShape::operator=(const GrShape& that) { |
return *this; |
} |
+const SkRect& GrShape::bounds() { |
+ static constexpr SkRect kEmpty = SkRect::MakeEmpty(); |
+ switch (fType) { |
+ case Type::kEmpty: |
robertphillips
2016/05/12 17:18:47
Why not just return SkRect::MakeEmpty here ?
bsalomon
2016/05/12 18:37:57
Becausethe return is a const& to a SkRect, so I ca
|
+ return kEmpty; |
+ case Type::kRRect: |
+ return fRRect.getBounds(); |
+ case Type::kPath: |
+ return fPath.get()->getBounds(); |
+ } |
+} |
+ |
+void GrShape::styledBounds(SkRect* bounds) { |
+ if (Type::kEmpty == fType && !fStyle.hasNonDashPathEffect()) { |
robertphillips
2016/05/12 17:18:47
Is it an empty path or a path with a single point
|
+ *bounds = SkRect::MakeEmpty(); |
+ } else { |
+ fStyle.adjustBounds(bounds, this->bounds()); |
+ } |
+} |
+ |
int GrShape::unstyledKeySize() const { |
if (fInheritedKey.count()) { |
return fInheritedKey.count(); |