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_WIN_SCALING_UTIL_H_ | 5 #ifndef UI_DISPLAY_WIN_SCALING_UTIL_H_ |
6 #define UI_DISPLAY_WIN_SCALING_UTIL_H_ | 6 #define UI_DISPLAY_WIN_SCALING_UTIL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "ui/display/display_export.h" | 10 #include "ui/display/display_export.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // +--------+ If the two DisplayInfos are bottom aligned or | 100 // +--------+ If the two DisplayInfos are bottom aligned or |
101 // | | right aligned, the DisplayPlacement will | 101 // | | right aligned, the DisplayPlacement will |
102 // | +--------+ have an offset of 0 relative to the | 102 // | +--------+ have an offset of 0 relative to the |
103 // | | | bottom-right of the DisplayInfo. | 103 // | | | bottom-right of the DisplayInfo. |
104 // | | | | 104 // | | | |
105 // +--------+--------+ | 105 // +--------+--------+ |
106 DISPLAY_EXPORT DisplayPlacement CalculateDisplayPlacement( | 106 DISPLAY_EXPORT DisplayPlacement CalculateDisplayPlacement( |
107 const DisplayInfo& parent, | 107 const DisplayInfo& parent, |
108 const DisplayInfo& current); | 108 const DisplayInfo& current); |
109 | 109 |
| 110 // Returns the squared distance between two rects. |
| 111 // The distance between two rects is the length of the shortest segment that can |
| 112 // be drawn between two rectangles. This segment generally connects two opposing |
| 113 // corners between rectangles like this... |
| 114 // |
| 115 // +----------+ |
| 116 // | | |
| 117 // +----------+ |
| 118 // \ <--- Shortest Segment |
| 119 // \ |
| 120 // +---+ |
| 121 // | | |
| 122 // | | |
| 123 // +---+ |
| 124 // |
| 125 // For rectangles that share coordinates within the same axis, that generally |
| 126 // means the segment is parallel to the axis and perpendicular to the edges. |
| 127 // |
| 128 // One of many shortest segments |
| 129 // +----------+ / \ +--------+ |
| 130 // | | | \ | | |
| 131 // | | V +---+ \ +--------+ |
| 132 // | |-----| | \-->| |
| 133 // +----------+ | | +----+ |
| 134 // | | | | |
| 135 // +---+ +----+ |
| 136 // |
| 137 // For rectangles that intersect each other, the distance is 0. |
| 138 // |
| 139 // The squared distance is used to avoid taking the square root as the common |
| 140 // usage is to compare distances greater than 1 unit. |
| 141 DISPLAY_EXPORT int64_t SquaredDistanceBetweenRects(const gfx::Rect& ref, |
| 142 const gfx::Rect& rect); |
| 143 |
110 } // namespace win | 144 } // namespace win |
111 } // namespace display | 145 } // namespace display |
112 | 146 |
113 #endif // UI_DISPLAY_WIN_SCALING_UTIL_H_ | 147 #endif // UI_DISPLAY_WIN_SCALING_UTIL_H_ |
OLD | NEW |