| Index: content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
|
| diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
|
| index 5572c1fa2a92ab8422d61ebe7d65efef2b0818ae..5fb7feeed5c6283a8b525842ef18dfaad362c24b 100644
|
| --- a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
|
| +++ b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
|
| @@ -35,7 +35,8 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplSharedMemory::Create(
|
| const gfx::Size& size,
|
| Format format) {
|
| scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory());
|
| - if (!shared_memory->CreateAnonymous(size.GetArea() * BytesPerPixel(format)))
|
| + if (!shared_memory->CreateAnonymous(size.GetArea() * BitsPerPixel(format) /
|
| + 8))
|
| return scoped_ptr<GpuMemoryBufferImpl>();
|
|
|
| return make_scoped_ptr(new GpuMemoryBufferImplSharedMemory(
|
| @@ -50,8 +51,7 @@ GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
|
| Format format,
|
| base::ProcessHandle child_process) {
|
| base::CheckedNumeric<int> buffer_size = size.width();
|
| - buffer_size *= size.height();
|
| - buffer_size *= BytesPerPixel(format);
|
| + buffer_size *= size.height() * BitsPerPixel(format) / 8;
|
| if (!buffer_size.IsValid())
|
| return gfx::GpuMemoryBufferHandle();
|
|
|
| @@ -90,6 +90,11 @@ bool GpuMemoryBufferImplSharedMemory::IsFormatSupported(Format format) {
|
| switch (format) {
|
| case RGBA_8888:
|
| case BGRA_8888:
|
| + case ATC:
|
| + case ATCIA:
|
| + case DXT1:
|
| + case DXT5:
|
| + case ETC1:
|
| return true;
|
| case RGBX_8888:
|
| return false;
|
| @@ -101,7 +106,7 @@ bool GpuMemoryBufferImplSharedMemory::IsFormatSupported(Format format) {
|
|
|
| void* GpuMemoryBufferImplSharedMemory::Map() {
|
| DCHECK(!mapped_);
|
| - if (!shared_memory_->Map(size_.GetArea() * BytesPerPixel(format_)))
|
| + if (!shared_memory_->Map(size_.GetArea() * BitsPerPixel(format_) / 8))
|
| return NULL;
|
| mapped_ = true;
|
| return shared_memory_->memory();
|
| @@ -114,7 +119,7 @@ void GpuMemoryBufferImplSharedMemory::Unmap() {
|
| }
|
|
|
| uint32 GpuMemoryBufferImplSharedMemory::GetStride() const {
|
| - return size_.width() * BytesPerPixel(format_);
|
| + return size_.width() * BitsPerPixel(format_) / 8;
|
| }
|
|
|
| gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSharedMemory::GetHandle() const {
|
|
|