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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkTArray.h" | 10 #include "SkTArray.h" |
11 | 11 |
12 namespace skiagm { | 12 namespace skiagm { |
13 | 13 |
14 class HairlinesGM : public GM { | 14 class HairlinesGM : public GM { |
15 protected: | 15 protected: |
16 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 16 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
17 return kSkipTiled_Flag; | 17 return kSkipTiled_Flag; |
18 } | 18 } |
19 | 19 |
20 | 20 |
21 virtual SkString onShortName() SK_OVERRIDE { | 21 virtual SkString onShortName() SK_OVERRIDE { |
22 return SkString("hairlines"); | 22 return SkString("hairlines"); |
23 } | 23 } |
24 | 24 |
25 virtual SkISize onISize() { return SkISize::Make(1250, 1250); } | 25 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(1250, 1250); } |
26 | 26 |
27 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 27 virtual void onOnceBeforeDraw() SK_OVERRIDE { |
28 { | 28 { |
29 SkPath* lineAnglesPath = &fPaths.push_back(); | 29 SkPath* lineAnglesPath = &fPaths.push_back(); |
30 enum { | 30 enum { |
31 kNumAngles = 15, | 31 kNumAngles = 15, |
32 kRadius = 40, | 32 kRadius = 40, |
33 }; | 33 }; |
34 for (int i = 0; i < kNumAngles; ++i) { | 34 for (int i = 0; i < kNumAngles; ++i) { |
35 SkScalar angle = SK_ScalarPI * SkIntToScalar(i) / kNumAngles; | 35 SkScalar angle = SK_ScalarPI * SkIntToScalar(i) / kNumAngles; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 SkTArray<SkPath> fPaths; | 219 SkTArray<SkPath> fPaths; |
220 typedef GM INHERITED; | 220 typedef GM INHERITED; |
221 }; | 221 }; |
222 | 222 |
223 ////////////////////////////////////////////////////////////////////////////// | 223 ////////////////////////////////////////////////////////////////////////////// |
224 | 224 |
225 static GM* MyFactory(void*) { return new HairlinesGM; } | 225 static GM* MyFactory(void*) { return new HairlinesGM; } |
226 static GMRegistry reg(MyFactory); | 226 static GMRegistry reg(MyFactory); |
227 | 227 |
228 } | 228 } |
OLD | NEW |