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