diff options
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 4 | ||||
-rw-r--r-- | ash/rotator/screen_rotation.cc | 16 | ||||
-rw-r--r-- | ash/rotator/screen_rotation.h | 15 |
3 files changed, 14 insertions, 21 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 26c0730..d98068a 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -146,11 +146,9 @@ bool HandleRotateWindows() { // rotation and position. Use replace so we only enqueue one at a time. target->layer()->GetAnimator()-> set_preemption_strategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); - scoped_ptr<ui::LayerAnimationSequence> screen_rotation( + target->layer()->GetAnimator()->ScheduleAnimation( new ui::LayerAnimationSequence( new ash::ScreenRotation(360, target->layer()))); - target->layer()->GetAnimator()->StartAnimation( - screen_rotation.release()); } return true; } diff --git a/ash/rotator/screen_rotation.cc b/ash/rotator/screen_rotation.cc index ecb45ef..686bc89 100644 --- a/ash/rotator/screen_rotation.cc +++ b/ash/rotator/screen_rotation.cc @@ -4,9 +4,8 @@ #include "ash/rotator/screen_rotation.h" -#include "base/debug/trace_event.h" #include "base/time.h" -#include "ui/compositor/layer_animation_delegate.h" +#include "ui/compositor/layer.h" #include "ui/gfx/interpolated_transform.h" #include "ui/gfx/rect.h" #include "ui/gfx/transform.h" @@ -31,18 +30,17 @@ base::TimeDelta GetTransitionDuration(int degrees) { } // namespace -ScreenRotation::ScreenRotation(int degrees, - ui::LayerAnimationDelegate* delegate) +ScreenRotation::ScreenRotation(int degrees, ui::Layer* layer) : ui::LayerAnimationElement(GetProperties(), GetTransitionDuration(degrees)), degrees_(degrees) { - InitTransform(delegate); + InitTransform(layer); } ScreenRotation::~ScreenRotation() { } -void ScreenRotation::InitTransform(ui::LayerAnimationDelegate* delegate) { +void ScreenRotation::InitTransform(ui::Layer* layer) { // No rotation required, use the identity transform. if (degrees_ == 0) { interpolated_transform_.reset( @@ -50,9 +48,9 @@ void ScreenRotation::InitTransform(ui::LayerAnimationDelegate* delegate) { return; } - const gfx::Transform& current_transform = - delegate->GetTransformForAnimation(); - const gfx::Rect& bounds = delegate->GetBoundsForAnimation(); + // Use the target transform/bounds in case the layer is already animating. + const gfx::Transform& current_transform = layer->GetTargetTransform(); + const gfx::Rect& bounds = layer->GetTargetBounds(); gfx::Point old_pivot; gfx::Point new_pivot; diff --git a/ash/rotator/screen_rotation.h b/ash/rotator/screen_rotation.h index 83d696c..339b99f 100644 --- a/ash/rotator/screen_rotation.h +++ b/ash/rotator/screen_rotation.h @@ -8,14 +8,12 @@ #include "ash/ash_export.h" #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "ui/base/animation/animation_delegate.h" -#include "ui/compositor/compositor_export.h" #include "ui/compositor/layer_animation_element.h" #include "ui/gfx/point.h" namespace ui { class InterpolatedTransform; -class LayerAnimationDelegate; +class Layer; } namespace aura { @@ -30,16 +28,15 @@ namespace ash { // in the middle of a transition. class ASH_EXPORT ScreenRotation : public ui::LayerAnimationElement { public: - // The screen rotation does not own the view or the listener, and these - // objects are required to outlive the Screen rotation object. - // |delegate| is usually a layer. - ScreenRotation(int degrees, ui::LayerAnimationDelegate* delegate); + // |degrees| are clockwise. |layer| is the target of the animation. Does not + // take ownership of |layer|. + ScreenRotation(int degrees, ui::Layer* layer); virtual ~ScreenRotation(); private: // Generates the intermediate transformation matrices used during the // animation. - void InitTransform(ui::LayerAnimationDelegate* delegate); + void InitTransform(ui::Layer* layer); // Implementation of ui::LayerAnimationDelegate virtual void OnStart(ui::LayerAnimationDelegate* delegate) OVERRIDE; @@ -56,7 +53,7 @@ class ASH_EXPORT ScreenRotation : public ui::LayerAnimationElement { // The number of degrees to rotate. int degrees_; - // The target origin + // The target origin. gfx::Point new_origin_; DISALLOW_COPY_AND_ASSIGN(ScreenRotation); |