OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h" | |
6 | |
7 #include "cc/animation/keyframed_animation_curve.h" | |
8 #include "cc/animation/timing_function.h" | |
9 #include "cc/output/filter_operations.h" | |
10 #include "webkit/renderer/compositor_bindings/web_animation_curve_common.h" | |
11 #include "webkit/renderer/compositor_bindings/web_filter_operations_impl.h" | |
12 | |
13 using blink::WebFilterKeyframe; | |
14 | |
15 namespace webkit { | |
16 | |
17 WebFilterAnimationCurveImpl::WebFilterAnimationCurveImpl() | |
18 : curve_(cc::KeyframedFilterAnimationCurve::Create()) {} | |
19 | |
20 WebFilterAnimationCurveImpl::~WebFilterAnimationCurveImpl() {} | |
21 | |
22 blink::WebAnimationCurve::AnimationCurveType | |
23 WebFilterAnimationCurveImpl::type() const { | |
24 return WebAnimationCurve::AnimationCurveTypeFilter; | |
25 } | |
26 | |
27 void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, | |
28 TimingFunctionType type) { | |
29 const cc::FilterOperations& filter_operations = | |
30 static_cast<const webkit::WebFilterOperationsImpl&>(keyframe.value()) | |
31 .AsFilterOperations(); | |
32 curve_->AddKeyframe(cc::FilterKeyframe::Create( | |
33 keyframe.time(), filter_operations, CreateTimingFunction(type))); | |
34 } | |
35 | |
36 void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe, | |
37 double x1, | |
38 double y1, | |
39 double x2, | |
40 double y2) { | |
41 const cc::FilterOperations& filter_operations = | |
42 static_cast<const webkit::WebFilterOperationsImpl&>(keyframe.value()) | |
43 .AsFilterOperations(); | |
44 curve_->AddKeyframe(cc::FilterKeyframe::Create( | |
45 keyframe.time(), | |
46 filter_operations, | |
47 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) | |
48 .PassAs<cc::TimingFunction>())); | |
49 } | |
50 | |
51 scoped_ptr<cc::AnimationCurve> | |
52 WebFilterAnimationCurveImpl::CloneToAnimationCurve() const { | |
53 return curve_->Clone(); | |
54 } | |
55 | |
56 } // namespace webkit | |
OLD | NEW |