aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ClipCubicTest.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-30 17:09:45 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-30 17:09:45 +0000
commit5546ef2dd9edad601383b85907f677118f857332 (patch)
tree9ba876bd661d1ff71c25a6491a80b3f21d875113 /tests/ClipCubicTest.cpp
parent9efd9a048aebaa6681afb76b18e1a7dd642078d3 (diff)
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
Diffstat (limited to 'tests/ClipCubicTest.cpp')
-rw-r--r--tests/ClipCubicTest.cpp20
1 files changed, 20 insertions, 0 deletions
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();
}