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

Side by Side Diff: webkit/compositor_bindings/web_transform_animation_curve_impl.cc

Issue 11745018: Not for review: Move the implementation of WebTransformOperations into chromium (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: New approach Created 7 years, 11 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/compositor_bindings/web_transform_animation_curve_impl.h" 5 #include "webkit/compositor_bindings/web_transform_animation_curve_impl.h"
6 6
7 #include "cc/keyframed_animation_curve.h" 7 #include "cc/keyframed_animation_curve.h"
8 #include "cc/timing_function.h" 8 #include "cc/timing_function.h"
9 #include "cc/transform_operations.h"
9 #include "webkit/compositor_bindings/web_animation_curve_common.h" 10 #include "webkit/compositor_bindings/web_animation_curve_common.h"
11 #include "webkit/compositor_bindings/web_transform_operations_impl.h"
10 12
11 namespace WebKit { 13 namespace WebKit {
12 14
13 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() 15 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl()
14 : m_curve(cc::KeyframedTransformAnimationCurve::create()) 16 : m_curve(cc::KeyframedTransformAnimationCurve::create())
15 { 17 {
16 } 18 }
17 19
18 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() 20 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl()
19 { 21 {
20 } 22 }
21 23
22 WebAnimationCurve::AnimationCurveType WebTransformAnimationCurveImpl::type() con st 24 WebAnimationCurve::AnimationCurveType WebTransformAnimationCurveImpl::type() con st
23 { 25 {
24 return WebAnimationCurve::AnimationCurveTypeTransform; 26 return WebAnimationCurve::AnimationCurveTypeTransform;
25 } 27 }
26 28
27 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) 29 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe)
28 { 30 {
29 add(keyframe, TimingFunctionTypeEase); 31 add(keyframe, TimingFunctionTypeEase);
30 } 32 }
31 33
32 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, T imingFunctionType type) 34 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, T imingFunctionType type)
33 { 35 {
34 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v alue, createTimingFunction(type))); 36 const cc::TransformOperations& transformOperations =
37 static_cast<const WebTransformOperationsImpl&>(keyframe.value()).AsTrans formOperations();
38 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time(), transfor mOperations, createTimingFunction(type)));
35 } 39 }
36 40
37 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, d ouble x1, double y1, double x2, double y2) 41 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, d ouble x1, double y1, double x2, double y2)
38 { 42 {
39 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v alue, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFun ction>())); 43 const cc::TransformOperations& transformOperations =
44 static_cast<const WebTransformOperationsImpl&>(keyframe.value()).AsTrans formOperations();
45 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time(), transfor mOperations, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::Ti mingFunction>()));
40 } 46 }
41 47
42 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co nst 48 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co nst
43 { 49 {
44 return m_curve->getValue(time); 50 return m_curve->getValue(time);
45 } 51 }
46 52
47 scoped_ptr<cc::AnimationCurve> WebTransformAnimationCurveImpl::cloneToAnimationC urve() const 53 scoped_ptr<cc::AnimationCurve> WebTransformAnimationCurveImpl::cloneToAnimationC urve() const
48 { 54 {
49 return m_curve->clone(); 55 return m_curve->clone();
50 } 56 }
51 57
52 } // namespace WebKit 58 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698