| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 static bool color_correct_rendering_enabled = | 212 static bool color_correct_rendering_enabled = |
| 213 base::CommandLine::ForCurrentProcess()->HasSwitch( | 213 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 214 switches::kEnableColorCorrectRendering); | 214 switches::kEnableColorCorrectRendering); |
| 215 if (color_correct_rendering_enabled) | 215 if (color_correct_rendering_enabled) |
| 216 force_color_space = true; | 216 force_color_space = true; |
| 217 | 217 |
| 218 if (force_color_space) { | 218 if (force_color_space) { |
| 219 CGColorSpaceRef color_space = color_correct_rendering_enabled | 219 CGColorSpaceRef color_space = color_correct_rendering_enabled |
| 220 ? base::mac::GetSRGBColorSpace() | 220 ? base::mac::GetSRGBColorSpace() |
| 221 : base::mac::GetSystemColorSpace(); | 221 : base::mac::GetSystemColorSpace(); |
| 222 base::ScopedCFTypeRef<CFDataRef> color_space_icc( | 222 if (__builtin_available(macOS 10.12, *)) { |
| 223 CGColorSpaceCopyICCProfile(color_space)); | 223 base::ScopedCFTypeRef<CFDataRef> color_space_icc( |
| 224 // Note that nullptr is an acceptable input to IOSurfaceSetValue. | 224 CGColorSpaceCopyICCProfile(color_space)); |
| 225 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); | 225 // Note that nullptr is an acceptable input to IOSurfaceSetValue. |
| 226 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); |
| 227 } |
| 226 } | 228 } |
| 227 | 229 |
| 228 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime", | 230 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime", |
| 229 base::TimeTicks::Now() - start_time); | 231 base::TimeTicks::Now() - start_time); |
| 230 return surface; | 232 return surface; |
| 231 } | 233 } |
| 232 | 234 |
| 233 } // namespace gfx | 235 } // namespace gfx |
| OLD | NEW |