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

Unified Diff: cc/resources/resource_format.cc

Issue 1379783002: Allow one-copy task tile worker pool to use compressed textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 5 years 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_format.cc
diff --git a/cc/resources/resource_format.cc b/cc/resources/resource_format.cc
index e11c097b04fb53cf58fc4706ddaa7ecb60beb0a4..3a9ca8ba7c9a4f5d6e3dfa88fe03d3ba39ef1c08 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:
@@ -97,14 +119,36 @@ gfx::BufferFormat BufferFormat(ResourceFormat format) {
return gfx::BufferFormat::RGBA_4444;
case RGBA_8888:
return gfx::BufferFormat::RGBA_8888;
+ case ETC1:
+ return gfx::BufferFormat::ETC1;
case ALPHA_8:
case LUMINANCE_8:
case RGB_565:
- case ETC1:
break;
}
NOTREACHED();
return gfx::BufferFormat::RGBA_8888;
}
+bool IsResourceFormatCompressed(ResourceFormat format) {
+ return format == ETC1;
+}
+
+bool DoesResourceFormatSupportAlpha(ResourceFormat format) {
+ switch (format) {
+ case RGBA_4444:
+ case RGBA_8888:
+ case BGRA_8888:
+ case ALPHA_8:
+ return true;
+ case LUMINANCE_8:
+ case RGB_565:
+ case ETC1:
+ case RED_8:
+ return false;
+ }
+ NOTREACHED();
+ return false;
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698