OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class DashingGM : public skiagm::GM { | 47 class DashingGM : public skiagm::GM { |
48 public: | 48 public: |
49 DashingGM() {} | 49 DashingGM() {} |
50 | 50 |
51 protected: | 51 protected: |
52 | 52 |
53 SkString onShortName() { | 53 SkString onShortName() { |
54 return SkString("dashing"); | 54 return SkString("dashing"); |
55 } | 55 } |
56 | 56 |
57 SkISize onISize() { return SkISize::Make(640, 300); } | 57 SkISize onISize() { return SkISize::Make(640, 340); } |
58 | 58 |
59 virtual void onDraw(SkCanvas* canvas) { | 59 virtual void onDraw(SkCanvas* canvas) { |
60 static const struct { | 60 static const struct { |
61 int fOnInterval; | 61 int fOnInterval; |
62 int fOffInterval; | 62 int fOffInterval; |
63 } gData[] = { | 63 } gData[] = { |
64 { 1, 1 }, | 64 { 1, 1 }, |
65 { 4, 1 }, | 65 { 4, 1 }, |
66 }; | 66 }; |
67 | 67 |
(...skipping 15 matching lines...) Expand all Loading... |
83 gData[data].fOffInterval * scale, | 83 gData[data].fOffInterval * scale, |
84 paint); | 84 paint); |
85 canvas->translate(0, SkIntToScalar(20)); | 85 canvas->translate(0, SkIntToScalar(20)); |
86 } | 86 } |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 show_giant_dash(canvas); | 90 show_giant_dash(canvas); |
91 canvas->translate(0, SkIntToScalar(20)); | 91 canvas->translate(0, SkIntToScalar(20)); |
92 show_zero_len_dash(canvas); | 92 show_zero_len_dash(canvas); |
| 93 canvas->translate(0, SkIntToScalar(20)); |
| 94 // Draw 0 on, 0 off dashed line |
| 95 paint.setStrokeWidth(SkIntToScalar(8)); |
| 96 drawline(canvas, 0, 0, paint); |
93 } | 97 } |
94 }; | 98 }; |
95 | 99 |
96 /////////////////////////////////////////////////////////////////////////////// | 100 /////////////////////////////////////////////////////////////////////////////// |
97 | 101 |
98 static void make_unit_star(SkPath* path, int n) { | 102 static void make_unit_star(SkPath* path, int n) { |
99 SkScalar rad = -SK_ScalarPI / 2; | 103 SkScalar rad = -SK_ScalarPI / 2; |
100 const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n; | 104 const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n; |
101 | 105 |
102 path->moveTo(0, -SK_Scalar1); | 106 path->moveTo(0, -SK_Scalar1); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 }; | 477 }; |
474 | 478 |
475 ////////////////////////////////////////////////////////////////////////////// | 479 ////////////////////////////////////////////////////////////////////////////// |
476 | 480 |
477 DEF_GM(return new DashingGM;) | 481 DEF_GM(return new DashingGM;) |
478 DEF_GM(return new Dashing2GM;) | 482 DEF_GM(return new Dashing2GM;) |
479 DEF_GM(return new Dashing3GM;) | 483 DEF_GM(return new Dashing3GM;) |
480 DEF_GM(return new Dashing4GM;) | 484 DEF_GM(return new Dashing4GM;) |
481 DEF_GM(return new Dashing5GM(true);) | 485 DEF_GM(return new Dashing5GM(true);) |
482 DEF_GM(return new Dashing5GM(false);) | 486 DEF_GM(return new Dashing5GM(false);) |
OLD | NEW |