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

Unified Diff: ui/gfx/compositor/layer.h

Issue 8247009: Explicit animation support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added new preemption strategy: replace queued animations. Created 9 years, 2 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: ui/gfx/compositor/layer.h
diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h
index c449e88e70809a286d8747c0659c2d007a711bbf..cadd3e90200c77678cd3e086cac2a9570b5d1c7d 100644
--- a/ui/gfx/compositor/layer.h
+++ b/ui/gfx/compositor/layer.h
@@ -15,16 +15,15 @@
#include "ui/gfx/rect.h"
#include "ui/gfx/transform.h"
#include "ui/gfx/compositor/compositor.h"
-#include "ui/gfx/compositor/layer_animator.h"
-#include "ui/gfx/compositor/layer_animator_delegate.h"
+#include "ui/gfx/compositor/layer_animation_delegate.h"
#include "ui/gfx/compositor/layer_delegate.h"
class SkCanvas;
namespace ui {
-class Animation;
class Compositor;
+class LayerAnimator;
class Texture;
// Layer manages a texture, transform and a set of child Layers. Any View that
@@ -35,7 +34,7 @@ class Texture;
// NOTE: unlike Views, each Layer does *not* own its children views. If you
// delete a Layer and it has children, the parent of each child layer is set to
// NULL, but the children are not deleted.
-class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
+class COMPOSITOR_EXPORT Layer : public LayerAnimationDelegate {
public:
enum LayerType {
LAYER_HAS_NO_TEXTURE = 0,
@@ -78,16 +77,13 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
// Returns true if this Layer contains |other| somewhere in its children.
bool Contains(const Layer* other) const;
- // Sets the animation to use for changes to opacity, position or transform.
- // That is, if you invoke this with non-NULL |animation| is started and any
- // changes to opacity, position or transform are animated between the current
- // value and target value. If the current animation is NULL or completed,
- // changes are immediate. If the opacity, transform or bounds are changed
- // and the animation is part way through, the animation is canceled and
- // the bounds, opacity and transfrom and set to the target value.
- // Layer takes ownership of |animation| and installs it's own delegate on the
- // animation.
- void SetAnimation(Animation* animation);
+ // The layer's animator is responsible for causing automatic animations when
+ // properties are set. It also manages a queue of pending animations and
+ // handles blending of animations.
sky 2011/10/19 00:06:33 Mention this takes ownership of LayerAnimator and
+ void SetAnimator(LayerAnimator* animator);
+
+ // Returns the layer's animator.
sky 2011/10/19 00:06:33 Mention this creates a LayerAnimator if null.
+ LayerAnimator* GetAnimator();
// The transform, relative to the parent.
void SetTransform(const ui::Transform& transform);
@@ -219,21 +215,20 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
// should have valid alpha.
bool has_valid_alpha_channel() const { return !layer_updated_externally_; }
- // If the animation is running and has progressed, it is stopped and all
- // properties that are animated (except |property|) are immediately set to
- // their target value.
- void StopAnimatingIfNecessary(LayerAnimator::AnimationProperty property);
-
// Following are invoked from the animation or if no animation exists to
// update the values immediately.
void SetBoundsImmediately(const gfx::Rect& bounds);
void SetTransformImmediately(const ui::Transform& transform);
void SetOpacityImmediately(float opacity);
- // LayerAnimatorDelegate overrides:
- virtual void SetBoundsFromAnimator(const gfx::Rect& bounds) OVERRIDE;
- virtual void SetTransformFromAnimator(const Transform& transform) OVERRIDE;
- virtual void SetOpacityFromAnimator(float opacity) OVERRIDE;
+ // Implementation of LayerAnimationDelegate
+ virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE;
+ virtual void SetTransformFromAnimation(const Transform& transform) OVERRIDE;
+ virtual void SetOpacityFromAnimation(float opacity) OVERRIDE;
+ virtual void ScheduleDrawForAnimation() OVERRIDE;
+ virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE;
+ virtual const Transform& GetTransformForAnimation() const OVERRIDE;
+ virtual const float GetOpacityForAnimation() const OVERRIDE;
const LayerType type_;

Powered by Google App Engine
This is Rietveld 408576698