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 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_IMPL_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "content/browser/renderer_host/input/fling/fling_curve.h" |
| 10 #include "content/common/content_export.h" |
| 11 #include "ui/gfx/point.h" |
| 12 #include "ui/gfx/point_f.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // Implementation of FlingCurve suitable for touch pad/screen-based |
| 17 // fling scroll. Starts with a flat velocity profile based on 'velocity', which |
| 18 // tails off to zero. Time is scaled to that duration of the fling is |
| 19 // proportional to the initial velocity. |
| 20 class FlingCurveImpl : public FlingCurve { |
| 21 public: |
| 22 |
| 23 CONTENT_EXPORT static FlingCurve* Create( |
| 24 const gfx::PointF& initial_velocity, |
| 25 float p0, |
| 26 float p1, |
| 27 float p2, |
| 28 const gfx::Point& cumulative_scroll); |
| 29 |
| 30 // Overridden from FlingCurve. |
| 31 virtual bool Apply(double time_in_secs, FlingCurveTarget* target) OVERRIDE; |
| 32 |
| 33 private: |
| 34 FlingCurveImpl(const gfx::PointF& initial_velocity, |
| 35 float p0, |
| 36 float p1, |
| 37 float p2, |
| 38 const gfx::Point& cumulative_scroll); |
| 39 virtual ~FlingCurveImpl(); |
| 40 |
| 41 gfx::PointF displacement_ratio_; |
| 42 gfx::PointF cumulative_scroll_; |
| 43 float coefficients_[3]; |
| 44 float time_offset_; |
| 45 float curve_duration_; |
| 46 float position_offset_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(FlingCurveImpl); |
| 49 }; |
| 50 |
| 51 } // namespace content |
| 52 |
| 53 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_IMPL_H_ |
OLD | NEW |