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 | 8 |
9 | 9 |
10 #ifndef SampleCode_DEFINED | 10 #ifndef SampleCode_DEFINED |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 public: | 53 public: |
54 virtual SkView* operator() () const = 0; | 54 virtual SkView* operator() () const = 0; |
55 }; | 55 }; |
56 | 56 |
57 typedef SkView* (*SkViewCreateFunc)(); | 57 typedef SkView* (*SkViewCreateFunc)(); |
58 | 58 |
59 // wraps SkViewCreateFunc in SkViewFactory interface | 59 // wraps SkViewCreateFunc in SkViewFactory interface |
60 class SkFuncViewFactory : public SkViewFactory { | 60 class SkFuncViewFactory : public SkViewFactory { |
61 public: | 61 public: |
62 SkFuncViewFactory(SkViewCreateFunc func); | 62 SkFuncViewFactory(SkViewCreateFunc func); |
63 virtual SkView* operator() () const SK_OVERRIDE; | 63 SkView* operator() () const SK_OVERRIDE; |
64 | 64 |
65 private: | 65 private: |
66 SkViewCreateFunc fCreateFunc; | 66 SkViewCreateFunc fCreateFunc; |
67 }; | 67 }; |
68 | 68 |
69 namespace skiagm { | 69 namespace skiagm { |
70 class GM; | 70 class GM; |
71 } | 71 } |
72 | 72 |
73 // factory function that creates a skiagm::GM | 73 // factory function that creates a skiagm::GM |
74 typedef skiagm::GM* (*GMFactoryFunc)(void*); | 74 typedef skiagm::GM* (*GMFactoryFunc)(void*); |
75 | 75 |
76 // Takes a GM factory function and implements the SkViewFactory interface | 76 // Takes a GM factory function and implements the SkViewFactory interface |
77 // by making the GM and wrapping it in a GMSampleView. GMSampleView bridges | 77 // by making the GM and wrapping it in a GMSampleView. GMSampleView bridges |
78 // the SampleView interface to skiagm::GM. | 78 // the SampleView interface to skiagm::GM. |
79 class SkGMSampleViewFactory : public SkViewFactory { | 79 class SkGMSampleViewFactory : public SkViewFactory { |
80 public: | 80 public: |
81 SkGMSampleViewFactory(GMFactoryFunc func); | 81 SkGMSampleViewFactory(GMFactoryFunc func); |
82 virtual SkView* operator() () const SK_OVERRIDE; | 82 SkView* operator() () const SK_OVERRIDE; |
83 private: | 83 private: |
84 GMFactoryFunc fFunc; | 84 GMFactoryFunc fFunc; |
85 }; | 85 }; |
86 | 86 |
87 class SkViewRegister : public SkRefCnt { | 87 class SkViewRegister : public SkRefCnt { |
88 public: | 88 public: |
89 explicit SkViewRegister(SkViewFactory*); | 89 explicit SkViewRegister(SkViewFactory*); |
90 explicit SkViewRegister(SkViewCreateFunc); | 90 explicit SkViewRegister(SkViewCreateFunc); |
91 explicit SkViewRegister(GMFactoryFunc); | 91 explicit SkViewRegister(GMFactoryFunc); |
92 | 92 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 SkOSMenu::TriState fPipeState; | 146 SkOSMenu::TriState fPipeState; |
147 SkColor fBGColor; | 147 SkColor fBGColor; |
148 | 148 |
149 private: | 149 private: |
150 int fRepeatCount; | 150 int fRepeatCount; |
151 | 151 |
152 typedef SkView INHERITED; | 152 typedef SkView INHERITED; |
153 }; | 153 }; |
154 | 154 |
155 #endif | 155 #endif |
OLD | NEW |