aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkScan_AntiPath.cpp
Commit message (Collapse)AuthorAge
* remove SkTCastGravatar Mike Klein2018-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SkTCast is functionally equivalent to reinterpret_cast. The comment about SkTCast helping to avoid strict alising issues is not true. Dereferencing a pointer cast to a pointer of an unrelated type is always undefined, even if smuggled through a union like in SkTCast. To really avoid aliasing issues, you need to make a union[1] of the two value types, or better, memcpy between values. I've had to fix MatrixText.cpp where switching to reinterpret_cast actually let Clang notice and warn that we're exploiting undefined behavior, and GrSwizzle.h and SkCamera.cpp caught by GCC. I've switched SkTLList over to use SkAlignedSTStorage, which seems to help convince some GCC versions that fObj is used in a sound way. [1] The union punning trick is non-standard in C++, but GCC and MSVC both explicitly support it. I believe Clang does not officially explicitly support it, but probably does quietly for GCC compatibility. Change-Id: I71822e82c962f9aaac8be24d3c0f39f4f8b05026 Reviewed-on: https://skia-review.googlesource.com/134947 Commit-Queue: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Salomon <bsalomon@google.com> Auto-Submit: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Salomon <bsalomon@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>
* Reland "Add private fIsBadForDAA bit to SkPath"Gravatar Yuqian Li2018-04-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ed5e069dbb0b2ef49e22b9d17af3875e3682cd61. Reason for revert: add the guard flag Original change's description: > Revert "Add private fIsBadForDAA bit to SkPath" > > This reverts commit 54aefc74103a5c1810a7cc074746915c78ab3132. > > Reason for revert: Forget the guard flag. Pixel tests would fail. > > Original change's description: > > Add private fIsBadForDAA bit to SkPath > > > > Bug: chromium:821353 > > Change-Id: Ic6585e76df692bb1853d0990d75f0e8d1dee22f4 > > Reviewed-on: https://skia-review.googlesource.com/120201 > > Commit-Queue: Yuqian Li <liyuqian@google.com> > > Reviewed-by: Mike Reed <reed@google.com> > > TBR=caryclark@google.com,liyuqian@google.com,reed@google.com > > Change-Id: I2fe7cfcc3a80a51415f72d656da95a894a3240a4 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: chromium:821353 > Reviewed-on: https://skia-review.googlesource.com/120505 > Reviewed-by: Yuqian Li <liyuqian@google.com> > Commit-Queue: Yuqian Li <liyuqian@google.com> TBR=caryclark@google.com,liyuqian@google.com,reed@google.com Change-Id: Iebf7caf9ca74f305dec25b1b6512e93cb41cc8ec No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:821353 Reviewed-on: https://skia-review.googlesource.com/120620 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Yuqian Li <liyuqian@google.com>
* Revert "Add private fIsBadForDAA bit to SkPath"Gravatar Yuqian Li2018-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 54aefc74103a5c1810a7cc074746915c78ab3132. Reason for revert: Forget the guard flag. Pixel tests would fail. Original change's description: > Add private fIsBadForDAA bit to SkPath > > Bug: chromium:821353 > Change-Id: Ic6585e76df692bb1853d0990d75f0e8d1dee22f4 > Reviewed-on: https://skia-review.googlesource.com/120201 > Commit-Queue: Yuqian Li <liyuqian@google.com> > Reviewed-by: Mike Reed <reed@google.com> TBR=caryclark@google.com,liyuqian@google.com,reed@google.com Change-Id: I2fe7cfcc3a80a51415f72d656da95a894a3240a4 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:821353 Reviewed-on: https://skia-review.googlesource.com/120505 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Add private fIsBadForDAA bit to SkPathGravatar Yuqian Li2018-04-11
| | | | | | | | Bug: chromium:821353 Change-Id: Ic6585e76df692bb1853d0990d75f0e8d1dee22f4 Reviewed-on: https://skia-review.googlesource.com/120201 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Mike Reed <reed@google.com>
* Reland "Use DAA for small cubics and non-convex paths that fit into a mask"Gravatar Yuqian Li2018-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 107d53971dab5245e88885f095aef52fd52942d3. Reason for revert: Ready to rebaseline Original change's description: > Revert "Use DAA for small cubics and non-convex paths that fit into a mask" > > This reverts commit 1875e053845c4d377a0f64f7233bdb9dc00bdce1. > > Reason for revert: > > I don't think there's anything wrong with this, but it looks like Yuqian is out today and there is a large number of GM, SKP, and SVG images to triage from this. This is just a triage-by-revert... should be fine to reland when you're ready to triage. > > Original change's description: > > Use DAA for small cubics and non-convex paths that fit into a mask > > > > I forgot to benchmark svgs and it turns out that DAA is specifically > > good for the small cubics and small non-convex paths in svgs. This > > should make our svg performance fast again: > > > > 2.84% faster in svgparse_Florida-StateSeal.svg_1 > > 2.90% faster in svgparse_NewYork-StateSeal.svg_1 > > 2.95% faster in svgparse_Seal_of_Texas.svg_1 > > 3.05% faster in car.svg_1 > > 3.53% faster in svgparse_Vermont_state_seal.svg_1 > > 3.68% faster in svgparse_Wyoming-StateSeal.svg_1 > > 4.88% faster in svgparse_Minnesota-StateSeal.svg_1 > > 5.22% faster in svgparse_NewMexico-StateSeal.svg_1 > > 6.49% faster in svgparse_fsm.svg_1 > > > > > > Bug: skia: > > Change-Id: Ia149944443d72c12c3dda178cb5ebc89d6d0bf18 > > Reviewed-on: https://skia-review.googlesource.com/116185 > > Reviewed-by: Cary Clark <caryclark@google.com> > > Commit-Queue: Yuqian Li <liyuqian@google.com> > > TBR=caryclark@google.com,liyuqian@google.com,reed@google.com,caryclark@skia.org > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: skia: > Change-Id: I232f34dcea1cdabef768879a261fe6796f3e4a79 > Reviewed-on: https://skia-review.googlesource.com/116400 > Reviewed-by: Mike Klein <mtklein@google.com> > Commit-Queue: Mike Klein <mtklein@google.com> TBR=mtklein@google.com,caryclark@google.com,liyuqian@google.com,reed@google.com,caryclark@skia.org Change-Id: I6a413e3a2f1ce9182f9e209f6e2654a602170378 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/116620 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Yuqian Li <liyuqian@google.com>
* Revert "Use DAA for small cubics and non-convex paths that fit into a mask"Gravatar Mike Klein2018-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1875e053845c4d377a0f64f7233bdb9dc00bdce1. Reason for revert: I don't think there's anything wrong with this, but it looks like Yuqian is out today and there is a large number of GM, SKP, and SVG images to triage from this. This is just a triage-by-revert... should be fine to reland when you're ready to triage. Original change's description: > Use DAA for small cubics and non-convex paths that fit into a mask > > I forgot to benchmark svgs and it turns out that DAA is specifically > good for the small cubics and small non-convex paths in svgs. This > should make our svg performance fast again: > > 2.84% faster in svgparse_Florida-StateSeal.svg_1 > 2.90% faster in svgparse_NewYork-StateSeal.svg_1 > 2.95% faster in svgparse_Seal_of_Texas.svg_1 > 3.05% faster in car.svg_1 > 3.53% faster in svgparse_Vermont_state_seal.svg_1 > 3.68% faster in svgparse_Wyoming-StateSeal.svg_1 > 4.88% faster in svgparse_Minnesota-StateSeal.svg_1 > 5.22% faster in svgparse_NewMexico-StateSeal.svg_1 > 6.49% faster in svgparse_fsm.svg_1 > > > Bug: skia: > Change-Id: Ia149944443d72c12c3dda178cb5ebc89d6d0bf18 > Reviewed-on: https://skia-review.googlesource.com/116185 > Reviewed-by: Cary Clark <caryclark@google.com> > Commit-Queue: Yuqian Li <liyuqian@google.com> TBR=caryclark@google.com,liyuqian@google.com,reed@google.com,caryclark@skia.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: skia: Change-Id: I232f34dcea1cdabef768879a261fe6796f3e4a79 Reviewed-on: https://skia-review.googlesource.com/116400 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
* Use DAA for small cubics and non-convex paths that fit into a maskGravatar Yuqian Li2018-03-23
| | | | | | | | | | | | | | | | | | | | | | | I forgot to benchmark svgs and it turns out that DAA is specifically good for the small cubics and small non-convex paths in svgs. This should make our svg performance fast again: 2.84% faster in svgparse_Florida-StateSeal.svg_1 2.90% faster in svgparse_NewYork-StateSeal.svg_1 2.95% faster in svgparse_Seal_of_Texas.svg_1 3.05% faster in car.svg_1 3.53% faster in svgparse_Vermont_state_seal.svg_1 3.68% faster in svgparse_Wyoming-StateSeal.svg_1 4.88% faster in svgparse_Minnesota-StateSeal.svg_1 5.22% faster in svgparse_NewMexico-StateSeal.svg_1 6.49% faster in svgparse_fsm.svg_1 Bug: skia: Change-Id: Ia149944443d72c12c3dda178cb5ebc89d6d0bf18 Reviewed-on: https://skia-review.googlesource.com/116185 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Better decisions about choosing AAA versus DAAGravatar Yuqian Li2018-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Chrome perf regressions (817942, 819185) are caused by the bad choices to use DAA instead of AAA for stroking simple curves. (BTW, in my tests, DAA is still faster than SAA so it's not too much of a regression.) We previously only considered the number of line segments, but not the length of each segment. That leads to our wrong judgement of the path complexity (the number of intersections per scan line) when there are many short line segments. The change will bring the following performance change to our nanobench: 8.45% slower in clip_strategy_path_10 8.39% slower in draw_stroke_bezier_quad_square_bevel_10 3.91% slower in chart_aa 3.76% faster in lines 6.29% faster in path_stroke_big_oval 22.81% faster in path_stroke_big_circle 24.44% faster in giantdashline_vert_2 The two slower cases, clip_strategy_path_10 and draw_stroke_bezier_quad_square_bevel_10 are caused by choosing AAA over DAA. Those two tests do seem to be simple strokes. I'll later investigate why AAA is slower than DAA for those two cases. For now, I think that this change is sufficient to address those chromium perf regresssions. Bug: chromium:817942 chromium:819185 Change-Id: I1d13c968b17f257b4ede4c70e552db5016baf1ab Reviewed-on: https://skia-review.googlesource.com/115583 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* Set SkDAARecord to empty type if the scan converter returns earlyGravatar Yuqian Li2018-03-05
| | | | | | | | | | | | | | Otherwise, ./out/Debug/dm --config t8888 -m bug583299 will crash at SkASSERT(record->fType != SkDAARecord::Type::kToBeComputed) Bug: skia: Change-Id: Ie93221bd6ea7ab9bc9f3d79fd7fe02b315e6a089 Reviewed-on: https://skia-review.googlesource.com/111680 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Add SkDAARecord to prepare for init-onceGravatar Yuqian Li2018-02-14
| | | | | | | | | | | This is just refactoring our code so we can easily bring DAA to init-once. No GMs are expected to change. Bug: skia: Change-Id: I05dd1bdfb68bb40b5393ee854de51795b55ed426 Reviewed-on: https://skia-review.googlesource.com/106480 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* check for huge pathsGravatar Mike Reed2018-01-22
| | | | | | | | | Bug:802976 Change-Id: Ibb5930442f75ca8483afc8dfa5869cac98573904 Reviewed-on: https://skia-review.googlesource.com/98440 Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
* relax path bounds checkGravatar Mike Reed2018-01-16
| | | | | | | | | | | | Revert of https://skia-review.googlesource.com/c/skia/+/94100 Reduced the "big" value by the amount we super-sample shift Bug: skia: Change-Id: I7b37b7db841312b0863f76cb353cc916aff1cfa8 Reviewed-on: https://skia-review.googlesource.com/94801 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "relax path bounds check so we can draw larger paths"Gravatar Mike Reed2018-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e2330261a704e2db762e2de0d297bf8b4dc510f1. Reason for revert: triggered assert 48.3s start tiles_rt-8888 gm bigrect 48.3s start tiles_rt-8888 gm big_rrect_circle_aa_effect 48.3s start tiles_rt-8888 gm big_rrect_ellipse_aa_effect ../../../src/core/SkScan_Path.cpp(229): fatal error: "assert(leftE->fFirstY <= stop_y)" Original change's description: > relax path bounds check so we can draw larger paths > > Bug:800804 > Change-Id: Ief0679de95887d8e11aa5853228c2bdef27d07a2 > Reviewed-on: https://skia-review.googlesource.com/94100 > Reviewed-by: Yuqian Li <liyuqian@google.com> > Commit-Queue: Mike Reed <reed@google.com> TBR=egdaniel@google.com,liyuqian@google.com,reed@google.com Change-Id: I63509625b8afaa2064f0b187c17b73bd7739cdb9 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 800804 Reviewed-on: https://skia-review.googlesource.com/94481 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* relax path bounds check so we can draw larger pathsGravatar Mike Reed2018-01-12
| | | | | | | | Bug:800804 Change-Id: Ief0679de95887d8e11aa5853228c2bdef27d07a2 Reviewed-on: https://skia-review.googlesource.com/94100 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Remove legacy containedInClip codeGravatar Yuqian Li2018-01-09
| | | | | | | | | | | It seems that we've already rebaselined the golden images TBR: reed@google.com Bug: skia:7271 Change-Id: I841dc4933f0cad015c3c6da7bd08ddfb2a35c5a2 Reviewed-on: https://skia-review.googlesource.com/92060 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Prepare rebaseline for removing legacy containedInClipGravatar Yuqian Li2018-01-05
| | | | | | | | Bug: skia:7271 Change-Id: I291d07d1d6c2513bf4a4d75474caab8ee5c07f54 Reviewed-on: https://skia-review.googlesource.com/90401 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Add forceDAA parameter to AntiFillPathGravatar Yuqian Li2017-11-27
| | | | | | | | | | Threaded backend will need this to always fill path in DAA. Bug: skia: Change-Id: Ifbfb0137b89eb71b7c2a2722aee1dad196a52553 Reviewed-on: https://skia-review.googlesource.com/76120 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Compute more accurate containedInClipGravatar Yuqian Li2017-11-09
| | | | | | | | | | | | | Eventually, we'll remove containedInClip from the function parameters and just compute it using ir and clipBounds. The current approach is for preparing rebaseline. TBR: reed@google.com Bug: skia:7271 Change-Id: Ife60e173d9f4f1c9ec80d13a2f7a88a0433b61e9 Reviewed-on: https://skia-review.googlesource.com/69220 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* This is a reland of 67340. This CL fixes the broken layout tests byGravatar Yuqian Li2017-11-07
| | | | | | | | | | | preserving the containedInClip boolean. We will eventually remove it and rebaseline the layout tests. Bug: skia:7271 Change-Id: I20e7220340d561ea2c50d30cd5d6ac6d2b4b3743 Reviewed-on: https://skia-review.googlesource.com/68100 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Revert "Simplify fill path call by removing do_fill_path"Gravatar Yuqian Li2017-11-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 12f322b9d4e98619bd128f39b02d3a6f3b78ba79. Reason for revert: Unexpectedly break Chrome layout tests. Will check why. Original change's description: > Simplify fill path call by removing do_fill_path > > The git diff is not very informative for this CL. > Here's a better diff: > > 1. do_fill_path is removed and its content is copied to AntiFillPath > > 2. Any call to do_fill_path is removed. > > 3. std::function FillPathFunc is removed (and replaced by direct > AAAFillPath, DAAFillPath, and SAAFillPath call). > > 4. The old call chain is: > AntiFillPath -> (AAAFillPath/DAAFillPath/...) > -> do_fill_path > -> specific FillPathFunc > The new call chain is: > AntiFillPath -> AAAFillPath/DAAFillPath/SAAFillPath > > This is made possible by the removal of SK_SUPPORT_LEGACY_AA_CHOICE > which makes sure that AntiFillPath is the only function that makes > the choice of AAA/DAA/SAA. > > In the next CL, I'll improve the structure of SkScan::AntiFillPath > to prepare for Threaded Backend's init-once change. > > Bug: skia: > Change-Id: If6ebbdab207cadb7bfe2cb3fcf33ea3d180c3896 > Reviewed-on: https://skia-review.googlesource.com/67340 > Reviewed-by: Mike Reed <reed@google.com> > Reviewed-by: Cary Clark <caryclark@google.com> > Commit-Queue: Yuqian Li <liyuqian@google.com> TBR=caryclark@google.com,liyuqian@google.com,reed@google.com,caryclark@skia.org Change-Id: I7d9517574265db5bc372a5749e6480df8e938f2e No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/67855 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Simplify fill path call by removing do_fill_pathGravatar Yuqian Li2017-11-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The git diff is not very informative for this CL. Here's a better diff: 1. do_fill_path is removed and its content is copied to AntiFillPath 2. Any call to do_fill_path is removed. 3. std::function FillPathFunc is removed (and replaced by direct AAAFillPath, DAAFillPath, and SAAFillPath call). 4. The old call chain is: AntiFillPath -> (AAAFillPath/DAAFillPath/...) -> do_fill_path -> specific FillPathFunc The new call chain is: AntiFillPath -> AAAFillPath/DAAFillPath/SAAFillPath This is made possible by the removal of SK_SUPPORT_LEGACY_AA_CHOICE which makes sure that AntiFillPath is the only function that makes the choice of AAA/DAA/SAA. In the next CL, I'll improve the structure of SkScan::AntiFillPath to prepare for Threaded Backend's init-once change. Bug: skia: Change-Id: If6ebbdab207cadb7bfe2cb3fcf33ea3d180c3896 Reviewed-on: https://skia-review.googlesource.com/67340 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Remove SK_SUPPORT_LEGACY_AA_CHOICEGravatar Yuqian Li2017-11-02
| | | | | | | | Bug: skia: Change-Id: If754225685699c1d1e8e516fb2a4671da2d13572 Reviewed-on: https://skia-review.googlesource.com/67260 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Use SK_SUPPORT_LEGACY_AA_CHOICE to stage some changesGravatar Yuqian Li2017-10-23
| | | | | | | | | | | So I can rebaseline the golden images and unify AA choices without fully turning on DAA. Bug: skia: Change-Id: I33447f60c8eac6318dda7730abd6caefdb14c5dc Reviewed-on: https://skia-review.googlesource.com/62840 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Simplify scan converter's argsGravatar Yuqian Li2017-09-28
| | | | | | | | | | | | | | | All scan converters need an SkIRect clipBounds and a bool containedInClip. However, we previously sent in an SkRegion and a SkIRect*, and convert them into clipBounds and containedInClip all over the places. This CL converts them only once inside do_fill_path and change all args to SkIRect and bool. Bug: skia: Change-Id: I05f1d76322942d8817860fd33991f7f7ce918e7c Reviewed-on: https://skia-review.googlesource.com/52741 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Unify DAA and AAA usage decisionGravatar Yuqian Li2017-07-27
| | | | | | | | Bug: skia: Change-Id: I2481d872e072fdd638640ef2306aa89c1a1d6d94 Reviewed-on: https://skia-review.googlesource.com/26801 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* New analytic AA scan converter using delta (I call it DAA for now)Gravatar Yuqian Li2017-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DAA is: 1. Much simpler than AAA. SkScan_AAAPath.cpp is about 1700 lines. SkScan_DAAPath.cpp is about 300 lines. The whole DAA CL is only about 800 lines. 2. Much faster than AAA for complicated paths. The speedup applies to GL backend (including ccpr)! Here's the frame time of 'SampleApp --slide Chart' on macbook pro: AAA-raster: 33ms DAA-raster: 21ms AAA-gl: 30ms DAA-gl: 20ms AAA-ccpr: 18ms DAA-ccpr: 12ms My linux desktop doesn't have SSE3 so the speedup is smaller (~25% for Chart). I believe that DAA is so fast that I can enable it for any paths (AAA is not enabled by default for complicated paths because it is slow; hence our older supersampling scan converter is used for stroking on Chart for AAA-xxx config.) 3. The SkCoverageDelta is suitable for threaded backend with out-of-order concurrent scan conversion as commented in the source code. Maybe we can also just send deltas to GPU. 4. Similar to most analytic path renderers, the quality is on the best ground-truth level, unless there are intersections within a pixel. The intersections look good to my eyes although theoretically that could be arbitrary far from the ground truth (see my AAA slides). 5. For simple paths, such as circle, triangle, rrect, etc., DAA is slower than AAA. But DAA is faster than our older supersampling scan converter in most cases. As those simple paths usually don't constitute the bottleneck of a picture (skp or svg), I strongly recommend use DAA. 6. DAA also heavily favors blitMask so it may work quite well with SkRasterPipeline and SkRasterPipelineBlitter. Finally, please check https://skia-review.googlesource.com/c/22420/ which accelerate DAA by specializing blitCoverageDeltas for SkARGB32_Blitter and SkARGB32_Black_Blitter. It brings a little(<5%) speedup. But I couldn't figure out how to reduce the duplicate code so I don't intend to land it. Bug: skia: Change-Id: I3b7ed6a727447922e645b1acb737a506e7c09a4c Reviewed-on: https://skia-review.googlesource.com/19666 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Remove SK_SUPPORT_LEGACY_RECT flagGravatar Yuqian Li2017-07-14
| | | | | | | | | | The rebaseline has finished in Chromium. Bug: skia: Change-Id: Ibafb32b3683f1bfc3e451911e6fb8382bfc9b857 Reviewed-on: https://skia-review.googlesource.com/23481 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Always enable Analytic AA for rectsGravatar Yuqian Li2017-07-12
| | | | | | | | | | | | Previously, suitableForAAA disabled Analytic AA for small rects. But that's a mistake. Re-enabling AAA will bring 10-20% speedup for small rects (~800ns -> ~700ns measured by path_fill_small_rect nanobench). Bug: skia: Change-Id: I943f1c754669391f55e46471781fa65840629377 Reviewed-on: https://skia-review.googlesource.com/22205 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Revert "Always enable Analytic AA for rects"Gravatar Yuqian Li2017-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6d70274ccf6e7a3729af53e401d2d9e6726035a3. Reason for revert: need rebaseline Original change's description: > Always enable Analytic AA for rects > > Previously, suitableForAAA disabled Analytic AA for small rects. > But that's a mistake. Re-enabling AAA will bring 10-20% speedup for small rects > (~800ns -> ~700ns measured by path_fill_small_rect nanobench). > > Bug: skia: > Change-Id: I1d8bf4c105d8d116ea441a46e6c955c546bcbb22 > Reviewed-on: https://skia-review.googlesource.com/22074 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Yuqian Li <liyuqian@google.com> TBR=mtklein@chromium.org,herb@google.com,caryclark@google.com,liyuqian@google.com,reed@google.com Change-Id: I87011bf7b8f30fa3be5d46287afbaf38c0be7da9 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/22140 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Always enable Analytic AA for rectsGravatar Yuqian Li2017-07-10
| | | | | | | | | | | | Previously, suitableForAAA disabled Analytic AA for small rects. But that's a mistake. Re-enabling AAA will bring 10-20% speedup for small rects (~800ns -> ~700ns measured by path_fill_small_rect nanobench). Bug: skia: Change-Id: I1d8bf4c105d8d116ea441a46e6c955c546bcbb22 Reviewed-on: https://skia-review.googlesource.com/22074 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Combine duplicate code in preparing clipRgn for fill_pathGravatar Yuqian Li2017-06-12
| | | | | | | | Bug: skia: Change-Id: I52ed98491457aa426e2bb74a29131f4a20330017 Reviewed-on: https://skia-review.googlesource.com/19341 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* Mark overridden destructors with 'override' and remove 'virtual'Gravatar Brian Salomon2017-03-22
| | | | | | | | | This silences a new warning in clang 5.0 Change-Id: Ieb5b75a6ffed60107c3fd16075d2ecfd515b55e8 Reviewed-on: https://skia-review.googlesource.com/10006 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* 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>
* 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>
* Simplify the signature of sk/aaa_fill_pathGravatar Yuqian Li2016-11-16
| | | | | | | | | | | | | | | Previously, the clipRect is either equal to nullptr or clipRgn's bound (after necessary supersampling shift). Hence we drop one of them to make the signature simpler. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4874 Change-Id: Ied8d5313809d6cf90374365b01f2b8d52f2236e2 Reviewed-on: https://skia-review.googlesource.com/4874 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
* Make global use-analytic-AA bit threadsafe.Gravatar Mike Klein2016-10-04
| | | | | | | | | | | | | | | | I also had to cut it down to just a global atomic bool... as a field in a global singleton accessed through instance(), it's very hard to make threadsafe. CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-TSAN-Trybot BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2937 Change-Id: If80be987906dd521fbe644d1d0d577009f06d0e3 Reviewed-on: https://skia-review.googlesource.com/2937 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* 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
* Remove some useless declarationsGravatar sylvestre.ledru2016-09-01
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2270613003 Review-Url: https://codereview.chromium.org/2270613003
* Style bikeshed - remove extraneous whitespaceGravatar halcanary2016-03-29
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842753002 Review URL: https://codereview.chromium.org/1842753002
* use left-shift macro to fix/avoid undefined behvarior warningsGravatar reed2016-02-03
| | | | | | | | | motivated by https://codereview.chromium.org/1657333002/ BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1661873003 Review URL: https://codereview.chromium.org/1661873003
* Another undefined shift caught by -fsanitize=shift.Gravatar mtklein2015-12-09
| | | | | | | | | | left was -16 I didn't see any warning about fTop, but seems simplest to fix that too. BUG=skia: Review URL: https://codereview.chromium.org/1505993007