Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2539)

Unified Diff: ash/laser/laser_pointer_points.h

Issue 2362063002: cros: Laser pointer fades out on release, do not cover palette. (Closed)
Patch Set: Moved age logic to laser pointer points class. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..268ea7032d8ddb39526daba6e6b28780a06f5b82 100644
--- a/ash/laser/laser_pointer_points.h
+++ b/ash/laser/laser_pointer_points.h
@@ -24,6 +24,9 @@ class ASH_EXPORT LaserPointerPoints {
struct LaserPoint {
gfx::Point location;
base::Time creation_time;
jdufault 2016/10/04 22:04:13 Why does the point store its creation_time? age ca
sammiequon 2016/10/05 17:42:23 Done.
+ // 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;
};
// Constructor with a parameter to choose the fade out time of the points in
@@ -33,6 +36,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.
@@ -52,9 +59,13 @@ class ASH_EXPORT LaserPointerPoints {
friend class LaserPointerPointsTestApi;
void ClearOldPoints();
+ void UpdateAges();
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);
};

Powered by Google App Engine
This is Rietveld 408576698