Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / cc / blink / web_float_animation_curve_impl.cc
blob4340ae8bdabbeed29f9f2ea8d210fd423b5107cf
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_float_animation_curve_impl.h"
7 #include "cc/animation/animation_curve.h"
8 #include "cc/animation/keyframed_animation_curve.h"
9 #include "cc/animation/timing_function.h"
10 #include "cc/blink/web_animation_curve_common.h"
12 using blink::WebFloatKeyframe;
14 namespace cc_blink {
16 WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl()
17 : curve_(cc::KeyframedFloatAnimationCurve::Create()) {
20 WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl() {
23 blink::WebCompositorAnimationCurve::AnimationCurveType
24 WebFloatAnimationCurveImpl::type() const {
25 return blink::WebCompositorAnimationCurve::AnimationCurveTypeFloat;
28 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) {
29 add(keyframe, TimingFunctionTypeEase);
32 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
33 TimingFunctionType type) {
34 curve_->AddKeyframe(
35 cc::FloatKeyframe::Create(base::TimeDelta::FromSecondsD(keyframe.time),
36 keyframe.value, CreateTimingFunction(type)));
39 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
40 double x1,
41 double y1,
42 double x2,
43 double y2) {
44 curve_->AddKeyframe(cc::FloatKeyframe::Create(
45 base::TimeDelta::FromSecondsD(keyframe.time), keyframe.value,
46 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2)));
49 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
50 int steps,
51 float steps_start_offset) {
52 curve_->AddKeyframe(cc::FloatKeyframe::Create(
53 base::TimeDelta::FromSecondsD(keyframe.time), keyframe.value,
54 cc::StepsTimingFunction::Create(steps, steps_start_offset)));
57 void WebFloatAnimationCurveImpl::setLinearTimingFunction() {
58 curve_->SetTimingFunction(nullptr);
61 void WebFloatAnimationCurveImpl::setCubicBezierTimingFunction(
62 TimingFunctionType type) {
63 curve_->SetTimingFunction(CreateTimingFunction(type));
66 void WebFloatAnimationCurveImpl::setCubicBezierTimingFunction(double x1,
67 double y1,
68 double x2,
69 double y2) {
70 curve_->SetTimingFunction(
71 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass());
74 void WebFloatAnimationCurveImpl::setStepsTimingFunction(
75 int number_of_steps,
76 float steps_start_offset) {
77 curve_->SetTimingFunction(cc::StepsTimingFunction::Create(
78 number_of_steps, steps_start_offset).Pass());
81 float WebFloatAnimationCurveImpl::getValue(double time) const {
82 return curve_->GetValue(base::TimeDelta::FromSecondsD(time));
85 scoped_ptr<cc::AnimationCurve>
86 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const {
87 return curve_->Clone();
90 } // namespace cc_blink