Make SkPathPriv::Raw handle SkPaths with infinite bounds correctly

Without this change, a path with infinite bounds was incorrectly
being set to having zero bounds.

This cherry-pick isn't a clean patch because the old impl on
that branch didn't have the SkPathBuilder route handle non-finite
bounds. I decided to update the PathBuilder route to mirror the
non-pathbuilder route on this branch.

Change-Id: I7cfc51915232fcbbf02e0389346260d0384c3968
Bug: b/447041289
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1065397
Commit-Queue: Kaylee Lubick <kjlubick@google.com>
Auto-Submit: Kaylee Lubick <kjlubick@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Mike Reed <mike@reedtribe.org>
(cherry picked from commit c4d8b104a19dc977a32119b71d7a58098c429db6)
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1065836
diff --git a/src/core/SkPathPriv.h b/src/core/SkPathPriv.h
index cc7d62f..7a5b215 100644
--- a/src/core/SkPathPriv.h
+++ b/src/core/SkPathPriv.h
@@ -441,26 +441,38 @@
 
     static SkPathRaw Raw(const SkPath& path) {
         const SkPathRef* ref = path.fPathRef.get();
+        SkASSERT(ref);
+        const SkRect bounds = ref->isFinite()
+                                      ? ref->getBounds()
+                                      : SkRect{SK_FloatNaN, SK_FloatNaN, SK_FloatNaN, SK_FloatNaN};
         return {
-            ref->pointSpan(),
-            ref->verbs(),
-            ref->conicSpan(),
-            ref->getBounds(),
-            path.getFillType(),
-            path.isConvex(),
-            SkTo<uint8_t>(ref->getSegmentMasks()),
+                ref->pointSpan(),
+                ref->verbs(),
+                ref->conicSpan(),
+                bounds,
+                path.getFillType(),
+                path.isConvex(),
+                SkTo<uint8_t>(ref->getSegmentMasks()),
         };
     }
 
     static SkPathRaw Raw(const SkPathBuilder& builder) {
+        const SkRect bounds = builder.isFinite()
+                                      ? builder.computeBounds()
+                                      : SkRect{SK_FloatNaN, SK_FloatNaN, SK_FloatNaN, SK_FloatNaN};
+        SkPathConvexity convexity = builder.fConvexity;
+        if (convexity == SkPathConvexity::kUnknown) {
+            convexity = SkPathPriv::ComputeConvexity(
+                    builder.fPts, builder.fVerbs, builder.fConicWeights);
+        }
         return {
-            builder.points(),
-            builder.verbs(),
-            builder.conicWeights(),
-            builder.computeBounds(),
-            builder.fillType(),
-            SkPathConvexity_IsConvex(builder.fConvexity),
-            SkTo<uint8_t>(builder.fSegmentMask),
+                builder.points(),
+                builder.verbs(),
+                builder.conicWeights(),
+                bounds,
+                builder.fillType(),
+                SkPathConvexity_IsConvex(convexity),
+                SkTo<uint8_t>(builder.fSegmentMask),
         };
     }
 };