Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: ash/display/multi_display_manager.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/instant/instant_controller.cc » ('j') | ui/gfx/rect_base.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/display/multi_display_manager.h" 5 #include "ash/display/multi_display_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/display/display_controller.h" 10 #include "ash/display/display_controller.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 const gfx::Display& MultiDisplayManager::GetDisplayMatching( 304 const gfx::Display& MultiDisplayManager::GetDisplayMatching(
305 const gfx::Rect& rect) const { 305 const gfx::Rect& rect) const {
306 if (rect.IsEmpty()) 306 if (rect.IsEmpty())
307 return GetDisplayNearestPoint(rect.origin()); 307 return GetDisplayNearestPoint(rect.origin());
308 308
309 int max = 0; 309 int max = 0;
310 const gfx::Display* matching = 0; 310 const gfx::Display* matching = 0;
311 for (std::vector<gfx::Display>::const_iterator iter = displays_.begin(); 311 for (std::vector<gfx::Display>::const_iterator iter = displays_.begin();
312 iter != displays_.end(); ++iter) { 312 iter != displays_.end(); ++iter) {
313 const gfx::Display& display = *iter; 313 const gfx::Display& display = *iter;
314 gfx::Rect intersect = display.bounds().Intersect(rect); 314 gfx::Rect intersect = display.bounds();
315 intersect.Intersect(rect);
315 int area = intersect.width() * intersect.height(); 316 int area = intersect.width() * intersect.height();
316 if (area > max) { 317 if (area > max) {
317 max = area; 318 max = area;
318 matching = &(*iter); 319 matching = &(*iter);
319 } 320 }
320 } 321 }
321 // Fallback to the primary display if there is no matching display. 322 // Fallback to the primary display if there is no matching display.
322 return matching ? *matching : DisplayController::GetPrimaryDisplay(); 323 return matching ? *matching : DisplayController::GetPrimaryDisplay();
323 } 324 }
324 325
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 DisplayList::iterator iter_to_update = to_update->begin(); 453 DisplayList::iterator iter_to_update = to_update->begin();
453 DisplayList::const_iterator iter = displays_.begin(); 454 DisplayList::const_iterator iter = displays_.begin();
454 for (; iter != displays_.end() && iter_to_update != to_update->end(); 455 for (; iter != displays_.end() && iter_to_update != to_update->end();
455 ++iter, ++iter_to_update) { 456 ++iter, ++iter_to_update) {
456 (*iter_to_update).set_id((*iter).id()); 457 (*iter_to_update).set_id((*iter).id());
457 } 458 }
458 } 459 }
459 460
460 } // namespace internal 461 } // namespace internal
461 } // namespace ash 462 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/instant/instant_controller.cc » ('j') | ui/gfx/rect_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698