Better decisions about choosing AAA versus DAA

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>
1 file changed