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

Side by Side Diff: gpu/ipc/client/gpu_memory_buffer_impl_io_surface.cc

Issue 2738713003: color: Ensure that VideoResourceUpdater give consistent colors (Closed)
Patch Set: Rebase Created 3 years, 9 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 | « cc/resources/video_resource_updater.cc ('k') | ui/gfx/color_space.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h" 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 114
115 void GpuMemoryBufferImplIOSurface::SetColorSpaceForScanout( 115 void GpuMemoryBufferImplIOSurface::SetColorSpaceForScanout(
116 const gfx::ColorSpace& color_space) { 116 const gfx::ColorSpace& color_space) {
117 if (color_space == color_space_) 117 if (color_space == color_space_)
118 return; 118 return;
119 color_space_ = color_space; 119 color_space_ = color_space;
120 120
121 // Retrieve the ICC profile data. 121 // Retrieve the ICC profile data.
122 gfx::ICCProfile icc_profile; 122 gfx::ICCProfile icc_profile;
123 if (!color_space_.GetICCProfile(&icc_profile)) { 123 if (!color_space_.GetAsFullRangeRGB().GetICCProfile(&icc_profile)) {
124 DLOG(ERROR) << "Failed to set color space for scanout: no ICC profile."; 124 DLOG(ERROR) << "Failed to set color space for scanout: no ICC profile.";
125 return; 125 return;
126 } 126 }
127 127
128 // Package it as a CFDataRef and send it to the IOSurface. 128 // Package it as a CFDataRef and send it to the IOSurface.
129 base::ScopedCFTypeRef<CFDataRef> cf_data_icc_profile(CFDataCreate( 129 base::ScopedCFTypeRef<CFDataRef> cf_data_icc_profile(CFDataCreate(
130 nullptr, reinterpret_cast<const UInt8*>(icc_profile.GetData().data()), 130 nullptr, reinterpret_cast<const UInt8*>(icc_profile.GetData().data()),
131 icc_profile.GetData().size())); 131 icc_profile.GetData().size()));
132 IOSurfaceSetValue(io_surface_, CFSTR("IOSurfaceColorSpace"), 132 IOSurfaceSetValue(io_surface_, CFSTR("IOSurfaceColorSpace"),
133 cf_data_icc_profile); 133 cf_data_icc_profile);
134 } 134 }
135 135
136 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { 136 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const {
137 gfx::GpuMemoryBufferHandle handle; 137 gfx::GpuMemoryBufferHandle handle;
138 handle.type = gfx::IO_SURFACE_BUFFER; 138 handle.type = gfx::IO_SURFACE_BUFFER;
139 handle.id = id_; 139 handle.id = id_;
140 return handle; 140 return handle;
141 } 141 }
142 142
143 } // namespace gpu 143 } // namespace gpu
OLDNEW
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | ui/gfx/color_space.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698