tweak conservative bounds value to save aberrant cubic

Bug: 844457
Change-Id: Ia3c7c0592df59022cf04f6747b1fe30975431ea4
Reviewed-on: https://skia-review.googlesource.com/129200
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index 2373e62..1854a7e 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -564,7 +564,10 @@
 // Bias used for conservative rounding of float rects to int rects, to nudge the irects a little
 // larger, so we don't "think" a path's bounds are inside a clip, when (due to numeric drift in
 // the scan-converter) we might walk beyond the predicted limits.
-static const double kConservativeRoundBias = 0.5 + 0.5 / SK_FDot6One;
+//
+// This value has been determined trial and error: pick the smallest value (after the 0.5) that
+// fixes any problematic cases (e.g. crbug.com/844457)
+static const double kConservativeRoundBias = 0.5 + 1.0 / SK_FDot6One;
 
 /**
  *  Round the value down. This is used to round the top and left of a rectangle,
diff --git a/tests/ClipCubicTest.cpp b/tests/ClipCubicTest.cpp
index a2024ff..427e753 100644
--- a/tests/ClipCubicTest.cpp
+++ b/tests/ClipCubicTest.cpp
@@ -211,3 +211,14 @@
     canvas->clipRect({0, 0, 65, 202});
     canvas->drawPath(path, paint);
 }
+
+DEF_TEST(cubic_scan_error_crbug_844457, reporter) {
+    auto surface(SkSurface::MakeRasterN32Premul(100, 100));
+
+    SkPath path;
+    path.moveTo(-30/64.0, -31/64.0);
+    path.cubicTo(-31/64.0, -31/64,-31/64.0, -31/64,-31/64.0, 100);
+    path.lineTo(100,100);
+
+    surface->getCanvas()->drawPath(path, SkPaint());
+}