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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 return SkString("dstreadshuffle"); | 37 return SkString("dstreadshuffle"); |
38 } | 38 } |
39 | 39 |
40 SkISize onISize() override { | 40 SkISize onISize() override { |
41 return SkISize::Make(kWidth, kHeight); | 41 return SkISize::Make(kWidth, kHeight); |
42 } | 42 } |
43 | 43 |
44 void drawShape(SkCanvas* canvas, | 44 void drawShape(SkCanvas* canvas, |
45 SkPaint* paint, | 45 SkPaint* paint, |
46 ShapeType type) { | 46 ShapeType type) { |
47 static const SkRect kRect = SkRect::MakeXYWH(SkIntToScalar(-50), SkIntTo
Scalar(-50), | 47 const SkRect kRect = SkRect::MakeXYWH(SkIntToScalar(-50), SkIntToScalar(
-50), |
48 SkIntToScalar(75), SkIntToS
calar(105)); | 48 SkIntToScalar(75), SkIntToScalar(1
05)); |
49 switch (type) { | 49 switch (type) { |
50 case kCircle_ShapeType: | 50 case kCircle_ShapeType: |
51 canvas->drawCircle(0, 0, 50, *paint); | 51 canvas->drawCircle(0, 0, 50, *paint); |
52 break; | 52 break; |
53 case kRoundRect_ShapeType: | 53 case kRoundRect_ShapeType: |
54 canvas->drawRoundRect(kRect, SkIntToScalar(10), SkIntToScalar(20
), *paint); | 54 canvas->drawRoundRect(kRect, SkIntToScalar(10), SkIntToScalar(20
), *paint); |
55 break; | 55 break; |
56 case kRect_ShapeType: | 56 case kRect_ShapeType: |
57 canvas->drawRect(kRect, *paint); | 57 canvas->drawRect(kRect, *paint); |
58 break; | 58 break; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 private: | 179 private: |
180 enum { | 180 enum { |
181 kNumShapes = 100, | 181 kNumShapes = 100, |
182 }; | 182 }; |
183 SkAutoTUnref<SkShader> fBG; | 183 SkAutoTUnref<SkShader> fBG; |
184 SkPath fConcavePath; | 184 SkPath fConcavePath; |
185 SkPath fConvexPath; | 185 SkPath fConvexPath; |
186 static const int kWidth = 900; | 186 static constexpr int kWidth = 900; |
187 static const int kHeight = 400; | 187 static constexpr int kHeight = 400; |
188 typedef GM INHERITED; | 188 typedef GM INHERITED; |
189 }; | 189 }; |
190 | 190 |
191 ////////////////////////////////////////////////////////////////////////////// | 191 ////////////////////////////////////////////////////////////////////////////// |
192 | 192 |
193 static GM* MyFactory(void*) { return new DstReadShuffle; } | 193 static GM* MyFactory(void*) { return new DstReadShuffle; } |
194 static GMRegistry reg(MyFactory); | 194 static GMRegistry reg(MyFactory); |
195 | 195 |
196 } | 196 } |
OLD | NEW |