New GrClipStack supporting only intersect/difference

Overview doc: https://docs.google.com/document/d/1ddIk74A1rL5Kj5kGcnInOYKVAXs3J2IsSgU5BLit0Ng/edit?usp=sharing

This is the new clip stack that will replace GrClipStackClip. The doc
link in the CL description has a much more detailed overview of what the
strategy of the new clip stack is, but at a very high level:

1. Add a temporary #define that lets SkGpuDevice switch between the old
stack and the new stack. For the new GrClipStack, it extends SkBaseDevice
directly and has to implement all of the device clipping virtuals.
   - If you look from patchset 5 and earlier, the define defaults to on
     so I can test it on the bots, etc. but the plan will be for it to
     default to off when this lands so it's only running on unit tests.
     Then in a follow up, I'll turn it on for our bots but keep it off in
     chrome and android. If everything looks good, chrome can then be
     turned on. There is a more extensive migration plan for android
     because of the expanding clip ops, but that is covered at the end of
     the overview doc.

2. GrClipStack manages save/restore logic of the stack and extends GrClip,
so the cpp file also includes code to apply a GrAppliedClip. At the moment
the apply strategy is as close to that in GrReducedClip and
GrClipStackClip as I could make it. Down the road, I think we can explore
other analytic coverage options and a clip atlas that replaces the unified
SW mask.
   - Once GrClipStack is enabled everywhere, it means GrReducedClip and
     GrClipStackClip can be deleted, so I'm not too worried about sharing
     code between the two. A lot is already shared through the use of
     GrSWMaskHelper and GrStencilMaskHelper.
   - SkClipStack and SkClipStackDevice are still used by the PDF and SVG
     backends, so they aren't necessarily deletable.

3. The GrClipStack only handles intersect and difference ops. It
represents all geometric clip operations as an element. The stack itself
is controlled by the "save record", which tracks aggregate bounds, valid
elements, and the non-geometric clip shader.
   - When a new save record is pushed on the stack, older elements are
     inactive. This means they cannot be modified, since they may need to
     be activated again when the current save is popped off the stack.
     However, they can still affect the clip during application.
   - When a new element is pushed on the stack, older elements may be
     invalidated. This means they don't need to be considered any more
     because they are redundant with the new clip shape (e.g. nested round
     rect clips only have to keep the innermost valid).


Bug: skia:10205
Change-Id: I68ccfd414033aa9014b102efaee3ad50a806f793
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308283
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
12 files changed