| Index: gpu/command_buffer/tests/gl_manager.cc
|
| diff --git a/gpu/command_buffer/tests/gl_manager.cc b/gpu/command_buffer/tests/gl_manager.cc
|
| index 6e5e58eda38768ab48e276f1439900ce09068f76..5947a962d53d23371a7944f89e0db3ead45a288e 100644
|
| --- a/gpu/command_buffer/tests/gl_manager.cc
|
| +++ b/gpu/command_buffer/tests/gl_manager.cc
|
| @@ -37,11 +37,11 @@
|
| namespace gpu {
|
| namespace {
|
|
|
| -size_t BytesPerPixel(gfx::GpuMemoryBuffer::Format format) {
|
| +size_t BitsPerPixel(gfx::GpuMemoryBuffer::Format format) {
|
| switch (format) {
|
| case gfx::GpuMemoryBuffer::RGBA_8888:
|
| case gfx::GpuMemoryBuffer::BGRA_8888:
|
| - return 4;
|
| + return 32;
|
| case gfx::GpuMemoryBuffer::RGBX_8888:
|
| NOTREACHED();
|
| return 0;
|
| @@ -51,6 +51,12 @@ size_t BytesPerPixel(gfx::GpuMemoryBuffer::Format format) {
|
| return 0;
|
| }
|
|
|
| +size_t PixelsToBytes(size_t pixel_count, gfx::GpuMemoryBuffer::Format format) {
|
| + size_t size_in_bits = pixel_count * BitsPerPixel(format);
|
| + DCHECK_EQ(size_in_bits % 8, 0u);
|
| + return size_in_bits / 8;
|
| +}
|
| +
|
| class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
|
| public:
|
| GpuMemoryBufferImpl(base::RefCountedBytes* bytes,
|
| @@ -71,7 +77,7 @@ class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
|
| bool IsMapped() const override { return mapped_; }
|
| Format GetFormat() const override { return format_; }
|
| uint32 GetStride() const override {
|
| - return size_.width() * BytesPerPixel(format_);
|
| + return PixelsToBytes(size_.width(), format_);
|
| }
|
| gfx::GpuMemoryBufferHandle GetHandle() const override {
|
| NOTREACHED();
|
| @@ -133,7 +139,7 @@ GLManager::~GLManager() {
|
| scoped_ptr<gfx::GpuMemoryBuffer> GLManager::CreateGpuMemoryBuffer(
|
| const gfx::Size& size,
|
| gfx::GpuMemoryBuffer::Format format) {
|
| - std::vector<unsigned char> data(size.GetArea() * BytesPerPixel(format), 0);
|
| + std::vector<unsigned char> data(PixelsToBytes(size.GetArea(), format), 0);
|
| scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data));
|
| return make_scoped_ptr<gfx::GpuMemoryBuffer>(
|
| new GpuMemoryBufferImpl(bytes.get(), size, format));
|
|
|