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

Unified Diff: ash/wm/session_state_animator.cc

Issue 11418040: gfx::Transform API clean-up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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
« no previous file with comments | « ash/wm/gestures/long_press_affordance_handler.cc ('k') | ash/wm/window_animations.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/session_state_animator.cc
diff --git a/ash/wm/session_state_animator.cc b/ash/wm/session_state_animator.cc
index 82f41f899fe6e52abe6adfec15c65093e198d0e0..12ddf337089715a5f3ec779681b9accf457346b1 100644
--- a/ash/wm/session_state_animator.cc
+++ b/ash/wm/session_state_animator.cc
@@ -26,16 +26,19 @@ const float kSlowCloseSizeRatio = 0.95f;
// Maximum opacity of white layer when animating pre-shutdown state.
const float kPartialFadeRatio = 0.3f;
+// Minimum size. Not zero as it causes numeric issues.
+const float kMinimumScale = 1e-4f;
+
// Returns the transform that should be applied to containers for the slow-close
// animation.
gfx::Transform GetSlowCloseTransform() {
gfx::Size root_size = Shell::GetPrimaryRootWindow()->bounds().size();
gfx::Transform transform;
- transform.SetScale(kSlowCloseSizeRatio, kSlowCloseSizeRatio);
- transform.ConcatTranslate(
+ transform.Translate(
floor(0.5 * (1.0 - kSlowCloseSizeRatio) * root_size.width() + 0.5),
floor(0.5 * (1.0 - kSlowCloseSizeRatio) * root_size.height() + 0.5));
- return transform;
+ transform.Scale(kSlowCloseSizeRatio, kSlowCloseSizeRatio);
+ return transform;
}
// Returns the transform that should be applied to containers for the fast-close
@@ -43,9 +46,9 @@ gfx::Transform GetSlowCloseTransform() {
gfx::Transform GetFastCloseTransform() {
gfx::Size root_size = Shell::GetPrimaryRootWindow()->bounds().size();
gfx::Transform transform;
- transform.SetScale(0.0, 0.0);
- transform.ConcatTranslate(floor(0.5 * root_size.width() + 0.5),
- floor(0.5 * root_size.height() + 0.5));
+ transform.Translate(floor(0.5 * root_size.width() + 0.5),
+ floor(0.5 * root_size.height() + 0.5));
+ transform.Scale(kMinimumScale, kMinimumScale);
return transform;
}
« no previous file with comments | « ash/wm/gestures/long_press_affordance_handler.cc ('k') | ash/wm/window_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698