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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl.cc

Issue 806653006: Update GPU memory buffers to use StrideInBytes internally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/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 d3c08bdb1a09b0d1256c297148cd190d2fae5690..cb53c205bbd5d026442f4d13df8a78d85da0b718 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl.cc
@@ -76,18 +76,27 @@ GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer(
}
// static
-size_t GpuMemoryBufferImpl::BytesPerPixel(Format format) {
+size_t GpuMemoryBufferImpl::BitsPerPixel(Format format) {
switch (format) {
case RGBA_8888:
case RGBX_8888:
case BGRA_8888:
- return 4;
+ return 32;
}
NOTREACHED();
return 0;
}
+// static
+size_t GpuMemoryBufferImpl::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;
+}
+
gfx::GpuMemoryBuffer::Format GpuMemoryBufferImpl::GetFormat() const {
return format_;
}

Powered by Google App Engine
This is Rietveld 408576698