OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/window_animations.h" | 5 #include "ash/wm/window_animations.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 const float kWindowAnimation_ShowBrightnessGrayscale = 0.f; | 55 const float kWindowAnimation_ShowBrightnessGrayscale = 0.f; |
56 | 56 |
57 const float kWindowAnimation_HideOpacity = 0.f; | 57 const float kWindowAnimation_HideOpacity = 0.f; |
58 const float kWindowAnimation_ShowOpacity = 1.f; | 58 const float kWindowAnimation_ShowOpacity = 1.f; |
59 // TODO(sky): if we end up sticking with 0, nuke the code doing the rotation. | 59 // TODO(sky): if we end up sticking with 0, nuke the code doing the rotation. |
60 const float kWindowAnimation_MinimizeRotate = 0.f; | 60 const float kWindowAnimation_MinimizeRotate = 0.f; |
61 | 61 |
62 // Tween type when cross fading a workspace window. | 62 // Tween type when cross fading a workspace window. |
63 const ui::Tween::Type kCrossFadeTweenType = ui::Tween::EASE_IN_OUT; | 63 const ui::Tween::Type kCrossFadeTweenType = ui::Tween::EASE_IN_OUT; |
64 | 64 |
65 // Scales for AshWindow above/below current workspace. | |
66 const float kAshWindowScaleAbove = 1.1f; | |
Daniel Erat
2012/11/30 14:33:08
kLayerScaleAboveSize, kLayerScaleBelowSize
| |
67 const float kAshWindowScaleBelow = .9f; | |
68 | |
65 int64 Round64(float f) { | 69 int64 Round64(float f) { |
66 return static_cast<int64>(f + 0.5f); | 70 return static_cast<int64>(f + 0.5f); |
67 } | 71 } |
68 | 72 |
69 } | 73 } |
70 | 74 |
71 gfx::Rect GetMinimizeRectForWindow(aura::Window* window) { | 75 gfx::Rect GetMinimizeRectForWindow(aura::Window* window) { |
72 Launcher* launcher = Launcher::ForWindow(window); | 76 Launcher* launcher = Launcher::ForWindow(window); |
73 // Launcher is created lazily and can be NULL. | 77 // Launcher is created lazily and can be NULL. |
74 if (!launcher) | 78 if (!launcher) |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 grayscale_element->set_tween_type(animation_type); | 498 grayscale_element->set_tween_type(animation_type); |
495 grayscale_sequence->AddElement(grayscale_element.release()); | 499 grayscale_sequence->AddElement(grayscale_element.release()); |
496 | 500 |
497 std::vector<ui::LayerAnimationSequence*> animations; | 501 std::vector<ui::LayerAnimationSequence*> animations; |
498 animations.push_back(brightness_sequence.release()); | 502 animations.push_back(brightness_sequence.release()); |
499 animations.push_back(grayscale_sequence.release()); | 503 animations.push_back(grayscale_sequence.release()); |
500 | 504 |
501 return animations; | 505 return animations; |
502 } | 506 } |
503 | 507 |
508 // Returns scale related to the specified AshWindowScaleType. | |
509 void ApplyAshWindowAnimationScale(ui::Layer* layer, | |
510 AshWindowScaleType type) { | |
511 const float scale = type == ASH_WINDOW_SCALE_ABOVE ? kAshWindowScaleAbove : | |
512 kAshWindowScaleBelow; | |
513 gfx::Transform transform; | |
514 transform.Translate(-layer->bounds().width() * (scale - 1.0f) / 2, | |
515 -layer->bounds().height() * (scale - 1.0f) / 2); | |
516 transform.Scale(scale, scale); | |
517 layer->SetTransform(transform); | |
518 } | |
519 | |
504 } // namespace ash | 520 } // namespace ash |
OLD | NEW |