test drawing large-coord aa rects

git-svn-id: http://skia.googlecode.com/svn/trunk@10926 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index b791a9a..aea07c1 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -9,6 +9,7 @@
 #include "SkBitmap.h"
 #include "SkCanvas.h"
 #include "SkDashPathEffect.h"
+#include "SkSurface.h"
 
 static SkCanvas* create(SkBitmap::Config config, int w, int h, int rb,
                         void* addr = NULL) {
@@ -28,6 +29,49 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
+// test that we can draw an aa-rect at coordinates > 32K (bigger than fixedpoint)
+static void test_big_aa_rect(skiatest::Reporter* reporter) {
+    SkBitmap output;
+    SkPMColor pixel[1];
+    output.setConfig(SkBitmap::kARGB_8888_Config, 1, 1, 4);
+    output.setPixels(pixel);
+
+    SkImage::Info info = {
+        300, 33300, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType
+    };
+    SkSurface* surf = SkSurface::NewRaster(info);
+    SkCanvas* canvas = surf->getCanvas();
+
+    SkRect r = { 0, 33000, 300, 33300 };
+    int x = SkScalarRoundToInt(r.left());
+    int y = SkScalarRoundToInt(r.top());
+
+    // check that the pixel in question starts as transparent (by the surface)
+    if (canvas->readPixels(&output, x, y)) {
+        REPORTER_ASSERT(reporter, 0 == pixel[0]);
+    } else {
+        REPORTER_ASSERT(reporter, !"readPixels failed");
+    }
+
+    SkPaint paint;
+    paint.setAntiAlias(true);
+    paint.setColor(SK_ColorWHITE);
+
+    canvas->drawRect(r, paint);
+
+    // Now check that it is BLACK
+    if (canvas->readPixels(&output, x, y)) {
+        // don't know what swizzling PMColor did, but white should always
+        // appear the same.
+        REPORTER_ASSERT(reporter, 0xFFFFFFFF == pixel[0]);
+    } else {
+        REPORTER_ASSERT(reporter, !"readPixels failed");
+    }
+    surf->unref();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
 static void moveToH(SkPath* path, const uint32_t raw[]) {
     const float* fptr = (const float*)raw;
     path->moveTo(fptr[0], fptr[1]);
@@ -276,6 +320,10 @@
     if (false) test_crbug131181();
     test_infinite_dash(reporter);
     test_crbug_165432(reporter);
+    
+    if (false) {    // working on a fix
+        test_big_aa_rect(reporter);
+    }
 }
 
 #include "TestClassDef.h"