Index: content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc |
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc |
index 13d2cc7fcd600b4704da4656649ea560bb465062..a65db1cb4aee89ea4318eb25f4ba0b1b8f225f12 100644 |
--- a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc |
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc |
@@ -89,27 +89,29 @@ base::Closure GpuMemoryBufferImplIOSurface::AllocateForTesting( |
return base::Bind(&FreeIOSurfaceForTesting, kBufferId); |
} |
-bool GpuMemoryBufferImplIOSurface::Map(void** data) { |
+bool GpuMemoryBufferImplIOSurface::Map() { |
DCHECK(!mapped_); |
IOReturn status = IOSurfaceLock(io_surface_, lock_flags_, NULL); |
DCHECK_NE(status, kIOReturnCannotLock); |
mapped_ = true; |
- size_t num_planes = gfx::NumberOfPlanesForBufferFormat(GetFormat()); |
- for (size_t plane = 0; plane < num_planes; ++plane) |
- data[plane] = IOSurfaceGetBaseAddressOfPlane(io_surface_, plane); |
return true; |
} |
+void* GpuMemoryBufferImplIOSurface::memory(size_t plane) { |
+ DCHECK(mapped_); |
+ DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_)); |
+ return IOSurfaceGetBaseAddressOfPlane(io_surface_, plane); |
+} |
+ |
void GpuMemoryBufferImplIOSurface::Unmap() { |
DCHECK(mapped_); |
IOSurfaceUnlock(io_surface_, lock_flags_, NULL); |
mapped_ = false; |
} |
-void GpuMemoryBufferImplIOSurface::GetStride(int* strides) const { |
- size_t num_planes = gfx::NumberOfPlanesForBufferFormat(GetFormat()); |
- for (size_t plane = 0; plane < num_planes; ++plane) |
- strides[plane] = IOSurfaceGetBytesPerRowOfPlane(io_surface_, plane); |
+int GpuMemoryBufferImplIOSurface::stride(size_t plane) const { |
+ DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_)); |
+ return IOSurfaceGetBytesPerRowOfPlane(io_surface_, plane); |
} |
gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { |