| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mac/io_surface.h" | 5 #include "ui/gfx/mac/io_surface.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // corrected (they were treated as though they were in the display color | 203 // corrected (they were treated as though they were in the display color |
| 204 // space). Override this by defaulting IOSurfaces to be in the main display | 204 // space). Override this by defaulting IOSurfaces to be in the main display |
| 205 // color space. | 205 // color space. |
| 206 // https://crbug.com/654488 | 206 // https://crbug.com/654488 |
| 207 if (base::mac::IsAtLeastOS10_12()) | 207 if (base::mac::IsAtLeastOS10_12()) |
| 208 force_color_space = true; | 208 force_color_space = true; |
| 209 | 209 |
| 210 // Ensure that all IOSurfaces start as sRGB when color correct rendering | 210 // Ensure that all IOSurfaces start as sRGB when color correct rendering |
| 211 // is enabled. | 211 // is enabled. |
| 212 static bool color_correct_rendering_enabled = | 212 static bool color_correct_rendering_enabled = |
| 213 base::CommandLine::ForCurrentProcess()->HasSwitch( | 213 base::FeatureList::IsEnabled(features::kColorCorrectRendering); |
| 214 switches::kEnableColorCorrectRendering); | |
| 215 if (color_correct_rendering_enabled) | 214 if (color_correct_rendering_enabled) |
| 216 force_color_space = true; | 215 force_color_space = true; |
| 217 | 216 |
| 218 if (force_color_space) { | 217 if (force_color_space) { |
| 219 CGColorSpaceRef color_space = color_correct_rendering_enabled | 218 CGColorSpaceRef color_space = color_correct_rendering_enabled |
| 220 ? base::mac::GetSRGBColorSpace() | 219 ? base::mac::GetSRGBColorSpace() |
| 221 : base::mac::GetSystemColorSpace(); | 220 : base::mac::GetSystemColorSpace(); |
| 222 base::ScopedCFTypeRef<CFDataRef> color_space_icc( | 221 base::ScopedCFTypeRef<CFDataRef> color_space_icc( |
| 223 CGColorSpaceCopyICCProfile(color_space)); | 222 CGColorSpaceCopyICCProfile(color_space)); |
| 224 // Note that nullptr is an acceptable input to IOSurfaceSetValue. | 223 // Note that nullptr is an acceptable input to IOSurfaceSetValue. |
| 225 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); | 224 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); |
| 226 } | 225 } |
| 227 | 226 |
| 228 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime", | 227 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime", |
| 229 base::TimeTicks::Now() - start_time); | 228 base::TimeTicks::Now() - start_time); |
| 230 return surface; | 229 return surface; |
| 231 } | 230 } |
| 232 | 231 |
| 233 } // namespace gfx | 232 } // namespace gfx |
| OLD | NEW |