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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 private: | 134 private: |
135 SkColor fColor; | 135 SkColor fColor; |
136 }; | 136 }; |
137 | 137 |
138 class LayersView : public SkView { | 138 class LayersView : public SkView { |
139 public: | 139 public: |
140 LayersView() {} | 140 LayersView() {} |
141 | 141 |
142 protected: | 142 protected: |
143 // overrides from SkEventSink | 143 // overrides from SkEventSink |
144 virtual bool onQuery(SkEvent* evt) { | 144 bool onQuery(SkEvent* evt) override { |
145 if (SampleCode::TitleQ(*evt)) { | 145 if (SampleCode::TitleQ(*evt)) { |
146 SampleCode::TitleR(evt, "Layers"); | 146 SampleCode::TitleR(evt, "Layers"); |
147 return true; | 147 return true; |
148 } | 148 } |
149 return this->INHERITED::onQuery(evt); | 149 return this->INHERITED::onQuery(evt); |
150 } | 150 } |
151 | 151 |
152 void drawBG(SkCanvas* canvas) { | 152 void drawBG(SkCanvas* canvas) { |
153 canvas->drawColor(SK_ColorGRAY); | 153 canvas->drawColor(SK_ColorGRAY); |
154 } | 154 } |
155 | 155 |
156 virtual void onDraw(SkCanvas* canvas) { | 156 void onDraw(SkCanvas* canvas) override { |
157 this->drawBG(canvas); | 157 this->drawBG(canvas); |
158 | 158 |
159 if (true) { | 159 if (true) { |
160 SkRect r; | 160 SkRect r; |
161 r.set(SkIntToScalar(0), SkIntToScalar(0), | 161 r.set(SkIntToScalar(0), SkIntToScalar(0), |
162 SkIntToScalar(220), SkIntToScalar(120)); | 162 SkIntToScalar(220), SkIntToScalar(120)); |
163 SkPaint p; | 163 SkPaint p; |
164 canvas->saveLayer(&r, &p); | 164 canvas->saveLayer(&r, &p); |
165 canvas->drawColor(0xFFFF0000); | 165 canvas->drawColor(0xFFFF0000); |
166 p.setAlpha(0); // or 0 | 166 p.setAlpha(0); // or 0 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 SkIntToScalar(220), SkIntToScalar(120)); | 207 SkIntToScalar(220), SkIntToScalar(120)); |
208 p.setColor(SK_ColorBLUE); | 208 p.setColor(SK_ColorBLUE); |
209 canvas->drawOval(r, p); | 209 canvas->drawOval(r, p); |
210 canvas->restore(); | 210 canvas->restore(); |
211 return; | 211 return; |
212 } | 212 } |
213 | 213 |
214 test_fade(canvas); | 214 test_fade(canvas); |
215 } | 215 } |
216 | 216 |
217 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, | 217 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove
rride { |
218 unsigned modi) override { | |
219 this->inval(NULL); | 218 this->inval(NULL); |
220 | 219 |
221 return this->INHERITED::onFindClickHandler(x, y, modi); | 220 return this->INHERITED::onFindClickHandler(x, y, modi); |
222 } | 221 } |
223 | 222 |
224 virtual bool onClick(Click* click) { | 223 bool onClick(Click* click) override { |
225 return this->INHERITED::onClick(click); | 224 return this->INHERITED::onClick(click); |
226 } | 225 } |
227 | 226 |
228 virtual bool handleKey(SkKey) { | 227 virtual bool handleKey(SkKey) { |
229 this->inval(NULL); | 228 this->inval(NULL); |
230 return true; | 229 return true; |
231 } | 230 } |
232 | 231 |
233 private: | 232 private: |
234 typedef SkView INHERITED; | 233 typedef SkView INHERITED; |
235 }; | 234 }; |
236 | 235 |
237 ////////////////////////////////////////////////////////////////////////////// | 236 ////////////////////////////////////////////////////////////////////////////// |
238 | 237 |
239 static SkView* MyFactory() { return new LayersView; } | 238 static SkView* MyFactory() { return new LayersView; } |
240 static SkViewRegister reg(MyFactory); | 239 static SkViewRegister reg(MyFactory); |
OLD | NEW |