Handle stroked single line special case in Ganesh

This CL roughly halves the time spent on the captured stroked lines skp.
On my Linux desktop it boosts the external benchmark from 2618 to 5007.

This is a companion to: https://codereview.chromium.org/2019193002/ (Add new GM to exercise stroked line special case)

The idea is to land the GM first so any regressions are visible.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2023693002

Review-Url: https://codereview.chromium.org/2023693002
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp
index 859328a..2c90b8b 100644
--- a/src/gpu/batches/GrAAFillRectBatch.cpp
+++ b/src/gpu/batches/GrAAFillRectBatch.cpp
@@ -84,10 +84,12 @@
     SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts);
     SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + 4 * vertexStride);
 
-    SkScalar inset = SkMinScalar(devRect.width(), SK_Scalar1);
-    inset = SK_ScalarHalf * SkMinScalar(inset, devRect.height());
+    SkScalar inset;
 
     if (viewMatrix.rectStaysRect()) {
+        inset = SkMinScalar(devRect.width(), SK_Scalar1);
+        inset = SK_ScalarHalf * SkMinScalar(inset, devRect.height());
+
         set_inset_fan(fan0Pos, vertexStride, devRect, -SK_ScalarHalf, -SK_ScalarHalf);
         set_inset_fan(fan1Pos, vertexStride, devRect, inset,  inset);
     } else {
@@ -97,11 +99,14 @@
           { viewMatrix[SkMatrix::kMSkewX],  viewMatrix[SkMatrix::kMScaleY] }
         };
 
-        vec[0].normalize();
+        SkScalar len1 = SkPoint::Normalize(&vec[0]);
         vec[0].scale(SK_ScalarHalf);
-        vec[1].normalize();
+        SkScalar len2 = SkPoint::Normalize(&vec[1]);
         vec[1].scale(SK_ScalarHalf);
 
+        inset = SkMinScalar(len1 * rect.width(), SK_Scalar1);
+        inset = SK_ScalarHalf * SkMinScalar(inset, len2 * rect.height());
+
         // create the rotated rect
         fan0Pos->setRectFan(rect.fLeft, rect.fTop,
                             rect.fRight, rect.fBottom, vertexStride);