OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #ifndef skiagm_DEFINED | 8 #ifndef skiagm_DEFINED |
9 #define skiagm_DEFINED | 9 #define skiagm_DEFINED |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return matrix; | 89 return matrix; |
90 } | 90 } |
91 | 91 |
92 SkColor getBGColor() const { return fBGColor; } | 92 SkColor getBGColor() const { return fBGColor; } |
93 void setBGColor(SkColor); | 93 void setBGColor(SkColor); |
94 | 94 |
95 // helper: fill a rect in the specified color based on the | 95 // helper: fill a rect in the specified color based on the |
96 // GM's getISize bounds. | 96 // GM's getISize bounds. |
97 void drawSizeBounds(SkCanvas*, SkColor); | 97 void drawSizeBounds(SkCanvas*, SkColor); |
98 | 98 |
99 static void SetResourcePath(const char*); | 99 static void SetResourcePath(const char* resourcePath) { |
100 static SkString GetResourcePath(); | 100 gResourcePath = resourcePath; |
| 101 } |
| 102 |
| 103 static SkString& GetResourcePath() { |
| 104 return gResourcePath; |
| 105 } |
101 | 106 |
102 bool isCanvasDeferred() const { return fCanvasIsDeferred; } | 107 bool isCanvasDeferred() const { return fCanvasIsDeferred; } |
103 void setCanvasIsDeferred(bool isDeferred) { | 108 void setCanvasIsDeferred(bool isDeferred) { |
104 fCanvasIsDeferred = isDeferred; | 109 fCanvasIsDeferred = isDeferred; |
105 } | 110 } |
106 | 111 |
107 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } | 112 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } |
108 void setStarterMatrix(const SkMatrix& matrix) { | 113 void setStarterMatrix(const SkMatrix& matrix) { |
109 fStarterMatrix = matrix; | 114 fStarterMatrix = matrix; |
110 } | 115 } |
111 | 116 |
112 protected: | 117 protected: |
113 static const char* gResourcePath; | 118 static SkString gResourcePath; |
114 | 119 |
115 virtual void onOnceBeforeDraw() {} | 120 virtual void onOnceBeforeDraw() {} |
116 virtual void onDraw(SkCanvas*) = 0; | 121 virtual void onDraw(SkCanvas*) = 0; |
117 virtual void onDrawBackground(SkCanvas*); | 122 virtual void onDrawBackground(SkCanvas*); |
118 virtual SkISize onISize() = 0; | 123 virtual SkISize onISize() = 0; |
119 virtual SkString onShortName() = 0; | 124 virtual SkString onShortName() = 0; |
120 virtual uint32_t onGetFlags() const { return 0; } | 125 virtual uint32_t onGetFlags() const { return 0; } |
121 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } | 126 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } |
122 | 127 |
123 private: | 128 private: |
124 Mode fMode; | 129 Mode fMode; |
125 SkString fShortName; | 130 SkString fShortName; |
126 SkColor fBGColor; | 131 SkColor fBGColor; |
127 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 132 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
128 bool fHaveCalledOnceBeforeDraw; | 133 bool fHaveCalledOnceBeforeDraw; |
129 SkMatrix fStarterMatrix; | 134 SkMatrix fStarterMatrix; |
130 }; | 135 }; |
131 | 136 |
132 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; | 137 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; |
133 } | 138 } |
134 | 139 |
135 #endif | 140 #endif |
OLD | NEW |