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 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 #include "GrTest.h" | 10 #include "GrTest.h" |
11 #include "effects/GrRRectEffect.h" | 11 #include "effects/GrRRectEffect.h" |
12 #endif | 12 #endif |
13 #include "SkDevice.h" | 13 #include "SkDevice.h" |
14 #include "SkRRect.h" | 14 #include "SkRRect.h" |
15 | 15 |
16 namespace skiagm { | 16 namespace skiagm { |
17 | 17 |
18 /////////////////////////////////////////////////////////////////////////////// | 18 /////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
20 class RRectGM : public GM { | 20 class RRectGM : public GM { |
21 public: | 21 public: |
22 enum Type { | 22 enum Type { |
23 kBW_Draw_Type, | 23 kBW_Draw_Type, |
24 kAA_Draw_Type, | 24 kAA_Draw_Type, |
25 kBW_Clip_Type, | 25 kBW_Clip_Type, |
26 kAA_Clip_Type, | 26 kAA_Clip_Type, |
27 kEffect_Type, | 27 kEffect_Type, |
28 }; | 28 }; |
29 RRectGM(Type type) : fType(type) { | 29 RRectGM(Type type) : fType(type) { } |
| 30 |
| 31 protected: |
| 32 |
| 33 void onOnceBeforeDraw() override { |
30 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); | 34 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); |
31 this->setUpRRects(); | 35 this->setUpRRects(); |
32 } | 36 } |
33 | 37 |
34 protected: | |
35 SkString onShortName() override { | 38 SkString onShortName() override { |
36 SkString name("rrect"); | 39 SkString name("rrect"); |
37 switch (fType) { | 40 switch (fType) { |
38 case kBW_Draw_Type: | 41 case kBW_Draw_Type: |
39 name.append("_draw_bw"); | 42 name.append("_draw_bw"); |
40 break; | 43 break; |
41 case kAA_Draw_Type: | 44 case kAA_Draw_Type: |
42 name.append("_draw_aa"); | 45 name.append("_draw_aa"); |
43 break; | 46 break; |
44 case kBW_Clip_Type: | 47 case kBW_Clip_Type: |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 262 |
260 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) | 263 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) |
261 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) | 264 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) |
262 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) | 265 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) |
263 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) | 266 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) |
264 #if SK_SUPPORT_GPU | 267 #if SK_SUPPORT_GPU |
265 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) | 268 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) |
266 #endif | 269 #endif |
267 | 270 |
268 } | 271 } |
OLD | NEW |