#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"
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;
}