add (disabled) test for big dashing
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 28 Jan 2013 16:57:29 +0000 (16:57 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 28 Jan 2013 16:57:29 +0000 (16:57 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@7417 2bbb7eff-a529-9590-31e7-b0007b416f81

gm/aaclip.cpp

index 10bfdf4b90574651bfde11665c435d482f007410..07e4085d696bc35304e1d2d2d3b73386ad2a4219 100644 (file)
@@ -9,6 +9,34 @@
 #include "SkCanvas.h"
 #include "SkPath.h"
 
+#include "SkDashPathEffect.h"
+static void test_giant_dash(SkCanvas* canvas) {
+    SkPaint paint;
+    const SkScalar intervals[] = { SK_Scalar1, SK_Scalar1 };
+
+    paint.setStrokeWidth(2);
+    paint.setPathEffect(new SkDashPathEffect(intervals, 2, 0))->unref();
+    
+    SkScalar big = 500 * 1000;
+
+    canvas->drawLine(10, 10, big, 10, paint);
+    canvas->drawLine(-big, 20, 500, 20, paint);
+    canvas->drawLine(-big, 30, big, 30, paint);
+
+    const SkScalar intervals2[] = { 20, 5, 10, 5 };
+    paint.setPathEffect(new SkDashPathEffect(intervals2, 4, 17))->unref();
+
+    canvas->translate(0, 40);
+    SkScalar x = -500;
+    SkScalar width = 3173;
+    for (int i = 0; i < 40; ++i) {
+        if (i > 10)
+        canvas->drawLine(x, 0, x + width, 0, paint);
+        x += 1;
+        canvas->translate(0, 4);
+    }
+}
+
 // Reproduces bug found here: http://jsfiddle.net/R8Cu5/1/
 //
 #include "SkGradientShader.h"
@@ -177,7 +205,10 @@ protected:
         return make_isize(640, 480);
     }
 
-    virtual void onDraw(SkCanvas* canvas) {
+    virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
+        if (false) {
+            test_giant_dash(canvas); return; 
+        }
         if (false) {
             test_grad(canvas); return;
         }