aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsBuilderTest.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-08-31 09:46:20 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-31 09:46:20 -0700
commitae576b733dc427761bd254dcce5ae5a1c5d552df (patch)
treee18a80a1c7b6aa579e8ef9527c000a8ae8c1b077 /tests/PathOpsBuilderTest.cpp
parent5e04bcfddde2ab22a04187199e9a953523886cf6 (diff)
remove duplicate linked list adjustment
The list of intersection points on a curve segment may have entries that can be safely removed when nearby points have nearly the same t value and point value. When a path includes very large curves as well as small ones, as is the case with this fuzzer, additional points may lie between the similar points that do not meet the nearby criteria. After merging the nearby point with its doppelganger, SkOpSegment::moveNearby() unnecessarily set the doppelganger's next pointer to the one following the nearby point. While this usually has no effect, since the merge already updated the linked list, the explicit call removes the additional outlier points from the segment. TBR=reed@google.com BUG=526025 Review URL: https://codereview.chromium.org/1323813003
Diffstat (limited to 'tests/PathOpsBuilderTest.cpp')
-rw-r--r--tests/PathOpsBuilderTest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/PathOpsBuilderTest.cpp b/tests/PathOpsBuilderTest.cpp
index 88684fe18d..88bfe1e554 100644
--- a/tests/PathOpsBuilderTest.cpp
+++ b/tests/PathOpsBuilderTest.cpp
@@ -271,3 +271,26 @@ DEF_TEST(Fuzz846, reporter) {
builder.resolve(&result);
}
+#include "SkParsePath.h"
+
+DEF_TEST(fuzzTNG, reporter) {
+ const char* pathStrs[] = {
+"M360,-2147483648.000000000000000000000000000000000000000000000000000001 A3240,3240 0.0 0 11 256,256 L100000000,4140 Z",
+"M360,4140 A11,-1 0.0 0 0 6840,4140 L100,512 L32,16 L360,1024 Z",
+"M360,4140 A3240,1000000001 32768 1024 128 100000000.000000000000000000000000000000000000000000000000000001,512 Z",
+"M127,321 L6840,270 L-21474836481,100000000 L2551,64 Z",
+"M-128,4140 Z",
+ };
+ SkPath clip[SK_ARRAY_COUNT(pathStrs)];
+ SkOpBuilder builder;
+ for (size_t i = 0; i < SK_ARRAY_COUNT(pathStrs); ++i) {
+ SkParsePath::FromSVGString(pathStrs[i], &clip[i]);
+ builder.add(clip[i], kUnion_SkPathOp);
+ }
+ SkPath result;
+ builder.resolve(&result);
+ SkPath path;
+ SkParsePath::FromSVGString("M-315,7425 L4096,7425 L-1000000001,-315 L-315,7425 Z", &path);
+ builder.add(path, kDifference_SkPathOp);
+ testPathOp(reporter, result, path, kDifference_SkPathOp, __FUNCTION__);
+}