Index: src/utils/SkTextureCompressor.cpp |
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp |
index b90d905d105fe6dad2b4601a84e0cf5d738cbc75..4034615b37f389a024547be0116574eb3e580f7a 100644 |
--- a/src/utils/SkTextureCompressor.cpp |
+++ b/src/utils/SkTextureCompressor.cpp |
@@ -44,31 +44,24 @@ |
} |
// No specialized arguments, return the dimensions as they are in the spec. |
- static const struct FormatDimensions { |
- const int fBlockSizeX; |
- const int fBlockSizeY; |
- } kFormatDimensions[kFormatCnt] = { |
- { 4, 4 }, // kLATC_Format |
- { 4, 4 }, // kR11_EAC_Format |
- { 4, 4 }, // kETC1_Format |
- { 4, 4 }, // kASTC_4x4_Format |
- { 5, 4 }, // kASTC_5x4_Format |
- { 5, 5 }, // kASTC_5x5_Format |
- { 6, 5 }, // kASTC_6x5_Format |
- { 6, 6 }, // kASTC_6x6_Format |
- { 8, 5 }, // kASTC_8x5_Format |
- { 8, 6 }, // kASTC_8x6_Format |
- { 8, 8 }, // kASTC_8x8_Format |
- { 10, 5 }, // kASTC_10x5_Format |
- { 10, 6 }, // kASTC_10x6_Format |
- { 10, 8 }, // kASTC_10x8_Format |
- { 10, 10 }, // kASTC_10x10_Format |
- { 12, 10 }, // kASTC_12x10_Format |
- { 12, 12 }, // kASTC_12x12_Format |
- }; |
- |
- *dimX = kFormatDimensions[format].fBlockSizeX; |
- *dimY = kFormatDimensions[format].fBlockSizeY; |
+ switch(format) { |
+ // These formats are 64 bits per 4x4 block. |
+ default: |
+ SkDEBUGFAIL("Unknown compression format!"); |
+ // fall through |
+ case kLATC_Format: |
+ case kR11_EAC_Format: |
+ case kETC1_Format: |
+ *dimX = 4; |
+ *dimY = 4; |
+ break; |
+ |
+ // This format is 12x12 blocks to 128 bits. |
+ case kASTC_12x12_Format: |
+ *dimX = 12; |
+ *dimY = 12; |
+ break; |
+ } |
} |
int GetCompressedDataSize(Format fmt, int width, int height) { |
@@ -85,20 +78,7 @@ |
encodedBlockSize = 8; |
break; |
- // This format is 128 bits. |
- case kASTC_4x4_Format: |
- case kASTC_5x4_Format: |
- case kASTC_5x5_Format: |
- case kASTC_6x5_Format: |
- case kASTC_6x6_Format: |
- case kASTC_8x5_Format: |
- case kASTC_8x6_Format: |
- case kASTC_8x8_Format: |
- case kASTC_10x5_Format: |
- case kASTC_10x6_Format: |
- case kASTC_10x8_Format: |
- case kASTC_10x10_Format: |
- case kASTC_12x10_Format: |
+ // This format is 12x12 blocks to 128 bits. |
case kASTC_12x12_Format: |
encodedBlockSize = 16; |
break; |
@@ -232,23 +212,9 @@ |
case kETC1_Format: |
return 0 == etc1_decode_image(src, dst, width, height, 3, dstRowBytes); |
#endif |
- |
- case kASTC_4x4_Format: |
- case kASTC_5x4_Format: |
- case kASTC_5x5_Format: |
- case kASTC_6x5_Format: |
- case kASTC_6x6_Format: |
- case kASTC_8x5_Format: |
- case kASTC_8x6_Format: |
- case kASTC_8x8_Format: |
- case kASTC_10x5_Format: |
- case kASTC_10x6_Format: |
- case kASTC_10x8_Format: |
- case kASTC_10x10_Format: |
- case kASTC_12x10_Format: |
- case kASTC_12x12_Format: |
- DecompressASTC(dst, dstRowBytes, src, width, height, dimX, dimY); |
- return true; |
+ case kASTC_12x12_Format: |
+ // TODO(krajcevski) .. right now just fall through and return false. |
+ return false; |
default: |
// Do nothing... |