aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkAnalyticEdge.cpp
Commit message (Collapse)AuthorAge
* 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>
* Revert "Revert "SkTypes: extract SkTo""Gravatar Hal Canary2018-06-14
| | | | | | | | | | | | | | | | This reverts commit fdcfb8b7c23fbf18f872d2c31d27978235033876. > Original change's description: > > SkTypes: extract SkTo > > > > Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09 > > Reviewed-on: https://skia-review.googlesource.com/133620 > > Reviewed-by: Mike Klein <mtklein@google.com> Change-Id: Ida74fbc5c21248a724a5edbf9fae18a33bcb23aa Reviewed-on: https://skia-review.googlesource.com/134506 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Revert "SkTypes: extract SkTo"Gravatar Hal Canary2018-06-13
| | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2a2f67592602b18527bc3fd449132d420cd5b62e. Reason for revert: this appears to be what is holding up the Chrome roll. Original change's description: > SkTypes: extract SkTo > > Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09 > Reviewed-on: https://skia-review.googlesource.com/133620 > Reviewed-by: Mike Klein <mtklein@google.com> TBR=mtklein@google.com,halcanary@google.com No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: Iafd738aedfb679a23c061a51afe4b98a8d4cdfae Reviewed-on: https://skia-review.googlesource.com/134504 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkTypes: extract SkToGravatar Hal Canary2018-06-12
| | | | | | Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09 Reviewed-on: https://skia-review.googlesource.com/133620 Reviewed-by: Mike Klein <mtklein@google.com>
* No chop at y extrema for cubicsGravatar Yuqian Li2017-08-09
| | | | | | | | | | | | | | | | | | The new Delta AA scan converter does not need the edge to be updated with monotonic Y so chopping at y extrema is not necessary. Removing such chopping brings ~10% performance increase to chalkboard.svg which has tons of small cubics (the same is true for many svgs I saw). We didn't remove the chopping for quads because that does not bring a significant speedup. Moreover, dropping those y extremas would make our strokecircle animation look a little more wobbly (because we would have fewer divisions for the quads at the top and bottom of the circle). Bug: skia: Change-Id: I3984d2619f9f77269ed24e8cbfa9f1429ebca4a8 Reviewed-on: https://skia-review.googlesource.com/31940 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Make update_edge as a member function of SkAnalyticEdgeGravatar Yuqian Li2017-07-21
| | | | | | | | | | | This is to prepare for future SkScan_DAAPath.cpp to use this member function (https://skia-review.googlesource.com/c/19666/). Bug: skia: Change-Id: I5fb90ac67b80f8a69a712e7e697d68dcadba5d14 Reviewed-on: https://skia-review.googlesource.com/24180 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Remove SK_SUPPORT_LEGACY_AAA flag as chromium now turns it offGravatar Yuqian Li2017-03-08
| | | | | | | | | BUG=skia: Change-Id: I3b385b8aeab08f402f4471637bf641cd456c8c56 Reviewed-on: https://skia-review.googlesource.com/9327 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Turn on concave analytic AAGravatar Yuqian Li2017-01-18
| | | | | | | | | | | | | | | | | | This will allow Skia trybots to exercise analytic AA. But there's still a guard flag in Chromium that prevents layout tests failure. Additionally, we 1. fixed nagative shift problem 2. relax the ASSERT when slope is too large: If slope is large, the accuracy of the slope is limited due to conversion to SkFDot6 and division. Hence we have to relax the constraint. 3. handle the special case where dx != 0 while slope == 0 because of very large dy and limited precision. BUG=skia: Change-Id: Ice70164f3f396f0db3896bedc7b96fbd613078dc Reviewed-on: https://skia-review.googlesource.com/7120 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Reland https://skia-review.googlesource.com/c/6091/Gravatar Yuqian Li2017-01-13
| | | | | | | | | | | | | | The only difference is that we now also put the guard flag SK_SUPPORT_LEGACY_AAA in SkUserConfig.h. Previously, SkAnalyticEdge.cpp doesn't get that flag from SkScan.h and that caused many problems. BUG=skia: TBR=reed@google.com,caryclark@google.com Change-Id: I134bb76cebd6fffa712f438076668765321bba3b Reviewed-on: https://skia-review.googlesource.com/6992 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Revert "Reland https://skia-review.googlesource.com/c/6091/"Gravatar Yuqian Li2017-01-13
| | | | | | | | | | | This reverts commit b46fff60bc82fe6f0c64b2241d854a121f7cb5f9. Reason for revert: possible chromium cc unit tests failure Change-Id: Ie174c55e4d0fc3ae45854b5897ba26b7ad5a9c13 Reviewed-on: https://skia-review.googlesource.com/6981 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Yuqian Li <liyuqian@google.com>
* Reland https://skia-review.googlesource.com/c/6091/Gravatar Yuqian Li2017-01-12
| | | | | | | | | | | | | | The only difference is that we now put the guard flag SK_SUPPORT_LEGACY_AAA in SkUserConfig.h instead of SkScan.h. Previously, SkAnalyticEdge.cpp doesn't get that flag from SkScan.h and that caused many problems. BUG=skia: TBR=reed@google.com,caryclark@google.com Change-Id: I7b89d3cb64ad71715101d2a5e8e77be3a8a6fa16 Reviewed-on: https://skia-review.googlesource.com/6972 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Revert "Implement Analytic AA for General Paths (with Guard against Chrome)"Gravatar Yuqian Li2017-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 89a0e72287e991cfa2f860f92fad545ca59defe1. Reason for revert: <INSERT REASONING HERE> Original change's description: > Implement Analytic AA for General Paths (with Guard against Chrome) > > I've set up a SK_SUPPORT_LEGACY_AAA flag to guard against Chromium layout tests. I also set that flag in this CL so theoretically this CL won't trigger any GM changes. I'll use this to verify my guard, and remove that flag and actually enables concave AAA in a future CL. > > When enabled, for most simple concave paths (e.g., rectangle stroke, rrect stroke, sawtooth, stars...), the Analytic AA achieves 1.3x-2x speedup, and they look much prettier. And they probably are the majority in our use cases by number. But they probably are not the majority by time cost; a single complicated path may cost 10x-100x more time to render than a rectangle stroke... For those complicated paths, we fall back to supersampling by default as we're likely to be 1.1-1.2x slower and the quality improvement is not visually significant. However, one can use gSkForceAnalyticAA to disable that fallback. > > BUG=skia: > > Change-Id: If9549a3acc4a187cfaf7eb51890c148da3083d31 > Reviewed-on: https://skia-review.googlesource.com/6091 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Yuqian Li <liyuqian@google.com> > TBR=caryclark@google.com,liyuqian@google.com,reed@google.com BUG=skia: NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I13c05aaa1bcb14956bd0fe01bb404e41be75af22 Reviewed-on: https://skia-review.googlesource.com/6961 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Yuqian Li <liyuqian@google.com>
* Implement Analytic AA for General Paths (with Guard against Chrome)Gravatar Yuqian Li2017-01-12
| | | | | | | | | | | | | I've set up a SK_SUPPORT_LEGACY_AAA flag to guard against Chromium layout tests. I also set that flag in this CL so theoretically this CL won't trigger any GM changes. I'll use this to verify my guard, and remove that flag and actually enables concave AAA in a future CL. When enabled, for most simple concave paths (e.g., rectangle stroke, rrect stroke, sawtooth, stars...), the Analytic AA achieves 1.3x-2x speedup, and they look much prettier. And they probably are the majority in our use cases by number. But they probably are not the majority by time cost; a single complicated path may cost 10x-100x more time to render than a rectangle stroke... For those complicated paths, we fall back to supersampling by default as we're likely to be 1.1-1.2x slower and the quality improvement is not visually significant. However, one can use gSkForceAnalyticAA to disable that fallback. BUG=skia: Change-Id: If9549a3acc4a187cfaf7eb51890c148da3083d31 Reviewed-on: https://skia-review.googlesource.com/6091 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Remove SK_ANALYTIC_AA_GUARD flagGravatar Yuqian Li2016-12-02
| | | | | | | | | BUG=skia: Change-Id: I4e10ba7afc76ed41c6c41275f9b6a5dde3a2a4be Reviewed-on: https://skia-review.googlesource.com/5502 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Add additional guard to the Analytic AA changeGravatar Yuqian Li2016-11-29
| | | | | | | | | | | This shall fix the DEPS roll. BUG=skia: Change-Id: I3ac208a8025c3408729b9e24e9c01e9f007a1799 Reviewed-on: https://skia-review.googlesource.com/5329 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Add the missing shift to the dyGravatar Yuqian Li2016-11-29
| | | | | | | | | | | | | | This is identical to https://skia-review.googlesource.com/c/5266/ except for the SK_ANALYTIC_AA_GUARD flag. BUG=chromium:668907 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5302 Change-Id: I3fc225a925d21fe615c46a4a0be7fe33c5790766 Reviewed-on: https://skia-review.googlesource.com/5302 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* Compute slope using fSnappedYGravatar Yuqian Li2016-11-29
| | | | | | | | | | | | | | If we use the oldy and dy directly as we did previously, the slope could be very different from (newSnappedX - fSnappedX) / (newSnappedY - fSnappedY) in the updateLine when the edge made a lot of updates with small dy but large dx. That will cause bug skia:5995 BUG=skia:5995 Change-Id: If521976ed87195dfea5961afd58bedb98447c568 Reviewed-on: https://skia-review.googlesource.com/5269 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Revert "Add the missing shift to the dy"Gravatar Yuqian Li2016-11-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit dd13c020793b0a7fb2ac1f22024e9fb91ea483ef. Reason for revert: this breaks the Chromium DEPS roll as we break the layout_tests. I'll add a flag to guard the change in the future and enable the flag while change the layout_tests. Original change's description: > Add the missing shift to the dy > > BUG=chromium:668907 > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5266 > > Change-Id: I6d3e56ffc149fbeac6f7a2df740542abbf84dac8 > Reviewed-on: https://skia-review.googlesource.com/5266 > Reviewed-by: Cary Clark <caryclark@google.com> > Commit-Queue: Yuqian Li <liyuqian@google.com> > TBR=mtklein@chromium.org,caryclark@google.com,liyuqian@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ifd5aa50f155c3ebe2f1495cbf3b8dd706211a639 Reviewed-on: https://skia-review.googlesource.com/5286 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Yuqian Li <liyuqian@google.com>
* Add the missing shift to the dyGravatar Yuqian Li2016-11-28
| | | | | | | | | | | BUG=chromium:668907 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5266 Change-Id: I6d3e56ffc149fbeac6f7a2df740542abbf84dac8 Reviewed-on: https://skia-review.googlesource.com/5266 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Add test for QuickFDot6DivGravatar Yuqian Li2016-11-18
| | | | | | | | | | | | | This test will catch our (1 << 10) bug (which should be 1 << 9) BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4986 Change-Id: I25b607d1535a647284cee3b304a6f567f389e7f6 Reviewed-on: https://skia-review.googlesource.com/4986 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Fix the quickSkFDot6Div range checkGravatar Yuqian Li2016-11-17
| | | | | | | | | | | | | | | Our previous (1 << 10) limit is based on 2^32 being our maximum value. However, that's not the case because we have one more sign bit. Therefore I should make it (1 << 9). BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4973 Change-Id: I38acb627cdb2514d3e4996aef02480b389cf3588 Reviewed-on: https://skia-review.googlesource.com/4973 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Use SkFixedMul instead of SkFixedMul_lowprecGravatar Yuqian Li2016-11-17
| | | | | | | | | | | | | | | | | | | It seems that SkFixedMul_lowprec doesn't have too much performance gain (maybe 1%). But its precision loss is siginificant. No serious issues have been found in convex cases, but things get much trickier for concave shapes. I'm removing it now to improve the stability and reliability of our algorithm, which may potentially benefit our Chrome landing. (Even if we do not remove SkFixedMul_lowprec now, we eventually will remove it when we land concave AAA code.) BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4926 Change-Id: Iae5739a3780bb77ce6237888eee51a502fea5cf2 Reviewed-on: https://skia-review.googlesource.com/4926 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Remove accumulative snapping errorGravatar Yuqian Li2016-11-14
| | | | | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4769 Change-Id: Ie70bdc280c680c82f3b8a186466bf3a0835a9107 Reviewed-on: https://skia-review.googlesource.com/4769 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Snap y when updating cubicGravatar Yuqian Li2016-11-11
| | | | | | | | | | | | | | | | If we don't snap, we could have end up with many tiny line segments wihtin a single row of pixels. That combined with our partial alpha rounding code (https://codereview.chromium.org/2483523002/) could accumlate so much error that violates our alpha <= 256 assert. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4724 Change-Id: I58b02cffc8a4dc9f541e194d61a2f6fef7b85c97 Reviewed-on: https://skia-review.googlesource.com/4724 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Check negative overflow of quickSkFDot6DivGravatar liyuqian2016-11-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following fuzz html reveals the bug in chromium content_shell ===html=begins=== <style> *{min-width:4%;-webkit-border-radius:+256%;} .CLASS11{text-decoration:rgba(128%,16129%,1%,0.0000000004656612317904879831274006762300773920593144339363789186) dotted blink;vertical-align:124px;-webkit-column-count:2147483655 !important;</style> <h1 class="CLASS11 CLASS1"> > B <button> <h4 class="CLASS11 CLASS12"> </h4> <p> c C <table> <caption class="CLASS11"> > <ruby class="CLASS11 CLASS12"> </ruby> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA x ===html===ends=== BUG=chromium:662905 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2482863004 Review-Url: https://codereview.chromium.org/2482863004
* Resubmit issue 2221103002 to fix the iOS build by declaring the flag inGravatar liyuqian2016-10-04
| | | | | | | | | | | SkCommonFlags.h TBR=reed@google.com,caryclark@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2393643002 Review-Url: https://codereview.chromium.org/2393643002
* Revert of Analytic AntiAlias for Convex Shapes (patchset #14 id:260001 of ↵Gravatar stephana2016-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/2221103002/ ) Reason for revert: Breaks iOS build. Original issue's description: > Implement AnalyticAA for convex shapes. > > Design doc: go/analyticAA > > A performance test can be found here: https://docs.google.com/a/google.com/spreadsheets/d/1n9LSjFzrQzx0hovFddWey0GSMXNRjl1oFuSypMlHWZk/edit?usp=sharing > > Our best case is filling big triangles, which according to our experiment has ~2.9x speedup. Our worst case is filling small ovals/circles, which has a ~1.06x slowdown. > > To see how our new algorithm changes the DM images, see: https://x20web.corp.google.com/~liyuqian/dmdiff/index.html > The most significant changes are in convexpaths and analytic_antialias_convex > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2221103002 > > Committed: https://skia.googlesource.com/skia/+/7795822807478143120c33228b68d2ab3918af2c TBR=reed@google.com,caryclark@google.com,liyuqian@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2388213003
* Implement AnalyticAA for convex shapes.Gravatar liyuqian2016-10-04
Design doc: go/analyticAA A performance test can be found here: https://docs.google.com/a/google.com/spreadsheets/d/1n9LSjFzrQzx0hovFddWey0GSMXNRjl1oFuSypMlHWZk/edit?usp=sharing Our best case is filling big triangles, which according to our experiment has ~2.9x speedup. Our worst case is filling small ovals/circles, which has a ~1.06x slowdown. To see how our new algorithm changes the DM images, see: https://x20web.corp.google.com/~liyuqian/dmdiff/index.html The most significant changes are in convexpaths and analytic_antialias_convex BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2221103002 Review-Url: https://codereview.chromium.org/2221103002