OLD | NEW |
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 "cc/input/page_scale_animation.h" | 5 #include "cc/input/page_scale_animation.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/point_f.h" | 10 #include "ui/gfx/point_f.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 viewport_size.width(), | 28 viewport_size.width(), |
29 viewport_size.height()); | 29 viewport_size.height()); |
30 } | 30 } |
31 | 31 |
32 gfx::Vector2dF InterpolateBetween(gfx::Vector2dF start, | 32 gfx::Vector2dF InterpolateBetween(gfx::Vector2dF start, |
33 gfx::Vector2dF end, | 33 gfx::Vector2dF end, |
34 float interp) { | 34 float interp) { |
35 return start + gfx::ScaleVector2d(end - start, interp); | 35 return start + gfx::ScaleVector2d(end - start, interp); |
36 } | 36 } |
37 | 37 |
38 } | 38 } // namespace |
39 | 39 |
40 namespace cc { | 40 namespace cc { |
41 | 41 |
42 scoped_ptr<PageScaleAnimation> PageScaleAnimation::Create( | 42 scoped_ptr<PageScaleAnimation> PageScaleAnimation::Create( |
43 gfx::Vector2dF start_scroll_offset, | 43 gfx::Vector2dF start_scroll_offset, |
44 float start_page_scale_factor, | 44 float start_page_scale_factor, |
45 gfx::SizeF viewport_size, | 45 gfx::SizeF viewport_size, |
46 gfx::SizeF root_layer_size, | 46 gfx::SizeF root_layer_size, |
47 double start_time) { | 47 double start_time) { |
48 return make_scoped_ptr(new PageScaleAnimation(start_scroll_offset, | 48 return make_scoped_ptr(new PageScaleAnimation(start_scroll_offset, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 // Linearly interpolate the magnitude in log scale. | 217 // Linearly interpolate the magnitude in log scale. |
218 float diff = target_page_scale_factor_ / start_page_scale_factor_; | 218 float diff = target_page_scale_factor_ / start_page_scale_factor_; |
219 float log_diff = log(diff); | 219 float log_diff = log(diff); |
220 log_diff *= interp; | 220 log_diff *= interp; |
221 diff = exp(log_diff); | 221 diff = exp(log_diff); |
222 return start_page_scale_factor_ * diff; | 222 return start_page_scale_factor_ * diff; |
223 } | 223 } |
224 | 224 |
225 } // namespace cc | 225 } // namespace cc |
OLD | NEW |