| 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 18 matching lines...) Expand all Loading... |
| 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 keyframe.time(), filter_operations, CreateTimingFunction(type))); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, | 38 void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, |
| 39 int steps, |
| 40 bool steps_at_start) { |
| 41 const cc::FilterOperations& filter_operations = |
| 42 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) |
| 43 .AsFilterOperations(); |
| 44 curve_->AddKeyframe(cc::FilterKeyframe::Create( |
| 45 keyframe.time(), |
| 46 filter_operations, |
| 47 cc::StepsTimingFunction::Create(steps, steps_at_start) |
| 48 .PassAs<cc::TimingFunction>())); |
| 49 } |
| 50 |
| 51 void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, |
| 39 double x1, | 52 double x1, |
| 40 double y1, | 53 double y1, |
| 41 double x2, | 54 double x2, |
| 42 double y2) { | 55 double y2) { |
| 43 const cc::FilterOperations& filter_operations = | 56 const cc::FilterOperations& filter_operations = |
| 44 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) | 57 static_cast<const WebFilterOperationsImpl&>(keyframe.value()) |
| 45 .AsFilterOperations(); | 58 .AsFilterOperations(); |
| 46 curve_->AddKeyframe(cc::FilterKeyframe::Create( | 59 curve_->AddKeyframe(cc::FilterKeyframe::Create( |
| 47 keyframe.time(), | 60 keyframe.time(), |
| 48 filter_operations, | 61 filter_operations, |
| 49 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) | 62 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) |
| 50 .PassAs<cc::TimingFunction>())); | 63 .PassAs<cc::TimingFunction>())); |
| 51 } | 64 } |
| 52 | 65 |
| 53 scoped_ptr<cc::AnimationCurve> | 66 scoped_ptr<cc::AnimationCurve> |
| 54 WebFilterAnimationCurveImpl::CloneToAnimationCurve() const { | 67 WebFilterAnimationCurveImpl::CloneToAnimationCurve() const { |
| 55 return curve_->Clone(); | 68 return curve_->Clone(); |
| 56 } | 69 } |
| 57 | 70 |
| 58 } // namespace cc_blink | 71 } // namespace cc_blink |
| OLD | NEW |