aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPath.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index cee93d352e..f8aa8521da 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 {