aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsOpTest.cpp
Commit message (Collapse)AuthorAge
* keep integral rectangle intersections integralGravatar Cary Clark2017-04-18
| | | | | | | | | | | | | | | | | | | | | | A pair of coincident lines can generate multiple intersection points. Path ops is more stable when the intersection T value is used to recompute the intersection point, but this has the side-effect of making integral edges intersect at non-integral values. While it's worthwhile to fix this, for the moment it is less disruptive to only worry about keeping intersection values integral if the original intersection point is integral in both axes. Also, fix some debugging code that bit-rotted. R=msarett@google.com Change-Id: Iefd27b25d1d21c22b224c174bd59bc6c105033c4 Reviewed-on: https://skia-review.googlesource.com/13721 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* fix fuzzGravatar Cary Clark2017-03-21
| | | | | | | | | | | | | | | | corrupted intersection point lists can loop forever. Add a safety hatch to abort after a large number of iterations. TBR=kjlubick@google.com BUG=700679 Change-Id: Ifd4b180b47ba3bbde38ade0bb13b16b8d645c1cb Reviewed-on: https://skia-review.googlesource.com/9967 Reviewed-by: Cary Clark <caryclark@skia.org> Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* limit addEndMoveSpans loop in pathopsGravatar Cary Clark2017-03-09
| | | | | | | | | | | | | | Prevent addEndMoveSpans from looping forever and abort with an error if the loop count is crazy big. R=kjlubick@google.com BUG=684553 Change-Id: I16c250c0b2f88534f809aba17a18081aea4e1f44 Reviewed-on: https://skia-review.googlesource.com/9458 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* fix fuzzerGravatar Cary Clark2017-01-03
| | | | | | | | | | | | abort if incoming data is out of range TBR=reed@google.com BUG=676866 Change-Id: I7d4850611654a399e32ea2012b23ca369dc53e70 Reviewed-on: https://skia-review.googlesource.com/6525 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* simplify bugGravatar Cary Clark2016-12-08
| | | | | | | | | | | | | | | | | | | | | | | The path contains a cubic with a very tight curve. Split the cubic into pieces so that the individual curves are better behaved. Use both inflections and max curvature to potentially split cubics. Since this may require a bit of work, preflight to ignore cubics that monotonically change in x and y. Only one of the three tests referred to by the bug below repro'd. Use path.dumpHex() instead of path.dump() to capture the crashing data. TBR=reed@google.com BUG=skia:6041 Change-Id: I29a264f87242cacc7c421e7685b90aca81621c74 Reviewed-on: https://skia-review.googlesource.com/5702 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* fuzz hang fix and pathops client debuggingGravatar Cary Clark2016-11-15
| | | | | | | | | | | | | | | | | The ASAN fuzzer on chrome caught a hanging state. To capture the data, allow the pathops client debugging to run in a release build. TBR=reed@google.com BUG=665295 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4834 Change-Id: I6b2c2baabd63994f63aa730d2ee7828986b5ab89 Reviewed-on: https://skia-review.googlesource.com/4834 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* fix more chrome asan fuzzer failuresGravatar caryclark2016-10-20
| | | | | | | | | | | | Small change to gracefully quit when fuzzer values cause pathops to fail. TBR=reed@google.com BUG=657411, 657559 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2426393004 Review-Url: https://chromiumcodereview.appspot.com/2426393004
* fix fuzzersGravatar caryclark2016-10-20
| | | | | | | | | | | | | | | Many old pathops-related fuzz failures have built up while the codebase was under a state a flux. Now that the code is stable, address these failures. Most of the CL plumbs the debug global state to downstream routines so that, if the data is not trusted (ala fuzzed) the function can safely exit without asserting. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2426173002 Review-Url: https://chromiumcodereview.appspot.com/2426173002
* fix some fuzzGravatar caryclark2016-10-17
| | | | | | | | TBR=reed@google.com BUG=654939, 655829, 656149 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2425733002 Review-Url: https://codereview.chromium.org/2425733002
* fix another fuzzGravatar caryclark2016-10-07
| | | | | | | | | Add one more early exit. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2401673004 Review-Url: https://codereview.chromium.org/2401673004
* fix fuzz bustersGravatar caryclark2016-10-07
| | | | | | | | | | | When fuzz is hit just quit TBR=reed@google.com BUG=skia:5837, skia:5838, skia:5839 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2404483002 Review-Url: https://codereview.chromium.org/2404483002
* fuzzer fixGravatar Cary Clark2016-10-06
| | | | | | | | | | | | | | | | | | Error out when fuzzing conditions are met. Also, make degenerate input line ends consistent. TBR=reed@google.com BUG=653452, 626164, skia:5829 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3048 Change-Id: I23a01adde9dec07b54d66ab2418b3ea0b96e4456 Reviewed-on: https://skia-review.googlesource.com/3048 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* validate using nx to match boundsGravatar caryclark2016-10-05
| | | | | | | | | | | Check the path against the bounds using Nx instead of straight scalars, R=mtklein@google.com BUG=skia:5541 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2388903006 Review-Url: https://codereview.chromium.org/2388903006
* fix fuzzGravatar Cary Clark2016-10-05
| | | | | | | | | | | | | | | | This fix is slightly interesting; if the final close of the contour degenerates into a zero-length line, remove the previous line from the generated contour. TBR=reed@google.com BUG=skia:5822 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3004 Change-Id: Id668d13ccf6aad9bc81d78588fc77437527a0b7b Reviewed-on: https://skia-review.googlesource.com/3004 Reviewed-by: Cary Clark <caryclark@google.com>
* fix fuzz with null checkGravatar Cary Clark2016-10-04
| | | | | | | | | | | | TBR=reed@google.com BUG=skia:5819 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2925 Change-Id: I1957d3f8f5c78bed41bb7fe413ae870df24f7c50 Reviewed-on: https://skia-review.googlesource.com/2925 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* fix cubic linear testGravatar caryclark2016-09-28
| | | | | | | | | | | | | | Check to see if the line between end points is degenerate before measuring control points. Also, add test case for a bug to see if it shows up on any platform. TBR=reed@google.com BUG=skia:5169, skia:5240 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2375053002 Review-Url: https://codereview.chromium.org/2375053002
* allow conic chop to failGravatar caryclark2016-09-26
| | | | | | | | | | | | | Fuzzy values may cause the conic chop to fail. Check to see if the values are all finite, and require the caller to do the same. R=reed@google.com BUG=650178 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2368993002 Review-Url: https://codereview.chromium.org/2368993002
* fix msan bug in pathopsGravatar caryclark2016-09-23
| | | | | | | | | | | | Msan and Valgrind found an uninitialized memory mistake in pathops. This also fixes similar bugs where not all parts of the geometry were covered in the loop iteration. R=borenet@google.com NOTREECHECKS=true GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2366893003 Review-Url: https://codereview.chromium.org/2366893003
* split tight quads and conicsGravatar caryclark2016-09-23
| | | | | | | | | | | | Tight quads and conics may nearly fold over on themselves, confusing coincidence against other curves. Split them at their max curvature early on to avoid complicating later logic. TBR=reed@google.com BUG=skia:5131 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2357353002 Review-Url: https://codereview.chromium.org/2357353002
* don't close a contour with a line if nothing's thereGravatar caryclark2016-09-22
| | | | | | | | R=kjlubick@google.com BUG=skia:5789 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2360083006 Review-Url: https://codereview.chromium.org/2360083006
* fix next kevin fuzzGravatar caryclark2016-09-22
| | | | | | | | | | Fix one more fuzzer crash. R=kjlubick@google.com BUG=skia:5775 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2357373002 Review-Url: https://codereview.chromium.org/2357373002
* fix skia pathops fuzzersGravatar caryclark2016-09-21
| | | | | | | | | | Add isolated tests. R=kjlubick@google.com BUG=skia:5775 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2358043002 Review-Url: https://codereview.chromium.org/2358043002
* fix fuzzer bugsGravatar caryclark2016-09-19
| | | | | | | | | | | | Add a couple more cases where Op() fails and returns false when the out of range input values make the internal numeric unstable. TBR=reed@google.com BUG=647834, 648068 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2348263002 Review-Url: https://codereview.chromium.org/2348263002
* fix fuzzerGravatar caryclark2016-09-09
| | | | | | | | | | | | Earlier fix aborted coincident loop on wrong condition. This aborts only when it reaches the end, and then propagates the error out correctly. TBR=reed@google.com BUG=644680, 644684 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2327053002 Review-Url: https://codereview.chromium.org/2327053002
* fix pathops fuzzersGravatar caryclark2016-09-07
| | | | | | | | | | | | | | Extreme values trigger asserts that in range values allow. Disable asserts and other tests to prevent extreme values from crashing. TBR=reed@google.com BUG=644684. 644680, 644640 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2316173002 Review-Url: https://codereview.chromium.org/2316173002
* provide safe exit for runaway intersectionsGravatar caryclark2016-09-06
| | | | | | | | | | | | | | Curve intersections with extreme numbers may cause the intersection template code to loop forever. Detect this by looking for marking more spans gone than exist, and return without any intersections found. TBR=reed@google.com BUG=643855 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2310113002 Review-Url: https://codereview.chromium.org/2310113002
* pathops coincident workGravatar caryclark2016-08-31
| | | | | | | | | | | | | This is working towards fixing all bugs around simplifying the tiger. This installment simplifies the point-t intersection list as it is built rather than doing the analysis once the intersections are complete. This avoids getting the list in an inconsistent state and makes coincident checks faster and more stable. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2237223002 TBR=reed@google.com BUG=skia:5131 Review-Url: https://codereview.chromium.org/2237223002
* if the winding of the top can't be computed, give upGravatar caryclark2016-08-26
| | | | | | | | TBR=reed@google.com BUG=641478 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2283993002 Review-Url: https://codereview.chromium.org/2283993002
* mark fuzz test flaky since it may fail on some platformsGravatar caryclark2016-08-24
| | | | | | | | NOTRY=true TBR=bungeman@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2277893004 Review-Url: https://codereview.chromium.org/2277893004
* remove point aliasesGravatar caryclark2016-08-24
| | | | | | | | | | | | | | | | This removes the notion of keeping track of every different t value that resolves to the same or a similar point. Other fixes make this concept unnecessary, and removing it simplifies the code. This removes an allocation, and speeds up paths with many overlapping curves. As a bonus, four fuzzer tests that failed before now succeed. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2275703003 Review-Url: https://codereview.chromium.org/2275703003
* fix pathops fuzzGravatar caryclark2016-08-23
| | | | | | | | | | | Extreme cubics may split so that one half is a point. Discard this rather than generating a degenerate line. TBR=reed@google.com BUG=640025 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2276503002 Review-Url: https://codereview.chromium.org/2276503002
* fix fuzzesGravatar caryclark2016-08-19
| | | | | | | | TBR=reed@google.com BUG=639157, 638783 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255243003 Review-Url: https://codereview.chromium.org/2255243003
* fix fuzz bugGravatar caryclark2016-08-16
| | | | | | | | TBR=reed@google.com BUG=637968, 638002 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2250573003 Review-Url: https://codereview.chromium.org/2250573003
* start working on tiger againGravatar caryclark2016-08-11
| | | | | | | | | | | | | | | The tiger tests are a suite under development that exercise many coincident edge cases. This fixes the case when a duplicate point is not ignored when the coincident span references the primary point. TBR=reed@google.com BUG=skia:5131 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2239803002 Review-Url: https://codereview.chromium.org/2239803002
* add flaky test optionGravatar caryclark2016-08-09
| | | | | | | | | | | | | | One fuzzer generated pathops test fails everywhere except for one builder. Add a flaky state to the pathops test framework to handle this until I can investigate further. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2221153005 Review-Url: https://codereview.chromium.org/2221153005
* template intersection fuzz fixesGravatar caryclark2016-08-08
| | | | | | | | | | | | | Plumb in the ability to ignore asserts for out of range input deeper into the template intersection code. Exit gracefully when error conditions are found. TBR=reed@google.com BUG=632607,632628,633063,633065,634251,633608 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2224823004 Review-Url: https://codereview.chromium.org/2224823004
* fuzz wednesdayGravatar caryclark2016-07-27
| | | | | | | | | | | | | Add debug 'skip assert' access to SkCoincidentSpans. That permits suppressing asserts to make it easier to detect when this fuzz data generates unparsable data. TBR=reed@google.com BUG=631564, 631992 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2186973002 Review-Url: https://codereview.chromium.org/2186973002
* fix fuzz bugsGravatar caryclark2016-07-26
| | | | | | | | | | | | | | | Add ability for intersection template to detect that the test contains bounded numbers so that extra asserts can trigger. Add some exit points for out of range numbers in those templates. TBR=reed@google.com BUG=631383,631374,631360 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2185703002 Review-Url: https://codereview.chromium.org/2185703002
* fix fuzzGravatar caryclark2016-07-25
| | | | | | | | | | | | Extreme inputs trigger asserts intended for in range data. Return an error without asserting unless the test signals otherwise. TBR=reed@google.com BUG=630736 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2178923002 Review-Url: https://codereview.chromium.org/2178923002
* limit number of searched rootsGravatar caryclark2016-07-22
| | | | | | | | | | | | | | Extreme numbers can generate more than three found cubic roots when the roots are found through a binary search. Fail in this case. TBR=reed@google.com BUG=630649 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2176733002 Review-Url: https://codereview.chromium.org/2176733002
* conic fuzz fixGravatar caryclark2016-07-22
| | | | | | | | | | | | | | | If no closest section is found in conic intersection (which can happen if the numbers are out of range) abort the intersection. Also suppress assert fired in this case so it only checks intersections with in-range values. TBR=reed@google.com BUG=630378 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2166813006 Review-Url: https://codereview.chromium.org/2166813006
* let line/cubic intersect at four spotsGravatar caryclark2016-07-21
| | | | | | | | | With this, let's update the fuzzer. R=kjlubick@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2169983002 Review-Url: https://codereview.chromium.org/2169983002
* allow curves on side of lines to be very smallGravatar caryclark2016-07-21
| | | | | | | | | | | | | | Increase the precision of the 'all on one side' pathops angle test to reduce the number of unorderable segments found by the cubics_d3 test. This allows pathsops_unittest release build with -v -V -x to run without error. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2168163002 Review-Url: https://codereview.chromium.org/2168163002
* fix fuzzer bugGravatar caryclark2016-07-21
| | | | | | | | | | | | | | | | | Fix another fuzzer bug. Some PathOps asserts only make sense if the incoming data is well-behaved. Well-behaved tests set debugging state to trigger these additional asserts. Formalize this by creating macros similar to SkASSERT that check to see if the assert should be skipped. TBR=reed@google.com BUG=629962 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2169863002 Review-Url: https://codereview.chromium.org/2169863002
* fix fuzzerGravatar caryclark2016-07-19
| | | | | | | | | | | | Previous spans always have a valid next pointer. The final span does not. Change the test for a valid link to take into consideration whether the links are chased forwards or backwards. TBR=reed@google.com BUG=629454 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2166543002 Review-Url: https://codereview.chromium.org/2166543002
* disable test that fails to compute bounds on nexus 5Gravatar caryclark2016-07-18
| | | | | | | TBR=jcgregario@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2160713003 Review-Url: https://codereview.chromium.org/2160713003
* pathops coincidence and security rewriteGravatar caryclark2016-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most changes stem from working on an examples bracketed by #if DEBUG_UNDER_DEVELOPMENT // tiger These exposed many problems with coincident curves, as well as errors throughout the code. Fixing these errors also fixed a number of fuzzer-inspired bug reports. * Line/Curve Intersections Check to see if the end of the line nearly intersects the curve. This was a FIXME in the old code. * Performance Use a central chunk allocator. Plumb the allocator into the global variable state so that it can be shared. (Note that 'SkGlobalState' is allocated on the stack and is visible to children functions but not other threads.) * Refactor Let SkOpAngle grow up from a structure to a class. Let SkCoincidentSpans grow up from a structure to a class. Rename enum Alias to AliasMatch. * Coincidence Rewrite Add more debugging to coincidence detection. Parallel debugging routines have read-only logic to report the current coincidence state so that steps through the logic can expose whether things got better or worse. More functions can error-out and cause the pathops engine to non-destructively exit. * Accuracy Remove code that adjusted point locations. Instead, offset the curve part so that sorted curves all use the same origin. Reduce the size (and influence) of magic numbers. * Testing The debug suite with verify and the full release suite ./out/Debug/pathops_unittest -v -V ./out/Release/pathops_unittest -v -V -x expose one error. That error is captured as cubics_d3. This error exists in the checked in code as well. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2128633003 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2128633003 Review-Url: https://codereview.chromium.org/2128633003
* fix another pathops fuzz bugGravatar caryclark2016-06-29
| | | | | | | | | | | | Tunnel out the error case when the numerics create uncalculable angles. R=mmoroz@chromium.org TBR=reed@google.com BUG=624351 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2103863005 Review-Url: https://codereview.chromium.org/2103863005
* fix fuzz test that exceeds numeric limitGravatar caryclark2016-06-29
| | | | | | | | | | | | The extreme values here exceed an internal test that expects computed numbers to be less than MAX_FLT. Use MAX_DBL instead. R=mmoroz@chromium.org TBR=reed@google.com BUG=624346 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2103903004 Review-Url: https://codereview.chromium.org/2103903004
* fix fuzz bugsGravatar caryclark2016-06-28
| | | | | | | | | | | | | | | | Detect more places where the pathops numerics cause numbers to become nearly identical and subsequently fail. These tests have extreme inputs and cannot succeed. Also remove the expectSuccess parameter from PathOpsDebug and check instead in the test framework. R=mbarbella@chromium.org TBR=reed@google.com BUG=623072,623022 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2103513002 Review-Url: https://codereview.chromium.org/2103513002