| OLD | NEW |
| 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 #include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl
.h" | 5 #include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl
.h" |
| 6 | 6 |
| 7 #include "cc/animation/keyframed_animation_curve.h" | 7 #include "cc/animation/keyframed_animation_curve.h" |
| 8 #include "cc/animation/timing_function.h" | 8 #include "cc/animation/timing_function.h" |
| 9 #include "cc/animation/transform_operations.h" | 9 #include "cc/animation/transform_operations.h" |
| 10 #include "webkit/renderer/compositor_bindings/web_animation_curve_common.h" | 10 #include "webkit/renderer/compositor_bindings/web_animation_curve_common.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 blink::WebAnimationCurve::AnimationCurveType | 22 blink::WebAnimationCurve::AnimationCurveType |
| 23 WebTransformAnimationCurveImpl::type() const { | 23 WebTransformAnimationCurveImpl::type() const { |
| 24 return WebAnimationCurve::AnimationCurveTypeTransform; | 24 return WebAnimationCurve::AnimationCurveTypeTransform; |
| 25 } | 25 } |
| 26 | 26 |
| 27 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) { | 27 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) { |
| 28 add(keyframe, TimingFunctionTypeEase); | 28 add(keyframe, TimingFunctionTypeEase); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, | 31 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, |
| 32 int steps, |
| 33 bool steps_at_start) { |
| 34 const cc::TransformOperations& transform_operations = |
| 35 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) |
| 36 .AsTransformOperations(); |
| 37 curve_->AddKeyframe(cc::TransformKeyframe::Create( |
| 38 keyframe.time(), |
| 39 transform_operations, |
| 40 cc::StepsTimingFunction::Create(steps, steps_at_start) |
| 41 .PassAs<cc::TimingFunction>())); |
| 42 } |
| 43 |
| 44 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, |
| 32 TimingFunctionType type) { | 45 TimingFunctionType type) { |
| 33 const cc::TransformOperations& transform_operations = | 46 const cc::TransformOperations& transform_operations = |
| 34 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) | 47 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) |
| 35 .AsTransformOperations(); | 48 .AsTransformOperations(); |
| 36 curve_->AddKeyframe(cc::TransformKeyframe::Create( | 49 curve_->AddKeyframe(cc::TransformKeyframe::Create( |
| 37 keyframe.time(), transform_operations, CreateTimingFunction(type))); | 50 keyframe.time(), transform_operations, CreateTimingFunction(type))); |
| 38 } | 51 } |
| 39 | 52 |
| 40 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, | 53 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, |
| 41 double x1, | 54 double x1, |
| 42 double y1, | 55 double y1, |
| 43 double x2, | 56 double x2, |
| 44 double y2) { | 57 double y2) { |
| 45 const cc::TransformOperations& transform_operations = | 58 const cc::TransformOperations& transform_operations = |
| 46 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) | 59 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) |
| 47 .AsTransformOperations(); | 60 .AsTransformOperations(); |
| 48 curve_->AddKeyframe(cc::TransformKeyframe::Create( | 61 curve_->AddKeyframe(cc::TransformKeyframe::Create( |
| 49 keyframe.time(), | 62 keyframe.time(), |
| 50 transform_operations, | 63 transform_operations, |
| 51 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) | 64 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) |
| 52 .PassAs<cc::TimingFunction>())); | 65 .PassAs<cc::TimingFunction>())); |
| 53 } | 66 } |
| 54 | 67 |
| 55 scoped_ptr<cc::AnimationCurve> | 68 scoped_ptr<cc::AnimationCurve> |
| 56 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { | 69 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { |
| 57 return curve_->Clone(); | 70 return curve_->Clone(); |
| 58 } | 71 } |
| 59 | 72 |
| 60 } // namespace webkit | 73 } // namespace webkit |
| OLD | NEW |