diff options
author | robertphillips <robertphillips@google.com> | 2015-01-05 10:13:46 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-05 10:13:46 -0800 |
commit | 91b0a3587342c48a1a6e1c4687686688737359da (patch) | |
tree | a315e268dae57ee07a83fa533b7818da096b3bcf /include/core | |
parent | 40c85e41b8be96f47f03a34bb2938696037afad4 (diff) |
Cleanup isRect variants
Review URL: https://codereview.chromium.org/832083002
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkPath.h | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h index 4b95e893e2..204a76e5b5 100644 --- a/include/core/SkPath.h +++ b/include/core/SkPath.h @@ -239,16 +239,6 @@ public: */ bool isLine(SkPoint line[2]) const; - /** Returns true if the path specifies a rectangle. If so, and if rect is - not null, set rect to the bounds of the path. If the path does not - specify a rectangle, return false and ignore rect. - - @param rect If not null, returns the bounds of the path if it specifies - a rectangle - @return true if the path specifies a rectangle - */ - bool isRect(SkRect* rect) const { return this->isRect(rect, NULL, NULL); } - /** Return the number of points in the path */ int countPoints() const; @@ -286,7 +276,8 @@ public: /** Returns the bounds of the path's points. If the path contains 0 or 1 points, the bounds is set to (0,0,0,0), and isEmpty() will return true. Note: this bounds may be larger than the actual shape, since curves - do not extend as far as their control points. + do not extend as far as their control points. Additionally this bound + can contain trailing MoveTo points (cf. isRect). */ const SkRect& getBounds() const { return fPathRef->getBounds(); @@ -592,19 +583,6 @@ public: */ PathAsRect asRect(Direction* direction = NULL) const; - /** Returns true if the path specifies a rectangle. If so, and if isClosed is - not null, set isClosed to true if the path is closed. Also, if returning true - and direction is not null, return the rect direction. If the path does not - specify a rectangle, return false and ignore isClosed and direction. - - @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(bool* isClosed, Direction* direction) const { - return this->isRect(NULL, isClosed, direction); - } - /** * Returns true if the path specifies a rectangle. * @@ -612,12 +590,15 @@ public: * 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 rect If not null, set to the bounds of the rectangle. + * Note : this bounds may be smaller than the path's bounds, since it is just + * the bounds of the "drawable" parts of the path. e.g. a trailing MoveTo would + * be ignored in this rect, but not by the path's bounds * @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; + bool isRect(SkRect* rect, bool* isClosed = NULL, Direction* direction = NULL) 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 |