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

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: cc/ fixes 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
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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 const gfx::Display& MultiDisplayManager::GetDisplayMatching( 333 const gfx::Display& MultiDisplayManager::GetDisplayMatching(
334 const gfx::Rect& rect) const { 334 const gfx::Rect& rect) const {
335 if (rect.IsEmpty()) 335 if (rect.IsEmpty())
336 return GetDisplayNearestPoint(rect.origin()); 336 return GetDisplayNearestPoint(rect.origin());
337 337
338 int max = 0; 338 int max = 0;
339 const gfx::Display* matching = 0; 339 const gfx::Display* matching = 0;
340 for (std::vector<gfx::Display>::const_iterator iter = displays_.begin(); 340 for (std::vector<gfx::Display>::const_iterator iter = displays_.begin();
341 iter != displays_.end(); ++iter) { 341 iter != displays_.end(); ++iter) {
342 const gfx::Display& display = *iter; 342 const gfx::Display& display = *iter;
343 gfx::Rect intersect = display.bounds().Intersect(rect); 343 gfx::Rect intersect = display.bounds();
344 intersect.Intersect(rect);
344 int area = intersect.width() * intersect.height(); 345 int area = intersect.width() * intersect.height();
345 if (area > max) { 346 if (area > max) {
346 max = area; 347 max = area;
347 matching = &(*iter); 348 matching = &(*iter);
348 } 349 }
349 } 350 }
350 // Fallback to the primary display if there is no matching display. 351 // Fallback to the primary display if there is no matching display.
351 return matching ? *matching : DisplayController::GetPrimaryDisplay(); 352 return matching ? *matching : DisplayController::GetPrimaryDisplay();
352 } 353 }
353 354
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 DisplayList::iterator iter_to_update = to_update->begin(); 484 DisplayList::iterator iter_to_update = to_update->begin();
484 DisplayList::const_iterator iter = displays_.begin(); 485 DisplayList::const_iterator iter = displays_.begin();
485 for (; iter != displays_.end() && iter_to_update != to_update->end(); 486 for (; iter != displays_.end() && iter_to_update != to_update->end();
486 ++iter, ++iter_to_update) { 487 ++iter, ++iter_to_update) {
487 (*iter_to_update).set_id((*iter).id()); 488 (*iter_to_update).set_id((*iter).id());
488 } 489 }
489 } 490 }
490 491
491 } // namespace internal 492 } // namespace internal
492 } // namespace ash 493 } // namespace ash
OLDNEW
« no previous file with comments | « ash/desktop_background/desktop_background_view.cc ('k') | ash/drag_drop/drag_drop_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698