Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: samplecode/SamplePathEffects.cpp

Issue 894083003: add SkAnimTimer, SPACE = pause/resume, ESP = stop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« gm/SkAnimTimer.h ('K') | « samplecode/SampleHairline.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
OLDNEW
« gm/SkAnimTimer.h ('K') | « samplecode/SampleHairline.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698