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
diff --git a/tests/ClipCubicTest.cpp b/tests/ClipCubicTest.cpp
index 931b61e..491d0e5 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 @@
1.297736168, 7.059780121,
2.505550385, 10,
shouldbe), tol));
+
+ test_giantClip();
}