OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkLightingImageFilter.h" | 10 #include "SkLightingImageFilter.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 shin
iness, | 151 shin
iness, |
152 inpu
t, | 152 inpu
t, |
153 cr))
; | 153 cr))
; |
154 drawClippedBitmap(canvas, paint, 220, y); | 154 drawClippedBitmap(canvas, paint, 220, y); |
155 | 155 |
156 y += 110; | 156 y += 110; |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 bool onAnimate(const SkAnimTimer& timer) override { | 160 bool onAnimate(const SkAnimTimer& timer) override { |
161 static const SkScalar kDesiredDurationSecs = 15.0f; | 161 constexpr SkScalar kDesiredDurationSecs = 15.0f; |
162 | 162 |
163 fAzimuth = kStartAzimuth + timer.scaled(360.0f/kDesiredDurationSecs, 360
.0f); | 163 fAzimuth = kStartAzimuth + timer.scaled(360.0f/kDesiredDurationSecs, 360
.0f); |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
167 private: | 167 private: |
168 static const int kStartAzimuth = 225; | 168 static constexpr int kStartAzimuth = 225; |
169 | 169 |
170 SkBitmap fBitmap; | 170 SkBitmap fBitmap; |
171 SkScalar fAzimuth; | 171 SkScalar fAzimuth; |
172 | 172 |
173 typedef GM INHERITED; | 173 typedef GM INHERITED; |
174 }; | 174 }; |
175 | 175 |
176 ////////////////////////////////////////////////////////////////////////////// | 176 ////////////////////////////////////////////////////////////////////////////// |
177 | 177 |
178 DEF_GM(return new ImageLightingGM;) | 178 DEF_GM(return new ImageLightingGM;) |
179 } | 179 } |
OLD | NEW |