Chromium Code Reviews| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 // https://crbug.com/594343. | 157 // https://crbug.com/594343. |
| 158 if (!base::mac::IsOSMavericks()) { | 158 if (!base::mac::IsOSMavericks()) { |
| 159 // Zero-initialize the IOSurface. Calling IOSurfaceLock/IOSurfaceUnlock | 159 // Zero-initialize the IOSurface. Calling IOSurfaceLock/IOSurfaceUnlock |
| 160 // appears to be sufficient. https://crbug.com/584760#c17 | 160 // appears to be sufficient. https://crbug.com/584760#c17 |
| 161 IOReturn r = IOSurfaceLock(surface, 0, nullptr); | 161 IOReturn r = IOSurfaceLock(surface, 0, nullptr); |
| 162 DCHECK_EQ(kIOReturnSuccess, r); | 162 DCHECK_EQ(kIOReturnSuccess, r); |
| 163 r = IOSurfaceUnlock(surface, 0, nullptr); | 163 r = IOSurfaceUnlock(surface, 0, nullptr); |
| 164 DCHECK_EQ(kIOReturnSuccess, r); | 164 DCHECK_EQ(kIOReturnSuccess, r); |
| 165 } | 165 } |
| 166 | 166 |
| 167 // Displaying an IOSurface that does not have a color space using an | |
| 168 // AVSampleBufferDisplayLayer can result in a black screen. Specify the | |
| 169 // main display's color profile by default, which will result in no color | |
| 170 // correction being done for the main monitor (which is the behavior of not | |
| 171 // specifying a color space). | |
| 172 // https://crbug.com/608879 | |
| 173 if (format == gfx::BufferFormat::YUV_420_BIPLANAR) { | |
| 174 base::ScopedCFTypeRef<CGColorSpaceRef> color_space( | |
| 175 CGDisplayCopyColorSpace(CGMainDisplayID())); | |
| 176 base::ScopedCFTypeRef<CFDataRef> color_space_icc( | |
| 177 CGColorSpaceCopyICCProfile(color_space)); | |
|
erikchen
2016/05/04 18:14:45
CGColorSpaceCopyICCProfile might return NULL. I th
ccameron
2016/05/05 18:50:01
I tested passing NULL to IOSurfaceSetValue, and it
erikchen
2016/05/05 19:11:55
Ok, just add a comment about NULL a valid paramete
| |
| 178 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); | |
| 179 } | |
| 180 | |
| 167 return surface; | 181 return surface; |
| 168 } | 182 } |
| 169 | 183 |
| 170 } // namespace gfx | 184 } // namespace gfx |
| OLD | NEW |