diff options
author | robertphillips <robertphillips@google.com> | 2014-12-29 14:06:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-29 14:06:51 -0800 |
commit | 4f662e62cd44e302ef689fabdb2c0ae8d9471b02 (patch) | |
tree | fe32ac5d0e93b9137bc2f38ba0b6cbd06d4eecf7 /include/core | |
parent | fe7c427e3d1c2c98bce7a3fa0ae6b5864527f169 (diff) |
Update stroke path to use rect returned from isRect (to fix trailing moveTo bug)
This basically recreates what was done in:
https://codereview.chromium.org/16950021/ (add rect-output parameter to isRect, allowing us to return the correct bounds even if a rectagular path has a trailing moveTo) with the addition of GM representation
BUG=skia:247770
Review URL: https://codereview.chromium.org/834503002
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkPath.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h index f5a6d4a2e7..4b95e893e2 100644 --- a/include/core/SkPath.h +++ b/include/core/SkPath.h @@ -247,7 +247,7 @@ public: a rectangle @return true if the path specifies a rectangle */ - bool isRect(SkRect* rect) const; + bool isRect(SkRect* rect) const { return this->isRect(rect, NULL, NULL); } /** Return the number of points in the path */ @@ -601,7 +601,23 @@ public: @param direction If not null, set to the rectangle's direction @return true if the path specifies a rectangle */ - bool isRect(bool* isClosed, Direction* direction) const; + bool isRect(bool* isClosed, Direction* direction) const { + return this->isRect(NULL, isClosed, direction); + } + + /** + * Returns true if the path specifies a rectangle. + * + * If this returns false, then all output parameters are ignored, and left + * unchanged. If this returns true, then each of the output parameters + * are checked for NULL. If they are not, they return their value. + * + * @param rect If not null, set to the bounds of the rectangle + * @param isClosed If not null, set to true if the path is closed + * @param direction If not null, set to the rectangle's direction + * @return true if the path specifies a rectangle + */ + bool isRect(SkRect* rect, bool* isClosed, Direction* direction) const; /** Returns true if the path specifies a pair of nested rectangles. If so, and if rect is not null, set rect[0] to the outer rectangle and rect[1] to the inner |