OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/renderer_host/input/fling/fling_curve_configuration.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "content/browser/renderer_host/input/fling/fling_curve.h" |
| 9 #include "content/browser/renderer_host/input/fling/fling_curve_impl.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 FlingCurveConfiguration::FlingCurveConfiguration() { } |
| 14 |
| 15 FlingCurveConfiguration::~FlingCurveConfiguration() { } |
| 16 |
| 17 void FlingCurveConfiguration::SetCurveParameters( |
| 18 const std::vector<float>& new_touchpad, |
| 19 const std::vector<float>& new_touchscreen) { |
| 20 DCHECK(new_touchpad.size() >= 3); |
| 21 DCHECK(new_touchscreen.size() >= 3); |
| 22 base::AutoLock scoped_lock(lock_); |
| 23 touchpad_coefs_ = new_touchpad; |
| 24 touchscreen_coefs_ = new_touchscreen; |
| 25 } |
| 26 |
| 27 FlingCurve* FlingCurveConfiguration::CreateCore( |
| 28 const std::vector<float>& coefs, |
| 29 const gfx::PointF& velocity, |
| 30 const gfx::Point& cumulative_scroll) { |
| 31 float p0, p1, p2; |
| 32 |
| 33 { |
| 34 base::AutoLock scoped_lock(lock_); |
| 35 p0 = coefs[0]; |
| 36 p1 = coefs[1]; |
| 37 p2 = coefs[2]; |
| 38 } |
| 39 |
| 40 return FlingCurveImpl::Create(velocity, p0, p1, p2, cumulative_scroll); |
| 41 } |
| 42 |
| 43 FlingCurve* FlingCurveConfiguration::CreateForTouchPad( |
| 44 const gfx::PointF& velocity, |
| 45 const gfx::Point& cumulative_scroll) { |
| 46 return CreateCore(touchpad_coefs_, velocity, cumulative_scroll); |
| 47 } |
| 48 |
| 49 FlingCurve* FlingCurveConfiguration::CreateForTouchScreen( |
| 50 const gfx::PointF& velocity, |
| 51 const gfx::Point& cumulative_scroll) { |
| 52 return CreateCore(touchscreen_coefs_, velocity, cumulative_scroll); |
| 53 } |
| 54 |
| 55 } // namespace webkit_glue |
OLD | NEW |