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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 double x2, | 42 double x2, |
43 double y2) { | 43 double y2) { |
44 const cc::FilterOperations& filter_operations = | 44 const cc::FilterOperations& filter_operations = |
45 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) | 45 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) |
46 .AsFilterOperations(); | 46 .AsFilterOperations(); |
47 curve_->AddKeyframe(cc::FilterKeyframe::Create( | 47 curve_->AddKeyframe(cc::FilterKeyframe::Create( |
48 base::TimeDelta::FromSecondsD(keyframe.time()), filter_operations, | 48 base::TimeDelta::FromSecondsD(keyframe.time()), 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::add(const WebFilterKeyframe& keyframe, |
| 53 int steps, |
| 54 float steps_start_offset) { |
| 55 const cc::FilterOperations& filter_operations = |
| 56 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) |
| 57 .AsFilterOperations(); |
| 58 curve_->AddKeyframe(cc::FilterKeyframe::Create( |
| 59 base::TimeDelta::FromSecondsD(keyframe.time()), filter_operations, |
| 60 cc::StepsTimingFunction::Create(steps, steps_start_offset))); |
| 61 } |
| 62 |
52 void WebFilterAnimationCurveImpl::setTimingFunction(TimingFunctionType type) { | 63 void WebFilterAnimationCurveImpl::setTimingFunction(TimingFunctionType type) { |
53 curve_->SetTimingFunction(CreateTimingFunction(type)); | 64 curve_->SetTimingFunction(CreateTimingFunction(type)); |
54 } | 65 } |
55 | 66 |
56 void WebFilterAnimationCurveImpl::setTimingFunction(double x1, | 67 void WebFilterAnimationCurveImpl::setTimingFunction(double x1, |
57 double y1, | 68 double y1, |
58 double x2, | 69 double x2, |
59 double y2) { | 70 double y2) { |
60 curve_->SetTimingFunction( | 71 curve_->SetTimingFunction( |
61 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); | 72 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); |
62 } | 73 } |
63 | 74 |
64 scoped_ptr<cc::AnimationCurve> | 75 scoped_ptr<cc::AnimationCurve> |
65 WebFilterAnimationCurveImpl::CloneToAnimationCurve() const { | 76 WebFilterAnimationCurveImpl::CloneToAnimationCurve() const { |
66 return curve_->Clone(); | 77 return curve_->Clone(); |
67 } | 78 } |
68 | 79 |
69 } // namespace cc_blink | 80 } // namespace cc_blink |
OLD | NEW |