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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc

Issue 1412223009: Reland: GpuMemoryBuffer interface change: Map(**) to Map() and memory(plane); stride(plane) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Win X64 compile fix Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
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 {

Powered by Google App Engine
This is Rietveld 408576698