| Index: cc/resources/resource_format.cc
|
| diff --git a/cc/resources/resource_format.cc b/cc/resources/resource_format.cc
|
| index c62ae934d728f5d749514164f5da80fc9094c4bd..b2eaee66b51a485830770711cb838a3c469e2e1f 100644
|
| --- a/cc/resources/resource_format.cc
|
| +++ b/cc/resources/resource_format.cc
|
| @@ -28,6 +28,28 @@ SkColorType ResourceFormatToSkColorType(ResourceFormat format) {
|
| return kN32_SkColorType;
|
| }
|
|
|
| +ResourceFormat SkColorTypeToResourceFormat(SkColorType color_type) {
|
| + switch (color_type) {
|
| + case kARGB_4444_SkColorType:
|
| + return RGBA_4444;
|
| + case kAlpha_8_SkColorType:
|
| + return ALPHA_8;
|
| + case kRGB_565_SkColorType:
|
| + return RGB_565;
|
| + case kRGBA_8888_SkColorType:
|
| + return RGBA_8888;
|
| + case kBGRA_8888_SkColorType:
|
| + return BGRA_8888;
|
| + case kGray_8_SkColorType:
|
| + case kIndex_8_SkColorType:
|
| + case kUnknown_SkColorType:
|
| + NOTREACHED();
|
| + break;
|
| + }
|
| + NOTREACHED();
|
| + return RGBA_8888;
|
| +}
|
| +
|
| int BitsPerPixel(ResourceFormat format) {
|
| switch (format) {
|
| case BGRA_8888:
|
| @@ -95,10 +117,11 @@ gfx::BufferFormat BufferFormat(ResourceFormat format) {
|
| return gfx::BufferFormat::BGRA_8888;
|
| case RGBA_4444:
|
| return gfx::BufferFormat::RGBA_4444;
|
| + case ETC1:
|
| + return gfx::BufferFormat::ETC1;
|
| case ALPHA_8:
|
| case LUMINANCE_8:
|
| case RGB_565:
|
| - case ETC1:
|
| case RED_8:
|
| break;
|
| }
|
| @@ -106,4 +129,33 @@ gfx::BufferFormat BufferFormat(ResourceFormat format) {
|
| return gfx::BufferFormat::RGBA_8888;
|
| }
|
|
|
| +ResourceFormat BufferFormatToResourceFormat(gfx::BufferFormat format) {
|
| + switch (format) {
|
| + case gfx::BufferFormat::RGBA_8888:
|
| + return RGBA_8888;
|
| + case gfx::BufferFormat::BGRA_8888:
|
| + return BGRA_8888;
|
| + case gfx::BufferFormat::RGBA_4444:
|
| + return RGBA_4444;
|
| + case gfx::BufferFormat::ETC1:
|
| + return ETC1;
|
| + case gfx::BufferFormat::ATC:
|
| + case gfx::BufferFormat::ATCIA:
|
| + case gfx::BufferFormat::DXT1:
|
| + case gfx::BufferFormat::DXT5:
|
| + case gfx::BufferFormat::R_8:
|
| + case gfx::BufferFormat::BGRX_8888:
|
| + case gfx::BufferFormat::YUV_420:
|
| + case gfx::BufferFormat::YUV_420_BIPLANAR:
|
| + case gfx::BufferFormat::UYVY_422:
|
| + break;
|
| + }
|
| + NOTREACHED();
|
| + return RGBA_8888;
|
| +}
|
| +
|
| +bool IsResourceFormatCompressed(ResourceFormat format) {
|
| + return format == ETC1;
|
| +}
|
| +
|
| } // namespace cc
|
|
|