OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkAnimTimer.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 canvas->drawPath(circle, p); | 88 canvas->drawPath(circle, p); |
89 canvas->restore(); | 89 canvas->restore(); |
90 canvas->translate(0, radius * 2 + 50); | 90 canvas->translate(0, radius * 2 + 50); |
91 } | 91 } |
92 canvas->restore(); | 92 canvas->restore(); |
93 canvas->translate(radius * 2 + 50, 0); | 93 canvas->translate(radius * 2 + 50, 0); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 bool onAnimate(const SkAnimTimer& timer) override { | 97 bool onAnimate(const SkAnimTimer& timer) override { |
98 static const SkScalar kDesiredDurationSecs = 100.0f; | 98 constexpr SkScalar kDesiredDurationSecs = 100.0f; |
99 | 99 |
100 fRotation = timer.scaled(360.0f/kDesiredDurationSecs, 360.0f); | 100 fRotation = timer.scaled(360.0f/kDesiredDurationSecs, 360.0f); |
101 return true; | 101 return true; |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 SkScalar fRotation; | 105 SkScalar fRotation; |
106 | 106 |
107 typedef GM INHERITED; | 107 typedef GM INHERITED; |
108 }; | 108 }; |
109 | 109 |
110 DEF_GM(return new DashCircleGM; ) | 110 DEF_GM(return new DashCircleGM; ) |
OLD | NEW |