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

Unified Diff: ash/laser/laser_pointer_points.cc

Issue 2716223002: ash: Use floating point precision for laser pointer. (Closed)
Patch Set: rebase and fix unit test Created 3 years, 10 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
« no previous file with comments | « ash/laser/laser_pointer_points.h ('k') | ash/laser/laser_pointer_points_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/laser/laser_pointer_points.cc
diff --git a/ash/laser/laser_pointer_points.cc b/ash/laser/laser_pointer_points.cc
index 7ca20966ebb61200b233c618dc72d62ea612c9c3..2bd23cebd7ea83e4dfa5aafde61e27873ad9c824 100644
--- a/ash/laser/laser_pointer_points.cc
+++ b/ash/laser/laser_pointer_points.cc
@@ -7,6 +7,8 @@
#include <algorithm>
#include <limits>
+#include "ui/gfx/geometry/rect_conversions.h"
+
namespace ash {
LaserPointerPoints::LaserPointerPoints(base::TimeDelta life_duration)
@@ -14,7 +16,7 @@ LaserPointerPoints::LaserPointerPoints(base::TimeDelta life_duration)
LaserPointerPoints::~LaserPointerPoints() {}
-void LaserPointerPoints::AddPoint(const gfx::Point& point) {
+void LaserPointerPoints::AddPoint(const gfx::PointF& point) {
MoveForwardToTime(base::Time::Now());
LaserPoint new_point;
@@ -50,13 +52,13 @@ gfx::Rect LaserPointerPoints::GetBoundingBox() {
if (IsEmpty())
return gfx::Rect();
- gfx::Point min_point = GetOldest().location;
- gfx::Point max_point = GetOldest().location;
+ gfx::PointF min_point = GetOldest().location;
+ gfx::PointF max_point = GetOldest().location;
for (const LaserPoint& point : points_) {
min_point.SetToMin(point.location);
max_point.SetToMax(point.location);
}
- return gfx::BoundingRect(min_point, max_point);
+ return gfx::ToEnclosingRect(gfx::BoundingRect(min_point, max_point));
}
LaserPointerPoints::LaserPoint LaserPointerPoints::GetOldest() const {
« no previous file with comments | « ash/laser/laser_pointer_points.h ('k') | ash/laser/laser_pointer_points_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698