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

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

Issue 1282313002: Add YUV_420_BIPLANAR to gfx::BufferFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gmb-planes
Patch Set: Rebase Created 5 years, 4 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 f16125bfa181f8e5bd51abfe54c0d48b3d453511..7a3f044f8999eaf06dc758b45b4e519f24e11cfd 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
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "content/common/mac/io_surface_manager.h"
+#include "ui/gfx/buffer_format_util.h"
namespace content {
namespace {
@@ -61,7 +62,9 @@ bool GpuMemoryBufferImplIOSurface::Map(void** data) {
IOReturn status = IOSurfaceLock(io_surface_, lock_flags_, NULL);
DCHECK_NE(status, kIOReturnCannotLock);
mapped_ = true;
- *data = IOSurfaceGetBaseAddress(io_surface_);
+ size_t num_planes = gfx::NumberOfPlanesForBufferFormat(GetFormat());
+ for (size_t plane = 0; plane < num_planes; ++plane)
+ data[plane] = IOSurfaceGetBaseAddressOfPlane(io_surface_, plane);
return true;
}
@@ -71,8 +74,10 @@ void GpuMemoryBufferImplIOSurface::Unmap() {
mapped_ = false;
}
-void GpuMemoryBufferImplIOSurface::GetStride(int* stride) const {
- *stride = IOSurfaceGetBytesPerRow(io_surface_);
+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);
}
gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const {
« no previous file with comments | « content/common/gpu/client/gpu_memory_buffer_impl.cc ('k') | content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698