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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void setCanvasIsDeferred(bool isDeferred) { | 93 void setCanvasIsDeferred(bool isDeferred) { |
94 fCanvasIsDeferred = isDeferred; | 94 fCanvasIsDeferred = isDeferred; |
95 } | 95 } |
96 | 96 |
97 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } | 97 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } |
98 void setStarterMatrix(const SkMatrix& matrix) { | 98 void setStarterMatrix(const SkMatrix& matrix) { |
99 fStarterMatrix = matrix; | 99 fStarterMatrix = matrix; |
100 } | 100 } |
101 | 101 |
102 bool animate(const SkAnimTimer&); | 102 bool animate(const SkAnimTimer&); |
| 103 bool handleKey(SkUnichar uni) { |
| 104 return this->onHandleKey(uni); |
| 105 } |
103 | 106 |
104 virtual void modifyGrContextOptions(GrContextOptions* options) {} | 107 virtual void modifyGrContextOptions(GrContextOptions* options) {} |
105 | 108 |
106 /** draws a standard message that the GM is only intended to be used wit
h the GPU.*/ | 109 /** draws a standard message that the GM is only intended to be used wit
h the GPU.*/ |
107 static void DrawGpuOnlyMessage(SkCanvas*); | 110 static void DrawGpuOnlyMessage(SkCanvas*); |
108 | 111 |
109 protected: | 112 protected: |
110 virtual void onOnceBeforeDraw() {} | 113 virtual void onOnceBeforeDraw() {} |
111 virtual void onDraw(SkCanvas*) = 0; | 114 virtual void onDraw(SkCanvas*) = 0; |
112 virtual void onDrawBackground(SkCanvas*); | 115 virtual void onDrawBackground(SkCanvas*); |
113 virtual SkISize onISize() = 0; | 116 virtual SkISize onISize() = 0; |
114 virtual SkString onShortName() = 0; | 117 virtual SkString onShortName() = 0; |
115 | 118 |
116 virtual bool onAnimate(const SkAnimTimer&) { return false; } | 119 virtual bool onAnimate(const SkAnimTimer&) { return false; } |
| 120 virtual bool onHandleKey(SkUnichar uni) { return false; } |
117 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } | 121 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } |
118 | 122 |
119 private: | 123 private: |
120 Mode fMode; | 124 Mode fMode; |
121 SkString fShortName; | 125 SkString fShortName; |
122 SkColor fBGColor; | 126 SkColor fBGColor; |
123 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 127 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
124 bool fHaveCalledOnceBeforeDraw; | 128 bool fHaveCalledOnceBeforeDraw; |
125 SkMatrix fStarterMatrix; | 129 SkMatrix fStarterMatrix; |
126 }; | 130 }; |
(...skipping 16 matching lines...) Expand all Loading... |
143 SkISize onISize() override; | 147 SkISize onISize() override; |
144 SkString onShortName() override; | 148 SkString onShortName() override; |
145 private: | 149 private: |
146 SkString fName; | 150 SkString fName; |
147 void (*fDrawProc)(SkCanvas*); | 151 void (*fDrawProc)(SkCanvas*); |
148 SkISize fSize; | 152 SkISize fSize; |
149 }; | 153 }; |
150 } | 154 } |
151 | 155 |
152 #endif | 156 #endif |
OLD | NEW |