| Index: ui/gfx/compositor/layer_animation_manager.cc
|
| diff --git a/ui/gfx/compositor/layer_animator.cc b/ui/gfx/compositor/layer_animation_manager.cc
|
| similarity index 81%
|
| copy from ui/gfx/compositor/layer_animator.cc
|
| copy to ui/gfx/compositor/layer_animation_manager.cc
|
| index c9a7bca2d8521798a25ede160f27d84b17e67ce3..0301ba4ce1a5cf86c9ec69273f0f12997b27d3e9 100644
|
| --- a/ui/gfx/compositor/layer_animator.cc
|
| +++ b/ui/gfx/compositor/layer_animation_manager.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ui/gfx/compositor/layer_animator.h"
|
| +#include "ui/gfx/compositor/layer_animation_manager.h"
|
|
|
| #include "base/logging.h"
|
| #include "base/stl_util.h"
|
| @@ -33,15 +33,15 @@ SkMScalar GetMatrixElement(const SkMatrix44& matrix, int index) {
|
|
|
| namespace ui {
|
|
|
| -LayerAnimator::LayerAnimator(Layer* layer)
|
| +LayerAnimationManager::LayerAnimationManager(Layer* layer)
|
| : layer_(layer),
|
| got_initial_tick_(false) {
|
| }
|
|
|
| -LayerAnimator::~LayerAnimator() {
|
| +LayerAnimationManager::~LayerAnimationManager() {
|
| }
|
|
|
| -void LayerAnimator::SetAnimation(Animation* animation) {
|
| +void LayerAnimationManager::SetAnimation(Animation* animation) {
|
| animation_.reset(animation);
|
| if (animation_.get()) {
|
| static ui::AnimationContainer* container = NULL;
|
| @@ -55,7 +55,7 @@ void LayerAnimator::SetAnimation(Animation* animation) {
|
| }
|
| }
|
|
|
| -void LayerAnimator::AnimateToPoint(const gfx::Point& target) {
|
| +void LayerAnimationManager::AnimateToPoint(const gfx::Point& target) {
|
| StopAnimating(LOCATION);
|
| const gfx::Rect& layer_bounds = layer_->bounds();
|
| if (target == layer_bounds.origin())
|
| @@ -68,7 +68,7 @@ void LayerAnimator::AnimateToPoint(const gfx::Point& target) {
|
| element.location.start_y = layer_bounds.origin().y();
|
| }
|
|
|
| -void LayerAnimator::AnimateTransform(const Transform& transform) {
|
| +void LayerAnimationManager::AnimateTransform(const Transform& transform) {
|
| StopAnimating(TRANSFORM);
|
| const Transform& layer_transform = layer_->transform();
|
| if (transform == layer_transform)
|
| @@ -83,7 +83,7 @@ void LayerAnimator::AnimateTransform(const Transform& transform) {
|
| }
|
| }
|
|
|
| -void LayerAnimator::AnimateOpacity(float target_opacity) {
|
| +void LayerAnimationManager::AnimateOpacity(float target_opacity) {
|
| StopAnimating(OPACITY);
|
| if (layer_->opacity() == target_opacity)
|
| return;
|
| @@ -93,19 +93,19 @@ void LayerAnimator::AnimateOpacity(float target_opacity) {
|
| element.opacity.target = target_opacity;
|
| }
|
|
|
| -gfx::Point LayerAnimator::GetTargetPoint() {
|
| +gfx::Point LayerAnimationManager::GetTargetPoint() {
|
| return IsAnimating(LOCATION) ?
|
| gfx::Point(elements_[LOCATION].location.target_x,
|
| elements_[LOCATION].location.target_y) :
|
| layer_->bounds().origin();
|
| }
|
|
|
| -float LayerAnimator::GetTargetOpacity() {
|
| +float LayerAnimationManager::GetTargetOpacity() {
|
| return IsAnimating(OPACITY) ?
|
| elements_[OPACITY].opacity.target : layer_->opacity();
|
| }
|
|
|
| -ui::Transform LayerAnimator::GetTargetTransform() {
|
| +ui::Transform LayerAnimationManager::GetTargetTransform() {
|
| if (IsAnimating(TRANSFORM)) {
|
| Transform transform;
|
| for (int i = 0; i < 16; ++i) {
|
| @@ -117,15 +117,16 @@ ui::Transform LayerAnimator::GetTargetTransform() {
|
| return layer_->transform();
|
| }
|
|
|
| -bool LayerAnimator::IsAnimating(AnimationProperty property) const {
|
| +bool LayerAnimationManager::IsAnimating(AnimationProperty property) const {
|
| return elements_.count(property) > 0;
|
| }
|
|
|
| -bool LayerAnimator::IsRunning() const {
|
| +bool LayerAnimationManager::IsRunning() const {
|
| return animation_.get() && animation_->is_animating();
|
| }
|
|
|
| -void LayerAnimator::AnimationProgressed(const ui::Animation* animation) {
|
| +void LayerAnimationManager::AnimationProgressed(
|
| + const ui::Animation* animation) {
|
| got_initial_tick_ = true;
|
| for (Elements::const_iterator i = elements_.begin(); i != elements_.end();
|
| ++i) {
|
| @@ -168,20 +169,18 @@ void LayerAnimator::AnimationProgressed(const ui::Animation* animation) {
|
| layer_->ScheduleDraw();
|
| }
|
|
|
| -void LayerAnimator::AnimationEnded(const ui::Animation* animation) {
|
| +void LayerAnimationManager::AnimationEnded(const ui::Animation* animation) {
|
| AnimationProgressed(animation);
|
| - if (layer_->delegate())
|
| - layer_->delegate()->OnLayerAnimationEnded(animation);
|
| }
|
|
|
| -void LayerAnimator::StopAnimating(AnimationProperty property) {
|
| +void LayerAnimationManager::StopAnimating(AnimationProperty property) {
|
| if (!IsAnimating(property))
|
| return;
|
|
|
| elements_.erase(property);
|
| }
|
|
|
| -LayerAnimatorDelegate* LayerAnimator::delegate() {
|
| +LayerAnimatorDelegate* LayerAnimationManager::delegate() {
|
| return static_cast<LayerAnimatorDelegate*>(layer_);
|
| }
|
|
|
|
|