OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkRandom.h" | 9 #include "SkRandom.h" |
10 #include "SkTArray.h" | 10 #include "SkTArray.h" |
11 | 11 |
12 class SkOnce : SkNoncopyable { | 12 class SkDoOnce : SkNoncopyable { |
13 public: | 13 public: |
14 SkOnce() { fDidOnce = false; } | 14 SkDoOnce() { fDidOnce = false; } |
15 | 15 |
16 bool needToDo() const { return !fDidOnce; } | 16 bool needToDo() const { return !fDidOnce; } |
17 bool alreadyDone() const { return fDidOnce; } | 17 bool alreadyDone() const { return fDidOnce; } |
18 void accomplished() { | 18 void accomplished() { |
19 SkASSERT(!fDidOnce); | 19 SkASSERT(!fDidOnce); |
20 fDidOnce = true; | 20 fDidOnce = true; |
21 } | 21 } |
22 | 22 |
23 private: | 23 private: |
24 bool fDidOnce; | 24 bool fDidOnce; |
25 }; | 25 }; |
26 | 26 |
27 namespace skiagm { | 27 namespace skiagm { |
28 | 28 |
29 class ConvexPathsGM : public GM { | 29 class ConvexPathsGM : public GM { |
30 SkOnce fOnce; | 30 SkDoOnce fOnce; |
31 public: | 31 public: |
32 ConvexPathsGM() { | 32 ConvexPathsGM() { |
33 this->setBGColor(0xFF000000); | 33 this->setBGColor(0xFF000000); |
34 } | 34 } |
35 | 35 |
36 protected: | 36 protected: |
37 virtual SkString onShortName() { | 37 virtual SkString onShortName() { |
38 return SkString("convexpaths"); | 38 return SkString("convexpaths"); |
39 } | 39 } |
40 | 40 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 typedef GM INHERITED; | 288 typedef GM INHERITED; |
289 SkTArray<SkPath> fPaths; | 289 SkTArray<SkPath> fPaths; |
290 }; | 290 }; |
291 | 291 |
292 ////////////////////////////////////////////////////////////////////////////// | 292 ////////////////////////////////////////////////////////////////////////////// |
293 | 293 |
294 static GM* MyFactory(void*) { return new ConvexPathsGM; } | 294 static GM* MyFactory(void*) { return new ConvexPathsGM; } |
295 static GMRegistry reg(MyFactory); | 295 static GMRegistry reg(MyFactory); |
296 | 296 |
297 } | 297 } |
OLD | NEW |