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 |
11 #include "SkImageInfo.h" | 11 #include "SkImageInfo.h" |
12 #include "SkBlitter.h" | 12 #include "SkBlitter.h" |
13 | 13 |
14 class SkBitmap; | 14 class SkBitmap; |
15 class SkData; | 15 class SkData; |
16 | 16 |
17 namespace SkTextureCompressor { | 17 namespace SkTextureCompressor { |
18 // Various texture compression formats that we support. | 18 // Various texture compression formats that we support. |
19 enum Format { | 19 enum Format { |
20 // Alpha only formats. | 20 // Alpha only formats. |
21 kLATC_Format, // 4x4 blocks, compresses A8 | 21 kLATC_Format, // 4x4 blocks, compresses A8 |
22 kR11_EAC_Format, // 4x4 blocks, compresses A8 | 22 kR11_EAC_Format, // 4x4 blocks, compresses A8 |
| 23 kASTC_12x12_Format, // 12x12 blocks, compresses A8 |
23 | 24 |
24 kLast_Format = kR11_EAC_Format | 25 kLast_Format = kASTC_12x12_Format |
25 }; | 26 }; |
26 static const int kFormatCnt = kLast_Format + 1; | 27 static const int kFormatCnt = kLast_Format + 1; |
27 | 28 |
28 // Returns the size of the compressed data given the width, height, and | 29 // Returns the size of the compressed data given the width, height, and |
29 // desired compression format. If the width and height are not an appropriat
e | 30 // desired compression format. If the width and height are not an appropriat
e |
30 // multiple of the block size, then this function returns an error (-1). | 31 // multiple of the block size, then this function returns an error (-1). |
31 int GetCompressedDataSize(Format fmt, int width, int height); | 32 int GetCompressedDataSize(Format fmt, int width, int height); |
32 | 33 |
33 // Returns an SkData holding a blob of compressed data that corresponds | 34 // Returns an SkData holding a blob of compressed data that corresponds |
34 // to the bitmap. If the bitmap colorType cannot be compressed using the | 35 // to the bitmap. If the bitmap colorType cannot be compressed using the |
(...skipping 15 matching lines...) Expand all Loading... |
50 int width, int height, int rowBytes); | 51 int width, int height, int rowBytes); |
51 | 52 |
52 // Returns the blitter for the given compression format. Note, the blitter | 53 // Returns the blitter for the given compression format. Note, the blitter |
53 // is intended to be used with the proper input. I.e. if you try to blit | 54 // is intended to be used with the proper input. I.e. if you try to blit |
54 // RGB source data into an R11 EAC texture, you're gonna have a bad time. | 55 // RGB source data into an R11 EAC texture, you're gonna have a bad time. |
55 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuf
fer, | 56 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuf
fer, |
56 Format format); | 57 Format format); |
57 } | 58 } |
58 | 59 |
59 #endif | 60 #endif |
OLD | NEW |