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/compositor_bindings/web_transform_animation_curve_impl.h" | 5 #include "webkit/compositor_bindings/web_transform_animation_curve_impl.h" |
6 | 6 |
7 #include "cc/keyframed_animation_curve.h" | 7 #include "cc/keyframed_animation_curve.h" |
8 #include "cc/timing_function.h" | 8 #include "cc/timing_function.h" |
9 #include "cc/transform_operations.h" | 9 #include "cc/transform_operations.h" |
10 #include "webkit/compositor_bindings/web_animation_curve_common.h" | 10 #include "webkit/compositor_bindings/web_animation_curve_common.h" |
11 #include "webkit/compositor_bindings/web_transform_operations_impl.h" | 11 #include "webkit/compositor_bindings/web_transform_operations_impl.h" |
12 #include "webkit/compositor_bindings/web_transformation_matrix_util.h" | 12 #include "webkit/compositor_bindings/web_transformation_matrix_util.h" |
13 | 13 |
14 namespace WebKit { | 14 namespace WebKit { |
15 | 15 |
16 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() | 16 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() |
17 : curve_(cc::KeyframedTransformAnimationCurve::create()) {} | 17 : curve_(cc::KeyframedTransformAnimationCurve::Create()) {} |
18 | 18 |
19 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() {} | 19 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() {} |
20 | 20 |
21 WebAnimationCurve::AnimationCurveType | 21 WebAnimationCurve::AnimationCurveType |
22 WebTransformAnimationCurveImpl::type() const { | 22 WebTransformAnimationCurveImpl::type() const { |
23 return WebAnimationCurve::AnimationCurveTypeTransform; | 23 return WebAnimationCurve::AnimationCurveTypeTransform; |
24 } | 24 } |
25 | 25 |
26 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) { | 26 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) { |
27 add(keyframe, TimingFunctionTypeEase); | 27 add(keyframe, TimingFunctionTypeEase); |
28 } | 28 } |
29 | 29 |
30 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, | 30 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, |
31 TimingFunctionType type) { | 31 TimingFunctionType type) { |
32 const cc::TransformOperations& transform_operations = | 32 const cc::TransformOperations& transform_operations = |
33 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) | 33 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) |
34 .AsTransformOperations(); | 34 .AsTransformOperations(); |
35 curve_->addKeyframe(cc::TransformKeyframe::create( | 35 curve_->AddKeyframe(cc::TransformKeyframe::Create( |
36 keyframe.time(), transform_operations, createTimingFunction(type))); | 36 keyframe.time(), transform_operations, createTimingFunction(type))); |
37 } | 37 } |
38 | 38 |
39 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, | 39 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, |
40 double x1, | 40 double x1, |
41 double y1, | 41 double y1, |
42 double x2, | 42 double x2, |
43 double y2) { | 43 double y2) { |
44 const cc::TransformOperations& transform_operations = | 44 const cc::TransformOperations& transform_operations = |
45 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) | 45 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) |
46 .AsTransformOperations(); | 46 .AsTransformOperations(); |
47 curve_->addKeyframe(cc::TransformKeyframe::create( | 47 curve_->AddKeyframe(cc::TransformKeyframe::Create( |
48 keyframe.time(), | 48 keyframe.time(), |
49 transform_operations, | 49 transform_operations, |
50 cc::CubicBezierTimingFunction::create(x1, y1, x2, y2) | 50 cc::CubicBezierTimingFunction::create(x1, y1, x2, y2) |
51 .PassAs<cc::TimingFunction>())); | 51 .PassAs<cc::TimingFunction>())); |
52 } | 52 } |
53 | 53 |
54 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue( | 54 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue( |
55 double time) const { | 55 double time) const { |
56 return WebTransformationMatrix(); | 56 return WebTransformationMatrix(); |
57 } | 57 } |
58 | 58 |
59 scoped_ptr<cc::AnimationCurve> | 59 scoped_ptr<cc::AnimationCurve> |
60 WebTransformAnimationCurveImpl::cloneToAnimationCurve() const { | 60 WebTransformAnimationCurveImpl::cloneToAnimationCurve() const { |
61 return curve_->clone(); | 61 return curve_->Clone(); |
62 } | 62 } |
63 | 63 |
64 } // namespace WebKit | 64 } // namespace WebKit |
OLD | NEW |