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 916083002: Add support for compressed GPU memory buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compressed format detection in own function and image size check Created 5 years, 10 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
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 4b05bbff2aa1c4ce67da55713b3d020a4a9d8f0a..0c0426f6794c394c3c05ad6abebdf1ace85f611b 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl.cc
@@ -82,6 +82,20 @@ bool GpuMemoryBufferImpl::StrideInBytes(size_t width,
size_t* stride_in_bytes) {
base::CheckedNumeric<size_t> s = width;
switch (format) {
+ case ATCIA:
+ case DXT5:
+ *stride_in_bytes = width;
+ return true;
+ case ATC:
+ case DXT1:
+ case ETC1:
+ DCHECK_EQ(width % 2, 0U);
piman 2015/02/19 23:52:04 Could we add a DCHECK, somewhere on the client sid
christiank 2015/02/20 08:32:14 I agree, sounds like a good idea. Fixed.
+ s /= 2;
+ if (!s.IsValid())
+ return false;
+
+ *stride_in_bytes = s.ValueOrDie();
+ return true;
case RGBA_8888:
case RGBX_8888:
case BGRA_8888:

Powered by Google App Engine
This is Rietveld 408576698