| OLD | NEW |
| 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 #ifndef UI_VIEWS_ANIMATION_FLOOD_FILL_INK_DROP_ANIMATION_H_ | 5 #ifndef UI_VIEWS_ANIMATION_FLOOD_FILL_INK_DROP_ANIMATION_H_ |
| 6 #define UI_VIEWS_ANIMATION_FLOOD_FILL_INK_DROP_ANIMATION_H_ | 6 #define UI_VIEWS_ANIMATION_FLOOD_FILL_INK_DROP_ANIMATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "ui/compositor/layer.h" | 14 #include "ui/compositor/layer.h" |
| 15 #include "ui/compositor/layer_animator.h" | 15 #include "ui/compositor/layer_animator.h" |
| 16 #include "ui/gfx/animation/tween.h" | 16 #include "ui/gfx/animation/tween.h" |
| 17 #include "ui/gfx/geometry/point.h" | 17 #include "ui/gfx/geometry/point.h" |
| 18 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
| 19 #include "ui/gfx/transform.h" | 20 #include "ui/gfx/transform.h" |
| 20 #include "ui/views/animation/ink_drop_animation.h" | 21 #include "ui/views/animation/ink_drop_animation.h" |
| 21 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" | 22 #include "ui/views/animation/ink_drop_painted_layer_delegates.h" |
| 22 #include "ui/views/animation/ink_drop_state.h" | 23 #include "ui/views/animation/ink_drop_state.h" |
| 23 #include "ui/views/views_export.h" | 24 #include "ui/views/views_export.h" |
| 24 | 25 |
| 25 namespace ui { | 26 namespace ui { |
| 26 class Layer; | 27 class Layer; |
| 27 } // namespace ui | 28 } // namespace ui |
| (...skipping 13 matching lines...) Expand all Loading... |
| 41 // {All InkDropStates} => HIDDEN | 42 // {All InkDropStates} => HIDDEN |
| 42 // HIDDEN => ACTION_PENDING | 43 // HIDDEN => ACTION_PENDING |
| 43 // HIDDEN, ACTION_PENDING => ACTION_TRIGGERED | 44 // HIDDEN, ACTION_PENDING => ACTION_TRIGGERED |
| 44 // ACTION_PENDING => ALTERNATE_ACTION_PENDING | 45 // ACTION_PENDING => ALTERNATE_ACTION_PENDING |
| 45 // ALTERNATE_ACTION_PENDING => ALTERNATE_ACTION_TRIGGERED | 46 // ALTERNATE_ACTION_PENDING => ALTERNATE_ACTION_TRIGGERED |
| 46 // {All InkDropStates} => ACTIVATED | 47 // {All InkDropStates} => ACTIVATED |
| 47 // {All InkDropStates} => DEACTIVATED | 48 // {All InkDropStates} => DEACTIVATED |
| 48 // | 49 // |
| 49 class VIEWS_EXPORT FloodFillInkDropAnimation : public InkDropAnimation { | 50 class VIEWS_EXPORT FloodFillInkDropAnimation : public InkDropAnimation { |
| 50 public: | 51 public: |
| 51 FloodFillInkDropAnimation(const gfx::Size& size, | 52 FloodFillInkDropAnimation(const gfx::Rect& clip_bounds, |
| 52 const gfx::Point& center_point, | 53 const gfx::Point& center_point, |
| 53 SkColor color); | 54 SkColor color); |
| 54 ~FloodFillInkDropAnimation() override; | 55 ~FloodFillInkDropAnimation() override; |
| 55 | 56 |
| 56 // InkDropAnimation: | 57 // InkDropAnimation: |
| 57 void SnapToActivated() override; | 58 void SnapToActivated() override; |
| 58 ui::Layer* GetRootLayer() override; | 59 ui::Layer* GetRootLayer() override; |
| 59 bool IsVisible() const override; | 60 bool IsVisible() const override; |
| 60 | 61 |
| 61 private: | 62 private: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 gfx::Tween::Type tween, | 95 gfx::Tween::Type tween, |
| 95 ui::LayerAnimationObserver* observer); | 96 ui::LayerAnimationObserver* observer); |
| 96 | 97 |
| 97 // Returns the Transform to be applied to the |painted_layer_| for the given | 98 // Returns the Transform to be applied to the |painted_layer_| for the given |
| 98 // |target_radius|. | 99 // |target_radius|. |
| 99 gfx::Transform CalculateTransform(float target_radius) const; | 100 gfx::Transform CalculateTransform(float target_radius) const; |
| 100 | 101 |
| 101 // Returns the target Transform for when the ink drop is fully shown. | 102 // Returns the target Transform for when the ink drop is fully shown. |
| 102 gfx::Transform GetMaxSizeTargetTransform() const; | 103 gfx::Transform GetMaxSizeTargetTransform() const; |
| 103 | 104 |
| 104 // The clip Size. | 105 // The clip bounds. |
| 105 const gfx::Size size_; | 106 const gfx::Rect clip_bounds_; |
| 106 | 107 |
| 107 // The point where the Center of the ink drop's circle should be drawn. | 108 // The point where the Center of the ink drop's circle should be drawn. |
| 108 gfx::Point center_point_; | 109 gfx::Point center_point_; |
| 109 | 110 |
| 110 // The root layer that parents the animating layer. The root layer is used to | 111 // The root layer that parents the animating layer. The root layer is used to |
| 111 // manipulate opacity and clipping bounds, and it child is used to manipulate | 112 // manipulate opacity and clipping bounds, and it child is used to manipulate |
| 112 // the different shape of the ink drop. | 113 // the different shape of the ink drop. |
| 113 ui::Layer root_layer_; | 114 ui::Layer root_layer_; |
| 114 | 115 |
| 115 // ui::LayerDelegate to paint the |painted_layer_|. | 116 // ui::LayerDelegate to paint the |painted_layer_|. |
| 116 CircleLayerDelegate circle_layer_delegate_; | 117 CircleLayerDelegate circle_layer_delegate_; |
| 117 | 118 |
| 118 // Child ui::Layer of |root_layer_|. Used to manipulate the different size | 119 // Child ui::Layer of |root_layer_|. Used to manipulate the different size |
| 119 // and shape of the ink drop. | 120 // and shape of the ink drop. |
| 120 ui::Layer painted_layer_; | 121 ui::Layer painted_layer_; |
| 121 | 122 |
| 122 // The current ink drop state. | 123 // The current ink drop state. |
| 123 InkDropState ink_drop_state_; | 124 InkDropState ink_drop_state_; |
| 124 | 125 |
| 125 DISALLOW_COPY_AND_ASSIGN(FloodFillInkDropAnimation); | 126 DISALLOW_COPY_AND_ASSIGN(FloodFillInkDropAnimation); |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 } // namespace views | 129 } // namespace views |
| 129 | 130 |
| 130 #endif // UI_VIEWS_ANIMATION_FLOOD_FILL_INK_DROP_ANIMATION_H_ | 131 #endif // UI_VIEWS_ANIMATION_FLOOD_FILL_INK_DROP_ANIMATION_H_ |
| OLD | NEW |