Reland "Refactor geometry union capabilities out of GrStyledShape"

This reverts commit af312c9d404468b5ab3cd23f42d9dfdf27332420.

Reason for revert: improved performance, updated empty point cap behavior
to make chrome happy.

Because of the performance regression in the original CL, this is a bit
more to it than just updating cap behavior. Summary of changes for perf:
1. In asPath(), only call reset() if the type isn't a path or arc.
   Otherwise it was just a wasted realloc of an empty path ref.
2. Rewrote the GrShape::simplify() to not progress through every shape
   type in order, it just jumps to the appropriate type.
3. Have simplify() return whether or not the shape started out closed,
   so we don't have to call GrShape::closed(), which is costly when the
   shape is a path.
4. Expose the GrShape's type enum so GrStyledShape's key writing can use
   switches instead of a giant block of ifs (where path happened to be
   last)

The regressions showed up most heavily on desk_mapsvg and desk_chalkboard
SKPs on the Android skpbench marks. On my system, I was able to
reproduce a similar %-regression from ToT and the original CL on the
chalkboard (but not mapsvg).

Master ranged between 5.1 and 5.3ms, original CL ranged from 5.6-5.8
and after the changes listed above, I got it down to 5.3-5.5. It's not
ideal but I haven't been able to figure out anything more substantial
that it could be. At this point it may just be code layout and/or the
fact that it's now split into two types.


Original change's description:
> Revert "Refactor geometry union capabilities out of GrStyledShape"
>
> This reverts commit 2becdde0740b84eec7856c3f811fd7637e011191.
>
> Reason for revert: likely breaking cc unit test due to empty shape cap change.
>
> Original change's description:
> > Refactor geometry union capabilities out of GrStyledShape
> >
> > The geometry union part of GrStyledShape is now held in GrShape. For the
> > most part, GrShape is entirely style agnostic and focuses on storing
> > the various types of geometry, and destructing them gracefully. It also
> > provides a public API that unifies functionality across all shape types,
> > such as contains() and bounds().
> >
> > GrStyledShape now just owns a GrShape and a GrStyle, and handles the
> > additional simplification logic that relies on knowing the effects of
> > the style on the draw. This is where GrShape makes some allowances for
> > style. Its simplify() function accepts flags that enable/disable various
> > simplification optimizations. Currently these are designed around
> > what is needed to respect path effects and stroking behaviors in
> > GrStyledShape. The main other user of GrShape (the new clip stack) will
> > always provide all flags since it treats every shape as if it were
> > simply filled.
> >
> > Several other related refactorings were taken at the same time:
> > 1. The implementations for asNestedRects, asRRect, etc. were moved out
> >    of the header and into the cpp file for GrStyledShape.
> > 2. GrRenderTargetContext relies on GrStyledShape for its stroke rect
> >    fallbacks.
> > 3. GrShape can hold points, lines, and rects explicitly. This let me
> >    simplify the stroke reasoning.
> >
> > Change-Id: I9fe75613fee51c30b4049b2b5a422daf80a1a86e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/284803
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
>
> TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com
>
> Change-Id: I2af5782e072e0ccb4a87f903bb88cbe335b9613f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286039
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

Change-Id: I8c614573582084f2e9ee0d73f93812e0a7c13983
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286396
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 4cb2825..290019c 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -341,6 +341,8 @@
   "$_src/gpu/geometry/GrQuadUtils.cpp",
   "$_src/gpu/geometry/GrQuadUtils.h",
   "$_src/gpu/geometry/GrRect.h",
+  "$_src/gpu/geometry/GrShape.cpp",
+  "$_src/gpu/geometry/GrShape.h",
   "$_src/gpu/geometry/GrStyledShape.cpp",
   "$_src/gpu/geometry/GrStyledShape.h",
   "$_src/gpu/ops/GrAAConvexPathRenderer.cpp",