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

Unified Diff: include/core/SkPath.h

Issue 1176953002: move SkPath direction-as-computed into SkPathPriv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « gm/strokefill.cpp ('k') | src/core/SkPath.cpp » ('j') | src/core/SkPath.cpp » ('J')
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 54a459b4d403d08a35f52f5d995e687d17bf1b31..52d2b2b514a144dbef386596c8fed36bfb6fbcfc 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -492,8 +492,6 @@ public:
void close();
enum Direction {
- /** Direction either has not been or could not be computed */
- kUnknown_Direction,
/** clockwise direction for adding closed contours */
kCW_Direction,
/** counter-clockwise direction for adding closed contours */
@@ -501,17 +499,6 @@ public:
};
/**
- * Return the opposite of the specified direction. kUnknown is its own
- * opposite.
- */
- static Direction OppositeDirection(Direction dir) {
- static const Direction gOppositeDir[] = {
- kUnknown_Direction, kCCW_Direction, kCW_Direction
- };
- return gOppositeDir[dir];
- }
-
- /**
* Returns whether or not a fill type is inverted
*
* kWinding_FillType -> false
@@ -544,27 +531,6 @@ public:
}
/**
- * Tries to quickly compute the direction of the first non-degenerate
- * contour. If it can be computed, return true and set dir to that
- * direction. If it cannot be (quickly) determined, return false and ignore
- * the dir parameter. If the direction was determined, it is cached to make
- * subsequent calls return quickly.
- */
- bool cheapComputeDirection(Direction* dir) const;
-
- /**
- * Returns true if the path's direction can be computed via
- * cheapComputDirection() and if that computed direction matches the
- * specified direction. If dir is kUnknown, returns true if the direction
- * cannot be computed.
- */
- bool cheapIsDirection(Direction dir) const {
- Direction computedDir = kUnknown_Direction;
- (void)this->cheapComputeDirection(&computedDir);
- return computedDir == dir;
- }
-
- /**
* Returns true if the path specifies a rectangle.
*
* If this returns false, then all output parameters are ignored, and left
@@ -598,8 +564,7 @@ public:
/**
* Add a closed rectangle contour to the path
* @param rect The rectangle to add as a closed contour to the path
- * @param dir The direction to wind the rectangle's contour. Cannot be
- * kUnknown_Direction.
+ * @param dir The direction to wind the rectangle's contour.
*/
void addRect(const SkRect& rect, Direction dir = kCW_Direction);
@@ -614,8 +579,7 @@ public:
* to the path
* @param bottom The bottom of a rectangle to add as a closed contour to
* the path
- * @param dir The direction to wind the rectangle's contour. Cannot be
- * kUnknown_Direction.
+ * @param dir The direction to wind the rectangle's contour.
*/
void addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom,
Direction dir = kCW_Direction);
@@ -624,8 +588,7 @@ public:
* Add a closed oval contour to the path
*
* @param oval The bounding oval to add as a closed contour to the path
- * @param dir The direction to wind the oval's contour. Cannot be
- * kUnknown_Direction.
+ * @param dir The direction to wind the oval's contour.
*/
void addOval(const SkRect& oval, Direction dir = kCW_Direction);
@@ -638,8 +601,7 @@ public:
* closed contour to the path
* @param radius The radius of a circle to add as a closed contour to the
* path
- * @param dir The direction to wind the circle's contour. Cannot be
- * kUnknown_Direction.
+ * @param dir The direction to wind the circle's contour.
*/
void addCircle(SkScalar x, SkScalar y, SkScalar radius,
Direction dir = kCW_Direction);
@@ -657,8 +619,7 @@ public:
* @param rect The bounds of a round-rectangle to add as a closed contour
* @param rx The x-radius of the rounded corners on the round-rectangle
* @param ry The y-radius of the rounded corners on the round-rectangle
- * @param dir The direction to wind the rectangle's contour. Cannot be
- * kUnknown_Direction.
+ * @param dir The direction to wind the rectangle's contour.
*/
void addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry,
Direction dir = kCW_Direction);
@@ -669,8 +630,7 @@ public:
* bottom-right, bottom-left.
* @param rect The bounds of a round-rectangle to add as a closed contour
* @param radii Array of 8 scalars, 4 [X,Y] pairs for each corner
- * @param dir The direction to wind the rectangle's contour. Cannot be
- * kUnknown_Direction.
+ * @param dir The direction to wind the rectangle's contour.
* Note: The radii here now go through the same constraint handling as the
* SkRRect radii (i.e., either radii at a corner being 0 implies a
* sqaure corner and oversized radii are proportionally scaled down).
@@ -681,8 +641,7 @@ public:
/**
* Add an SkRRect contour to the path
* @param rrect The rounded rect to add as a closed contour
- * @param dir The winding direction for the new contour. Cannot be
- * kUnknown_Direction.
+ * @param dir The winding direction for the new contour.
*/
void addRRect(const SkRRect& rrect, Direction dir = kCW_Direction);
@@ -976,7 +935,7 @@ private:
int fLastMoveToIndex;
uint8_t fFillType;
mutable uint8_t fConvexity;
- mutable uint8_t fDirection;
+ mutable uint8_t fFirstDirection; // SkPathPriv::FirstDirection
mutable SkBool8 fIsVolatile;
/** Resets all fields other than fPathRef to their initial 'empty' values.
@@ -992,7 +951,7 @@ private:
void copyFields(const SkPath& that);
friend class Iter;
-
+ friend class SkPathPriv;
friend class SkPathStroker;
/* Append, in reverse order, the first contour of path, ignoring path's
« no previous file with comments | « gm/strokefill.cpp ('k') | src/core/SkPath.cpp » ('j') | src/core/SkPath.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698