| Index: content/common/gpu/client/gpu_memory_buffer_impl.cc
|
| diff --git a/content/common/gpu/client/gpu_memory_buffer_impl.cc b/content/common/gpu/client/gpu_memory_buffer_impl.cc
|
| index 0c0426f6794c394c3c05ad6abebdf1ace85f611b..0e57e467d8d8141c73bdaf8938e68368b52e84ec 100644
|
| --- a/content/common/gpu/client/gpu_memory_buffer_impl.cc
|
| +++ b/content/common/gpu/client/gpu_memory_buffer_impl.cc
|
| @@ -30,6 +30,7 @@ GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id,
|
| : id_(id),
|
| size_(size),
|
| format_(format),
|
| + num_planes_(NumberOfPlanesForGpuMemoryBufferFormat(format)),
|
| callback_(callback),
|
| mapped_(false),
|
| destruction_sync_point_(0) {
|
| @@ -111,6 +112,10 @@ bool GpuMemoryBufferImpl::StrideInBytes(size_t width,
|
| return false;
|
| }
|
|
|
| +size_t GpuMemoryBufferImpl::GetNumberOfPlanes() const {
|
| + return num_planes_;
|
| +}
|
| +
|
| gfx::GpuMemoryBuffer::Format GpuMemoryBufferImpl::GetFormat() const {
|
| return format_;
|
| }
|
| @@ -123,4 +128,23 @@ ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() {
|
| return reinterpret_cast<ClientBuffer>(this);
|
| }
|
|
|
| +// static
|
| +size_t GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(
|
| + gfx::GpuMemoryBuffer::Format format) {
|
| + switch (format) {
|
| + case gfx::GpuMemoryBuffer::Format::ATC:
|
| + case gfx::GpuMemoryBuffer::Format::ATCIA:
|
| + case gfx::GpuMemoryBuffer::Format::DXT1:
|
| + case gfx::GpuMemoryBuffer::Format::DXT5:
|
| + case gfx::GpuMemoryBuffer::Format::ETC1:
|
| + case gfx::GpuMemoryBuffer::Format::RGBA_8888:
|
| + case gfx::GpuMemoryBuffer::Format::RGBX_8888:
|
| + case gfx::GpuMemoryBuffer::Format::BGRA_8888:
|
| + return 1;
|
| + default:
|
| + NOTREACHED();
|
| + return 0;
|
| + }
|
| +}
|
| +
|
| } // namespace content
|
|
|