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

Side by Side Diff: ui/compositor/transform_animation_curve_adapter.h

Issue 22861008: Add support for inverse transform animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed loop condition nit. Created 7 years, 3 months 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 | « ui/compositor/test/test_utils.cc ('k') | ui/compositor/transform_animation_curve_adapter.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 (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 "base/time/time.h" 8 #include "base/time/time.h"
9 #include "cc/animation/animation_curve.h" 9 #include "cc/animation/animation_curve.h"
10 #include "ui/base/animation/tween.h" 10 #include "ui/base/animation/tween.h"
11 #include "ui/compositor/compositor_export.h"
11 #include "ui/gfx/transform.h" 12 #include "ui/gfx/transform.h"
12 #include "ui/gfx/transform_util.h" 13 #include "ui/gfx/transform_util.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 class TransformAnimationCurveAdapter :public cc::TransformAnimationCurve { 17 class COMPOSITOR_EXPORT TransformAnimationCurveAdapter
18 : public cc::TransformAnimationCurve {
17 public: 19 public:
18 TransformAnimationCurveAdapter(Tween::Type tween_type, 20 TransformAnimationCurveAdapter(Tween::Type tween_type,
19 gfx::Transform intial_value, 21 gfx::Transform intial_value,
20 gfx::Transform target_value, 22 gfx::Transform target_value,
21 base::TimeDelta duration); 23 base::TimeDelta duration);
22 24
23 virtual ~TransformAnimationCurveAdapter(); 25 virtual ~TransformAnimationCurveAdapter();
24 26
25 // TransformAnimationCurve implementation. 27 // TransformAnimationCurve implementation.
26 virtual double Duration() const OVERRIDE; 28 virtual double Duration() const OVERRIDE;
27 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; 29 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
28 virtual gfx::Transform GetValue(double t) const OVERRIDE; 30 virtual gfx::Transform GetValue(double t) const OVERRIDE;
29 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, 31 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box,
30 gfx::BoxF* bounds) const OVERRIDE; 32 gfx::BoxF* bounds) const OVERRIDE;
31 33
32 private: 34 private:
33 Tween::Type tween_type_; 35 Tween::Type tween_type_;
34 gfx::Transform initial_value_; 36 gfx::Transform initial_value_;
35 gfx::Transform target_value_; 37 gfx::Transform target_value_;
36 gfx::DecomposedTransform decomposed_initial_value_; 38 gfx::DecomposedTransform decomposed_initial_value_;
37 gfx::DecomposedTransform decomposed_target_value_; 39 gfx::DecomposedTransform decomposed_target_value_;
38 base::TimeDelta duration_; 40 base::TimeDelta duration_;
41
42 DISALLOW_ASSIGN(TransformAnimationCurveAdapter);
43 };
44
45 class COMPOSITOR_EXPORT InverseTransformCurveAdapter
46 : public cc::TransformAnimationCurve {
47 public:
48 InverseTransformCurveAdapter(TransformAnimationCurveAdapter base_curve,
49 gfx::Transform initial_value,
50 base::TimeDelta duration);
51
52 virtual ~InverseTransformCurveAdapter();
53
54 virtual double Duration() const OVERRIDE;
55 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
56 virtual gfx::Transform GetValue(double t) const OVERRIDE;
57 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box,
58 gfx::BoxF* bounds) const OVERRIDE;
59
60 private:
61 TransformAnimationCurveAdapter base_curve_;
62 gfx::Transform initial_value_;
63 gfx::Transform effective_initial_value_;
64 base::TimeDelta duration_;
65
66 DISALLOW_ASSIGN(InverseTransformCurveAdapter);
39 }; 67 };
40 68
41 } // namespace ui 69 } // namespace ui
42 70
43 #endif // UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_ 71 #endif // UI_COMPOSITOR_TRANSFORM_ANIMATION_CURVE_ADAPTER_H_
44 72
OLDNEW
« no previous file with comments | « ui/compositor/test/test_utils.cc ('k') | ui/compositor/transform_animation_curve_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698