| Index: ash/laser/laser_pointer_points.cc
|
| diff --git a/ash/laser/laser_pointer_points.cc b/ash/laser/laser_pointer_points.cc
|
| index 2bd23cebd7ea83e4dfa5aafde61e27873ad9c824..1e597636b826d2542ea31e7d478c7f1415833323 100644
|
| --- a/ash/laser/laser_pointer_points.cc
|
| +++ b/ash/laser/laser_pointer_points.cc
|
| @@ -16,15 +16,24 @@ LaserPointerPoints::LaserPointerPoints(base::TimeDelta life_duration)
|
|
|
| LaserPointerPoints::~LaserPointerPoints() {}
|
|
|
| -void LaserPointerPoints::AddPoint(const gfx::PointF& point) {
|
| - MoveForwardToTime(base::Time::Now());
|
| +void LaserPointerPoints::AddPoint(const gfx::PointF& point,
|
| + const base::TimeTicks& time) {
|
| + // Move forward in time if needed.
|
| + if (time > collection_latest_time_)
|
| + MoveForwardToTime(time);
|
|
|
| LaserPoint new_point;
|
| new_point.location = point;
|
| + new_point.time = time;
|
| + new_point.age = std::min((collection_latest_time_ - time).InMillisecondsF() /
|
| + life_duration_.InMillisecondsF(),
|
| + 1.0);
|
| points_.push_back(new_point);
|
| }
|
|
|
| -void LaserPointerPoints::MoveForwardToTime(const base::Time& latest_time) {
|
| +void LaserPointerPoints::MoveForwardToTime(const base::TimeTicks& latest_time) {
|
| + DCHECK_GE(latest_time, collection_latest_time_);
|
| +
|
| if (!points_.empty()) {
|
| DCHECK(!collection_latest_time_.is_null());
|
|
|
| @@ -80,7 +89,7 @@ int LaserPointerPoints::GetNumberOfPoints() const {
|
| }
|
|
|
| const std::deque<LaserPointerPoints::LaserPoint>&
|
| -LaserPointerPoints::laser_points() {
|
| +LaserPointerPoints::laser_points() const {
|
| return points_;
|
| }
|
| } // namespace ash
|
|
|