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

Side by Side Diff: samplecode/SampleHairline.cpp

Issue 894083003: add SkAnimTimer, SPACE = pause/resume, ESP = stop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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
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 "SkView.h" 10 #include "SkView.h"
10 #include "SkCanvas.h" 11 #include "SkCanvas.h"
11 #include "SkCornerPathEffect.h" 12 #include "SkCornerPathEffect.h"
12 #include "SkGradientShader.h" 13 #include "SkGradientShader.h"
13 #include "SkGraphics.h" 14 #include "SkGraphics.h"
14 #include "SkImageDecoder.h" 15 #include "SkImageDecoder.h"
15 #include "SkPath.h" 16 #include "SkPath.h"
16 #include "SkRandom.h" 17 #include "SkRandom.h"
17 #include "SkRegion.h" 18 #include "SkRegion.h"
18 #include "SkShader.h" 19 #include "SkShader.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 SkCanvas c2(bm2); 215 SkCanvas c2(bm2);
215 SkPaint paint; 216 SkPaint paint;
216 paint.setAntiAlias(fDoAA); 217 paint.setAntiAlias(fDoAA);
217 paint.setStyle(SkPaint::kStroke_Style); 218 paint.setStyle(SkPaint::kStroke_Style);
218 219
219 bm2.eraseColor(SK_ColorTRANSPARENT); 220 bm2.eraseColor(SK_ColorTRANSPARENT);
220 gProcs[fProcIndex].fProc(&c2, paint, bm); 221 gProcs[fProcIndex].fProc(&c2, paint, bm);
221 canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), NULL); 222 canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), NULL);
222 } 223 }
223 224
224 bool onAnimatePulse(SkMSec curr, SkMSec prev) SK_OVERRIDE { 225 bool onAnimate(const SkAnimTimer&) SK_OVERRIDE {
225 if (fDoAA) { 226 if (fDoAA) {
226 fProcIndex = cycle_hairproc_index(fProcIndex); 227 fProcIndex = cycle_hairproc_index(fProcIndex);
227 // todo: signal that we want to rebuild our TITLE 228 // todo: signal that we want to rebuild our TITLE
228 } 229 }
229 fDoAA = !fDoAA; 230 fDoAA = !fDoAA;
230 return true; 231 return true;
231 } 232 }
232 233
233 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) SK_ OVERRIDE { 234 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) SK_ OVERRIDE {
234 fDoAA = !fDoAA; 235 fDoAA = !fDoAA;
235 this->inval(NULL); 236 this->inval(NULL);
236 return this->INHERITED::onFindClickHandler(x, y, modi); 237 return this->INHERITED::onFindClickHandler(x, y, modi);
237 } 238 }
238 239
239 240
240 private: 241 private:
241 typedef SampleView INHERITED; 242 typedef SampleView INHERITED;
242 }; 243 };
243 244
244 ////////////////////////////////////////////////////////////////////////////// 245 //////////////////////////////////////////////////////////////////////////////
245 246
246 static SkView* MyFactory() { return new HairlineView; } 247 static SkView* MyFactory() { return new HairlineView; }
247 static SkViewRegister reg(MyFactory); 248 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698