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

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

Issue 11876016: Define cc::TransformOperations and webkit::WebTransformOperationsImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Put TransformOperation into its own header 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 {
36 #if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
37 const cc::TransformOperations& transformOperations =
38 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) .AsTransformOperations();
39 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time(), transfor mOperations, createTimingFunction(type)));
40 #else
34 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v alue, createTimingFunction(type))); 41 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v alue, createTimingFunction(type)));
42 #endif
35 } 43 }
36 44
37 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, d ouble x1, double y1, double x2, double y2) 45 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, d ouble x1, double y1, double x2, double y2)
38 { 46 {
47 #if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
48 const cc::TransformOperations& transformOperations =
49 static_cast<const webkit::WebTransformOperationsImpl&>(keyframe.value()) .AsTransformOperations();
50 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time(), transfor mOperations, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::Ti mingFunction>()));
51 #else
39 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v alue, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFun ction>())); 52 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v alue, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFun ction>()));
53 #endif
40 } 54 }
41 55
42 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co nst 56 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co nst
43 { 57 {
44 return m_curve->getValue(time); 58 return m_curve->getValue(time);
45 } 59 }
46 60
47 scoped_ptr<cc::AnimationCurve> WebTransformAnimationCurveImpl::cloneToAnimationC urve() const 61 scoped_ptr<cc::AnimationCurve> WebTransformAnimationCurveImpl::cloneToAnimationC urve() const
48 { 62 {
49 return m_curve->clone(); 63 return m_curve->clone();
50 } 64 }
51 65
52 } // namespace WebKit 66 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698