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 "SkPath.h" | 10 #include "SkPath.h" |
11 | 11 |
12 class CircularClipsGM : public skiagm::GM { | 12 class CircularClipsGM : public skiagm::GM { |
13 SkScalar fX1, fX2, fY, fR; | 13 SkScalar fX1, fX2, fY, fR; |
14 SkPath fCircle1, fCircle2; | 14 SkPath fCircle1, fCircle2; |
15 | 15 |
16 public: | 16 public: |
17 CircularClipsGM() { | 17 CircularClipsGM() { |
18 fX1 = 80; | 18 fX1 = 80; |
19 fX2 = 120; | 19 fX2 = 120; |
20 fY = 50; | 20 fY = 50; |
21 fR = 40; | 21 fR = 40; |
22 | 22 |
23 fCircle1.addCircle(fX1, fY, fR, SkPath::kCW_Direction); | 23 fCircle1.addCircle(fX1, fY, fR, SkPath::kCW_Direction); |
24 fCircle2.addCircle(fX2, fY, fR, SkPath::kCW_Direction); | 24 fCircle2.addCircle(fX2, fY, fR, SkPath::kCW_Direction); |
25 } | 25 } |
26 | 26 |
27 protected: | 27 protected: |
28 uint32_t onGetFlags() const SK_OVERRIDE { | 28 uint32_t onGetFlags() const SK_OVERRIDE { |
29 return kSkipTiled_Flag | kAsBench_Flag; | 29 return kSkipTiled_Flag; |
30 } | 30 } |
31 | 31 |
| 32 bool runAsBench() const SK_OVERRIDE { return true; } |
| 33 |
32 SkString onShortName() SK_OVERRIDE { | 34 SkString onShortName() SK_OVERRIDE { |
33 return SkString("circular-clips"); | 35 return SkString("circular-clips"); |
34 } | 36 } |
35 | 37 |
36 SkISize onISize() SK_OVERRIDE { | 38 SkISize onISize() SK_OVERRIDE { |
37 return SkISize::Make(800, 600); | 39 return SkISize::Make(800, 600); |
38 } | 40 } |
39 | 41 |
40 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 42 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
41 SkRegion::Op ops[] = { | 43 SkRegion::Op ops[] = { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 76 } |
75 } | 77 } |
76 | 78 |
77 private: | 79 private: |
78 typedef skiagm::GM INHERITED; | 80 typedef skiagm::GM INHERITED; |
79 }; | 81 }; |
80 | 82 |
81 ////////////////////////////////////////////////////////////////////////////// | 83 ////////////////////////////////////////////////////////////////////////////// |
82 | 84 |
83 DEF_GM( return new CircularClipsGM; ) | 85 DEF_GM( return new CircularClipsGM; ) |
OLD | NEW |