Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_DISPLAY_DISPLAY_FINDER_H_ | 5 #ifndef UI_DISPLAY_DISPLAY_FINDER_H_ |
| 6 #define UI_DISPLAY_DISPLAY_FINDER_H_ | 6 #define UI_DISPLAY_DISPLAY_FINDER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ui/display/display_export.h" | 10 #include "ui/display/display_export.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 class Point; | 13 class Point; |
| 14 class Rect; | 14 class Rect; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace display { | 17 namespace display { |
| 18 class Display; | 18 class Display; |
| 19 | 19 |
| 20 // Returns the display in |displays| closest to |point|. | 20 // Returns the display containing |point|. If no displays contain |point|, then |
| 21 // this returns the display closest to |point|. | |
| 21 DISPLAY_EXPORT const Display* FindDisplayNearestPoint( | 22 DISPLAY_EXPORT const Display* FindDisplayNearestPoint( |
| 22 const std::vector<Display>& displays, | 23 const std::vector<Display>& displays, |
| 23 const gfx::Point& point); | 24 const gfx::Point& point); |
| 24 | 25 |
| 25 // Returns the display in |displays| with the biggest intersection of |rect|. | 26 // Returns the display in |displays| with the biggest intersection of |rect|. |
| 26 // If none of the displays intersect |rect| null is returned. | 27 // If none of the displays intersect |rect| null is returned. |
| 27 DISPLAY_EXPORT const Display* FindDisplayWithBiggestIntersection( | 28 DISPLAY_EXPORT const Display* FindDisplayWithBiggestIntersection( |
| 28 const std::vector<Display>& displays, | 29 const std::vector<Display>& displays, |
| 29 const gfx::Rect& rect); | 30 const gfx::Rect& rect); |
| 30 | 31 |
| 32 // Returns the index in |displays| whose bounds contains |point_in_screen|. | |
| 33 // Returns -1 if no such Display contains |point_in_screen|. | |
| 34 DISPLAY_EXPORT int FindDisplayIndexContainingPoint( | |
|
kylechar
2017/03/06 18:00:20
Would it be "more" correct to return an iterator i
sky
2017/03/06 18:22:00
I just copy/pasted the code. But I agree, an itera
| |
| 35 const std::vector<Display>& displays, | |
| 36 const gfx::Point& point_in_screen); | |
| 37 | |
| 31 } // namespace display | 38 } // namespace display |
| 32 | 39 |
| 33 #endif // UI_DISPLAY_DISPLAY_FINDER_H_ | 40 #endif // UI_DISPLAY_DISPLAY_FINDER_H_ |
| OLD | NEW |