| 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_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_ | 5 #ifndef UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_ |
| 6 #define UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_ | 6 #define UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "cc/animation/animation_curve.h" | 12 #include "cc/animation/animation_curve.h" |
| 13 #include "cc/animation/transform_operations.h" |
| 13 #include "ui/compositor/compositor_export.h" | 14 #include "ui/compositor/compositor_export.h" |
| 14 #include "ui/gfx/animation/tween.h" | 15 #include "ui/gfx/animation/tween.h" |
| 15 #include "ui/gfx/transform.h" | 16 #include "ui/gfx/transform.h" |
| 16 #include "ui/gfx/transform_util.h" | 17 #include "ui/gfx/transform_util.h" |
| 17 | 18 |
| 18 namespace ui { | 19 namespace ui { |
| 19 | 20 |
| 20 class COMPOSITOR_EXPORT TransformAnimationCurveAdapter | 21 class COMPOSITOR_EXPORT TransformAnimationCurveAdapter |
| 21 : public cc::TransformAnimationCurve { | 22 : public cc::TransformAnimationCurve { |
| 22 public: | 23 public: |
| 23 TransformAnimationCurveAdapter(gfx::Tween::Type tween_type, | 24 TransformAnimationCurveAdapter(gfx::Tween::Type tween_type, |
| 24 gfx::Transform intial_value, | 25 gfx::Transform intial_value, |
| 25 gfx::Transform target_value, | 26 gfx::Transform target_value, |
| 26 base::TimeDelta duration); | 27 base::TimeDelta duration); |
| 27 | 28 |
| 28 TransformAnimationCurveAdapter(const TransformAnimationCurveAdapter& other); | 29 TransformAnimationCurveAdapter(const TransformAnimationCurveAdapter& other); |
| 29 | 30 |
| 30 ~TransformAnimationCurveAdapter() override; | 31 ~TransformAnimationCurveAdapter() override; |
| 31 | 32 |
| 32 // TransformAnimationCurve implementation. | 33 // TransformAnimationCurve implementation. |
| 33 base::TimeDelta Duration() const override; | 34 base::TimeDelta Duration() const override; |
| 34 std::unique_ptr<AnimationCurve> Clone() const override; | 35 std::unique_ptr<AnimationCurve> Clone() const override; |
| 35 gfx::Transform GetValue(base::TimeDelta t) const override; | 36 cc::TransformOperations GetValue(base::TimeDelta t) const override; |
| 36 bool AnimatedBoundsForBox(const gfx::BoxF& box, | 37 bool AnimatedBoundsForBox(const gfx::BoxF& box, |
| 37 gfx::BoxF* bounds) const override; | 38 gfx::BoxF* bounds) const override; |
| 38 bool IsTranslation() const override; | 39 bool IsTranslation() const override; |
| 39 bool PreservesAxisAlignment() const override; | 40 bool PreservesAxisAlignment() const override; |
| 40 bool AnimationStartScale(bool forward_direction, | 41 bool AnimationStartScale(bool forward_direction, |
| 41 float* start_scale) const override; | 42 float* start_scale) const override; |
| 42 bool MaximumTargetScale(bool forward_direction, | 43 bool MaximumTargetScale(bool forward_direction, |
| 43 float* max_scale) const override; | 44 float* max_scale) const override; |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 gfx::Tween::Type tween_type_; | 47 gfx::Tween::Type tween_type_; |
| 47 gfx::Transform initial_value_; | 48 gfx::Transform initial_value_; |
| 49 cc::TransformOperations initial_wrapped_value_; |
| 48 gfx::Transform target_value_; | 50 gfx::Transform target_value_; |
| 51 cc::TransformOperations target_wrapped_value_; |
| 49 gfx::DecomposedTransform decomposed_initial_value_; | 52 gfx::DecomposedTransform decomposed_initial_value_; |
| 50 gfx::DecomposedTransform decomposed_target_value_; | 53 gfx::DecomposedTransform decomposed_target_value_; |
| 51 base::TimeDelta duration_; | 54 base::TimeDelta duration_; |
| 52 | 55 |
| 53 DISALLOW_ASSIGN(TransformAnimationCurveAdapter); | 56 DISALLOW_ASSIGN(TransformAnimationCurveAdapter); |
| 54 }; | 57 }; |
| 55 | 58 |
| 56 class COMPOSITOR_EXPORT InverseTransformCurveAdapter | 59 class COMPOSITOR_EXPORT InverseTransformCurveAdapter |
| 57 : public cc::TransformAnimationCurve { | 60 : public cc::TransformAnimationCurve { |
| 58 public: | 61 public: |
| 59 InverseTransformCurveAdapter(TransformAnimationCurveAdapter base_curve, | 62 InverseTransformCurveAdapter(TransformAnimationCurveAdapter base_curve, |
| 60 gfx::Transform initial_value, | 63 gfx::Transform initial_value, |
| 61 base::TimeDelta duration); | 64 base::TimeDelta duration); |
| 62 | 65 |
| 63 ~InverseTransformCurveAdapter() override; | 66 ~InverseTransformCurveAdapter() override; |
| 64 | 67 |
| 65 base::TimeDelta Duration() const override; | 68 base::TimeDelta Duration() const override; |
| 66 std::unique_ptr<AnimationCurve> Clone() const override; | 69 std::unique_ptr<AnimationCurve> Clone() const override; |
| 67 gfx::Transform GetValue(base::TimeDelta t) const override; | 70 cc::TransformOperations GetValue(base::TimeDelta t) const override; |
| 68 bool AnimatedBoundsForBox(const gfx::BoxF& box, | 71 bool AnimatedBoundsForBox(const gfx::BoxF& box, |
| 69 gfx::BoxF* bounds) const override; | 72 gfx::BoxF* bounds) const override; |
| 70 bool IsTranslation() const override; | 73 bool IsTranslation() const override; |
| 71 bool PreservesAxisAlignment() const override; | 74 bool PreservesAxisAlignment() const override; |
| 72 bool AnimationStartScale(bool forward_direction, | 75 bool AnimationStartScale(bool forward_direction, |
| 73 float* start_scale) const override; | 76 float* start_scale) const override; |
| 74 bool MaximumTargetScale(bool forward_direction, | 77 bool MaximumTargetScale(bool forward_direction, |
| 75 float* max_scale) const override; | 78 float* max_scale) const override; |
| 76 | 79 |
| 77 private: | 80 private: |
| 78 TransformAnimationCurveAdapter base_curve_; | 81 TransformAnimationCurveAdapter base_curve_; |
| 79 gfx::Transform initial_value_; | 82 gfx::Transform initial_value_; |
| 83 cc::TransformOperations initial_wrapped_value_; |
| 80 gfx::Transform effective_initial_value_; | 84 gfx::Transform effective_initial_value_; |
| 81 base::TimeDelta duration_; | 85 base::TimeDelta duration_; |
| 82 | 86 |
| 83 DISALLOW_ASSIGN(InverseTransformCurveAdapter); | 87 DISALLOW_ASSIGN(InverseTransformCurveAdapter); |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace ui | 90 } // namespace ui |
| 87 | 91 |
| 88 #endif // UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_ | 92 #endif // UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_ |
| 89 | 93 |
| OLD | NEW |