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* resourcePath) { | 99 static void SetResourcePath(const char*); |
100 gResourcePath = resourcePath; | 100 static SkString GetResourcePath(); |
101 } | |
102 | |
103 static SkString& GetResourcePath() { | |
104 return gResourcePath; | |
105 } | |
106 | 101 |
107 bool isCanvasDeferred() const { return fCanvasIsDeferred; } | 102 bool isCanvasDeferred() const { return fCanvasIsDeferred; } |
108 void setCanvasIsDeferred(bool isDeferred) { | 103 void setCanvasIsDeferred(bool isDeferred) { |
109 fCanvasIsDeferred = isDeferred; | 104 fCanvasIsDeferred = isDeferred; |
110 } | 105 } |
111 | 106 |
112 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } | 107 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } |
113 void setStarterMatrix(const SkMatrix& matrix) { | 108 void setStarterMatrix(const SkMatrix& matrix) { |
114 fStarterMatrix = matrix; | 109 fStarterMatrix = matrix; |
115 } | 110 } |
116 | 111 |
117 protected: | 112 protected: |
118 static SkString gResourcePath; | 113 static const char* gResourcePath; |
119 | 114 |
120 virtual void onOnceBeforeDraw() {} | 115 virtual void onOnceBeforeDraw() {} |
121 virtual void onDraw(SkCanvas*) = 0; | 116 virtual void onDraw(SkCanvas*) = 0; |
122 virtual void onDrawBackground(SkCanvas*); | 117 virtual void onDrawBackground(SkCanvas*); |
123 virtual SkISize onISize() = 0; | 118 virtual SkISize onISize() = 0; |
124 virtual SkString onShortName() = 0; | 119 virtual SkString onShortName() = 0; |
125 virtual uint32_t onGetFlags() const { return 0; } | 120 virtual uint32_t onGetFlags() const { return 0; } |
126 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } | 121 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } |
127 | 122 |
128 private: | 123 private: |
129 Mode fMode; | 124 Mode fMode; |
130 SkString fShortName; | 125 SkString fShortName; |
131 SkColor fBGColor; | 126 SkColor fBGColor; |
132 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 127 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
133 bool fHaveCalledOnceBeforeDraw; | 128 bool fHaveCalledOnceBeforeDraw; |
134 SkMatrix fStarterMatrix; | 129 SkMatrix fStarterMatrix; |
135 }; | 130 }; |
136 | 131 |
137 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; | 132 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; |
138 } | 133 } |
139 | 134 |
140 #endif | 135 #endif |
OLD | NEW |