roll libyuv to r1437 to resolve msan overread on odd width ARGBToYUY2.
[chromium-blink-merge.git] / cc / blink / web_transform_animation_curve_impl.cc
blob4dafd1012d49ce3e43e7a60ce6cf1767af4af2d0
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
3 // found in the LICENSE file.
5 #include "cc/blink/web_transform_animation_curve_impl.h"
7 #include "cc/animation/keyframed_animation_curve.h"
8 #include "cc/animation/timing_function.h"
9 #include "cc/animation/transform_operations.h"
10 #include "cc/blink/web_animation_curve_common.h"
11 #include "cc/blink/web_transform_operations_impl.h"
13 using blink::WebTransformKeyframe;
15 namespace cc_blink {
17 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl()
18 : curve_(cc::KeyframedTransformAnimationCurve::Create()) {
21 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() {
24 blink::WebCompositorAnimationCurve::AnimationCurveType
25 WebTransformAnimationCurveImpl::type() const {
26 return WebCompositorAnimationCurve::AnimationCurveTypeTransform;
29 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) {
30 add(keyframe, TimingFunctionTypeEase);
33 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe,
34 TimingFunctionType type) {
35 const cc::TransformOperations& transform_operations =
36 static_cast<const WebTransformOperationsImpl&>(keyframe.value())
37 .AsTransformOperations();
38 curve_->AddKeyframe(cc::TransformKeyframe::Create(
39 base::TimeDelta::FromSecondsD(keyframe.time()), transform_operations,
40 CreateTimingFunction(type)));
43 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe,
44 double x1,
45 double y1,
46 double x2,
47 double y2) {
48 const cc::TransformOperations& transform_operations =
49 static_cast<const WebTransformOperationsImpl&>(keyframe.value())
50 .AsTransformOperations();
51 curve_->AddKeyframe(cc::TransformKeyframe::Create(
52 base::TimeDelta::FromSecondsD(keyframe.time()), transform_operations,
53 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2)));
56 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe,
57 int steps,
58 float steps_start_offset) {
59 const cc::TransformOperations& transform_operations =
60 static_cast<const WebTransformOperationsImpl&>(keyframe.value())
61 .AsTransformOperations();
62 curve_->AddKeyframe(cc::TransformKeyframe::Create(
63 base::TimeDelta::FromSecondsD(keyframe.time()), transform_operations,
64 cc::StepsTimingFunction::Create(steps, steps_start_offset)));
67 void WebTransformAnimationCurveImpl::setLinearTimingFunction() {
68 curve_->SetTimingFunction(nullptr);
71 void WebTransformAnimationCurveImpl::setCubicBezierTimingFunction(
72 TimingFunctionType type) {
73 curve_->SetTimingFunction(CreateTimingFunction(type));
76 void WebTransformAnimationCurveImpl::setCubicBezierTimingFunction(double x1,
77 double y1,
78 double x2,
79 double y2) {
80 curve_->SetTimingFunction(
81 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass());
84 void WebTransformAnimationCurveImpl::setStepsTimingFunction(
85 int number_of_steps,
86 float steps_start_offset) {
87 curve_->SetTimingFunction(cc::StepsTimingFunction::Create(
88 number_of_steps, steps_start_offset).Pass());
91 scoped_ptr<cc::AnimationCurve>
92 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const {
93 return curve_->Clone();
96 } // namespace cc_blink