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

Side by Side Diff: gm/addarc.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
« gm/SkAnimTimer.h ('K') | « gm/SkAnimTimer.h ('k') | gm/gm.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 "gm.h" 8 #include "gm.h"
9 #include "SkAnimTimer.h"
9 #include "SkCanvas.h" 10 #include "SkCanvas.h"
10 #include "SkRandom.h" 11 #include "SkRandom.h"
11 12
12 class AddArcGM : public skiagm::GM { 13 class AddArcGM : public skiagm::GM {
13 public: 14 public:
14 AddArcGM() : fRotate(0) {} 15 AddArcGM() : fRotate(0) {}
15 16
16 protected: 17 protected:
17 SkString onShortName() SK_OVERRIDE { return SkString("addarc"); } 18 SkString onShortName() SK_OVERRIDE { return SkString("addarc"); }
18 19
(...skipping 23 matching lines...) Expand all
42 43
43 SkPath path; 44 SkPath path;
44 path.addArc(r, startAngle, sweepAngle); 45 path.addArc(r, startAngle, sweepAngle);
45 canvas->drawPath(path, paint); 46 canvas->drawPath(path, paint);
46 47
47 r.inset(inset, inset); 48 r.inset(inset, inset);
48 sign = -sign; 49 sign = -sign;
49 } 50 }
50 } 51 }
51 52
52 bool onAnimatePulse(SkMSec curr, SkMSec prev) SK_OVERRIDE { 53 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE {
53 fRotate = SkDoubleToScalar(fmod(curr * 0.001, 360)); 54 fRotate = timer.scaled(1, 360);
54 return true; 55 return true;
55 } 56 }
56 57
57 private: 58 private:
58 SkScalar fRotate; 59 SkScalar fRotate;
59 typedef skiagm::GM INHERITED; 60 typedef skiagm::GM INHERITED;
60 }; 61 };
61 DEF_GM( return new AddArcGM; ) 62 DEF_GM( return new AddArcGM; )
OLDNEW
« gm/SkAnimTimer.h ('K') | « gm/SkAnimTimer.h ('k') | gm/gm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698