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

Side by Side Diff: webkit/renderer/compositor_bindings/web_float_animation_curve_impl.cc

Issue 140253013: Define accelerated steps time function. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl upload Created 6 years, 10 months 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" 5 #include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h"
6 6
7 #include "cc/animation/animation_curve.h" 7 #include "cc/animation/animation_curve.h"
8 #include "cc/animation/keyframed_animation_curve.h" 8 #include "cc/animation/keyframed_animation_curve.h"
9 #include "cc/animation/timing_function.h" 9 #include "cc/animation/timing_function.h"
10 #include "webkit/renderer/compositor_bindings/web_animation_curve_common.h" 10 #include "webkit/renderer/compositor_bindings/web_animation_curve_common.h"
(...skipping 16 matching lines...) Expand all
27 add(keyframe, TimingFunctionTypeEase); 27 add(keyframe, TimingFunctionTypeEase);
28 } 28 }
29 29
30 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, 30 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
31 TimingFunctionType type) { 31 TimingFunctionType type) {
32 curve_->AddKeyframe(cc::FloatKeyframe::Create( 32 curve_->AddKeyframe(cc::FloatKeyframe::Create(
33 keyframe.time, keyframe.value, CreateTimingFunction(type))); 33 keyframe.time, keyframe.value, CreateTimingFunction(type)));
34 } 34 }
35 35
36 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, 36 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
37 int steps,
38 bool stepsAtStart) {
39 curve_->AddKeyframe(cc::FloatKeyframe::Create(
40 keyframe.time,
41 keyframe.value,
42 cc::StepsTimingFunction::Create(steps, stepsAtStart)
43 .PassAs<cc::TimingFunction>()));
44 }
45
46 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
37 double x1, 47 double x1,
38 double y1, 48 double y1,
39 double x2, 49 double x2,
40 double y2) { 50 double y2) {
41 curve_->AddKeyframe(cc::FloatKeyframe::Create( 51 curve_->AddKeyframe(cc::FloatKeyframe::Create(
42 keyframe.time, 52 keyframe.time,
43 keyframe.value, 53 keyframe.value,
44 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) 54 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2)
45 .PassAs<cc::TimingFunction>())); 55 .PassAs<cc::TimingFunction>()));
46 } 56 }
47 57
48 float WebFloatAnimationCurveImpl::getValue(double time) const { 58 float WebFloatAnimationCurveImpl::getValue(double time) const {
49 return curve_->GetValue(time); 59 return curve_->GetValue(time);
50 } 60 }
51 61
52 scoped_ptr<cc::AnimationCurve> 62 scoped_ptr<cc::AnimationCurve>
53 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { 63 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const {
54 return curve_->Clone(); 64 return curve_->Clone();
55 } 65 }
56 66
57 } // namespace webkit 67 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698