Chromium Code Reviews| Index: src/utils/SkTextureCompressor.cpp |
| diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp |
| index 30fd3072d5b67e8dab3e9981ebef631509893e7e..e9f66725a62ac216fdac886298fb34adb32be071 100644 |
| --- a/src/utils/SkTextureCompressor.cpp |
| +++ b/src/utils/SkTextureCompressor.cpp |
| @@ -20,12 +20,12 @@ |
| namespace SkTextureCompressor { |
|
robertphillips
2014/07/31 15:01:01
Is there a better name then hardware?
krajcevski
2014/07/31 15:12:18
Done.
|
| -void GetBlockDimensions(Format format, int* dimX, int* dimY) { |
| +void GetBlockDimensions(Format format, int* dimX, int* dimY, bool hardware) { |
| if (NULL == dimX || NULL == dimY) { |
| return; |
| } |
| - if (SkTextureCompressorGetPlatformDims(format, dimX, dimY)) { |
| + if (!hardware && SkTextureCompressorGetPlatformDims(format, dimX, dimY)) { |
| return; |
| } |
| @@ -159,4 +159,30 @@ SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuffer, |
| return NULL; |
| } |
| +bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t* src, |
| + int width, int height, Format format) { |
| + int dimX, dimY; |
| + GetBlockDimensions(format, &dimX, &dimY, true); |
| + |
| + if (width < 0 || ((width % dimX) != 0) || height < 0 || ((height % dimY) != 0)) { |
| + return false; |
| + } |
| + |
| + switch(format) { |
| + case kLATC_Format: |
| + DecompressLATC(dst, dstRowBytes, src, width, height); |
| + return true; |
| + |
| + case kR11_EAC_Format: |
| + DecompressR11EAC(dst, dstRowBytes, src, width, height); |
| + return true; |
| + |
| + case kASTC_12x12_Format: |
| + // TODO(krajcevski) .. right now just fall through and return false. |
| + return false; |
| + } |
| + |
| + return false; |
| +} |
| + |
| } // namespace SkTextureCompressor |