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 #ifndef skiagm_DEFINED | 8 #ifndef skiagm_DEFINED |
9 #define skiagm_DEFINED | 9 #define skiagm_DEFINED |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 void setBGColor(SkColor); | 73 void setBGColor(SkColor); |
74 | 74 |
75 // helper: fill a rect in the specified color based on the | 75 // helper: fill a rect in the specified color based on the |
76 // GM's getISize bounds. | 76 // GM's getISize bounds. |
77 void drawSizeBounds(SkCanvas*, SkColor); | 77 void drawSizeBounds(SkCanvas*, SkColor); |
78 | 78 |
79 static void SetResourcePath(const char* resourcePath) { | 79 static void SetResourcePath(const char* resourcePath) { |
80 gResourcePath = resourcePath; | 80 gResourcePath = resourcePath; |
81 } | 81 } |
82 | 82 |
| 83 static SkString& GetResourcePath() { |
| 84 return gResourcePath; |
| 85 } |
| 86 |
83 bool isCanvasDeferred() const { return fCanvasIsDeferred; } | 87 bool isCanvasDeferred() const { return fCanvasIsDeferred; } |
84 void setCanvasIsDeferred(bool isDeferred) { | 88 void setCanvasIsDeferred(bool isDeferred) { |
85 fCanvasIsDeferred = isDeferred; | 89 fCanvasIsDeferred = isDeferred; |
86 } | 90 } |
87 | 91 |
88 protected: | 92 protected: |
89 static SkString gResourcePath; | 93 static SkString gResourcePath; |
90 | 94 |
91 virtual void onOnceBeforeDraw() {} | 95 virtual void onOnceBeforeDraw() {} |
92 virtual void onDraw(SkCanvas*) = 0; | 96 virtual void onDraw(SkCanvas*) = 0; |
93 virtual void onDrawBackground(SkCanvas*); | 97 virtual void onDrawBackground(SkCanvas*); |
94 virtual SkISize onISize() = 0; | 98 virtual SkISize onISize() = 0; |
95 virtual SkString onShortName() = 0; | 99 virtual SkString onShortName() = 0; |
96 virtual uint32_t onGetFlags() const { return 0; } | 100 virtual uint32_t onGetFlags() const { return 0; } |
97 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } | 101 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } |
98 | 102 |
99 private: | 103 private: |
100 SkString fShortName; | 104 SkString fShortName; |
101 SkColor fBGColor; | 105 SkColor fBGColor; |
102 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 106 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
103 bool fHaveCalledOnceBeforeDraw; | 107 bool fHaveCalledOnceBeforeDraw; |
104 }; | 108 }; |
105 | 109 |
106 typedef SkTRegistry<GM*, void*> GMRegistry; | 110 typedef SkTRegistry<GM*, void*> GMRegistry; |
107 } | 111 } |
108 | 112 |
109 #endif | 113 #endif |
OLD | NEW |