#include "cc/input/snap_fling_curve.h"
#include <algorithm>
#include <cmath>
#include "build/build_config.h"
namespace cc {
namespace {
#if BUILDFLAG(IS_ANDROID)
constexpr double kDistanceEstimatorScalar = 40;
constexpr double kRatio = 0.9;
#else
constexpr double kDistanceEstimatorScalar = …;
constexpr double kRatio = …;
#endif
constexpr auto kFrameTime = …;
constexpr base::TimeDelta kMaximumSnapDuration = …;
double GetDistanceFromDisplacement(gfx::Vector2dF displacement) { … }
double EstimateFramesFromDistance(double distance) { … }
double CalculateFirstDelta(double distance, double frames) { … }
bool IsWithinOnePixel(gfx::Vector2dF actual, gfx::Vector2dF target) { … }
}
gfx::Vector2dF SnapFlingCurve::EstimateDisplacement(
const gfx::Vector2dF& first_delta) { … }
SnapFlingCurve::SnapFlingCurve(const gfx::PointF& start_offset,
const gfx::PointF& target_offset,
base::TimeTicks first_gsu_time)
: … { … }
SnapFlingCurve::~SnapFlingCurve() = default;
double SnapFlingCurve::GetCurrentCurveDistance(base::TimeDelta current_time) { … }
gfx::Vector2dF SnapFlingCurve::GetScrollDelta(base::TimeTicks time_stamp) { … }
void SnapFlingCurve::UpdateCurrentOffset(const gfx::PointF& current_offset) { … }
bool SnapFlingCurve::IsFinished() const { … }
}