From 958c79f841bea98be700ee4380dea57de5dac4ae Mon Sep 17 00:00:00 2001
From: "oshima@chromium.org"
 <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 16 Mar 2012 23:29:07 +0000
Subject: Revert r127269 "Adds a new layer animation element which owns an
 interpolated transform. This allows more control over the interpolation, and
 in particular, it allows for a rotation about a pivot."

Revert r127280 "Fix Win Aura compile break caused by r127269."

TBR=mpcomplete@chromium.org,vollick@chromium.org
BUG=None
TEST=None

Review URL: https://chromiumcodereview.appspot.com/9722015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127300 0039d316-1c4b-4281-b951-d872f2087c98
---
 ash/wm/window_animations.cc | 76 ++++++++++-----------------------------------
 1 file changed, 17 insertions(+), 59 deletions(-)

(limited to 'ash/wm/window_animations.cc')

diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index c10afde..f2269eb 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -18,10 +18,8 @@
 #include "ui/aura/window_observer.h"
 #include "ui/aura/window_property.h"
 #include "ui/gfx/compositor/layer_animation_observer.h"
-#include "ui/gfx/compositor/layer_animation_sequence.h"
 #include "ui/gfx/compositor/layer_animator.h"
 #include "ui/gfx/compositor/scoped_layer_animation_settings.h"
-#include "ui/gfx/interpolated_transform.h"
 #include "ui/gfx/screen.h"
 
 DECLARE_WINDOW_PROPERTY_TYPE(int)
@@ -74,7 +72,7 @@ const float kWindowAnimation_HideOpacity = 0.f;
 const float kWindowAnimation_ShowOpacity = 1.f;
 const float kWindowAnimation_TranslateFactor = -0.025f;
 const float kWindowAnimation_ScaleFactor = 1.05f;
-const float kWindowAnimation_MinimizeRotate = -5.f;
+const float kWindowAnimation_MinimizeRotate = -90.f;
 
 const float kWindowAnimation_Vertical_TranslateY = 15.f;
 
@@ -346,59 +344,18 @@ gfx::Rect GetMinimizeRectForWindow(aura::Window* window) {
   return target_bounds;
 }
 
-void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
+void AnimateShowWindow_Minimize(aura::Window* window) {
   // Recalculate the transform at restore time since the launcher item may have
   // moved while the window was minimized.
-  gfx::Rect bounds = window->bounds();
   gfx::Rect target_bounds = GetMinimizeRectForWindow(window);
-  float scale_x = static_cast<float>(target_bounds.height()) / bounds.width();
-  float scale_y = static_cast<float>(target_bounds.width()) / bounds.height();
-
-  scoped_ptr<ui::InterpolatedTransform> scale(
-      new ui::InterpolatedScale(gfx::Point3f(1, 1, 1),
-                                gfx::Point3f(scale_x, scale_y, 1)));
-
-  scoped_ptr<ui::InterpolatedTransform> translation(
-      new ui::InterpolatedTranslation(
-          gfx::Point(),
-          gfx::Point(target_bounds.x() - bounds.x(),
-                     target_bounds.y() - bounds.y())));
-
-  scoped_ptr<ui::InterpolatedTransform> rotation(
-      new ui::InterpolatedRotation(0, kWindowAnimation_MinimizeRotate));
-
-  scoped_ptr<ui::InterpolatedTransform> rotation_about_pivot(
-      new ui::InterpolatedTransformAboutPivot(
-          gfx::Point(bounds.width() * 0.5, bounds.height() * 0.5),
-          rotation.release()));
-
-  scale->SetChild(translation.release());
-  rotation_about_pivot->SetChild(scale.release());
-
-  rotation_about_pivot->SetReversed(show);
-
-  base::TimeDelta duration = base::TimeDelta::FromMilliseconds(350);
-
-  scoped_ptr<ui::LayerAnimationElement> transition(
-      ui::LayerAnimationElement::CreateInterpolatedTransformElement(
-          rotation_about_pivot.release(), duration));
-
-  transition->set_tween_type(
-      show ? ui::Tween::EASE_IN : ui::Tween::EASE_IN_OUT);
-
-  window->layer()->GetAnimator()->ScheduleAnimation(
-      new ui::LayerAnimationSequence(transition.release()));
-
-  float opacity = show ? 1.0f : 0.0f;
-  window->layer()->GetAnimator()->ScheduleAnimation(
-      new ui::LayerAnimationSequence(
-          ui::LayerAnimationElement::CreateOpacityElement(opacity, duration)));
-}
+  ui::Transform transform;
+  transform.ConcatScale(
+      static_cast<float>(target_bounds.height()) / window->bounds().width(),
+      static_cast<float>(target_bounds.width()) / window->bounds().height());
+  transform.ConcatTranslate(target_bounds.x() - window->bounds().x(),
+                            target_bounds.y() - window->bounds().y());
 
-void AnimateShowWindow_Minimize(aura::Window* window) {
-  window->layer()->set_delegate(window);
-  window->layer()->SetOpacity(kWindowAnimation_HideOpacity);
-  AddLayerAnimationsForMinimize(window, true);
+  AnimateShowWindowCommon(window, transform, ui::Transform());
 
   // Now that the window has been restored, we need to clear its animation style
   // to default so that normal animation applies.
@@ -407,13 +364,14 @@ void AnimateShowWindow_Minimize(aura::Window* window) {
 }
 
 void AnimateHideWindow_Minimize(aura::Window* window) {
-  window->layer()->set_delegate(NULL);
-
-  // Property sets within this scope will be implicitly animated.
-  ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
-  settings.AddObserver(new HidingWindowAnimationObserver(window));
-
-  AddLayerAnimationsForMinimize(window, false);
+  gfx::Rect target_bounds = GetMinimizeRectForWindow(window);
+  ui::Transform transform;
+  transform.ConcatScale(
+      static_cast<float>(target_bounds.height()) / window->bounds().width(),
+      static_cast<float>(target_bounds.width()) / window->bounds().height());
+  transform.ConcatTranslate(target_bounds.x() - window->bounds().x(),
+                            target_bounds.y() - window->bounds().y());
+  AnimateHideWindowCommon(window, transform);
 }
 
 bool AnimateShowWindow(aura::Window* window) {
-- 
cgit v1.1