From b6399a79b25f50b13679d32e08183988b0486cc8 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 28 Jan 2013 16:57:29 +0000 Subject: add (disabled) test for big dashing git-svn-id: http://skia.googlecode.com/svn/trunk@7417 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gm/aaclip.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'gm/aaclip.cpp') diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp index 10bfdf4b90..07e4085d69 100644 --- a/gm/aaclip.cpp +++ b/gm/aaclip.cpp @@ -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; } -- cgit v1.2.3