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

Side by Side Diff: ui/compositor/transform_animation_curve_adapter.cc

Issue 12035029: Finish migrating cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix nits Created 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/compositor/transform_animation_curve_adapter.h" 5 #include "ui/compositor/transform_animation_curve_adapter.h"
6 6
7 using WebKit::WebTransformationMatrix;
8
9 namespace {
10 // TODO(ajuma): Remove this once the return type of
11 // cc::TransformAnimationCurve::getValue is changed to gfx::Transform.
12 WebTransformationMatrix convertTransformToWebTransformationMatrix(
13 const gfx::Transform& transform) {
14 return WebTransformationMatrix(transform.matrix().getDouble(0, 0),
15 transform.matrix().getDouble(1, 0),
16 transform.matrix().getDouble(2, 0),
17 transform.matrix().getDouble(3, 0),
18 transform.matrix().getDouble(0, 1),
19 transform.matrix().getDouble(1, 1),
20 transform.matrix().getDouble(2, 1),
21 transform.matrix().getDouble(3, 1),
22 transform.matrix().getDouble(0, 2),
23 transform.matrix().getDouble(1, 2),
24 transform.matrix().getDouble(2, 2),
25 transform.matrix().getDouble(3, 2),
26 transform.matrix().getDouble(0, 3),
27 transform.matrix().getDouble(1, 3),
28 transform.matrix().getDouble(2, 3),
29 transform.matrix().getDouble(3, 3));
30
31 }
32 } // namespace
33
34 namespace ui { 7 namespace ui {
35 8
36 TransformAnimationCurveAdapter::TransformAnimationCurveAdapter( 9 TransformAnimationCurveAdapter::TransformAnimationCurveAdapter(
37 Tween::Type tween_type, 10 Tween::Type tween_type,
38 gfx::Transform initial_value, 11 gfx::Transform initial_value,
39 gfx::Transform target_value, 12 gfx::Transform target_value,
40 base::TimeDelta duration) 13 base::TimeDelta duration)
41 : tween_type_(tween_type), 14 : tween_type_(tween_type),
42 initial_value_(initial_value), 15 initial_value_(initial_value),
43 target_value_(target_value), 16 target_value_(target_value),
(...skipping 11 matching lines...) Expand all
55 28
56 scoped_ptr<cc::AnimationCurve> TransformAnimationCurveAdapter::clone() const { 29 scoped_ptr<cc::AnimationCurve> TransformAnimationCurveAdapter::clone() const {
57 scoped_ptr<TransformAnimationCurveAdapter> to_return( 30 scoped_ptr<TransformAnimationCurveAdapter> to_return(
58 new TransformAnimationCurveAdapter(tween_type_, 31 new TransformAnimationCurveAdapter(tween_type_,
59 initial_value_, 32 initial_value_,
60 target_value_, 33 target_value_,
61 duration_)); 34 duration_));
62 return to_return.PassAs<cc::AnimationCurve>(); 35 return to_return.PassAs<cc::AnimationCurve>();
63 } 36 }
64 37
65 WebTransformationMatrix TransformAnimationCurveAdapter::getValue( 38 gfx::Transform TransformAnimationCurveAdapter::getValue(
66 double t) const { 39 double t) const {
67 if (t >= duration_.InSecondsF()) 40 if (t >= duration_.InSecondsF())
68 return convertTransformToWebTransformationMatrix(target_value_); 41 return target_value_;
69 if (t <= 0.0) 42 if (t <= 0.0)
70 return convertTransformToWebTransformationMatrix(initial_value_); 43 return initial_value_;
71 double progress = t / duration_.InSecondsF(); 44 double progress = t / duration_.InSecondsF();
72 45
73 gfx::DecomposedTransform to_return; 46 gfx::DecomposedTransform to_return;
74 gfx::BlendDecomposedTransforms(&to_return, 47 gfx::BlendDecomposedTransforms(&to_return,
75 decomposed_initial_value_, 48 decomposed_initial_value_,
76 decomposed_target_value_, 49 decomposed_target_value_,
77 Tween::CalculateValue(tween_type_, progress)); 50 Tween::CalculateValue(tween_type_, progress));
78 return convertTransformToWebTransformationMatrix( 51 return gfx::ComposeTransform(to_return);
79 gfx::ComposeTransform(to_return));
80 } 52 }
81 53
82 } // namespace ui 54 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/transform_animation_curve_adapter.h ('k') | webkit/compositor_bindings/compositor_bindings.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698