Chromium Code Reviews| Index: ui/views/rect_based_targeting_utils.cc |
| diff --git a/ui/views/rect_based_targeting_utils.cc b/ui/views/rect_based_targeting_utils.cc |
| index de4d3464f645d1f6b6a3182d06e4f871ce44a674..ebe589a30111311005e65fa33ecb029fa21cf906 100644 |
| --- a/ui/views/rect_based_targeting_utils.cc |
| +++ b/ui/views/rect_based_targeting_utils.cc |
| @@ -9,12 +9,12 @@ |
| namespace views { |
| -bool UsePointBasedTargeting(const gfx::Rect& rect) { |
| - return rect.width() == 1 && rect.height() == 1; |
| +bool UsePointBasedTargeting(const gfx::RectF& rect) { |
| + return rect.width() == 1.f && rect.height() == 1.f; |
|
tdresser
2014/05/02 13:19:06
Is comparing equality of floats here acceptable, o
|
| } |
| -float PercentCoveredBy(const gfx::Rect& rect_1, const gfx::Rect& rect_2) { |
| - gfx::Rect intersection(rect_1); |
| +float PercentCoveredBy(const gfx::RectF& rect_1, const gfx::RectF& rect_2) { |
| + gfx::RectF intersection(rect_1); |
| intersection.Intersect(rect_2); |
| int intersect_area = intersection.size().GetArea(); |
| int rect_1_area = rect_1.size().GetArea(); |
| @@ -22,11 +22,11 @@ float PercentCoveredBy(const gfx::Rect& rect_1, const gfx::Rect& rect_2) { |
| static_cast<float>(intersect_area) / static_cast<float>(rect_1_area) : 0; |
| } |
| -int DistanceSquaredFromCenterToPoint(const gfx::Point& point, |
| - const gfx::Rect& rect) { |
| - gfx::Point center_point = rect.CenterPoint(); |
| - int dx = center_point.x() - point.x(); |
| - int dy = center_point.y() - point.y(); |
| +float DistanceSquaredFromCenterToPoint(const gfx::PointF& point, |
| + const gfx::RectF& rect) { |
| + gfx::PointF center_point = rect.CenterPoint(); |
| + float dx = center_point.x() - point.x(); |
| + float dy = center_point.y() - point.y(); |
| return (dx * dx) + (dy * dy); |
| } |