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

Unified Diff: samplecode/SampleDegenerateTwoPtRadials.cpp

Issue 888283002: allow GMs to animate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: switch all existing animations to use animatePulse Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleCode.h ('k') | samplecode/SampleHT.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleDegenerateTwoPtRadials.cpp
diff --git a/samplecode/SampleDegenerateTwoPtRadials.cpp b/samplecode/SampleDegenerateTwoPtRadials.cpp
index 4665425934385b0bc5bea9978f1d01b22a8082b8..71c03b016ad23f7959c393cf18ea8561c96c7ef8 100644
--- a/samplecode/SampleDegenerateTwoPtRadials.cpp
+++ b/samplecode/SampleDegenerateTwoPtRadials.cpp
@@ -37,7 +37,6 @@ static void draw_gradient2(SkCanvas* canvas, const SkRect& rect, SkScalar delta)
class DegenerateTwoPtRadialsView : public SampleView {
-
public:
DegenerateTwoPtRadialsView() {
fTime = 0;
@@ -45,8 +44,7 @@ public:
}
protected:
- // overrides from SkEventSink
- virtual bool onQuery(SkEvent* evt) {
+ bool onQuery(SkEvent* evt) SK_OVERRIDE {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "DegenerateTwoPtRadials");
return true;
@@ -54,8 +52,7 @@ protected:
return this->INHERITED::onQuery(evt);
}
- virtual void onDrawContent(SkCanvas* canvas) {
- fTime += SampleCode::GetAnimSecondsDelta();
+ void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
SkScalar delta = fTime / 15.f;
int intPart = SkScalarFloorToInt(delta);
delta = delta - SK_Scalar1 * intPart;
@@ -77,7 +74,11 @@ protected:
paint.setAntiAlias(true);
paint.setColor(SK_ColorBLACK);
canvas->drawText(txt.c_str(), txt.size(), l + w/2 + w*DELTA_SCALE*delta, t + h + SK_Scalar1 * 10, paint);
- this->inval(NULL);
+ }
+
+ bool onAnimatePulse(SkMSec curr, SkMSec prev) SK_OVERRIDE {
+ fTime += (curr - prev) * 0.001f;
+ return true;
}
private:
« no previous file with comments | « samplecode/SampleCode.h ('k') | samplecode/SampleHT.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698