Downgrade giant clip ops' AA in SkRasterClipStack

Anti-aliased path rendering in the software backend has an internal
limit of +/-16384 per coordinate. Path rendering is triggered by draws
and clips. Draws are tiled at a high-level before entering the blitter,
so this limit will not be encountered. Coverage mask generation for
AA clips, however, is not tiled. Normally, it relies on the path being
clipped by the underlying device dimensions. When the device itself
is larger than 16384, then the clip ops can reach the blitter and
exceed the internal limit.

When this happens, SkScan::FillPath adds a hard rect clip, which is
what caused the mis-applied clip seen in the attached bug report.

This CL detects when the canvas/device dimensions are large enough to
cause this problem and forcefully disables anti-aliasing for all clips.
This shouldn't really be a visual behavior change since the blitter
already was downgrading from AA. The main advantage is that the clip
stack will use SkRegion for BW clips exclusively instead of switching
to use SkAAClip.

It was decided to handle this at the clip stack level vs. a per-op
decision since a non-AA large clip element used with SkAAClip (
triggered by a smaller non-problematic op) would still show the bug.

This is only a mitigation. The long-term solution is to use tiling for
clipping as well as drawing (possibly by requiring the tiling to be
handled by clients, with surface creation failing at sizes > 16k).

Bug: chromium:1240718, skia:7998
Change-Id: I1f4cae540bec4d44c6e1d8032ded9e95ff32b82f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441456
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
3 files changed