OLD | NEW |
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/base/animation/tween.h" | 5 #include "ui/base/animation/tween.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <float.h> | 10 #include <float.h> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const gfx::Rect& target_bounds) { | 89 const gfx::Rect& target_bounds) { |
90 return gfx::Rect(ValueBetween(value, start_bounds.x(), target_bounds.x()), | 90 return gfx::Rect(ValueBetween(value, start_bounds.x(), target_bounds.x()), |
91 ValueBetween(value, start_bounds.y(), target_bounds.y()), | 91 ValueBetween(value, start_bounds.y(), target_bounds.y()), |
92 ValueBetween(value, start_bounds.width(), | 92 ValueBetween(value, start_bounds.width(), |
93 target_bounds.width()), | 93 target_bounds.width()), |
94 ValueBetween(value, start_bounds.height(), | 94 ValueBetween(value, start_bounds.height(), |
95 target_bounds.height())); | 95 target_bounds.height())); |
96 } | 96 } |
97 | 97 |
98 // static | 98 // static |
99 Transform Tween::ValueBetween(double value, | 99 gfx::Transform Tween::ValueBetween(double value, |
100 const Transform& start_transform, | 100 const gfx::Transform& start_transform, |
101 const Transform& end_transform) { | 101 const gfx::Transform& end_transform) { |
102 if (value >= 1.0) | 102 if (value >= 1.0) |
103 return end_transform; | 103 return end_transform; |
104 if (value <= 0.0) | 104 if (value <= 0.0) |
105 return start_transform; | 105 return start_transform; |
106 | 106 |
107 Transform to_return; | 107 gfx::Transform to_return; |
108 gfx::Point start_translation, end_translation; | 108 gfx::Point start_translation, end_translation; |
109 float start_rotation, end_rotation; | 109 float start_rotation, end_rotation; |
110 gfx::Point3f start_scale, end_scale; | 110 gfx::Point3f start_scale, end_scale; |
111 if (InterpolatedTransform::FactorTRS(start_transform, | 111 if (InterpolatedTransform::FactorTRS(start_transform, |
112 &start_translation, | 112 &start_translation, |
113 &start_rotation, | 113 &start_rotation, |
114 &start_scale) && | 114 &start_scale) && |
115 InterpolatedTransform::FactorTRS(end_transform, | 115 InterpolatedTransform::FactorTRS(end_transform, |
116 &end_translation, | 116 &end_translation, |
117 &end_rotation, | 117 &end_rotation, |
(...skipping 12 matching lines...) Expand all Loading... |
130 start_transform.matrix().get(row, col), | 130 start_transform.matrix().get(row, col), |
131 end_transform.matrix().get(row, col))); | 131 end_transform.matrix().get(row, col))); |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 return to_return; | 136 return to_return; |
137 } | 137 } |
138 | 138 |
139 } // namespace ui | 139 } // namespace ui |
OLD | NEW |