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_filter_animation_curve_impl.h" | 5 #include "cc/blink/web_filter_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/blink/web_animation_curve_common.h" | 9 #include "cc/blink/web_animation_curve_common.h" |
10 #include "cc/blink/web_filter_operations_impl.h" | 10 #include "cc/blink/web_filter_operations_impl.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 WebFilterAnimationCurveImpl::type() const { | 25 WebFilterAnimationCurveImpl::type() const { |
26 return WebCompositorAnimationCurve::AnimationCurveTypeFilter; | 26 return WebCompositorAnimationCurve::AnimationCurveTypeFilter; |
27 } | 27 } |
28 | 28 |
29 void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, | 29 void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, |
30 TimingFunctionType type) { | 30 TimingFunctionType type) { |
31 const cc::FilterOperations& filter_operations = | 31 const cc::FilterOperations& filter_operations = |
32 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) | 32 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) |
33 .AsFilterOperations(); | 33 .AsFilterOperations(); |
34 curve_->AddKeyframe(cc::FilterKeyframe::Create( | 34 curve_->AddKeyframe(cc::FilterKeyframe::Create( |
35 keyframe.time(), filter_operations, CreateTimingFunction(type))); | 35 base::TimeDelta::FromSecondsD(keyframe.time()), filter_operations, |
| 36 CreateTimingFunction(type))); |
36 } | 37 } |
37 | 38 |
38 void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, | 39 void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, |
39 double x1, | 40 double x1, |
40 double y1, | 41 double y1, |
41 double x2, | 42 double x2, |
42 double y2) { | 43 double y2) { |
43 const cc::FilterOperations& filter_operations = | 44 const cc::FilterOperations& filter_operations = |
44 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) | 45 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) |
45 .AsFilterOperations(); | 46 .AsFilterOperations(); |
46 curve_->AddKeyframe(cc::FilterKeyframe::Create( | 47 curve_->AddKeyframe(cc::FilterKeyframe::Create( |
47 keyframe.time(), | 48 base::TimeDelta::FromSecondsD(keyframe.time()), filter_operations, |
48 filter_operations, | |
49 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2))); | 49 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2))); |
50 } | 50 } |
51 | 51 |
52 void WebFilterAnimationCurveImpl::setTimingFunction(TimingFunctionType type) { | 52 void WebFilterAnimationCurveImpl::setTimingFunction(TimingFunctionType type) { |
53 curve_->SetTimingFunction(CreateTimingFunction(type)); | 53 curve_->SetTimingFunction(CreateTimingFunction(type)); |
54 } | 54 } |
55 | 55 |
56 void WebFilterAnimationCurveImpl::setTimingFunction(double x1, | 56 void WebFilterAnimationCurveImpl::setTimingFunction(double x1, |
57 double y1, | 57 double y1, |
58 double x2, | 58 double x2, |
59 double y2) { | 59 double y2) { |
60 curve_->SetTimingFunction( | 60 curve_->SetTimingFunction( |
61 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); | 61 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); |
62 } | 62 } |
63 | 63 |
64 scoped_ptr<cc::AnimationCurve> | 64 scoped_ptr<cc::AnimationCurve> |
65 WebFilterAnimationCurveImpl::CloneToAnimationCurve() const { | 65 WebFilterAnimationCurveImpl::CloneToAnimationCurve() const { |
66 return curve_->Clone(); | 66 return curve_->Clone(); |
67 } | 67 } |
68 | 68 |
69 } // namespace cc_blink | 69 } // namespace cc_blink |
OLD | NEW |