Index: src/core/SkPath.cpp |
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp |
index cee93d352e7537aa4b95fa98ea3efa2f78a6d622..f8aa8521dadb1e13cc6e785d7fa7b88acf0bb4bc 100644 |
--- a/src/core/SkPath.cpp |
+++ b/src/core/SkPath.cpp |
@@ -538,11 +538,20 @@ bool SkPath::isRect(SkRect* rect) const { |
SkDEBUGCODE(this->validate();) |
int currVerb = 0; |
const SkPoint* pts = fPathRef->points(); |
- bool result = isRectContour(false, &currVerb, &pts, NULL, NULL); |
- if (result && rect) { |
- *rect = getBounds(); |
+ const SkPoint* first = pts; |
+ bool isClosed; |
+ if (!this->isRectContour(false, &currVerb, &pts, &isClosed, NULL)) { |
+ return false; |
} |
- return result; |
+ if (rect) { |
+ if (isClosed) { |
+ rect->set(first, SkToS32(pts - first)); |
+ } else { |
+ // 'pts' isn't updated for open rects |
+ *rect = this->getBounds(); |
+ } |
+ } |
+ return true; |
} |
bool SkPath::isRect(bool* isClosed, Direction* direction) const { |