Index: ui/gl/gl_image_shared_memory.cc |
diff --git a/ui/gl/gl_image_shared_memory.cc b/ui/gl/gl_image_shared_memory.cc |
index 0bbf54910fcc9c9fe7391954f8c9adcb1e8434c5..866e24479ed6c8f594b2610fe2e4e7d99a78a271 100644 |
--- a/ui/gl/gl_image_shared_memory.cc |
+++ b/ui/gl/gl_image_shared_memory.cc |
@@ -17,9 +17,11 @@ bool SizeInBytes(const gfx::Size& size, |
size_t* size_in_bytes) { |
if (size.IsEmpty()) |
return false; |
- base::CheckedNumeric<size_t> s = GLImageMemory::BytesPerPixel(format); |
+ DCHECK_EQ(size.GetArea() * GLImageMemory::BitsPerPixel(format) % 8, 0u); |
reveman
2014/12/15 17:33:34
Hm, so this will fail for a 1x1 buffer with bpp <
christiank
2014/12/16 12:02:52
Currently we don't support images with a width and
reveman
2014/12/16 16:40:12
A renderer should not be able cause the GPU servic
|
+ base::CheckedNumeric<size_t> s = GLImageMemory::BitsPerPixel(format); |
s *= size.width(); |
s *= size.height(); |
+ s /= 8; |
if (!s.IsValid()) |
return false; |
*size_in_bytes = s.ValueOrDie(); |