Chromium Code Reviews| Index: ash/laser/laser_pointer_points.h |
| diff --git a/ash/laser/laser_pointer_points.h b/ash/laser/laser_pointer_points.h |
| index 19e95c1d1b3b1d6598cf47fb5483be7a9d153813..9b10bc0da1985ef7f8d20e07d9b1a927d48c2d28 100644 |
| --- a/ash/laser/laser_pointer_points.h |
| +++ b/ash/laser/laser_pointer_points.h |
| @@ -23,7 +23,9 @@ class ASH_EXPORT LaserPointerPoints { |
| // Struct to describe each point. |
| struct LaserPoint { |
| gfx::Point location; |
| - base::Time creation_time; |
| + // age is a value between [0,1] where 0 means the point was just added and 1 |
| + // means that the point is just about to be removed. |
| + double age; |
|
jdufault
2016/10/05 18:08:51
Going from 0 -> 1 seems a bit strange to me (I'd e
sammiequon
2016/10/05 21:15:22
Is it normal convention to go the other way?
jdufault
2016/10/05 21:36:04
I think so, but with 'age' it is confusing. ie, li
|
| }; |
| // Constructor with a parameter to choose the fade out time of the points in |
| @@ -33,6 +35,10 @@ class ASH_EXPORT LaserPointerPoints { |
| // Adds a point. Automatically clears points that are too old. |
| void AddPoint(const gfx::Point& point); |
| + // Updates the collection latest time. Automatically clears points that are |
| + // too old. |
| + void MoveForwardToCurrentTime(); |
| + void MoveForwardToTime(const base::Time& new_latest_time); |
| // Removes all points. |
| void Clear(); |
| // Gets the bounding box of the points. |
| @@ -55,6 +61,9 @@ class ASH_EXPORT LaserPointerPoints { |
| base::TimeDelta life_duration_; |
| std::deque<LaserPoint> points_; |
| + // The latest time of the collection of points. This gets updated when new |
| + // points are added or when MoveForwardInTime is called. |
| + base::Time collection_latest_time_; |
| DISALLOW_COPY_AND_ASSIGN(LaserPointerPoints); |
| }; |