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" |
| 12 |
11 class SkBitmap; | 13 class SkBitmap; |
12 class SkData; | 14 class SkData; |
13 | 15 |
14 namespace SkTextureCompressor { | 16 namespace SkTextureCompressor { |
15 // Various texture compression formats that we support. | 17 // Various texture compression formats that we support. |
16 enum Format { | 18 enum Format { |
17 // Alpha only format. | 19 // Alpha only format. |
18 kLATC_Format, | 20 kLATC_Format, |
19 | 21 |
20 kLast_Format = kLATC_Format | 22 kLast_Format = kLATC_Format |
21 }; | 23 }; |
22 static const int kFormatCnt = kLast_Format + 1; | 24 static const int kFormatCnt = kLast_Format + 1; |
23 | 25 |
24 // Returns an SkData holding a blob of compressed data that corresponds | 26 // Returns an SkData holding a blob of compressed data that corresponds |
25 // to the bitmap. If the bitmap colorType cannot be compressed using the | 27 // to the bitmap. If the bitmap colorType cannot be compressed using the |
26 // associated format, then we return NULL. The caller is responsible for | 28 // associated format, then we return NULL. The caller is responsible for |
27 // calling unref() on the returned data. | 29 // calling unref() on the returned data. |
28 SkData* CompressBitmapToFormat(const SkBitmap& bitmap, Format format); | 30 SkData* CompressBitmapToFormat(const SkBitmap& bitmap, Format format); |
| 31 |
| 32 // Compresses the given src data into dst. The src data is assumed to be |
| 33 // large enough to hold width*height pixels. The dst data is expected to |
| 34 // be large enough to hold the compressed data according to the format. |
| 35 bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType sr
cColorType, |
| 36 int width, int height, int rowBytes, Format form
at); |
29 } | 37 } |
30 | 38 |
31 #endif | 39 #endif |
OLD | NEW |