aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops
Commit message (Collapse)AuthorAge
* avoid uninitialized under fuzzerGravatar Cary Clark2018-07-26
| | | | | | | | | | | | | | | | | | https://skia-review.googlesource.com/143112 introduced new logic to handle failures; fuzzer found a way to exploit this. FWIW, skia's fuzzer did not call pathops when fed the test case. TBR=kjlubick@google.com Bug:867314 Change-Id: Id894962d3f32e206362faff332a1330db75da175 Reviewed-on: https://skia-review.googlesource.com/143318 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org>
* Pin max curvature solutions to 0..1Gravatar Chris Dalton2018-07-25
| | | | | | | | | | | | | | Pins out-of-range solutions for cubic/quad max curvature instead of throwing them out. Code that wants to know the endpoint(s) closest to max curvature now has the information. Code not interested in these values can just ignore 0 and 1. Bug: skia: Change-Id: I8e7e2ef236b4ab963865dc049ac3e09d5396757d Reviewed-on: https://skia-review.googlesource.com/143041 Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* handle failing pathop testsGravatar Cary Clark2018-07-24
| | | | | | | | | | | | | | | Some tests isolated from GrShapes_arcs do not fail gracefully, so make sure errors are properly handled. TBR=reed@google.com Bug: skia: Change-Id: Ia8c9903e64ef755ec11c398df3e5d258ca1f5f8b Reviewed-on: https://skia-review.googlesource.com/143112 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org>
* Whitespace FixupGravatar Hal Canary2018-07-11
| | | | | | | | Change-Id: I6c4c4b43dfa6b59832c63f8fcf43192b4973d88b Reviewed-on: https://skia-review.googlesource.com/140565 Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Hal Canary <halcanary@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
* propogate simple angles in pathopsGravatar Cary Clark2018-07-11
| | | | | | | | | | | | | | | | | | | | If an edge is unsortable, its winding value is untrustworthy; it cannot be added to the output on that alone. If one end adjoins a trusted edge, and that edge is added to the output, the untrusted edge can be added as well. Also add in msvs debugging for angles. With this change, all extended tests pass. TBR=reed@google.com Bug: skia:8125 Change-Id: I049c6efa2fa83edd7b49cdd598ec94c356481b0f Reviewed-on: https://skia-review.googlesource.com/140562 Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org>
* fix line intersect divide by zeroGravatar Cary Clark2018-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | Test filinmangust14 exposes two problems: - finding top of contour can expose divide by zero - joining partial contour results can add diagonal The latter makes the test return the wrong result, and has not been seen in other tests. The fix is to join disconnected contours by only following the contours provided as input. Working on that. The former bug is more straight-forward; just don't try to compute axis-aligned intersection if the denominator is zero. All existing tests prior to the new one work with this change. R=caryclark@google.com Bug: skia:8125 Change-Id: Ic878d090066708d9baca8475f27d4d5aba2294cc Reviewed-on: https://skia-review.googlesource.com/140121 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org>
* fix fuzzer found timeoutGravatar Cary Clark2018-06-29
| | | | | | | | | | | | | | | curiously, test case ran fine with skia's fuzzer, but hung with ubsan chrome fuzzer. R=kjlubick@google.com Bug:858985 Change-Id: Ie747ba9b902a25e59330a084fbdd5246d9de4920 Reviewed-on: https://skia-review.googlesource.com/138520 Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* fix pathop fuzz timeoutGravatar Cary Clark2018-06-25
| | | | | | | | | | | R=caryclark@google.com Bug:855751 Change-Id: Ieb6bae50311f62c9b03b84b2cf84f09ad2db2e46 Reviewed-on: https://skia-review.googlesource.com/137361 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org>
* fix op fuzz timeoutGravatar Cary Clark2018-06-19
| | | | | | | | | | R=kjlubick@google.com Bug:831647 Change-Id: I003ff28ac40ec81400570310bf6f6f1a08a925e5 Reviewed-on: https://skia-review.googlesource.com/134505 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Kevin Lubick <kjlubick@google.com> Reviewed-by: Cary Clark <caryclark@skia.org>
* fix fuzzer bugs in pathopsGravatar Cary Clark2018-06-19
| | | | | | | | | | | | | one from clusterfuzz, one from Skia fuzzer R=kjlubick@google.com Bug:853938 Change-Id: If456bf45e4d75edecf4e4e8222ddcdaa301455f4 Reviewed-on: https://skia-review.googlesource.com/135701 Commit-Queue: Cary Clark <caryclark@skia.org> Commit-Queue: Kevin Lubick <kjlubick@google.com> Auto-Submit: Cary Clark <caryclark@skia.org> Reviewed-by: Kevin Lubick <kjlubick@google.com>
* Stop using SkTSwap.Gravatar Ben Wagner2018-06-19
| | | | | | | | | | | | | Use std::swap instead. It does not appear that any external user specializes SkTSwap, but some may still use it. This removes all use in Skia so that SkTSwap can later be removed in a smaller CL. After that the <utility> include can be removed from SkTypes.h. Change-Id: If03d4ee07dbecda961aa9f0dc34d171ef5168753 Reviewed-on: https://skia-review.googlesource.com/135578 Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* fast path for pathopsGravatar Cary Clark2018-06-18
| | | | | | | | | | | | | | | Add faster path for simple but common path ops: - intersect two rects - all ops where one operand is empty R=halcanary@google.com Bug: skia:8049 Change-Id: I2a516d095feae8478ee9433262c9c77e5e18ce81 Reviewed-on: https://skia-review.googlesource.com/132929 Auto-Submit: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
* SkTypes: more into SkMacrosGravatar Hal Canary2018-06-12
| | | | | | | | Change-Id: I4c9a2d81a1bc4ccebc78eea56c0de116b98d415e Reviewed-on: https://skia-review.googlesource.com/134330 Commit-Queue: Hal Canary <halcanary@google.com> Auto-Submit: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* fix pathops fuzzerGravatar Cary Clark2018-06-07
| | | | | | | | | | | | | turn assert into fail R=kjlubick Change-Id: I3a2172b6b1a9eff092bcfddcf8310f32754b93f7 Reviewed-on: https://skia-review.googlesource.com/132780 Commit-Queue: Cary Clark <caryclark@skia.org> Commit-Queue: Kevin Lubick <kjlubick@google.com> Auto-Submit: Cary Clark <caryclark@skia.org> Reviewed-by: Kevin Lubick <kjlubick@google.com>
* add documentationGravatar Cary Clark2018-06-06
| | | | | | | | | | | | diagram for pathops change TBR=caryclark@google.com Bug: skia:8049 Change-Id: I2bbd04f1efad53e1197a45baf3ce98f0eb550512 Reviewed-on: https://skia-review.googlesource.com/132664 Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org>
* fix ops for very close rectsGravatar Cary Clark2018-06-06
| | | | | | | | | | | | | | | | | | | | | Pathops sorts line intersections to determine which edges to keep. If the intersections are very short, they may get discarded and the adjacent edge is used instead. If a pair of edges are 180 degrees apart, and an adjacent edge is part of the sort, it is ambiguous whether it is inside or outside the span. Add logic to look for this and evaluate the original data rather than the adjacent edge. In a separate CL, I'll add a specialization for rect/rect ops. R=halcanary@google.com Bug: skia:8049 Change-Id: I8d88d5520051d41303ea683e7d6b844f2afa9937 Reviewed-on: https://skia-review.googlesource.com/132661 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Hal Canary <halcanary@google.com> Auto-Submit: Cary Clark <caryclark@skia.org>
* don't walk off end of pointerGravatar Cary Clark2018-05-31
| | | | | | | | | | | | | Avoids pointer-overflow in ASAN/UBSAN. R=mtklein@google.com Bug:836282 Change-Id: I2125fa7927c30ae601431af8daec0f900c84799c Reviewed-on: https://skia-review.googlesource.com/131261 Auto-Submit: Cary Clark <caryclark@skia.org> Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
* ccpr: Normalize the cubic inflection function instead of its rootsGravatar Chris Dalton2018-04-16
| | | | | | | | | | | | When solving for KLM, switches back to normalizing the cubic's inflection function rather than both individual roots. Also performs some general code clean up for SkClassifyCubic. Bug: skia: Change-Id: Id513e7e02c50a8709f3eccf92fad9e5134d73d83 Reviewed-on: https://skia-review.googlesource.com/121201 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* fix pathop fuzzesGravatar Cary Clark2018-04-03
| | | | | | | | | | | | | | | | | throw an error instead of asserting for one for the other, only assert if the values are trusted. That's not ideal, but I don't see an easy way to insert a fail safety hatch in this code and if the assert is ignored, no further assert is triggered. verified that extended tests run without problem on debug and release R=kjlubick@google.com Bug: skia: Change-Id: I5544b6cbef97479854dbecb05baae6b2c41cabc9 Reviewed-on: https://skia-review.googlesource.com/117725 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Kevin Lubick <kjlubick@google.com>
* fix pathop fuzzerGravatar Cary Clark2018-03-20
| | | | | | | | | | | turn assert into fail R=kjlubick@google.com Bug: skia: Change-Id: I1124573959c90c7dae1a8cd54199dae429b8ca73 Reviewed-on: https://skia-review.googlesource.com/115481 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
* fix op fuzzGravatar Cary Clark2018-03-19
| | | | | | | | | | | | | | | | | | | fixes the current four fuzzer fails by rewriting asserts as function exits. Passes all extended pathops testing. To run the extended tests: ./out/debug/pathops_unittest -V -x ./out/release/pathops_unittest -V -x R=kjlubick@google.com Docs-Preview: https://skia.org/?cl=114962 Bug: skia: Change-Id: I05bd368a87b38b1121403cf93b21caf76c2e7d7e Reviewed-on: https://skia-review.googlesource.com/114962 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Kevin Lubick <kjlubick@google.com>
* fix pathops fuzzers and debuggingGravatar Cary Clark2018-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | En route to fixing fuzzer bugs, I discovered that most debugging in pathops was broken. Pathops has extensive runtime functions that trace links and connections between data structures that are invaluable to debugging. The only practical way to use these functions is to call them from the debugger in immediate mode. Some time, some where, the MSVS Immediate Window ceased to be able to call functions that are members of structs or classes, and functions that take templated parameters. I can find no mention of this on the web, so I assume that something about our setup is triggering this, but I've had no luck finding the culprit. In the meantime, I've added global functions wrapped in a namespace to sneak calls to these functions without MSVS being any the wiser. While this works, it is likely to bitrot by tomorrow or next Tuesday so I will continue to try to find and fix the root cause. This also fixes the fuzzer bugs; generally one-line edits that change asserts to fails. All pathops tests succeed with this. To run all tests, do: ./out/debug/pathops_unittest -V -x ./out/release/pathops_unittest -V -x TBR=caryclark@google.com Bug: skia: Change-Id: I956ae3d8df6d25e155e62bd6dede64519c7fbdb1 Reviewed-on: https://skia-review.googlesource.com/114321 Reviewed-by: Kevin Lubick <kjlubick@google.com> Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
* avoid divide by zeroGravatar Cary Clark2018-03-13
| | | | | | | | | | R=kjlubick@google.com Bug: skia:7623 Change-Id: Ia9fb31201a39a4540d94f97e8d2f06eb290ab6e5 Reviewed-on: https://skia-review.googlesource.com/114082 Commit-Queue: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
* fix a couple pathops fuzzersGravatar Cary Clark2018-03-13
| | | | | | | | | | | | | | This fixes these: src/pathops/SkOpCoincidence.cpp -- 1 crash-causing fuzzes src/pathops/SkOpSpan.h -- 1 crash-causing fuzzes R=kjlubick@google.com Bug: skia: Change-Id: I2b0dbd74757a32e522901753e2e17114a1a9f79b Reviewed-on: https://skia-review.googlesource.com/113751 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Kevin Lubick <kjlubick@google.com>
* some fuzzer fixesGravatar Cary Clark2018-03-09
| | | | | | | | | | | | should fix three or four of the PathOp asserts triggered by the fuzzer tool. R=kjlubick@google.com Bug: skia: Change-Id: I470895addf1e922da6a7c41d44d54eca92e68fb6 Reviewed-on: https://skia-review.googlesource.com/113163 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
* avoid divide in pathopsquadGravatar Cary Clark2018-02-27
| | | | | | | | Bug: skia: Change-Id: I535b1833712e87bb562e2cbef450a4f6e16ec2c5 Reviewed-on: https://skia-review.googlesource.com/110441 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Cary Clark <caryclark@skia.org>
* handle degenerate cubic loopsGravatar Cary Clark2018-02-02
| | | | | | | | | | | | | | | | | | | fuzzer generated a cubic with a very tiny loop at one end. Breaking the cubic in two generated a piece so small it was discarded, passing the original along. Instead, use the loop detection as a hint that passing the original may fail further along. Keep the big piece, which is more linear than the original; and change its end to match the original input if the small piece isn't worth keeping. R=kjlubick Bug: skia:7480 Change-Id: If4c5cd46dbf7e16526269f2854e4f2278f427461 Reviewed-on: https://skia-review.googlesource.com/103100 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
* bug fixes from PVS Studio (static analysis)Gravatar Mike Klein2018-01-26
| | | | | | | | | | | | | | | - Hal, please check out SkPDFCanon... was this unused? - Cary, please SkOpContour... is it right that allDone isn't necessary? - Brian, the rest? Bug: chromium:805881 Change-Id: I7cbbcf44f4460a114f4ed2a59ed3856203049cdc Reviewed-on: https://skia-review.googlesource.com/99960 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* fix external link in commentGravatar Cary Clark2018-01-09
| | | | | | | | | | | | update link to one that is accessible by all TBR=iclelland@google.com NOTRY=true Change-Id: Ib8fb6d05779d863641d323311435dbbb5807eeee Reviewed-on: https://skia-review.googlesource.com/92685 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org>
* Enable conditional-uninitialized flagGravatar Kevin Lubick2018-01-05
| | | | | | | | | Bug: skia:7462 Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SKNX_NO_SIMD Change-Id: I1c0a09984bf28a5c620a89af56040f018bae6310 Reviewed-on: https://skia-review.googlesource.com/90941 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* move divide by zero inside guardGravatar Cary Clark2017-12-13
| | | | | | | | | | | | speculative fix to see if this helps developer. It's the right thing to do in any case. TBR=reed@google.com Change-Id: I4fa576a096a6188f290957a7f2fabe73668f142d Reviewed-on: https://skia-review.googlesource.com/84521 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
* fix float-cast-overflow in pathopsGravatar Cary Clark2017-12-13
| | | | | | | | | | | | | | | | | these tests can be taken off the blacklist: clippedcubic2 PathOpsCubicIntersection PathOpsCubicLineIntersection PathOpsOpCubicsThreaded PathOpsOpLoopsThreaded R=benjaminwagner@google.com Bug: skia:7052 Change-Id: I25b422e78ea1d19531613fea0a3fece7f4096e16 Reviewed-on: https://skia-review.googlesource.com/80863 Reviewed-by: Ben Wagner <benjaminwagner@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
* fix pathops handling of tiny wrapback quads and cubicsGravatar Cary Clark2017-12-01
| | | | | | | | | | | | | If a quad or cubic reverses on itself, path ops breaks it in two. It determines the type of curve remaining, but needs to replace near-zero with zero first. TBR=reed@google.com Bug:790731 Change-Id: I3a1afa14fff064ca874b5abc768ec1ec5c2cf22f Reviewed-on: https://skia-review.googlesource.com/79400 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Cary Clark <caryclark@skia.org>
* move parts of SkPoint to SkPointPrivGravatar Cary Clark2017-11-08
| | | | | | | | | | | | Move specialized SkPoint methods to SkPointPriv. Use constexpr and inline initialization where possible. R=reed@google.com,bsalomon@google.com Bug: skia: 6898 Change-Id: I01ec5186f010f2dc80c068c70d9cc352f3221338 Reviewed-on: https://skia-review.googlesource.com/68700 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ravi Mistry <rmistry@google.com>
* add fuzzer timeout escapeGravatar Cary Clark2017-10-18
| | | | | | | | | | | | | | | | | SkOpSegment::moveNearby may loop for a long time, maybe forever. The longest loop isolated is 500 in a fuzzer generated test, and 50 in a real world test. Add an escape hatch to abandon the op after 9999 loops. While this puts a limit on the complexity path ops can handle, realistically paths this complex fail otherwise. TBR:hcm@google.com Bug: 764699 Change-Id: Iad62b9d505b94b2c2845ad2874342ac90478642e Reviewed-on: https://skia-review.googlesource.com/61200 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
* fix typoGravatar Cary Clark2017-10-17
| | | | | | | | | | | | | developer reported a harmless, but misleading typo in pathops. Verified that correcting it is also harmless TBR:reed@google.com Bug: skia:7172 Change-Id: I3aff926752ef6c5d95a78f4e6cf57c9b42789f64 Reviewed-on: https://skia-review.googlesource.com/60561 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
* Small pathops cleanup.Gravatar Ben Wagner2017-10-09
| | | | | | | | | | | | | | | | | | Newer clang compiler produces the diagnostic ../../tests/PathOpsDebug.cpp:1349:44: error: comparison of unsigned enum expression >= 0 is always true [-Werror,-Wtautological-unsigned-enum-zero-compare] if (!firstOp && c->operand() && op >= 0) { The check seems to be defending against bad values of SkPathOp, but this now seems unnecessary. This also adds 'rdiff' to kPathOpStr for future debugging. Change-Id: I08e5ba77c56e519ce4d9ae89491f7ccd5eb7f944 Reviewed-on: https://skia-review.googlesource.com/57104 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* Remove trailing whitespace.Gravatar Ben Wagner2017-10-09
| | | | | | | | | | | Also adds a presubmit to prevent adding trailing whitespace to source code in the future. Change-Id: I41a4df81487f6f00aa19b188f0cac6a3377efde6 Reviewed-on: https://skia-review.googlesource.com/57380 Reviewed-by: Ravi Mistry <rmistry@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* Remove carriage returns.Gravatar Ben Wagner2017-10-09
| | | | | | | | | Also add a presubmit so they don't get added to source code. Change-Id: I6a85c6a934b1068a63646a0dcc0d3a08baa96ced Reviewed-on: https://skia-review.googlesource.com/57110 Reviewed-by: Ravi Mistry <rmistry@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* Fix float-cast-overflow in SkOpSpan::sortableTop.Gravatar Ben Wagner2017-09-19
| | | | | | | | Bug: skia:4632 Change-Id: I5af8bb7b04673307cdf7865bb7d56a041ba27d83 Reviewed-on: https://skia-review.googlesource.com/47320 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Ben Wagner <benjaminwagner@google.com>
* possible fix for pathops timeoutGravatar Cary Clark2017-09-06
| | | | | | | | | | | | | | | | | | | | fuzzer causes pathops to loop somewhere finding complex intersections, but does not have a reproducible test case. Somewhat grasping at straws, the failing condition in this CL was triggered by the fuzzer tests, but may or may not be related to the hang. TBR=reed@google.com Bug: 754434 Change-Id: Ia8edc0709cec559b277ed83a5ad6feb67d8088c6 Reviewed-on: https://skia-review.googlesource.com/42780 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
* Move all Linux GCE bots to DebianGravatar Eric Boren2017-06-28
| | | | | | | | | NOTREECHECKS:true Bug: skia: Change-Id: I612989c6ce2f309d2f70f896500f73e4baa971a7 Reviewed-on: https://skia-review.googlesource.com/19811 Commit-Queue: Eric Boren <borenet@google.com> Reviewed-by: Eric Boren <borenet@google.com>
* Convert SkClassifyCubic to double precisionGravatar Chris Dalton2017-06-12
| | | | | | | | | | | | | Even though it's in homogeneous coordinates, we still get unfortunate artifacts if this math is not done in double precision. Prioritizing correctness for now; we can revisit in the future as the need for performance dictates. Bug: skia: Change-Id: If416ef6b70291f1454fcb9f7630d1108644ac2a5 Reviewed-on: https://skia-review.googlesource.com/19501 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
* Improve cubic KLM accuracyGravatar Chris Dalton2017-06-09
| | | | | | | | | | | | | | | | | | | | | | Moves cubic root finding logic out of GrPathUtils and PathOpsCubicIntersectionTest, and unifies it in SkGeometry. "Normalizes" the homogeneous parameter values of the roots, rather than the cubic inflection function. Does this normalization by twiddling the exponents instead of division (which causes a loss of precision). Abandons the built-in derivatives in GrCubicEffect. These don't have high enough precision on many mobile gpus. Instead we pass the KLM matrix to the vertex shader via uniform, where we can use it to set up new linear functionals from which the fragment shader can calculate the gradient of the implicit function. Bug: skia:4410 Change-Id: Ibd64e999520adc8cdef7803a492d3699995aef5a Reviewed-on: https://skia-review.googlesource.com/19017 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* Use more stable root finding methods for cubicsGravatar Christopher Dalton2017-06-06
| | | | | | | | | | | | | | Applies the quadratic formula from "Numerical Recipes in C", Section 5.6, to the homogeneous quadratic equations that find cubic inflection points and loop intersections. Also addresses KLM orientation ahead of time, rather than negating K and L after the fact. Bug: skia: Change-Id: Ic7e0818e2fe49b7724f9b583bae52281cfb1aea1 Reviewed-on: https://skia-review.googlesource.com/13481 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* SkSTArenaAllocGravatar Florin Malita2017-05-24
| | | | | | | | | Syntactic sugar, gets rid of some boilerplate. Change-Id: Ibdb28b7a8f1d5e4a4e18c12d423b987d7194e340 Reviewed-on: https://skia-review.googlesource.com/17837 Commit-Queue: Florin Malita <fmalita@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
* Remove SkOpTAllocatorGravatar Herb Derby2017-04-19
| | | | | | | | | | Have the callsites of SkOpTAllocator call SkArenaAlloc directly. Bug: skia: Change-Id: Ic54e92c3e9a0abed038aa3ae40e8a195895af99d Reviewed-on: https://skia-review.googlesource.com/13870 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Herb Derby <herb@google.com>
* 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>
* Improve accuracy of cubic classificationGravatar Chris Dalton2017-04-14
| | | | | | | | | | | | | | | | | | - Updates the logic to reflect the Loop-Blinn paper instead of the GPU gems website. - Removes the threshold for detecting local cusps. The serpentine codepath works for these cusps anyway, so what we really want to know is whether the discriminant is negative. - Makes sure to not scale the inflection function by 1/0. - Shifts the inflection function coefficients in d[] so they match the paper. - Stores the cubic discriminant in d[0]. Bug: skia: Change-Id: I909a522a0fd27c9c8dfbc27d968bc43eeb7a416f Reviewed-on: https://skia-review.googlesource.com/13304 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@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>