| 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 "SkAnimTimer.h" |
| 9 #include "SkView.h" | 10 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 11 #include "SkCamera.h" | 12 #include "SkCamera.h" |
| 12 #include "SkEmbossMaskFilter.h" | 13 #include "SkEmbossMaskFilter.h" |
| 13 #include "SkGradientShader.h" | 14 #include "SkGradientShader.h" |
| 14 #include "SkPath.h" | 15 #include "SkPath.h" |
| 15 #include "SkRegion.h" | 16 #include "SkRegion.h" |
| 16 #include "SkShader.h" | 17 #include "SkShader.h" |
| 17 #include "SkUtils.h" | 18 #include "SkUtils.h" |
| 18 #include "SkRandom.h" | 19 #include "SkRandom.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 82 } |
| 82 | 83 |
| 83 paint.setAntiAlias(true); | 84 paint.setAntiAlias(true); |
| 84 paint.setShader(fShaders[fShaderIndex]); | 85 paint.setShader(fShaders[fShaderIndex]); |
| 85 paint.setFilterLevel(SkPaint::kLow_FilterLevel); | 86 paint.setFilterLevel(SkPaint::kLow_FilterLevel); |
| 86 SkRect r = { -150, -150, 150, 150 }; | 87 SkRect r = { -150, -150, 150, 150 }; |
| 87 canvas->drawRoundRect(r, 30, 30, paint); | 88 canvas->drawRoundRect(r, 30, 30, paint); |
| 88 } | 89 } |
| 89 } | 90 } |
| 90 | 91 |
| 91 bool onAnimatePulse(SkMSec curr, SkMSec prev) SK_OVERRIDE { | 92 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE { |
| 92 fRY += (curr - prev) * 0.09f; | 93 if (timer.isStopped()) { |
| 93 if (fRY >= 360) { | |
| 94 fRY = 0; | 94 fRY = 0; |
| 95 } else { |
| 96 fRY = timer.scaled(90, 360); |
| 95 } | 97 } |
| 96 return true; | 98 return true; |
| 97 } | 99 } |
| 98 | 100 |
| 99 private: | 101 private: |
| 100 SkScalar fRX, fRY, fRZ; | 102 SkScalar fRX, fRY, fRZ; |
| 101 typedef SampleView INHERITED; | 103 typedef SampleView INHERITED; |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 ////////////////////////////////////////////////////////////////////////////// | 106 ////////////////////////////////////////////////////////////////////////////// |
| 105 | 107 |
| 106 static SkView* MyFactory() { return new CameraView; } | 108 static SkView* MyFactory() { return new CameraView; } |
| 107 static SkViewRegister reg(MyFactory); | 109 static SkViewRegister reg(MyFactory); |
| OLD | NEW |