| 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 #include "ui/display/manager/display_manager_utilities.h" | 5 #include "ui/display/manager/display_manager_utilities.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } else { | 259 } else { |
| 260 a_edge_in_screen->SetRect(a_bounds.right() - 1, top, 1, bottom - top); | 260 a_edge_in_screen->SetRect(a_bounds.right() - 1, top, 1, bottom - top); |
| 261 b_edge_in_screen->SetRect(b_bounds.x(), top, 1, bottom - top); | 261 b_edge_in_screen->SetRect(b_bounds.x(), top, 1, bottom - top); |
| 262 } | 262 } |
| 263 break; | 263 break; |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 return true; | 266 return true; |
| 267 } | 267 } |
| 268 | 268 |
| 269 int FindDisplayIndexContainingPoint(const std::vector<Display>& displays, | |
| 270 const gfx::Point& point_in_screen) { | |
| 271 auto iter = std::find_if(displays.begin(), displays.end(), | |
| 272 [point_in_screen](const Display& display) { | |
| 273 return display.bounds().Contains(point_in_screen); | |
| 274 }); | |
| 275 return iter == displays.end() ? -1 : (iter - displays.begin()); | |
| 276 } | |
| 277 | |
| 278 DisplayIdList CreateDisplayIdList(const Displays& list) { | 269 DisplayIdList CreateDisplayIdList(const Displays& list) { |
| 279 return GenerateDisplayIdList( | 270 return GenerateDisplayIdList( |
| 280 list.begin(), list.end(), | 271 list.begin(), list.end(), |
| 281 [](const Display& display) { return display.id(); }); | 272 [](const Display& display) { return display.id(); }); |
| 282 } | 273 } |
| 283 | 274 |
| 284 void SortDisplayIdList(DisplayIdList* ids) { | 275 void SortDisplayIdList(DisplayIdList* ids) { |
| 285 std::sort(ids->begin(), ids->end(), | 276 std::sort(ids->begin(), ids->end(), |
| 286 [](int64_t a, int64_t b) { return CompareDisplayIds(a, b); }); | 277 [](int64_t a, int64_t b) { return CompareDisplayIds(a, b); }); |
| 287 } | 278 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 301 // Output index is stored in the first 8 bits. See GetDisplayIdFromEDID | 292 // Output index is stored in the first 8 bits. See GetDisplayIdFromEDID |
| 302 // in edid_parser.cc. | 293 // in edid_parser.cc. |
| 303 int index_1 = id1 & 0xFF; | 294 int index_1 = id1 & 0xFF; |
| 304 int index_2 = id2 & 0xFF; | 295 int index_2 = id2 & 0xFF; |
| 305 DCHECK_NE(index_1, index_2) << id1 << " and " << id2; | 296 DCHECK_NE(index_1, index_2) << id1 << " and " << id2; |
| 306 return Display::IsInternalDisplayId(id1) || | 297 return Display::IsInternalDisplayId(id1) || |
| 307 (index_1 < index_2 && !Display::IsInternalDisplayId(id2)); | 298 (index_1 < index_2 && !Display::IsInternalDisplayId(id2)); |
| 308 } | 299 } |
| 309 | 300 |
| 310 } // namespace display | 301 } // namespace display |
| OLD | NEW |