From 5546ef2dd9edad601383b85907f677118f857332 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 30 Jan 2012 17:09:45 +0000 Subject: inject a 32767 bounded cliprect before using SuperSampler blitter, to avoid crash/assert when our run-array is larger than int16_t. Better fix may be to "tile" the drawing, so we never see a clip that's too wide, and perhaps this technique can help us avoid disabling AA for large parths (not sure tho). git-svn-id: http://skia.googlecode.com/svn/trunk@3104 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tests/ClipCubicTest.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/ClipCubicTest.cpp') diff --git a/tests/ClipCubicTest.cpp b/tests/ClipCubicTest.cpp index 931b61e09c..491d0e5f3e 100644 --- a/tests/ClipCubicTest.cpp +++ b/tests/ClipCubicTest.cpp @@ -7,9 +7,27 @@ */ #include "Test.h" +#include "SkCanvas.h" +#include "SkPaint.h" #include "SkCubicClipper.h" #include "SkGeometry.h" +// Currently the supersampler blitter uses int16_t for its index into an array +// the width of the clip. Test that we don't crash/assert if we try to draw +// with a device/clip that is larger. +static void test_giantClip() { + SkBitmap bm; + bm.setConfig(SkBitmap::kARGB_8888_Config, 64919, 1); + bm.allocPixels(); + SkCanvas canvas(bm); + canvas.clear(0); + + SkPath path; + path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(33, 1); + SkPaint paint; + paint.setAntiAlias(true); + canvas.drawPath(path, paint); +} static void PrintCurve(const char *name, const SkPoint crv[4]) { printf("%s: %.10g, %.10g, %.10g, %.10g, %.10g, %.10g, %.10g, %.10g\n", @@ -142,6 +160,8 @@ static void TestCubicClipping(skiatest::Reporter* reporter) { 1.297736168, 7.059780121, 2.505550385, 10, shouldbe), tol)); + + test_giantClip(); } -- cgit v1.2.3