Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: sky/viewer/cc/web_float_animation_curve_impl.cc

Issue 752683002: Break Sky's dependency on cc (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "sky/viewer/cc/web_float_animation_curve_impl.h"
6
7 #include "cc/animation/animation_curve.h"
8 #include "cc/animation/keyframed_animation_curve.h"
9 #include "cc/animation/timing_function.h"
10 #include "sky/viewer/cc/web_animation_curve_common.h"
11
12 using blink::WebFloatKeyframe;
13
14 namespace sky_viewer_cc {
15
16 WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl()
17 : curve_(cc::KeyframedFloatAnimationCurve::Create()) {
18 }
19
20 WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl() {
21 }
22
23 blink::WebCompositorAnimationCurve::AnimationCurveType
24 WebFloatAnimationCurveImpl::type() const {
25 return blink::WebCompositorAnimationCurve::AnimationCurveTypeFloat;
26 }
27
28 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) {
29 add(keyframe, TimingFunctionTypeEase);
30 }
31
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)));
37 }
38
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).Pass()));
47 }
48
49 float WebFloatAnimationCurveImpl::getValue(double time) const {
50 return curve_->GetValue(base::TimeDelta::FromSecondsD(time));
51 }
52
53 scoped_ptr<cc::AnimationCurve>
54 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const {
55 return curve_->Clone();
56 }
57
58 } // namespace sky_viewer_cc
OLDNEW
« no previous file with comments | « sky/viewer/cc/web_float_animation_curve_impl.h ('k') | sky/viewer/cc/web_float_animation_curve_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698