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

Unified Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 806653006: Update GPU memory buffers to use StrideInBytes internally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit Created 5 years, 11 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
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc ('k') | ui/gl/gl_image_memory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0686dc856f1bcf0658376e027aed6ded7fdea1d9 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 StrideInBytes(size_t width, gfx::GpuMemoryBuffer::Format format) {
switch (format) {
case gfx::GpuMemoryBuffer::RGBA_8888:
case gfx::GpuMemoryBuffer::BGRA_8888:
- return 4;
+ return width * 4;
case gfx::GpuMemoryBuffer::RGBX_8888:
NOTREACHED();
return 0;
@@ -71,7 +71,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 StrideInBytes(size_.width(), format_);
}
gfx::GpuMemoryBufferHandle GetHandle() const override {
NOTREACHED();
@@ -133,7 +133,8 @@ 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(
+ StrideInBytes(size.width(), format) * size.height(), 0);
scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data));
return make_scoped_ptr<gfx::GpuMemoryBuffer>(
new GpuMemoryBufferImpl(bytes.get(), size, format));
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_shared_memory.cc ('k') | ui/gl/gl_image_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698