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

Unified Diff: include/core/SkPath.h

Issue 1228383002: compute convexity for very small paths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix path documentation Created 5 years, 5 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 99f8242ff7de59167a0e69a1004c8fe8e3120c4b..fe89766558c4ab5be1710f10f17d6ddc7f8b843b 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -206,8 +206,8 @@ public:
@return true if the line is of zero length; otherwise false.
*/
- static bool IsLineDegenerate(const SkPoint& p1, const SkPoint& p2) {
- return p1.equalsWithinTolerance(p2);
+ static bool IsLineDegenerate(const SkPoint& p1, const SkPoint& p2, bool exact) {
+ return exact ? p1 == p2 : p1.equalsWithinTolerance(p2);
}
/** Test a quad for zero length
@@ -215,8 +215,8 @@ public:
@return true if the quad is of zero length; otherwise false.
*/
static bool IsQuadDegenerate(const SkPoint& p1, const SkPoint& p2,
- const SkPoint& p3) {
- return p1.equalsWithinTolerance(p2) &&
+ const SkPoint& p3, bool exact) {
+ return exact ? p1 == p2 && p2 == p3 : p1.equalsWithinTolerance(p2) &&
p2.equalsWithinTolerance(p3);
}
@@ -225,8 +225,8 @@ public:
@return true if the cubic is of zero length; otherwise false.
*/
static bool IsCubicDegenerate(const SkPoint& p1, const SkPoint& p2,
- const SkPoint& p3, const SkPoint& p4) {
- return p1.equalsWithinTolerance(p2) &&
+ const SkPoint& p3, const SkPoint& p4, bool exact) {
+ return exact ? p1 == p2 && p2 == p3 && p3 == p4 : p1.equalsWithinTolerance(p2) &&
p2.equalsWithinTolerance(p3) &&
p3.equalsWithinTolerance(p4);
}
@@ -800,11 +800,15 @@ public:
@param pts The points representing the current verb and/or segment
@param doConsumeDegerates If true, first scan for segments that are
deemed degenerate (too short) and skip those.
+ @param exact if doConsumeDegenerates is true and exact is true, skip only
+ degenerate elements with lengths exactly equal to zero. If exact
+ is false, skip degenerate elements with lengths close to zero. If
+ doConsumeDegenerates is false, exact has no effect.
@return The verb for the current segment
*/
- Verb next(SkPoint pts[4], bool doConsumeDegerates = true) {
+ Verb next(SkPoint pts[4], bool doConsumeDegerates = true, bool exact = false) {
if (doConsumeDegerates) {
- this->consumeDegenerateSegments();
+ this->consumeDegenerateSegments(exact);
}
return this->doNext(pts);
}
@@ -844,7 +848,7 @@ public:
inline const SkPoint& cons_moveTo();
Verb autoClose(SkPoint pts[2]);
- void consumeDegenerateSegments();
+ void consumeDegenerateSegments(bool exact);
Verb doNext(SkPoint pts[4]);
};
« 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