aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/DrawPathTest.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-06 19:01:34 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-06 19:01:34 +0000
commite2faf17bcc523557e44ef443b48a53f286886a53 (patch)
tree9b5397c46273789dbcca64423942e3142ccaac87 /tests/DrawPathTest.cpp
parentd9ee348720f933d8a23547ee36693880296810c5 (diff)
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
Diffstat (limited to 'tests/DrawPathTest.cpp')
-rw-r--r--tests/DrawPathTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index f421ee87b6..8b787bb197 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -76,6 +76,23 @@ static void test_crbug131181(skiatest::Reporter*) {
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 @@ static void TestDrawPath(skiatest::Reporter* reporter) {
test_bigcubic(reporter);
test_crbug_124652(reporter);
test_crbug_140642(reporter);
+ test_crbug_140803(reporter);
test_inversepathwithclip(reporter);
// test_crbug131181(reporter);
}