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

Side by Side Diff: ui/views/animation/flood_fill_ink_drop_ripple.cc

Issue 2535243002: Disabled ink drop animations based on gfx::Animation::ShouldRenderRichAnimation(). (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_highlight.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/views/animation/flood_fill_ink_drop_ripple.h" 5 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/compositor/layer.h" 11 #include "ui/compositor/layer.h"
12 #include "ui/compositor/layer_animation_sequence.h" 12 #include "ui/compositor/layer_animation_sequence.h"
13 #include "ui/compositor/scoped_layer_animation_settings.h" 13 #include "ui/compositor/scoped_layer_animation_settings.h"
14 #include "ui/gfx/animation/animation.h"
14 #include "ui/gfx/geometry/point_conversions.h" 15 #include "ui/gfx/geometry/point_conversions.h"
15 #include "ui/gfx/geometry/vector2d_f.h" 16 #include "ui/gfx/geometry/vector2d_f.h"
16 17
17 namespace { 18 namespace {
18 19
19 // The minimum radius to use when scaling the painted layers. Smaller values 20 // The minimum radius to use when scaling the painted layers. Smaller values
20 // were causing visual anomalies. 21 // were causing visual anomalies.
21 const float kMinRadius = 1.f; 22 const float kMinRadius = 1.f;
22 23
23 // All the sub animations that are used to animate each of the InkDropStates. 24 // All the sub animations that are used to animate each of the InkDropStates.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 300, // ACTION_TRIGGERED_FADE_OUT 89 300, // ACTION_TRIGGERED_FADE_OUT
89 200, // ALTERNATE_ACTION_PENDING 90 200, // ALTERNATE_ACTION_PENDING
90 300, // ALTERNATE_ACTION_TRIGGERED_FADE_OUT 91 300, // ALTERNATE_ACTION_TRIGGERED_FADE_OUT
91 150, // ACTIVATED_FADE_IN 92 150, // ACTIVATED_FADE_IN
92 200, // ACTIVATED_TRANSFORM 93 200, // ACTIVATED_TRANSFORM
93 300, // DEACTIVATED_FADE_OUT 94 300, // DEACTIVATED_FADE_OUT
94 }; 95 };
95 96
96 // Returns the InkDropState sub animation duration for the given |state|. 97 // Returns the InkDropState sub animation duration for the given |state|.
97 base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) { 98 base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) {
99 // Ink drop animations are controlled by the system animation settings for
100 // accessibility reasons."See https://crbug.com/658384.
101 if (!gfx::Animation::ShouldRenderRichAnimation())
102 return base::TimeDelta();
98 return base::TimeDelta::FromMilliseconds( 103 return base::TimeDelta::FromMilliseconds(
99 (views::InkDropRipple::UseFastAnimations() 104 (views::InkDropRipple::UseFastAnimations()
100 ? 1 105 ? 1
101 : views::InkDropRipple::kSlowAnimationDurationFactor) * 106 : views::InkDropRipple::kSlowAnimationDurationFactor) *
102 kAnimationDurationInMs[state]); 107 kAnimationDurationInMs[state]);
103 } 108 }
104 109
105 } // namespace 110 } // namespace
106 111
107 namespace views { 112 namespace views {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 (bounds.bottom_right() - point).Length(); 334 (bounds.bottom_right() - point).Length();
330 335
331 float largest_distance = 336 float largest_distance =
332 std::max(distance_to_top_left, distance_to_top_right); 337 std::max(distance_to_top_left, distance_to_top_right);
333 largest_distance = std::max(largest_distance, distance_to_bottom_left); 338 largest_distance = std::max(largest_distance, distance_to_bottom_left);
334 largest_distance = std::max(largest_distance, distance_to_bottom_right); 339 largest_distance = std::max(largest_distance, distance_to_bottom_right);
335 return largest_distance; 340 return largest_distance;
336 } 341 }
337 342
338 } // namespace views 343 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_highlight.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698