| Index: ui/views/animation/flood_fill_ink_drop_animation.cc
|
| diff --git a/ui/views/animation/flood_fill_ink_drop_animation.cc b/ui/views/animation/flood_fill_ink_drop_animation.cc
|
| index 77e091e4e495e6e81961bff87257feeec3d10679..2de0c90eb4d4ebe27d0f0e43e5b6fad2543eadd0 100644
|
| --- a/ui/views/animation/flood_fill_ink_drop_animation.cc
|
| +++ b/ui/views/animation/flood_fill_ink_drop_animation.cc
|
| @@ -18,7 +18,7 @@ namespace {
|
|
|
| // The minimum radius to use when scaling the painted layers. Smaller values
|
| // were causing visual anomalies.
|
| -const float kMinRadius = 0.01f;
|
| +const float kMinRadius = 1.f;
|
|
|
| // All the sub animations that are used to animate each of the InkDropStates.
|
| // These are used to get time durations with
|
| @@ -100,25 +100,6 @@ base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) {
|
| kAnimationDurationInMs[state]);
|
| }
|
|
|
| -// Calculates the largest distance from |point| to the corners of a rectangle
|
| -// with origin (0, 0) and the given |size|.
|
| -float CalculateLargestDistanceToCorners(const gfx::Size& size,
|
| - const gfx::Point& point) {
|
| - const float top_left_distance = gfx::Vector2dF(point.x(), point.y()).Length();
|
| - const float top_right_distance =
|
| - gfx::Vector2dF(size.width() - point.x(), point.y()).Length();
|
| - const float bottom_left_distance =
|
| - gfx::Vector2dF(point.x(), size.height() - point.y()).Length();
|
| - const float bottom_right_distance =
|
| - gfx::Vector2dF(size.width() - point.x(), size.height() - point.y())
|
| - .Length();
|
| -
|
| - float largest_distance = std::max(top_left_distance, top_right_distance);
|
| - largest_distance = std::max(largest_distance, bottom_left_distance);
|
| - largest_distance = std::max(largest_distance, bottom_right_distance);
|
| - return largest_distance;
|
| -}
|
| -
|
| } // namespace
|
|
|
| namespace views {
|
| @@ -180,15 +161,10 @@ void FloodFillInkDropAnimation::AnimateStateChange(
|
| case InkDropState::HIDDEN:
|
| if (!IsVisible()) {
|
| SetStateToHidden();
|
| - break;
|
| } else {
|
| AnimateToOpacity(kHiddenOpacity, GetAnimationDuration(HIDDEN_FADE_OUT),
|
| ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
|
| gfx::Tween::EASE_IN_OUT, animation_observer);
|
| - const gfx::Transform transform = CalculateTransform(kMinRadius);
|
| - AnimateToTransform(transform, GetAnimationDuration(HIDDEN_TRANSFORM),
|
| - ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
|
| - gfx::Tween::EASE_IN_OUT, animation_observer);
|
| }
|
| break;
|
| case InkDropState::ACTION_PENDING: {
|
| @@ -204,9 +180,7 @@ void FloodFillInkDropAnimation::AnimateStateChange(
|
| ui::LayerAnimator::ENQUEUE_NEW_ANIMATION,
|
| gfx::Tween::EASE_IN, animation_observer);
|
|
|
| - const gfx::Transform transform = CalculateTransform(
|
| - CalculateLargestDistanceToCorners(size_, center_point_));
|
| - AnimateToTransform(transform,
|
| + AnimateToTransform(GetActivatedTargetTransform(),
|
| GetAnimationDuration(ACTION_PENDING_TRANSFORM),
|
| ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
|
| gfx::Tween::FAST_OUT_SLOW_IN, animation_observer);
|
| @@ -231,9 +205,8 @@ void FloodFillInkDropAnimation::AnimateStateChange(
|
| GetAnimationDuration(SLOW_ACTION_PENDING),
|
| ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
|
| gfx::Tween::EASE_IN, animation_observer);
|
| - const gfx::Transform transform = CalculateTransform(
|
| - CalculateLargestDistanceToCorners(size_, center_point_));
|
| - AnimateToTransform(transform, GetAnimationDuration(SLOW_ACTION_PENDING),
|
| + AnimateToTransform(GetActivatedTargetTransform(),
|
| + GetAnimationDuration(SLOW_ACTION_PENDING),
|
| ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
|
| gfx::Tween::EASE_IN_OUT, animation_observer);
|
| break;
|
| @@ -265,8 +238,7 @@ void FloodFillInkDropAnimation::AnimateStateChange(
|
| }
|
|
|
| void FloodFillInkDropAnimation::SetStateToHidden() {
|
| - gfx::Transform transform = CalculateTransform(kMinRadius);
|
| - painted_layer_.SetTransform(transform);
|
| + painted_layer_.SetTransform(CalculateTransform(kMinRadius));
|
| root_layer_.SetOpacity(InkDropAnimation::kHiddenOpacity);
|
| root_layer_.SetVisible(false);
|
| }
|
| @@ -338,7 +310,7 @@ gfx::Transform FloodFillInkDropAnimation::CalculateTransform(
|
|
|
| gfx::Transform FloodFillInkDropAnimation::GetActivatedTargetTransform() const {
|
| return CalculateTransform(
|
| - CalculateLargestDistanceToCorners(size_, center_point_));
|
| + gfx::Vector2dF(size_.width(), size_.height()).Length());
|
| }
|
|
|
| } // namespace views
|
|
|