diff options
author | kaanb@chromium.org <kaanb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-24 07:13:16 +0000 |
---|---|---|
committer | kaanb@chromium.org <kaanb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-24 07:13:16 +0000 |
commit | 186f096098ec9b599d84ea38b6eda11fa1082107 (patch) | |
tree | 4577bc37421f7c265639de7d8d46bbd361ab6e1a /cc/resources | |
parent | 501725f023c51933adc1cfd9aa50a1b2211d49a9 (diff) | |
download | chromium_src-186f096098ec9b599d84ea38b6eda11fa1082107.zip chromium_src-186f096098ec9b599d84ea38b6eda11fa1082107.tar.gz chromium_src-186f096098ec9b599d84ea38b6eda11fa1082107.tar.bz2 |
[Android] Use RGB_565 renderer transport surfaces for low-end devices.
BUG=272436
Review URL: https://chromiumcodereview.appspot.com/24313005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources')
-rw-r--r-- | cc/resources/raster_worker_pool.cc | 1 | ||||
-rw-r--r-- | cc/resources/resource_format.cc | 1 | ||||
-rw-r--r-- | cc/resources/resource_format.h | 3 | ||||
-rw-r--r-- | cc/resources/resource_provider.cc | 38 |
4 files changed, 21 insertions, 22 deletions
diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc index 2df3d442..260766c 100644 --- a/cc/resources/raster_worker_pool.cc +++ b/cc/resources/raster_worker_pool.cc @@ -146,6 +146,7 @@ class RasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask { bitmap.setPixels(buffer); break; case LUMINANCE_8: + case RGB_565: NOTREACHED(); break; } diff --git a/cc/resources/resource_format.cc b/cc/resources/resource_format.cc index 28bb1e4..5ea3df1 100644 --- a/cc/resources/resource_format.cc +++ b/cc/resources/resource_format.cc @@ -14,6 +14,7 @@ SkBitmap::Config SkBitmapConfigFromFormat(ResourceFormat format) { case BGRA_8888: return SkBitmap::kARGB_8888_Config; case LUMINANCE_8: + case RGB_565: NOTREACHED(); break; } diff --git a/cc/resources/resource_format.h b/cc/resources/resource_format.h index 4b12d92..ef83cc0 100644 --- a/cc/resources/resource_format.h +++ b/cc/resources/resource_format.h @@ -15,7 +15,8 @@ enum ResourceFormat { RGBA_4444, BGRA_8888, LUMINANCE_8, - RESOURCE_FORMAT_MAX = LUMINANCE_8, + RGB_565, + RESOURCE_FORMAT_MAX = RGB_565, }; SkBitmap::Config SkBitmapConfigFromFormat(ResourceFormat format); diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index 2d7bdec..666a793 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc @@ -39,12 +39,15 @@ GLenum TextureToStorageFormat(ResourceFormat format) { GLenum storage_format = GL_RGBA8_OES; switch (format) { case RGBA_8888: - case RGBA_4444: - case LUMINANCE_8: break; case BGRA_8888: storage_format = GL_BGRA8_EXT; break; + case RGBA_4444: + case LUMINANCE_8: + case RGB_565: + NOTREACHED(); + break; } return storage_format; @@ -57,6 +60,7 @@ bool IsFormatSupportedForStorage(ResourceFormat format) { return true; case RGBA_4444: case LUMINANCE_8: + case RGB_565: return false; } return false; @@ -1647,30 +1651,18 @@ WebKit::WebGraphicsContext3D* ResourceProvider::Context3d() const { } size_t ResourceProvider::BytesPerPixel(ResourceFormat format) { - size_t components_per_pixel = 0; - switch (format) { - case RGBA_8888: - case RGBA_4444: - case BGRA_8888: - components_per_pixel = 4; - break; - case LUMINANCE_8: - components_per_pixel = 1; - break; - } - size_t bits_per_component = 0; switch (format) { case RGBA_8888: case BGRA_8888: - case LUMINANCE_8: - bits_per_component = 8; - break; + return 4; case RGBA_4444: - bits_per_component = 4; - break; + case RGB_565: + return 2; + case LUMINANCE_8: + return 1; } - const size_t kBitsPerByte = 8; - return (components_per_pixel * bits_per_component) / kBitsPerByte; + NOTREACHED(); + return 4; } GLenum ResourceProvider::GetGLDataType(ResourceFormat format) { @@ -1681,6 +1673,8 @@ GLenum ResourceProvider::GetGLDataType(ResourceFormat format) { case BGRA_8888: case LUMINANCE_8: return GL_UNSIGNED_BYTE; + case RGB_565: + return GL_UNSIGNED_SHORT_5_6_5; } NOTREACHED(); return GL_UNSIGNED_BYTE; @@ -1695,6 +1689,8 @@ GLenum ResourceProvider::GetGLDataFormat(ResourceFormat format) { return GL_BGRA_EXT; case LUMINANCE_8: return GL_LUMINANCE; + case RGB_565: + return GL_RGB; } NOTREACHED(); return GL_RGBA; |