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

Side by Side Diff: ui/gfx/screen_mac.mm

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
« no previous file with comments | « ui/gfx/screen_gtk.cc ('k') | ui/views/animation/bounds_animator.cc » ('j') | no next file with comments »
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 "ui/gfx/screen.h" 5 #include "ui/gfx/screen.h"
6 6
7 #import <ApplicationServices/ApplicationServices.h> 7 #import <ApplicationServices/ApplicationServices.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) { 34 NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) {
35 // Default to the monitor with the current keyboard focus, in case 35 // Default to the monitor with the current keyboard focus, in case
36 // |match_rect| is not on any screen at all. 36 // |match_rect| is not on any screen at all.
37 NSScreen* max_screen = [NSScreen mainScreen]; 37 NSScreen* max_screen = [NSScreen mainScreen];
38 int max_area = 0; 38 int max_area = 0;
39 39
40 for (NSScreen* screen in [NSScreen screens]) { 40 for (NSScreen* screen in [NSScreen screens]) {
41 gfx::Rect monitor_area = ConvertCoordinateSystem([screen frame]); 41 gfx::Rect monitor_area = ConvertCoordinateSystem([screen frame]);
42 gfx::Rect intersection = monitor_area.Intersect(match_rect); 42 gfx::Rect intersection = monitor_area;
43 intersection.Intersect(match_rect);
43 int area = intersection.width() * intersection.height(); 44 int area = intersection.width() * intersection.height();
44 if (area > max_area) { 45 if (area > max_area) {
45 max_area = area; 46 max_area = area;
46 max_screen = screen; 47 max_screen = screen;
47 } 48 }
48 } 49 }
49 50
50 return max_screen; 51 return max_screen;
51 } 52 }
52 53
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 175
175 } // namespace 176 } // namespace
176 177
177 namespace gfx { 178 namespace gfx {
178 179
179 Screen* CreateNativeScreen() { 180 Screen* CreateNativeScreen() {
180 return new ScreenMac; 181 return new ScreenMac;
181 } 182 }
182 183
183 } 184 }
OLDNEW
« no previous file with comments | « ui/gfx/screen_gtk.cc ('k') | ui/views/animation/bounds_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698