OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "cc/blink/web_animation_impl.h" | 5 #include "cc/blink/web_animation_impl.h" |
6 | 6 |
7 #include "cc/animation/animation.h" | 7 #include "cc/animation/animation.h" |
8 #include "cc/animation/animation_curve.h" | 8 #include "cc/animation/animation_curve.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "cc/blink/web_filter_animation_curve_impl.h" | 10 #include "cc/blink/web_filter_animation_curve_impl.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 double WebCompositorAnimationImpl::timeOffset() const { | 109 double WebCompositorAnimationImpl::timeOffset() const { |
110 return animation_->time_offset().InSecondsF(); | 110 return animation_->time_offset().InSecondsF(); |
111 } | 111 } |
112 | 112 |
113 void WebCompositorAnimationImpl::setTimeOffset(double monotonic_time) { | 113 void WebCompositorAnimationImpl::setTimeOffset(double monotonic_time) { |
114 animation_->set_time_offset(base::TimeDelta::FromSecondsD(monotonic_time)); | 114 animation_->set_time_offset(base::TimeDelta::FromSecondsD(monotonic_time)); |
115 } | 115 } |
116 | 116 |
117 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION | |
118 blink::WebCompositorAnimation::Direction WebCompositorAnimationImpl::direction() | 117 blink::WebCompositorAnimation::Direction WebCompositorAnimationImpl::direction() |
119 const { | 118 const { |
120 switch (animation_->direction()) { | 119 switch (animation_->direction()) { |
121 case cc::Animation::Normal: | 120 case cc::Animation::Normal: |
122 return DirectionNormal; | 121 return DirectionNormal; |
123 case cc::Animation::Reverse: | 122 case cc::Animation::Reverse: |
124 return DirectionReverse; | 123 return DirectionReverse; |
125 case cc::Animation::Alternate: | 124 case cc::Animation::Alternate: |
126 return DirectionAlternate; | 125 return DirectionAlternate; |
127 case cc::Animation::AlternateReverse: | 126 case cc::Animation::AlternateReverse: |
(...skipping 13 matching lines...) Expand all Loading... |
141 animation_->set_direction(cc::Animation::Reverse); | 140 animation_->set_direction(cc::Animation::Reverse); |
142 break; | 141 break; |
143 case DirectionAlternate: | 142 case DirectionAlternate: |
144 animation_->set_direction(cc::Animation::Alternate); | 143 animation_->set_direction(cc::Animation::Alternate); |
145 break; | 144 break; |
146 case DirectionAlternateReverse: | 145 case DirectionAlternateReverse: |
147 animation_->set_direction(cc::Animation::AlternateReverse); | 146 animation_->set_direction(cc::Animation::AlternateReverse); |
148 break; | 147 break; |
149 } | 148 } |
150 } | 149 } |
151 #else | |
152 bool WebCompositorAnimationImpl::alternatesDirection() const { | |
153 return animation_->direction() == cc::Animation::Alternate; | |
154 } | |
155 | |
156 void WebCompositorAnimationImpl::setAlternatesDirection(bool alternates) { | |
157 if (alternates) | |
158 animation_->set_direction(cc::Animation::Alternate); | |
159 else | |
160 animation_->set_direction(cc::Animation::Normal); | |
161 } | |
162 #endif | |
163 | 150 |
164 double WebCompositorAnimationImpl::playbackRate() const { | 151 double WebCompositorAnimationImpl::playbackRate() const { |
165 return animation_->playback_rate(); | 152 return animation_->playback_rate(); |
166 } | 153 } |
167 | 154 |
168 void WebCompositorAnimationImpl::setPlaybackRate(double playback_rate) { | 155 void WebCompositorAnimationImpl::setPlaybackRate(double playback_rate) { |
169 animation_->set_playback_rate(playback_rate); | 156 animation_->set_playback_rate(playback_rate); |
170 } | 157 } |
171 | 158 |
172 scoped_ptr<cc::Animation> WebCompositorAnimationImpl::PassAnimation() { | 159 scoped_ptr<cc::Animation> WebCompositorAnimationImpl::PassAnimation() { |
173 animation_->set_needs_synchronized_start_time(true); | 160 animation_->set_needs_synchronized_start_time(true); |
174 return animation_.Pass(); | 161 return animation_.Pass(); |
175 } | 162 } |
176 | 163 |
177 } // namespace cc_blink | 164 } // namespace cc_blink |
OLD | NEW |