summaryrefslogtreecommitdiffstats
path: root/app/animation.h
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-07 17:23:14 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-07 17:23:14 +0000
commitdbba0c455f8b3f139fbfd9634d0bfba268085a33 (patch)
tree91c42ac484be649b5ed537ff1e12fc7edbe9f7fa /app/animation.h
parent4c1b6f0b5e1ce512780f5c83c245fd62dca3f3d1 (diff)
downloadchromium_src-dbba0c455f8b3f139fbfd9634d0bfba268085a33.zip
chromium_src-dbba0c455f8b3f139fbfd9634d0bfba268085a33.tar.gz
chromium_src-dbba0c455f8b3f139fbfd9634d0bfba268085a33.tar.bz2
Adds Animation::CurrentValueBetween and gets rid of a bunch of
duplicate code. BUG=none TEST=none Review URL: http://codereview.chromium.org/570055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/animation.h')
-rw-r--r--app/animation.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/animation.h b/app/animation.h
index bd38fb4..bfa7fd0 100644
--- a/app/animation.h
+++ b/app/animation.h
@@ -11,6 +11,10 @@
class Animation;
+namespace gfx {
+class Rect;
+}
+
// AnimationDelegate
//
// Implement this interface when you want to receive notifications about the
@@ -77,6 +81,13 @@ class Animation {
// however subclasses can override this to provide others.
virtual double GetCurrentValue() const;
+ // Convenience for returning a value between |start| and |target| based on
+ // the current value. This is (target - start) * GetCurrentValue() + start.
+ double CurrentValueBetween(double start, double target) const;
+ int CurrentValueBetween(int start, int target) const;
+ gfx::Rect CurrentValueBetween(const gfx::Rect& start_bounds,
+ const gfx::Rect& target_bounds) const;
+
// Start the animation.
void Start();
@@ -98,6 +109,9 @@ class Animation {
// to give guidance for heavy animations such as "start download" arrow.
static bool ShouldRenderRichAnimation();
+ // Sets the delegate.
+ void set_delegate(AnimationDelegate* delegate) { delegate_ = delegate; }
+
protected:
// Overriddable, called by Run.
virtual void Step();