Even when the pts are restricted to 32K values, we can still overflow computing
a fixed-point coefficient for quadratics. To avoid this, we bias these
coefficients, storing 1/2 of their actual value, and then apply the 2x unbias
in updateQuadratic().

Fixes http://code.google.com/p/chromium/issues/detail?id=140803
Review URL: https://codereview.appspot.com/6450099

git-svn-id: http://skia.googlecode.com/svn/trunk@4960 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index f421ee8..8b787bb 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -76,6 +76,23 @@
     canvas->drawPath(path, paint);
 }
 
+// This used to assert in debug builds (and crash writing bad memory in release)
+// because we overflowed an intermediate value (B coefficient) setting up our
+// stepper for the quadratic. Now we bias that value by 1/2 so we don't overflow
+static void test_crbug_140803(skiatest::Reporter* reporter) {
+    SkBitmap bm;
+    bm.setConfig(SkBitmap::kARGB_8888_Config, 2700, 30*1024);
+    bm.allocPixels();
+    SkCanvas canvas(bm);
+    
+    SkPath path;
+    path.moveTo(2762, 20);
+    path.quadTo(11, 21702, 10, 21706);
+    SkPaint paint;
+    paint.setAntiAlias(true);
+    canvas.drawPath(path, paint);
+}
+
 // Need to exercise drawing an inverse-path whose bounds intersect the clip,
 // but whose edges do not (since its a quad which draws only in the bottom half
 // of its bounds).
@@ -208,6 +225,7 @@
     test_bigcubic(reporter);
     test_crbug_124652(reporter);
     test_crbug_140642(reporter);
+    test_crbug_140803(reporter);
     test_inversepathwithclip(reporter);
 //    test_crbug131181(reporter);
 }