Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: samplecode/SampleHairline.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samplecode/SampleHT.cpp ('k') | samplecode/SampleIdentityScale.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 bool fDoAA; 178 bool fDoAA;
179 public: 179 public:
180 HairlineView() { 180 HairlineView() {
181 fProcIndex = 0; 181 fProcIndex = 0;
182 fDoAA = true; 182 fDoAA = true;
183 fNow = 0; 183 fNow = 0;
184 } 184 }
185 185
186 protected: 186 protected:
187 // overrides from SkEventSink 187 // overrides from SkEventSink
188 bool onQuery(SkEvent* evt) SK_OVERRIDE { 188 bool onQuery(SkEvent* evt) override {
189 if (SampleCode::TitleQ(*evt)) { 189 if (SampleCode::TitleQ(*evt)) {
190 SkString str; 190 SkString str;
191 str.printf("Hair-%s", gProcs[fProcIndex].fName); 191 str.printf("Hair-%s", gProcs[fProcIndex].fName);
192 SampleCode::TitleR(evt, str.c_str()); 192 SampleCode::TitleR(evt, str.c_str());
193 return true; 193 return true;
194 } 194 }
195 return this->INHERITED::onQuery(evt); 195 return this->INHERITED::onQuery(evt);
196 } 196 }
197 197
198 void show_bitmaps(SkCanvas* canvas, const SkBitmap& b0, const SkBitmap& b1, 198 void show_bitmaps(SkCanvas* canvas, const SkBitmap& b0, const SkBitmap& b1,
199 const SkIRect& inset) { 199 const SkIRect& inset) {
200 canvas->drawBitmap(b0, 0, 0, NULL); 200 canvas->drawBitmap(b0, 0, 0, NULL);
201 canvas->drawBitmap(b1, SkIntToScalar(b0.width()), 0, NULL); 201 canvas->drawBitmap(b1, SkIntToScalar(b0.width()), 0, NULL);
202 } 202 }
203 203
204 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 204 void onDrawContent(SkCanvas* canvas) override {
205 gRand.setSeed(fNow); 205 gRand.setSeed(fNow);
206 206
207 SkBitmap bm, bm2; 207 SkBitmap bm, bm2;
208 bm.allocN32Pixels(WIDTH + MARGIN*2, HEIGHT + MARGIN*2); 208 bm.allocN32Pixels(WIDTH + MARGIN*2, HEIGHT + MARGIN*2);
209 // this will erase our margin, which we want to always stay 0 209 // this will erase our margin, which we want to always stay 0
210 bm.eraseColor(SK_ColorTRANSPARENT); 210 bm.eraseColor(SK_ColorTRANSPARENT);
211 211
212 bm2.installPixels(SkImageInfo::MakeN32Premul(WIDTH, HEIGHT), 212 bm2.installPixels(SkImageInfo::MakeN32Premul(WIDTH, HEIGHT),
213 bm.getAddr32(MARGIN, MARGIN), bm.rowBytes()); 213 bm.getAddr32(MARGIN, MARGIN), bm.rowBytes());
214 214
215 SkCanvas c2(bm2); 215 SkCanvas c2(bm2);
216 SkPaint paint; 216 SkPaint paint;
217 paint.setAntiAlias(fDoAA); 217 paint.setAntiAlias(fDoAA);
218 paint.setStyle(SkPaint::kStroke_Style); 218 paint.setStyle(SkPaint::kStroke_Style);
219 219
220 bm2.eraseColor(SK_ColorTRANSPARENT); 220 bm2.eraseColor(SK_ColorTRANSPARENT);
221 gProcs[fProcIndex].fProc(&c2, paint, bm); 221 gProcs[fProcIndex].fProc(&c2, paint, bm);
222 canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), NULL); 222 canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), NULL);
223 } 223 }
224 224
225 bool onAnimate(const SkAnimTimer&) SK_OVERRIDE { 225 bool onAnimate(const SkAnimTimer&) override {
226 if (fDoAA) { 226 if (fDoAA) {
227 fProcIndex = cycle_hairproc_index(fProcIndex); 227 fProcIndex = cycle_hairproc_index(fProcIndex);
228 // todo: signal that we want to rebuild our TITLE 228 // todo: signal that we want to rebuild our TITLE
229 } 229 }
230 fDoAA = !fDoAA; 230 fDoAA = !fDoAA;
231 return true; 231 return true;
232 } 232 }
233 233
234 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) SK_ OVERRIDE { 234 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride {
235 fDoAA = !fDoAA; 235 fDoAA = !fDoAA;
236 this->inval(NULL); 236 this->inval(NULL);
237 return this->INHERITED::onFindClickHandler(x, y, modi); 237 return this->INHERITED::onFindClickHandler(x, y, modi);
238 } 238 }
239 239
240 240
241 private: 241 private:
242 typedef SampleView INHERITED; 242 typedef SampleView INHERITED;
243 }; 243 };
244 244
245 ////////////////////////////////////////////////////////////////////////////// 245 //////////////////////////////////////////////////////////////////////////////
246 246
247 static SkView* MyFactory() { return new HairlineView; } 247 static SkView* MyFactory() { return new HairlineView; }
248 static SkViewRegister reg(MyFactory); 248 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleHT.cpp ('k') | samplecode/SampleIdentityScale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698