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

Side by Side Diff: ui/display/mac/screen_mac.mm

Issue 2480583002: Mac: Workaround IOSurface color behavior change in 10.12 (Closed)
Patch Set: Created 4 years, 1 month 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 | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | ui/gfx/mac/io_surface.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/display/screen.h" 5 #include "ui/display/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 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/mac/mac_util.h"
15 #include "base/mac/sdk_forward_declarations.h" 16 #include "base/mac/sdk_forward_declarations.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/timer/timer.h" 18 #include "base/timer/timer.h"
18 #include "ui/display/display.h" 19 #include "ui/display/display.h"
19 #include "ui/display/display_change_notifier.h" 20 #include "ui/display/display_change_notifier.h"
20 #include "ui/gfx/mac/coordinate_conversion.h" 21 #include "ui/gfx/mac/coordinate_conversion.h"
21 22
22 extern "C" { 23 extern "C" {
23 Boolean CGDisplayUsesForceToGray(void); 24 Boolean CGDisplayUsesForceToGray(void);
24 } 25 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 display.set_bounds(gfx::ScreenRectFromNSRect(frame)); 70 display.set_bounds(gfx::ScreenRectFromNSRect(frame));
70 display.set_work_area(gfx::ScreenRectFromNSRect(visible_frame)); 71 display.set_work_area(gfx::ScreenRectFromNSRect(visible_frame));
71 } 72 }
72 CGFloat scale = [screen backingScaleFactor]; 73 CGFloat scale = [screen backingScaleFactor];
73 74
74 if (Display::HasForceDeviceScaleFactor()) 75 if (Display::HasForceDeviceScaleFactor())
75 scale = Display::GetForcedDeviceScaleFactor(); 76 scale = Display::GetForcedDeviceScaleFactor();
76 77
77 display.set_device_scale_factor(scale); 78 display.set_device_scale_factor(scale);
78 79
79 display.set_icc_profile( 80 // On Sierra, we need to operate in a single screen's color space because
80 gfx::ICCProfile::FromCGColorSpace([[screen colorSpace] CGColorSpace])); 81 // IOSurfaces do not opt-out of color correction.
82 // https://crbug.com/654488
83 CGColorSpaceRef color_space = [[screen colorSpace] CGColorSpace];
84 if (base::mac::IsAtLeastOS10_12())
85 color_space = base::mac::GetSystemColorSpace();
86
87 display.set_icc_profile(gfx::ICCProfile::FromCGColorSpace(color_space));
81 display.set_color_depth(NSBitsPerPixelFromDepth([screen depth])); 88 display.set_color_depth(NSBitsPerPixelFromDepth([screen depth]));
82 display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth])); 89 display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth]));
83 display.set_is_monochrome(CGDisplayUsesForceToGray()); 90 display.set_is_monochrome(CGDisplayUsesForceToGray());
84 91
85 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will 92 // CGDisplayRotation returns a double. Display::SetRotationAsDegree will
86 // handle the unexpected situations were the angle is not a multiple of 90. 93 // handle the unexpected situations were the angle is not a multiple of 90.
87 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id))); 94 display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(display_id)));
88 return display; 95 return display;
89 } 96 }
90 97
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 298
292 } // namespace 299 } // namespace
293 300
294 #if !defined(USE_AURA) 301 #if !defined(USE_AURA)
295 Screen* CreateNativeScreen() { 302 Screen* CreateNativeScreen() {
296 return new ScreenMac; 303 return new ScreenMac;
297 } 304 }
298 #endif 305 #endif
299 306
300 } // namespace display 307 } // namespace display
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | ui/gfx/mac/io_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698