Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: src/core/SkPath.cpp

Issue 16950021: add rect-output parameter to isRect, allowing us to return the correct bounds even if a rectagular … (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 8e9be855962aeb24b015178184c2fd0cfc483db8..694de2b1e74e678192f8b3d911874f8ff56c744f 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -587,22 +587,19 @@ bool SkPath::isRectContour(bool allowPartial, int* currVerb, const SkPoint** pts
return result;
}
-bool SkPath::isRect(SkRect* rect) const {
+bool SkPath::isRect(SkRect* rect, bool* isClosed, Direction* direction) 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;
+ if (!this->isRectContour(false, &currVerb, &pts, isClosed, direction)) {
+ return false;
}
- return result;
-}
-
-bool SkPath::isRect(bool* isClosed, Direction* direction) const {
- SkDEBUGCODE(this->validate();)
- int currVerb = 0;
- const SkPoint* pts = fPathRef->points();
- return isRectContour(false, &currVerb, &pts, isClosed, direction);
+
+ if (rect) {
+ rect->set(first, SkToS32(pts - first));
+ }
+ return true;
}
bool SkPath::isNestedRects(SkRect rects[2], Direction dirs[2]) const {
« include/core/SkPath.h ('K') | « include/core/SkPath.h ('k') | src/core/SkStroke.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698