OLD | NEW |
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 Loading... |
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; ) |
OLD | NEW |