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

Unified Diff: content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc

Issue 1062853002: Add gfx::GpuMemoryBuffer::YUV_420 and GpuMemoryBufferImplSharedMemory support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reveman@ comments. Created 5 years, 8 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/gpu_memory_buffer_factory_shared_memory.cc
diff --git a/content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc b/content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc
index 790fcab9f8ae4bfcda1daba8d4b1638a446cdb03..e82a15c38e44ebc73a9af9d7bed2ad5d6d18c897 100644
--- a/content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc
+++ b/content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc
@@ -24,7 +24,8 @@ void GpuMemoryBufferFactorySharedMemory::
std::vector<Configuration>* configurations) {
const Configuration supported_configurations[] = {
{ gfx::GpuMemoryBuffer::RGBA_8888, gfx::GpuMemoryBuffer::MAP },
- { gfx::GpuMemoryBuffer::BGRA_8888, gfx::GpuMemoryBuffer::MAP }
+ { gfx::GpuMemoryBuffer::BGRA_8888, gfx::GpuMemoryBuffer::MAP },
+ { gfx::GpuMemoryBuffer::YUV_420, gfx::GpuMemoryBuffer::MAP }
};
configurations->assign(
supported_configurations,
@@ -39,19 +40,12 @@ GpuMemoryBufferFactorySharedMemory::CreateGpuMemoryBuffer(
gfx::GpuMemoryBuffer::Usage usage,
int client_id,
gfx::PluginWindowHandle surface_handle) {
- base::SharedMemory shared_memory;
-
- size_t stride_in_bytes = 0;
- if (!GpuMemoryBufferImpl::StrideInBytes(
- size.width(), format, &stride_in_bytes))
+ size_t buffer_size = 0u;
+ if (!GpuMemoryBufferImpl::BufferSizeInBytes(size, format, &buffer_size))
return gfx::GpuMemoryBufferHandle();
- base::CheckedNumeric<size_t> size_in_bytes = stride_in_bytes;
- size_in_bytes *= size.height();
- if (!size_in_bytes.IsValid())
- return gfx::GpuMemoryBufferHandle();
-
- if (!shared_memory.CreateAnonymous(size_in_bytes.ValueOrDie()))
+ base::SharedMemory shared_memory;
+ if (!shared_memory.CreateAnonymous(buffer_size))
return gfx::GpuMemoryBufferHandle();
gfx::GpuMemoryBufferHandle handle;

Powered by Google App Engine
This is Rietveld 408576698