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

Side by Side Diff: cc/animation/animation.h

Issue 180153010: Handle direction control in compositor Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new patch: address reviewer comment Created 6 years, 9 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 | « no previous file | cc/animation/animation.cc » ('j') | cc/animation/animation_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 CC_ANIMATION_ANIMATION_H_ 5 #ifndef CC_ANIMATION_ANIMATION_H_
6 #define CC_ANIMATION_ANIMATION_H_ 6 #define CC_ANIMATION_ANIMATION_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
(...skipping 30 matching lines...) Expand all
41 enum TargetProperty { 41 enum TargetProperty {
42 Transform = 0, 42 Transform = 0,
43 Opacity, 43 Opacity,
44 Filter, 44 Filter,
45 ScrollOffset, 45 ScrollOffset,
46 BackgroundColor, 46 BackgroundColor,
47 // This sentinel must be last. 47 // This sentinel must be last.
48 TargetPropertyEnumSize 48 TargetPropertyEnumSize
49 }; 49 };
50 50
51 enum Direction { Normal = 0, Reverse, Alternate, AlternateReverse };
ajuma 2014/03/04 19:02:38 Is the "= 0" needed? (The previous enum only needs
52
51 static scoped_ptr<Animation> Create(scoped_ptr<AnimationCurve> curve, 53 static scoped_ptr<Animation> Create(scoped_ptr<AnimationCurve> curve,
52 int animation_id, 54 int animation_id,
53 int group_id, 55 int group_id,
54 TargetProperty target_property); 56 TargetProperty target_property);
55 57
56 virtual ~Animation(); 58 virtual ~Animation();
57 59
58 int id() const { return id_; } 60 int id() const { return id_; }
59 int group() const { return group_; } 61 int group() const { return group_; }
60 TargetProperty target_property() const { return target_property_; } 62 TargetProperty target_property() const { return target_property_; }
(...skipping 10 matching lines...) Expand all
71 double start_time() const { return start_time_; } 73 double start_time() const { return start_time_; }
72 void set_start_time(double monotonic_time) { start_time_ = monotonic_time; } 74 void set_start_time(double monotonic_time) { start_time_ = monotonic_time; }
73 bool has_set_start_time() const { return !!start_time_; } 75 bool has_set_start_time() const { return !!start_time_; }
74 76
75 double time_offset() const { return time_offset_; } 77 double time_offset() const { return time_offset_; }
76 void set_time_offset(double monotonic_time) { time_offset_ = monotonic_time; } 78 void set_time_offset(double monotonic_time) { time_offset_ = monotonic_time; }
77 79
78 void Suspend(double monotonic_time); 80 void Suspend(double monotonic_time);
79 void Resume(double monotonic_time); 81 void Resume(double monotonic_time);
80 82
81 // If alternates_direction is true, on odd numbered iterations we reverse the 83 Direction direction() { return direction_; }
82 // curve. 84 void set_direction(Direction direction) { direction_ = direction; }
83 bool alternates_direction() const { return alternates_direction_; }
84 void set_alternates_direction(bool alternates) {
85 alternates_direction_ = alternates;
86 }
87 85
88 bool IsFinishedAt(double monotonic_time) const; 86 bool IsFinishedAt(double monotonic_time) const;
89 bool is_finished() const { 87 bool is_finished() const {
90 return run_state_ == Finished || 88 return run_state_ == Finished ||
91 run_state_ == Aborted || 89 run_state_ == Aborted ||
92 run_state_ == WaitingForDeletion; 90 run_state_ == WaitingForDeletion;
93 } 91 }
94 92
95 AnimationCurve* curve() { return curve_.get(); } 93 AnimationCurve* curve() { return curve_.get(); }
96 const AnimationCurve* curve() const { return curve_.get(); } 94 const AnimationCurve* curve() const { return curve_.get(); }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // group id. Grouped animations are guaranteed to start at the same time and 141 // group id. Grouped animations are guaranteed to start at the same time and
144 // no other animations may animate any of the group's target properties until 142 // no other animations may animate any of the group's target properties until
145 // all animations in the group have finished animating. Note: an active 143 // all animations in the group have finished animating. Note: an active
146 // animation's group id and target property uniquely identify that animation. 144 // animation's group id and target property uniquely identify that animation.
147 int group_; 145 int group_;
148 146
149 TargetProperty target_property_; 147 TargetProperty target_property_;
150 RunState run_state_; 148 RunState run_state_;
151 int iterations_; 149 int iterations_;
152 double start_time_; 150 double start_time_;
153 bool alternates_direction_; 151 Direction direction_;
154 152
155 // The time offset effectively pushes the start of the animation back in time. 153 // The time offset effectively pushes the start of the animation back in time.
156 // This is used for resuming paused animations -- an animation is added with a 154 // This is used for resuming paused animations -- an animation is added with a
157 // non-zero time offset, causing the animation to skip ahead to the desired 155 // non-zero time offset, causing the animation to skip ahead to the desired
158 // point in time. 156 // point in time.
159 double time_offset_; 157 double time_offset_;
160 158
161 bool needs_synchronized_start_time_; 159 bool needs_synchronized_start_time_;
162 bool received_finished_event_; 160 bool received_finished_event_;
163 161
(...skipping 19 matching lines...) Expand all
183 bool is_controlling_instance_; 181 bool is_controlling_instance_;
184 182
185 bool is_impl_only_; 183 bool is_impl_only_;
186 184
187 DISALLOW_COPY_AND_ASSIGN(Animation); 185 DISALLOW_COPY_AND_ASSIGN(Animation);
188 }; 186 };
189 187
190 } // namespace cc 188 } // namespace cc
191 189
192 #endif // CC_ANIMATION_ANIMATION_H_ 190 #endif // CC_ANIMATION_ANIMATION_H_
OLDNEW
« no previous file with comments | « no previous file | cc/animation/animation.cc » ('j') | cc/animation/animation_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698