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

Unified Diff: samplecode/SampleCode.h

Issue 894083003: add SkAnimTimer, SPACE = pause/resume, ESP = stop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
Index: samplecode/SampleCode.h
diff --git a/samplecode/SampleCode.h b/samplecode/SampleCode.h
index 02590f17a90d1a9e4b985e298131604c799935c4..e65919a765dc2fa3ab44ed37796aef040b3145c5 100644
--- a/samplecode/SampleCode.h
+++ b/samplecode/SampleCode.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2011 Google Inc.
*
@@ -6,7 +5,6 @@
* found in the LICENSE file.
*/
-
#ifndef SampleCode_DEFINED
#define SampleCode_DEFINED
@@ -15,7 +13,9 @@
#include "SkKey.h"
#include "SkView.h"
#include "SkOSMenu.h"
+
class GrContext;
+class SkAnimTimer;
#define DEF_SAMPLE(code) \
static SkView* SK_MACRO_APPEND_LINE(F_)() { code } \
@@ -36,16 +36,6 @@ public:
static bool FastTextQ(const SkEvent&);
-private:
- static SkMSec GetAnimTime();
- static SkMSec GetAnimTimeDelta();
- static SkScalar GetAnimSecondsDelta();
- static SkScalar GetAnimScalar(SkScalar speedPerSec, SkScalar period = 0);
- // gives a sinusoidal value between 0 and amplitude
- static SkScalar GetAnimSinScalar(SkScalar amplitude,
- SkScalar periodInSec,
- SkScalar phaseInSec = 0);
-
friend class SampleWindow;
};
@@ -120,7 +110,7 @@ public:
{}
void setBGColor(SkColor color) { fBGColor = color; }
- bool animatePulse(SkMSec curr, SkMSec prev) { return this->onAnimatePulse(curr, prev); }
+ bool animate(const SkAnimTimer& timer) { return this->onAnimate(timer); }
static bool IsSampleView(SkView*);
static bool SetRepeatDraw(SkView*, int count);
@@ -140,7 +130,7 @@ public:
protected:
virtual void onDrawBackground(SkCanvas*);
virtual void onDrawContent(SkCanvas*) = 0;
- virtual bool onAnimatePulse(SkMSec curr, SkMSec prev) { return false; }
+ virtual bool onAnimate(const SkAnimTimer&) { return false; }
// overrides
virtual bool onEvent(const SkEvent& evt);

Powered by Google App Engine
This is Rietveld 408576698