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

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

Issue 2298353002: gfx: Use unsigned strides for gpu memory buffers. (Closed)
Patch Set: . Created 4 years, 3 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
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/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 9 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
10 #include "ui/gfx/buffer_format_util.h" 10 #include "ui/gfx/buffer_format_util.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_)); 98 DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
99 return IOSurfaceGetBaseAddressOfPlane(io_surface_, plane); 99 return IOSurfaceGetBaseAddressOfPlane(io_surface_, plane);
100 } 100 }
101 101
102 void GpuMemoryBufferImplIOSurface::Unmap() { 102 void GpuMemoryBufferImplIOSurface::Unmap() {
103 DCHECK(mapped_); 103 DCHECK(mapped_);
104 IOSurfaceUnlock(io_surface_, lock_flags_, NULL); 104 IOSurfaceUnlock(io_surface_, lock_flags_, NULL);
105 mapped_ = false; 105 mapped_ = false;
106 } 106 }
107 107
108 int GpuMemoryBufferImplIOSurface::stride(size_t plane) const { 108 uint32_t GpuMemoryBufferImplIOSurface::stride(size_t plane) const {
109 DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_)); 109 DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
110 return IOSurfaceGetBytesPerRowOfPlane(io_surface_, plane); 110 return IOSurfaceGetBytesPerRowOfPlane(io_surface_, plane);
111 } 111 }
112 112
113 void GpuMemoryBufferImplIOSurface::SetColorSpaceForScanout( 113 void GpuMemoryBufferImplIOSurface::SetColorSpaceForScanout(
114 const gfx::ColorSpace& color_space) { 114 const gfx::ColorSpace& color_space) {
115 if (color_space == color_space_) 115 if (color_space == color_space_)
116 return; 116 return;
117 color_space_ = color_space; 117 color_space_ = color_space;
118 std::vector<char> icc_profile = 118 std::vector<char> icc_profile =
119 gfx::ICCProfile::FromColorSpace(color_space).GetData(); 119 gfx::ICCProfile::FromColorSpace(color_space).GetData();
120 if (icc_profile.size()) { 120 if (icc_profile.size()) {
121 base::ScopedCFTypeRef<CFDataRef> cf_data_icc_profile(CFDataCreate( 121 base::ScopedCFTypeRef<CFDataRef> cf_data_icc_profile(CFDataCreate(
122 nullptr, reinterpret_cast<const UInt8*>(icc_profile.data()), 122 nullptr, reinterpret_cast<const UInt8*>(icc_profile.data()),
123 icc_profile.size())); 123 icc_profile.size()));
124 IOSurfaceSetValue(io_surface_, CFSTR("IOSurfaceColorSpace"), 124 IOSurfaceSetValue(io_surface_, CFSTR("IOSurfaceColorSpace"),
125 cf_data_icc_profile); 125 cf_data_icc_profile);
126 } 126 }
127 } 127 }
128 128
129 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { 129 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const {
130 gfx::GpuMemoryBufferHandle handle; 130 gfx::GpuMemoryBufferHandle handle;
131 handle.type = gfx::IO_SURFACE_BUFFER; 131 handle.type = gfx::IO_SURFACE_BUFFER;
132 handle.id = id_; 132 handle.id = id_;
133 return handle; 133 return handle;
134 } 134 }
135 135
136 } // namespace gpu 136 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h ('k') | gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698