diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/SkTextureCompressor.cpp | 37 | ||||
-rw-r--r-- | src/utils/SkTextureCompressor.h | 21 |
2 files changed, 10 insertions, 48 deletions
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp index 4eeebcdcd6..801328642f 100644 --- a/src/utils/SkTextureCompressor.cpp +++ b/src/utils/SkTextureCompressor.cpp @@ -16,20 +16,6 @@ #include "SkTextureCompression_opts.h" -#ifndef SK_IGNORE_ETC1_SUPPORT -# include "etc1.h" -#endif - -// Convert ETC1 functions to our function signatures -static bool compress_etc1_565(uint8_t* dst, const uint8_t* src, - int width, int height, int rowBytes) { -#ifndef SK_IGNORE_ETC1_SUPPORT - return 0 == etc1_encode_image(src, width, height, 2, rowBytes, dst); -#else - return false; -#endif -} - //////////////////////////////////////////////////////////////////////////////// namespace SkTextureCompressor { @@ -49,9 +35,8 @@ void GetBlockDimensions(Format format, int* dimX, int* dimY, bool matchSpec) { default: SkDEBUGFAIL("Unknown compression format!"); // fall through - case kLATC_Format: case kR11_EAC_Format: - case kETC1_Format: + case kLATC_Format: *dimX = 4; *dimY = 4; break; @@ -72,9 +57,8 @@ int GetCompressedDataSize(Format fmt, int width, int height) { switch (fmt) { // These formats are 64 bits per 4x4 block. - case kLATC_Format: case kR11_EAC_Format: - case kETC1_Format: + case kLATC_Format: encodedBlockSize = 8; break; @@ -126,19 +110,6 @@ bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType srcCol } break; - case kRGB_565_SkColorType: - { - switch (format) { - case kETC1_Format: - proc = compress_etc1_565; - break; - default: - // Do nothing... - break; - } - } - break; - default: // Do nothing... break; @@ -208,10 +179,6 @@ bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t* sr DecompressR11EAC(dst, dstRowBytes, src, width, height); return true; -#ifndef SK_IGNORE_ETC1_SUPPORT - case kETC1_Format: - return 0 == etc1_decode_image(src, dst, width, height, 3, dstRowBytes); -#endif case kASTC_12x12_Format: // TODO(krajcevski) .. right now just fall through and return false. return false; diff --git a/src/utils/SkTextureCompressor.h b/src/utils/SkTextureCompressor.h index 4254ae76fb..eac8c5eea3 100644 --- a/src/utils/SkTextureCompressor.h +++ b/src/utils/SkTextureCompressor.h @@ -18,18 +18,9 @@ namespace SkTextureCompressor { // Various texture compression formats that we support. enum Format { // Alpha only formats. - kLATC_Format, // 4x4 blocks, (de)compresses A8 - kR11_EAC_Format, // 4x4 blocks, (de)compresses A8 - - // RGB only formats - kETC1_Format, // 4x4 blocks, compresses RGB 565, decompresses 8-bit RGB - // NOTE: ETC1 supports 8-bit RGB compression, but we - // currently don't have any RGB8 SkColorTypes. We could - // support 8-bit RGBA but we would have to preprocess the - // bitmap to insert alphas. - - // Multi-purpose formats - kASTC_12x12_Format, // 12x12 blocks, compresses A8, decompresses RGBA + kLATC_Format, // 4x4 blocks, compresses A8 + kR11_EAC_Format, // 4x4 blocks, compresses A8 + kASTC_12x12_Format, // 12x12 blocks, compresses A8 kLast_Format = kASTC_12x12_Format }; @@ -57,7 +48,11 @@ namespace SkTextureCompressor { // destination buffer. The width and height of the data passed corresponds // to the width and height of the uncompressed image. The destination buffer (dst) // is assumed to be large enough to hold the entire decompressed image. The - // decompressed image colors are determined based on the passed format. + // decompressed image colors are determined based on the passed format: + // + // LATC -> Alpha 8 + // R11_EAC -> Alpha 8 + // ASTC -> RGBA // // Note, CompressBufferToFormat compresses A8 data into ASTC. However, // general ASTC data encodes RGBA data, so that is what the decompressor |