Chromium Code Reviews| Index: cc/resources/resource.cc |
| diff --git a/cc/resources/resource.cc b/cc/resources/resource.cc |
| index 192eaebddc6d0c09fbf35619c8605f3144dff4ac..41dd535645a03e0dcacb07ef4b276ae24ac0f845 100644 |
| --- a/cc/resources/resource.cc |
| +++ b/cc/resources/resource.cc |
| @@ -11,14 +11,16 @@ size_t Resource::bytes() const { |
| if (size_.IsEmpty()) |
| return 0; |
| - return MemorySizeBytes(size_, format_); |
| + return MemorySizeBytes(size_, format_, is_16_bit_resource_); |
| } |
| -size_t Resource::BytesPerPixel(GLenum format) { |
| +size_t Resource::BytesPerPixel(GLenum format, bool is_16_bit_resource) { |
|
epennerAtGoogle
2013/09/05 01:54:15
Could we just pass in the GL type here rather than
Sami
2013/09/05 14:13:26
+1, I think that would make this a lot cleaner.
kaanb
2013/09/06 02:05:54
On my TODO list for tomorrow.
|
| size_t components_per_pixel = 0; |
| size_t bytes_per_component = 1; |
| switch (format) { |
| case GL_RGBA: |
| + components_per_pixel = (is_16_bit_resource) ? 2 : 4; |
| + break; |
| case GL_BGRA_EXT: |
| components_per_pixel = 4; |
| break; |
| @@ -31,8 +33,10 @@ size_t Resource::BytesPerPixel(GLenum format) { |
| return components_per_pixel * bytes_per_component; |
| } |
| -size_t Resource::MemorySizeBytes(gfx::Size size, GLenum format) { |
| - return BytesPerPixel(format) * size.width() * size.height(); |
| +size_t Resource::MemorySizeBytes( |
| + gfx::Size size, GLenum format, bool is_16_bit_resource) { |
| + return |
| + BytesPerPixel(format, is_16_bit_resource) * size.width() * size.height(); |
| } |