| 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 "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
| 11 #include "ui/gfx/point_f.h" | 11 #include "ui/gfx/geometry/point_f.h" |
| 12 #include "ui/gfx/rect_f.h" | 12 #include "ui/gfx/geometry/rect_f.h" |
| 13 #include "ui/gfx/vector2d_conversions.h" | 13 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // This takes a viewport-relative vector and returns a vector whose values are | 17 // This takes a viewport-relative vector and returns a vector whose values are |
| 18 // between 0 and 1, representing the percentage position within the viewport. | 18 // between 0 and 1, representing the percentage position within the viewport. |
| 19 gfx::Vector2dF NormalizeFromViewport(const gfx::Vector2dF& denormalized, | 19 gfx::Vector2dF NormalizeFromViewport(const gfx::Vector2dF& denormalized, |
| 20 const gfx::SizeF& viewport_size) { | 20 const gfx::SizeF& viewport_size) { |
| 21 return gfx::ScaleVector2d(denormalized, | 21 return gfx::ScaleVector2d(denormalized, |
| 22 1.f / viewport_size.width(), | 22 1.f / viewport_size.width(), |
| 23 1.f / viewport_size.height()); | 23 1.f / viewport_size.height()); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 // Linearly interpolate the magnitude in log scale. | 237 // Linearly interpolate the magnitude in log scale. |
| 238 float diff = target_page_scale_factor_ / start_page_scale_factor_; | 238 float diff = target_page_scale_factor_ / start_page_scale_factor_; |
| 239 float log_diff = log(diff); | 239 float log_diff = log(diff); |
| 240 log_diff *= interp; | 240 log_diff *= interp; |
| 241 diff = exp(log_diff); | 241 diff = exp(log_diff); |
| 242 return start_page_scale_factor_ * diff; | 242 return start_page_scale_factor_ * diff; |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // namespace cc | 245 } // namespace cc |
| OLD | NEW |