From ae576b733dc427761bd254dcce5ae5a1c5d552df Mon Sep 17 00:00:00 2001 From: caryclark Date: Mon, 31 Aug 2015 09:46:20 -0700 Subject: 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 --- tests/PathOpsBuilderTest.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/PathOpsBuilderTest.cpp') 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__); +} -- cgit v1.2.3