Index: gm/dashing.cpp |
diff --git a/gm/dashing.cpp b/gm/dashing.cpp |
index 2f5be081597d55a940405b9c1fc5d323f1e68760..7102b44d44e837f83785c8f6ba8cf6cf31b7eaf1 100644 |
--- a/gm/dashing.cpp |
+++ b/gm/dashing.cpp |
@@ -313,10 +313,69 @@ protected: |
////////////////////////////////////////////////////////////////////////////// |
+class Dashing4GM : public skiagm::GM { |
+public: |
+ Dashing4GM() {} |
+ |
+protected: |
+ virtual uint32_t onGetFlags() const SK_OVERRIDE { |
+ return kSkipTiled_Flag; |
+ } |
+ |
+ SkString onShortName() { |
+ return SkString("dashing4"); |
+ } |
+ |
+ SkISize onISize() { return skiagm::make_isize(640, 730); } |
+ |
+ virtual void onDraw(SkCanvas* canvas) { |
+ static const struct { |
+ int fOnInterval; |
+ int fOffInterval; |
+ } gData[] = { |
+ { 1, 1 }, |
+ { 4, 2 }, |
+ { 0, 4 }, // test for zero length on interval |
+ }; |
+ |
+ SkPaint paint; |
+ paint.setStyle(SkPaint::kStroke_Style); |
+ |
+ canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); |
+ canvas->translate(0, SK_ScalarHalf); |
+ |
+ for (int width = 0; width <= 2; ++width) { |
+ for (size_t data = 0; data < SK_ARRAY_COUNT(gData); ++data) { |
+ for (int aa = 0; aa <= 1; ++aa) { |
+ for (int cap = 0; cap <= 1; ++cap) { |
+ int w = width * width * width; |
+ paint.setAntiAlias(SkToBool(aa)); |
+ paint.setStrokeWidth(SkIntToScalar(w)); |
+ |
+ SkToBool(cap) ? paint.setStrokeCap(SkPaint::kSquare_Cap) |
+ : paint.setStrokeCap(SkPaint::kRound_Cap); |
+ |
+ int scale = w ? w : 1; |
+ |
+ drawline(canvas, gData[data].fOnInterval * scale, |
+ gData[data].fOffInterval * scale, |
+ paint); |
+ canvas->translate(0, SkIntToScalar(20)); |
+ } |
+ } |
+ } |
+ } |
+ } |
+}; |
+ |
+////////////////////////////////////////////////////////////////////////////// |
+ |
static skiagm::GM* F0(void*) { return new DashingGM; } |
static skiagm::GM* F1(void*) { return new Dashing2GM; } |
static skiagm::GM* F2(void*) { return new Dashing3GM; } |
+static skiagm::GM* F3(void*) { return new Dashing4GM; } |
static skiagm::GMRegistry gR0(F0); |
static skiagm::GMRegistry gR1(F1); |
static skiagm::GMRegistry gR2(F2); |
+static skiagm::GMRegistry gR3(F3); |