increase coverage of SkPath.cpp, remove unused code
Using Mike Klein's excellent coverage tool, increase the
unit testing of SkPath.cpp from 70% to 95%.
Along the way, determined that these functions were not
maintained or used:
SkPath::pathTo
SkPath::contains
as well as a large block of SkPath::cheapGetDirection().
Changed SkPath::validate() to permit infinities in
the path data points.
Fixed errors in preserving direction.
Fixed error setting direction when convexity is unknown.
Added missing conic to moveTo only detector.
BUG=
R=bsalomon@google.com, reed@google.com
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/65493004
git-svn-id: http://skia.googlecode.com/svn/trunk@12291 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index d8a2ca9..11151d9 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -495,7 +495,6 @@
kAdd_AddType,
kAddTrans_AddType,
kAddMatrix_AddType,
- kPathTo_AddType,
kReverseAdd_AddType,
kReversePathTo_AddType,
};
@@ -513,8 +512,6 @@
return "path_add_path_trans";
case kAddMatrix_AddType:
return "path_add_path_matrix";
- case kPathTo_AddType:
- return "path_path_to";
case kReverseAdd_AddType:
return "path_reverse_add_path";
case kReversePathTo_AddType:
@@ -526,9 +523,8 @@
}
virtual void onPreDraw() SK_OVERRIDE {
- // pathTo and reversePathTo assume a single contour path.
- bool allowMoves = kPathTo_AddType != fType &&
- kReversePathTo_AddType != fType;
+ // reversePathTo assumes a single contour path.
+ bool allowMoves = kReversePathTo_AddType != fType;
this->createData(10, 100, allowMoves);
fPaths0.reset(kPathCnt);
fPaths1.reset(kPathCnt);
@@ -562,13 +558,6 @@
result.addPath(fPaths1[idx], fMatrix);
}
break;
- case kPathTo_AddType:
- for (int i = 0; i < this->getLoops(); ++i) {
- int idx = i & (kPathCnt - 1);
- SkPath result = fPaths0[idx];
- result.pathTo(fPaths1[idx]);
- }
- break;
case kReverseAdd_AddType:
for (int i = 0; i < this->getLoops(); ++i) {
int idx = i & (kPathCnt - 1);
@@ -1036,7 +1025,6 @@
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kAdd_AddType); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kAddTrans_AddType); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kAddMatrix_AddType); )
-DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kPathTo_AddType); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kReverseAdd_AddType); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kReversePathTo_AddType); )