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

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

Issue 806653006: Update GPU memory buffers to use StrideInBytes internally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use StrideInBytes Created 6 years 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_io_surface.cc
diff --git a/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc b/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc
index ba00ea2553a2600002baee58b12b5ee9cdb9a4c0..5b0174f4064e03e7a26ac9cbe4f48d71d5889991 100644
--- a/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc
+++ b/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc
@@ -94,6 +94,9 @@ GpuMemoryBufferFactoryIOSurface::CreateGpuMemoryBuffer(
gfx::GpuMemoryBuffer::Usage usage,
int client_id,
gfx::PluginWindowHandle surface_handle) {
+ size_t width_in_bytes =
+ GpuMemoryBufferImpl::StrideInBytes(size.width(), format);
+ DCHECK_EQ(width_in_bytes % size.width(), 0u);
base::ScopedCFTypeRef<CFMutableDictionaryRef> properties;
properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault,
0,
@@ -101,7 +104,8 @@ GpuMemoryBufferFactoryIOSurface::CreateGpuMemoryBuffer(
&kCFTypeDictionaryValueCallBacks));
AddIntegerValue(properties, kIOSurfaceWidth, size.width());
AddIntegerValue(properties, kIOSurfaceHeight, size.height());
- AddIntegerValue(properties, kIOSurfaceBytesPerElement, BytesPerPixel(format));
+ AddIntegerValue(properties, kIOSurfaceBytesPerElement,
+ width_in_bytes / size.width());
reveman 2014/12/18 18:49:57 nit: Please keep using BytesPerPixel here instead.
christiank 2015/01/12 10:35:22 Alright, I missed that this file actually had its
AddIntegerValue(properties, kIOSurfacePixelFormat, PixelFormat(format));
// TODO(reveman): Remove this when using a mach_port_t to transfer
// IOSurface to browser and renderer process. crbug.com/323304

Powered by Google App Engine
This is Rietveld 408576698