Chromium Code Reviews| Index: ash/common/wm/wm_window_animations.cc |
| diff --git a/ash/common/wm/wm_window_animations.cc b/ash/common/wm/wm_window_animations.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1fe83b152720031e5ea0762045048e5b5fafb346 |
| --- /dev/null |
| +++ b/ash/common/wm/wm_window_animations.cc |
| @@ -0,0 +1,29 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ash/common/wm/wm_window_animations.h" |
| + |
| +#include "ui/compositor/layer.h" |
| +#include "ui/gfx/transform.h" |
| + |
| +namespace ash { |
| + |
| +// Returns scale related to the specified AshWindowScaleType. |
|
James Cook
2016/08/11 23:27:35
Doesn't seem to apply anymore.
msw
2016/08/12 00:17:15
Done.
|
| +void SetTransformForScaleAnimation(ui::Layer* layer, |
| + LayerScaleAnimationDirection type) { |
| + // Scales for AshWindow above/below current workspace. |
|
James Cook
2016/08/11 23:27:35
WmWindow? just window?
msw
2016/08/12 00:17:15
Done.
|
| + const float kLayerScaleAboveSize = 1.1f; |
| + const float kLayerScaleBelowSize = .9f; |
| + |
| + const float scale = type == LAYER_SCALE_ANIMATION_ABOVE |
| + ? kLayerScaleAboveSize |
| + : kLayerScaleBelowSize; |
| + gfx::Transform transform; |
| + transform.Translate(-layer->bounds().width() * (scale - 1.0f) / 2, |
| + -layer->bounds().height() * (scale - 1.0f) / 2); |
| + transform.Scale(scale, scale); |
| + layer->SetTransform(transform); |
| +} |
| + |
| +} // namespace ash |