OLD | NEW |
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 "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 fFrontFace = frontFace; | 79 fFrontFace = frontFace; |
80 fShaderIndex = (fShaderIndex + 1) % fShaders.count(); | 80 fShaderIndex = (fShaderIndex + 1) % fShaders.count(); |
81 } | 81 } |
82 | 82 |
83 paint.setAntiAlias(true); | 83 paint.setAntiAlias(true); |
84 paint.setShader(fShaders[fShaderIndex]); | 84 paint.setShader(fShaders[fShaderIndex]); |
85 paint.setFilterLevel(SkPaint::kLow_FilterLevel); | 85 paint.setFilterLevel(SkPaint::kLow_FilterLevel); |
86 SkRect r = { -150, -150, 150, 150 }; | 86 SkRect r = { -150, -150, 150, 150 }; |
87 canvas->drawRoundRect(r, 30, 30, paint); | 87 canvas->drawRoundRect(r, 30, 30, paint); |
88 } | 88 } |
| 89 } |
89 | 90 |
90 fRY += SampleCode::GetAnimSecondsDelta() * 90; | 91 bool onAnimatePulse(SkMSec curr, SkMSec prev) SK_OVERRIDE { |
91 if (fRY >= SkIntToScalar(360)) { | 92 fRY += (curr - prev) * 0.09f; |
| 93 if (fRY >= 360) { |
92 fRY = 0; | 94 fRY = 0; |
93 } | 95 } |
94 this->inval(NULL); | 96 return true; |
95 } | 97 } |
96 | 98 |
97 private: | 99 private: |
98 SkScalar fRX, fRY, fRZ; | 100 SkScalar fRX, fRY, fRZ; |
99 typedef SampleView INHERITED; | 101 typedef SampleView INHERITED; |
100 }; | 102 }; |
101 | 103 |
102 ////////////////////////////////////////////////////////////////////////////// | 104 ////////////////////////////////////////////////////////////////////////////// |
103 | 105 |
104 static SkView* MyFactory() { return new CameraView; } | 106 static SkView* MyFactory() { return new CameraView; } |
105 static SkViewRegister reg(MyFactory); | 107 static SkViewRegister reg(MyFactory); |
OLD | NEW |