aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleCode.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-02-02 12:55:02 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-02 12:55:02 -0800
commit76113a9b7716748c70ea0ecf7aacbabe4cce5009 (patch)
tree57d91f56a717a0ffcb829b00c71e17195491753c /samplecode/SampleCode.h
parenta669bc7a7ae7580c5cd92067aeb95d09e64ea720 (diff)
add SkAnimTimer, SPACE = pause/resume, ESP = stop
Diffstat (limited to 'samplecode/SampleCode.h')
-rw-r--r--samplecode/SampleCode.h18
1 files changed, 4 insertions, 14 deletions
diff --git a/samplecode/SampleCode.h b/samplecode/SampleCode.h
index 02590f17a9..e65919a765 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);