OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 | 9 |
10 namespace skiagm { | 10 namespace skiagm { |
11 | 11 |
12 // Draw rects with various stroke widths at 1/8 pixel increments | 12 // Draw rects with various stroke widths at 1/8 pixel increments |
13 class ThinStrokedRectsGM : public GM { | 13 class ThinStrokedRectsGM : public GM { |
14 public: | 14 public: |
15 ThinStrokedRectsGM() { | 15 ThinStrokedRectsGM() { |
16 this->setBGColor(0xFF000000); | 16 this->setBGColor(0xFF000000); |
17 } | 17 } |
18 | 18 |
19 protected: | 19 protected: |
20 virtual SkString onShortName() SK_OVERRIDE { | 20 SkString onShortName() SK_OVERRIDE { |
21 return SkString("thinstrokedrects"); | 21 return SkString("thinstrokedrects"); |
22 } | 22 } |
23 | 23 |
24 virtual SkISize onISize() SK_OVERRIDE { | 24 SkISize onISize() SK_OVERRIDE { |
25 return SkISize::Make(240, 320); | 25 return SkISize::Make(240, 320); |
26 } | 26 } |
27 | 27 |
28 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 28 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
29 | 29 |
30 SkPaint paint; | 30 SkPaint paint; |
31 paint.setColor(SK_ColorWHITE); | 31 paint.setColor(SK_ColorWHITE); |
32 paint.setStyle(SkPaint::kStroke_Style); | 32 paint.setStyle(SkPaint::kStroke_Style); |
33 paint.setAntiAlias(true); | 33 paint.setAntiAlias(true); |
34 | 34 |
35 static const SkRect rect = { 0, 0, 10, 10 }; | 35 static const SkRect rect = { 0, 0, 10, 10 }; |
36 static const SkRect rect2 = { 0, 0, 20, 20 }; | 36 static const SkRect rect2 = { 0, 0, 20, 20 }; |
37 | 37 |
38 static const SkScalar gStrokeWidths[] = { | 38 static const SkScalar gStrokeWidths[] = { |
(...skipping 30 matching lines...) Expand all Loading... |
69 | 69 |
70 private: | 70 private: |
71 typedef GM INHERITED; | 71 typedef GM INHERITED; |
72 }; | 72 }; |
73 | 73 |
74 ////////////////////////////////////////////////////////////////////////////// | 74 ////////////////////////////////////////////////////////////////////////////// |
75 | 75 |
76 DEF_GM( return SkNEW(ThinStrokedRectsGM); ) | 76 DEF_GM( return SkNEW(ThinStrokedRectsGM); ) |
77 | 77 |
78 } | 78 } |
OLD | NEW |