| Index: src/utils/SkTextureCompressor.cpp
|
| diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp
|
| index 2b9234746091bc64ef94af123369154dc799088f..c4a6293ed26f6a4407a0f20332e088a8119b8319 100644
|
| --- a/src/utils/SkTextureCompressor.cpp
|
| +++ b/src/utils/SkTextureCompressor.cpp
|
| @@ -10,8 +10,6 @@
|
| #include "SkBitmap.h"
|
| #include "SkData.h"
|
| #include "SkEndian.h"
|
| -
|
| -#include "SkTextureCompression_opts.h"
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| //
|
| @@ -588,14 +586,15 @@
|
|
|
| // x: b f 00 00 00 a e c g i m 00 00 00 d h j n 00 k o 00 l p
|
|
|
| - x = (x | ((x << 52) & (0x3FULL << 52)) | ((x << 20) & (0x3FULL << 28))) >> 16;
|
| -
|
| + x |= ((x << 52) & (0x3FULL << 52));
|
| + x = (x | ((x << 20) & (0x3FULL << 28))) >> 16;
|
| +
|
| +#if defined (SK_CPU_BENDIAN)
|
| // x: 00 00 00 00 00 00 00 00 b f l p a e c g i m k o d h j n
|
|
|
| t = (x ^ (x >> 6)) & 0xFC0000ULL;
|
| x = x ^ t ^ (t << 6);
|
|
|
| -#if defined (SK_CPU_BENDIAN)
|
| // x: 00 00 00 00 00 00 00 00 b f l p a e i m c g k o d h j n
|
|
|
| t = (x ^ (x >> 36)) & 0x3FULL;
|
| @@ -611,6 +610,11 @@
|
| #else
|
| // If our CPU is little endian, then the above logic will
|
| // produce the following indices:
|
| + // x: 00 00 00 00 00 00 00 00 c g i m d h b f l p j n a e k o
|
| +
|
| + t = (x ^ (x >> 6)) & 0xFC0000ULL;
|
| + x = x ^ t ^ (t << 6);
|
| +
|
| // x: 00 00 00 00 00 00 00 00 c g i m d h l p b f j n a e k o
|
|
|
| t = (x ^ (x >> 36)) & 0xFC0ULL;
|
| @@ -766,37 +770,19 @@
|
| }
|
| }
|
|
|
| +typedef bool (*CompressBitmapProc)(uint8_t* dst, const uint8_t* src,
|
| + int width, int height, int rowBytes);
|
| +
|
| bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType srcColorType,
|
| - int width, int height, int rowBytes, Format format, bool opt) {
|
| - CompressionProc proc = NULL;
|
| - if (opt) {
|
| - proc = SkTextureCompressorGetPlatformProc(srcColorType, format);
|
| - }
|
| -
|
| - if (NULL == proc) {
|
| - switch (srcColorType) {
|
| - case kAlpha_8_SkColorType:
|
| - {
|
| - switch (format) {
|
| - case kLATC_Format:
|
| - proc = compress_a8_to_latc;
|
| - break;
|
| - case kR11_EAC_Format:
|
| - proc = compress_a8_to_r11eac;
|
| - break;
|
| - default:
|
| - // Do nothing...
|
| - break;
|
| - }
|
| - }
|
| - break;
|
| -
|
| - default:
|
| - // Do nothing...
|
| - break;
|
| - }
|
| - }
|
| -
|
| + int width, int height, int rowBytes, Format format) {
|
| +
|
| + CompressBitmapProc kProcMap[kFormatCnt][kLastEnum_SkColorType + 1];
|
| + memset(kProcMap, 0, sizeof(kProcMap));
|
| +
|
| + kProcMap[kLATC_Format][kAlpha_8_SkColorType] = compress_a8_to_latc;
|
| + kProcMap[kR11_EAC_Format][kAlpha_8_SkColorType] = compress_a8_to_r11eac;
|
| +
|
| + CompressBitmapProc proc = kProcMap[format][srcColorType];
|
| if (NULL != proc) {
|
| return proc(dst, src, width, height, rowBytes);
|
| }
|
|
|