| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ |
| 6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ | 6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 public: | 38 public: |
| 39 enum AnimatableProperty { | 39 enum AnimatableProperty { |
| 40 UNKNOWN = 0, | 40 UNKNOWN = 0, |
| 41 TRANSFORM = (1 << 0), | 41 TRANSFORM = (1 << 0), |
| 42 BOUNDS = (1 << 1), | 42 BOUNDS = (1 << 1), |
| 43 OPACITY = (1 << 2), | 43 OPACITY = (1 << 2), |
| 44 VISIBILITY = (1 << 3), | 44 VISIBILITY = (1 << 3), |
| 45 BRIGHTNESS = (1 << 4), | 45 BRIGHTNESS = (1 << 4), |
| 46 GRAYSCALE = (1 << 5), | 46 GRAYSCALE = (1 << 5), |
| 47 COLOR = (1 << 6), | 47 COLOR = (1 << 6), |
| 48 TEMPERATURE = (1 << 7), |
| 48 | 49 |
| 49 // Used when iterating over properties. | 50 // Used when iterating over properties. |
| 50 FIRST_PROPERTY = TRANSFORM, | 51 FIRST_PROPERTY = TRANSFORM, |
| 51 SENTINEL = (1 << 7) | 52 SENTINEL = (1 << 8) |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 static AnimatableProperty ToAnimatableProperty( | 55 static AnimatableProperty ToAnimatableProperty( |
| 55 cc::TargetProperty::Type property); | 56 cc::TargetProperty::Type property); |
| 56 | 57 |
| 57 struct COMPOSITOR_EXPORT TargetValue { | 58 struct COMPOSITOR_EXPORT TargetValue { |
| 58 TargetValue(); | 59 TargetValue(); |
| 59 // Initializes the target value to match the delegate. NULL may be supplied. | 60 // Initializes the target value to match the delegate. NULL may be supplied. |
| 60 explicit TargetValue(const LayerAnimationDelegate* delegate); | 61 explicit TargetValue(const LayerAnimationDelegate* delegate); |
| 61 | 62 |
| 62 gfx::Rect bounds; | 63 gfx::Rect bounds; |
| 63 gfx::Transform transform; | 64 gfx::Transform transform; |
| 64 float opacity; | 65 float opacity; |
| 65 bool visibility; | 66 bool visibility; |
| 66 float brightness; | 67 float brightness; |
| 67 float grayscale; | 68 float grayscale; |
| 68 SkColor color; | 69 SkColor color; |
| 70 float temperature; |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 typedef uint32_t AnimatableProperties; | 73 typedef uint32_t AnimatableProperties; |
| 72 | 74 |
| 73 LayerAnimationElement(AnimatableProperties properties, | 75 LayerAnimationElement(AnimatableProperties properties, |
| 74 base::TimeDelta duration); | 76 base::TimeDelta duration); |
| 75 | 77 |
| 76 virtual ~LayerAnimationElement(); | 78 virtual ~LayerAnimationElement(); |
| 77 | 79 |
| 78 // Creates an element that transitions to the given transform. The caller owns | 80 // Creates an element that transitions to the given transform. The caller owns |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 static std::unique_ptr<LayerAnimationElement> CreatePauseElement( | 130 static std::unique_ptr<LayerAnimationElement> CreatePauseElement( |
| 129 AnimatableProperties properties, | 131 AnimatableProperties properties, |
| 130 base::TimeDelta duration); | 132 base::TimeDelta duration); |
| 131 | 133 |
| 132 // Creates an element that transitions to the given color. The caller owns the | 134 // Creates an element that transitions to the given color. The caller owns the |
| 133 // return value. | 135 // return value. |
| 134 static std::unique_ptr<LayerAnimationElement> CreateColorElement( | 136 static std::unique_ptr<LayerAnimationElement> CreateColorElement( |
| 135 SkColor color, | 137 SkColor color, |
| 136 base::TimeDelta duration); | 138 base::TimeDelta duration); |
| 137 | 139 |
| 140 // Creates an element that transitions to the given color temperature. The |
| 141 // caller owns the return value. |
| 142 static std::unique_ptr<LayerAnimationElement> CreateTemperatureElement( |
| 143 float temperature, |
| 144 base::TimeDelta duration); |
| 145 |
| 138 // Sets the start time for the animation. This must be called before the first | 146 // Sets the start time for the animation. This must be called before the first |
| 139 // call to {Start, IsFinished}. Once the animation is finished, this must | 147 // call to {Start, IsFinished}. Once the animation is finished, this must |
| 140 // be called again in order to restart the animation. | 148 // be called again in order to restart the animation. |
| 141 void set_requested_start_time(base::TimeTicks start_time) { | 149 void set_requested_start_time(base::TimeTicks start_time) { |
| 142 requested_start_time_ = start_time; | 150 requested_start_time_ = start_time; |
| 143 } | 151 } |
| 144 base::TimeTicks requested_start_time() const { return requested_start_time_; } | 152 base::TimeTicks requested_start_time() const { return requested_start_time_; } |
| 145 | 153 |
| 146 // Sets the actual start time for the animation, taking into account any | 154 // Sets the actual start time for the animation, taking into account any |
| 147 // queueing delays. | 155 // queueing delays. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 int start_frame_number_; | 252 int start_frame_number_; |
| 245 | 253 |
| 246 base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_; | 254 base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_; |
| 247 | 255 |
| 248 DISALLOW_ASSIGN(LayerAnimationElement); | 256 DISALLOW_ASSIGN(LayerAnimationElement); |
| 249 }; | 257 }; |
| 250 | 258 |
| 251 } // namespace ui | 259 } // namespace ui |
| 252 | 260 |
| 253 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ | 261 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ |
| OLD | NEW |