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

Unified Diff: include/core/SkPath.h

Issue 832083002: Cleanup isRect variants (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Improve comments Created 5 years, 11 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
« no previous file with comments | « no previous file | src/core/SkPath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPath.h
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 4b95e893e2821821aecaf129f9fbea9430b0e266..c6ff715404cd972679505e136ae2377047e9c8ae 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
« no previous file with comments | « no previous file | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698