Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_RECT_BASED_TARGETING_UTILS_H_ | |
|
sky
2013/10/08 20:01:12
Since this is all touch based, how about touch_tar
tdanderson
2013/10/09 21:42:06
My preference would be to use point/rect instead o
| |
| 6 #define UI_RECT_BASED_TARGETING_UTILS_H_ | |
| 7 | |
| 8 #include "ui/gfx/point.h" | |
| 9 #include "ui/gfx/rect.h" | |
| 10 #include "ui/views/views_export.h" | |
| 11 | |
| 12 namespace views { | |
| 13 | |
| 14 // Returns true if |rect| is 1x1. | |
| 15 VIEWS_EXPORT bool UsePointBasedTargeting(const gfx::Rect& rect); | |
| 16 | |
| 17 // Returns the percentage of |rect_1|'s area that is covered by |rect_2|. | |
| 18 VIEWS_EXPORT float PercentCoveredBy(const gfx::Rect& rect_1, | |
| 19 const gfx::Rect& rect_2); | |
| 20 | |
| 21 // Returns the square of the distance from |point| to the center line of | |
| 22 // |rect|. The center line of a rectangle is obtained by repeatedly | |
| 23 // stripping away 1px borders around the rectangle until a line remains. | |
| 24 VIEWS_EXPORT int DistanceSquaredFromCenterLineToPoint(const gfx::Point& point, | |
| 25 const gfx::Rect& rect); | |
| 26 | |
| 27 } // namespace views | |
| 28 | |
| 29 #endif // UI_RECT_BASED_TARGETING_UTILS_H_ | |
| OLD | NEW |