| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 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 "SkGradientShader.h" | 12 #include "SkGradientShader.h" |
| 12 #include "SkPath.h" | 13 #include "SkPath.h" |
| 13 #include "SkRegion.h" | 14 #include "SkRegion.h" |
| 14 #include "SkShader.h" | 15 #include "SkShader.h" |
| 15 #include "SkUtils.h" | 16 #include "SkUtils.h" |
| 16 #include "Sk1DPathEffect.h" | 17 #include "Sk1DPathEffect.h" |
| 17 #include "SkCornerPathEffect.h" | 18 #include "SkCornerPathEffect.h" |
| 18 #include "SkPathMeasure.h" | 19 #include "SkPathMeasure.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 152 |
| 152 canvas->translate(0, 50); | 153 canvas->translate(0, 50); |
| 153 | 154 |
| 154 paint.setARGB(0xFF, 0, 0, 0); | 155 paint.setARGB(0xFF, 0, 0, 0); |
| 155 paint.setPathEffect(make_warp_pe(fPhase))->unref(); | 156 paint.setPathEffect(make_warp_pe(fPhase))->unref(); |
| 156 TestRastBuilder testRastBuilder; | 157 TestRastBuilder testRastBuilder; |
| 157 paint.setRasterizer(testRastBuilder.detachRasterizer())->unref(); | 158 paint.setRasterizer(testRastBuilder.detachRasterizer())->unref(); |
| 158 canvas->drawPath(fPath, paint); | 159 canvas->drawPath(fPath, paint); |
| 159 } | 160 } |
| 160 | 161 |
| 161 bool onAnimatePulse(SkMSec curr, SkMSec prev) SK_OVERRIDE { | 162 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE { |
| 162 fPhase -= (curr - prev) * 0.04f; | 163 fPhase = timer.scaled(40); |
| 163 return true; | 164 return true; |
| 164 } | 165 } |
| 165 | 166 |
| 166 private: | 167 private: |
| 167 typedef SampleView INHERITED; | 168 typedef SampleView INHERITED; |
| 168 }; | 169 }; |
| 169 | 170 |
| 170 ////////////////////////////////////////////////////////////////////////////// | 171 ////////////////////////////////////////////////////////////////////////////// |
| 171 | 172 |
| 172 static SkView* MyFactory() { return new PathEffectView; } | 173 static SkView* MyFactory() { return new PathEffectView; } |
| 173 static SkViewRegister reg(MyFactory); | 174 static SkViewRegister reg(MyFactory); |
| OLD | NEW |