| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkTextureCompressor_DEFINED | 8 #ifndef SkTextureCompressor_DEFINED |
| 9 #define SkTextureCompressor_DEFINED | 9 #define SkTextureCompressor_DEFINED |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 kR11_EAC_Format, // 4x4 blocks, (de)compresses A8 | 22 kR11_EAC_Format, // 4x4 blocks, (de)compresses A8 |
| 23 | 23 |
| 24 // RGB only formats | 24 // RGB only formats |
| 25 kETC1_Format, // 4x4 blocks, compresses RGB 565, decompresses 8-bi
t RGB | 25 kETC1_Format, // 4x4 blocks, compresses RGB 565, decompresses 8-bi
t RGB |
| 26 // NOTE: ETC1 supports 8-bit RGB compression, but
we | 26 // NOTE: ETC1 supports 8-bit RGB compression, but
we |
| 27 // currently don't have any RGB8 SkColorTypes. We
could | 27 // currently don't have any RGB8 SkColorTypes. We
could |
| 28 // support 8-bit RGBA but we would have to prepro
cess the | 28 // support 8-bit RGBA but we would have to prepro
cess the |
| 29 // bitmap to insert alphas. | 29 // bitmap to insert alphas. |
| 30 | 30 |
| 31 // Multi-purpose formats | 31 // Multi-purpose formats |
| 32 kASTC_4x4_Format, // 4x4 blocks, no compression, decompresses RGBA | |
| 33 kASTC_5x4_Format, // 5x4 blocks, no compression, decompresses RGBA | |
| 34 kASTC_5x5_Format, // 5x5 blocks, no compression, decompresses RGBA | |
| 35 kASTC_6x5_Format, // 6x5 blocks, no compression, decompresses RGBA | |
| 36 kASTC_6x6_Format, // 6x6 blocks, no compression, decompresses RGBA | |
| 37 kASTC_8x5_Format, // 8x5 blocks, no compression, decompresses RGBA | |
| 38 kASTC_8x6_Format, // 8x6 blocks, no compression, decompresses RGBA | |
| 39 kASTC_8x8_Format, // 8x8 blocks, no compression, decompresses RGBA | |
| 40 kASTC_10x5_Format, // 10x5 blocks, no compression, decompresses RGBA | |
| 41 kASTC_10x6_Format, // 10x6 blocks, no compression, decompresses RGBA | |
| 42 kASTC_10x8_Format, // 10x8 blocks, no compression, decompresses RGBA | |
| 43 kASTC_10x10_Format, // 10x10 blocks, no compression, decompresses RGBA | |
| 44 kASTC_12x10_Format, // 12x10 blocks, no compression, decompresses RGBA | |
| 45 kASTC_12x12_Format, // 12x12 blocks, compresses A8, decompresses RGBA | 32 kASTC_12x12_Format, // 12x12 blocks, compresses A8, decompresses RGBA |
| 46 | 33 |
| 47 kLast_Format = kASTC_12x12_Format | 34 kLast_Format = kASTC_12x12_Format |
| 48 }; | 35 }; |
| 49 static const int kFormatCnt = kLast_Format + 1; | 36 static const int kFormatCnt = kLast_Format + 1; |
| 50 | 37 |
| 51 // Returns the size of the compressed data given the width, height, and | 38 // Returns the size of the compressed data given the width, height, and |
| 52 // desired compression format. If the width and height are not an appropriat
e | 39 // desired compression format. If the width and height are not an appropriat
e |
| 53 // multiple of the block size, then this function returns an error (-1). | 40 // multiple of the block size, then this function returns an error (-1). |
| 54 int GetCompressedDataSize(Format fmt, int width, int height); | 41 int GetCompressedDataSize(Format fmt, int width, int height); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Returns the desired dimensions of the block size for the given format. Th
ese dimensions | 82 // Returns the desired dimensions of the block size for the given format. Th
ese dimensions |
| 96 // don't necessarily correspond to the specification's dimensions, since the
re may | 83 // don't necessarily correspond to the specification's dimensions, since the
re may |
| 97 // be specialized algorithms that operate on multiple blocks at once. If the | 84 // be specialized algorithms that operate on multiple blocks at once. If the |
| 98 // flag 'matchSpec' is true, then the actual dimensions from the specificati
on are | 85 // flag 'matchSpec' is true, then the actual dimensions from the specificati
on are |
| 99 // returned. If the flag is false, then these dimensions reflect the appropr
iate operable | 86 // returned. If the flag is false, then these dimensions reflect the appropr
iate operable |
| 100 // dimensions of the compression functions. | 87 // dimensions of the compression functions. |
| 101 void GetBlockDimensions(Format format, int* dimX, int* dimY, bool matchSpec
= false); | 88 void GetBlockDimensions(Format format, int* dimX, int* dimY, bool matchSpec
= false); |
| 102 } | 89 } |
| 103 | 90 |
| 104 #endif | 91 #endif |
| OLD | NEW |