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

Unified Diff: cc/resources/resource.cc

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix raster-on-demand codepath Created 7 years, 3 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: 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();
}

Powered by Google App Engine
This is Rietveld 408576698