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

Unified Diff: ash/wm/window_animations.cc

Issue 11087093: Migrate ui::Transform to gfx::Transform (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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: ash/wm/window_animations.cc
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index 96ecddc2a808f17f752d75422e44f35ceb5b47b9..9767b6a474cc8d0b315a49747f644b67129aa081 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -232,8 +232,8 @@ class WorkspaceHidingWindowAnimationObserver
// its visibility to true, and its transform from |start_transform| to
// |end_transform|.
void AnimateShowWindowCommon(aura::Window* window,
- const ui::Transform& start_transform,
- const ui::Transform& end_transform) {
+ const gfx::Transform& start_transform,
+ const gfx::Transform& end_transform) {
window->layer()->set_delegate(window);
window->layer()->SetOpacity(kWindowAnimation_HideOpacity);
window->layer()->SetTransform(start_transform);
@@ -254,7 +254,7 @@ void AnimateShowWindowCommon(aura::Window* window,
// Hides a window using an animation, animating its opacity from 1.f to 0.f,
// its visibility to false, and its transform to |end_transform|.
void AnimateHideWindowCommon(aura::Window* window,
- const ui::Transform& end_transform) {
+ const gfx::Transform& end_transform) {
window->layer()->set_delegate(NULL);
// Property sets within this scope will be implicitly animated.
@@ -272,18 +272,18 @@ void AnimateHideWindowCommon(aura::Window* window,
// Show/Hide windows using a shrink animation.
void AnimateShowWindow_Drop(aura::Window* window) {
- ui::Transform transform;
+ gfx::Transform transform;
transform.ConcatScale(kWindowAnimation_ScaleFactor,
kWindowAnimation_ScaleFactor);
gfx::Rect bounds = window->bounds();
transform.ConcatTranslate(
kWindowAnimation_TranslateFactor * bounds.width(),
kWindowAnimation_TranslateFactor * bounds.height());
- AnimateShowWindowCommon(window, transform, ui::Transform());
+ AnimateShowWindowCommon(window, transform, gfx::Transform());
}
void AnimateHideWindow_Drop(aura::Window* window) {
- ui::Transform transform;
+ gfx::Transform transform;
transform.ConcatScale(kWindowAnimation_ScaleFactor,
kWindowAnimation_ScaleFactor);
gfx::Rect bounds = window->bounds();
@@ -295,14 +295,14 @@ void AnimateHideWindow_Drop(aura::Window* window) {
// Show/Hide windows using a vertical Glenimation.
void AnimateShowWindow_Vertical(aura::Window* window) {
- ui::Transform transform;
+ gfx::Transform transform;
transform.ConcatTranslate(0, window->GetProperty(
kWindowVisibilityAnimationVerticalPositionKey));
- AnimateShowWindowCommon(window, transform, ui::Transform());
+ AnimateShowWindowCommon(window, transform, gfx::Transform());
}
void AnimateHideWindow_Vertical(aura::Window* window) {
- ui::Transform transform;
+ gfx::Transform transform;
transform.ConcatTranslate(0, window->GetProperty(
kWindowVisibilityAnimationVerticalPositionKey));
AnimateHideWindowCommon(window, transform);
@@ -310,16 +310,17 @@ void AnimateHideWindow_Vertical(aura::Window* window) {
// Show/Hide windows using a fade.
void AnimateShowWindow_Fade(aura::Window* window) {
- AnimateShowWindowCommon(window, ui::Transform(), ui::Transform());
+ AnimateShowWindowCommon(window, gfx::Transform(), gfx::Transform());
}
void AnimateHideWindow_Fade(aura::Window* window) {
- AnimateHideWindowCommon(window, ui::Transform());
+ AnimateHideWindowCommon(window, gfx::Transform());
}
// Builds the transform used when switching workspaces for the specified
// window.
-ui::Transform BuildWorkspaceSwitchTransform(aura::Window* window, float scale) {
+gfx::Transform BuildWorkspaceSwitchTransform(aura::Window* window,
+ float scale) {
// Animations for transitioning workspaces scale all windows. To give the
// effect of scaling from the center of the screen the windows are translated.
gfx::Rect bounds = window->bounds();
@@ -332,7 +333,7 @@ ui::Transform BuildWorkspaceSwitchTransform(aura::Window* window, float scale) {
float initial_y =
(static_cast<float>(bounds.y()) - mid_y) * scale + mid_y;
- ui::Transform transform;
+ gfx::Transform transform;
transform.ConcatTranslate(
initial_x - static_cast<float>(bounds.x()),
initial_y - static_cast<float>(bounds.y()));
@@ -341,7 +342,7 @@ ui::Transform BuildWorkspaceSwitchTransform(aura::Window* window, float scale) {
}
void AnimateShowWindow_Workspace(aura::Window* window) {
- ui::Transform transform(
+ gfx::Transform transform(
BuildWorkspaceSwitchTransform(window, kWorkspaceScale));
// When we call SetOpacity here, if a hide sequence is already running,
// the default animation preemption strategy fast forwards the hide sequence
@@ -356,7 +357,7 @@ void AnimateShowWindow_Workspace(aura::Window* window) {
// Property sets within this scope will be implicitly animated.
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
- window->layer()->SetTransform(ui::Transform());
+ window->layer()->SetTransform(gfx::Transform());
// Opacity animates only during the first half of the animation.
settings.SetTransitionDuration(settings.GetTransitionDuration() / 2);
window->layer()->SetOpacity(1.0f);
@@ -364,10 +365,10 @@ void AnimateShowWindow_Workspace(aura::Window* window) {
}
void AnimateHideWindow_Workspace(aura::Window* window) {
- ui::Transform transform(
+ gfx::Transform transform(
BuildWorkspaceSwitchTransform(window, kWorkspaceScale));
window->layer()->SetOpacity(1.0f);
- window->layer()->SetTransform(ui::Transform());
+ window->layer()->SetTransform(gfx::Transform());
// Opacity animates from 1 to 0 only over the second half of the animation. To
// get this functionality two animations are schedule for opacity, the first
@@ -720,7 +721,7 @@ enum WorkspaceAnimateTypes {
void ApplyWorkspaceScale(ui::Layer* layer, WorkspaceScaleType type) {
const float scale = type == WORKSPACE_SCALE_ABOVE ? kWorkspaceScaleAbove :
kWorkspaceScaleBelow;
- ui::Transform transform;
+ gfx::Transform transform;
transform.ConcatScale(scale, scale);
transform.ConcatTranslate(
-layer->bounds().width() * (scale - 1.0f) / 2,
@@ -757,7 +758,7 @@ TimeDelta CrossFadeImpl(aura::Window* window,
settings.AddObserver(new internal::CrossFadeObserver(window, old_layer));
settings.SetTransitionDuration(duration);
settings.SetTweenType(tween_type);
- ui::Transform out_transform;
+ gfx::Transform out_transform;
float scale_x = static_cast<float>(new_bounds.width()) /
static_cast<float>(old_bounds.width());
float scale_y = static_cast<float>(new_bounds.height()) /
@@ -777,7 +778,7 @@ TimeDelta CrossFadeImpl(aura::Window* window,
// Set the new layer's current transform, such that the user sees a scaled
// version of the window with the original bounds at the original position.
- ui::Transform in_transform;
+ gfx::Transform in_transform;
const float scale_x = static_cast<float>(old_bounds.width()) /
static_cast<float>(new_bounds.width());
const float scale_y = static_cast<float>(old_bounds.height()) /
@@ -801,7 +802,7 @@ TimeDelta CrossFadeImpl(aura::Window* window,
ui::LayerAnimationElement::OPACITY, -1);
settings.SetTransitionDuration(duration);
settings.SetTweenType(tween_type);
- window->layer()->SetTransform(ui::Transform());
+ window->layer()->SetTransform(gfx::Transform());
if (!old_on_top) {
// New layer is on top, fade it in.
window->layer()->SetOpacity(1.f);
@@ -864,7 +865,7 @@ void AnimateWorkspaceInImpl(aura::Window* window,
settings.SetTweenType(tween_type);
settings.SetTransitionDuration(duration);
- window->layer()->SetTransform(ui::Transform());
+ window->layer()->SetTransform(gfx::Transform());
window->layer()->SetOpacity(1.0f);
window->layer()->SetLayerBrightness(0.0f);
}
@@ -877,7 +878,7 @@ void AnimateWorkspaceOutImpl(aura::Window* window,
ui::Tween::Type tween_type,
TimeDelta duration) {
window->Show();
- window->layer()->SetTransform(ui::Transform());
+ window->layer()->SetTransform(gfx::Transform());
window->layer()->SetLayerBrightness(0.0f);
window->layer()->SetOpacity(1.0f);
window->layer()->GetAnimator()->StopAnimating();
@@ -915,7 +916,7 @@ void AnimateWorkspaceOutImpl(aura::Window* window,
// version.
settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
settings.SetTransitionDuration(base::TimeDelta());
- window->layer()->SetTransform(ui::Transform());
+ window->layer()->SetTransform(gfx::Transform());
}
}
@@ -1019,7 +1020,7 @@ void CrossFadeWindowBetweenWorkspaces(aura::Window* old_workspace,
// that, so we explicitly animate each of the children to give the effect of
// the workspace scaling.
new_workspace->Show();
- new_workspace->SetTransform(ui::Transform());
+ new_workspace->SetTransform(gfx::Transform());
new_workspace->layer()->SetOpacity(1.0f);
new_workspace->layer()->SetLayerBrightness(0.0f);
const Windows& children(new_workspace->children());
@@ -1034,7 +1035,7 @@ void CrossFadeWindowBetweenWorkspaces(aura::Window* old_workspace,
ui::ScopedLayerAnimationSettings settings(child->layer()->GetAnimator());
settings.SetTweenType(ui::Tween::EASE_OUT);
settings.SetTransitionDuration(duration);
- child->SetTransform(ui::Transform());
+ child->SetTransform(gfx::Transform());
child->layer()->SetLayerBrightness(0.0f);
}
} else {
@@ -1046,7 +1047,7 @@ void CrossFadeWindowBetweenWorkspaces(aura::Window* old_workspace,
new_workspace->Show();
new_workspace->layer()->SetOpacity(1.f);
- new_workspace->layer()->SetTransform(ui::Transform());
+ new_workspace->layer()->SetTransform(gfx::Transform());
new_workspace->layer()->SetLayerBrightness(0.0f);
}
}

Powered by Google App Engine
This is Rietveld 408576698