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 25 matching lines...) Expand all Loading... | |
36 // associated format, then we return NULL. The caller is responsible for | 36 // associated format, then we return NULL. The caller is responsible for |
37 // calling unref() on the returned data. | 37 // calling unref() on the returned data. |
38 SkData* CompressBitmapToFormat(const SkBitmap& bitmap, Format format); | 38 SkData* CompressBitmapToFormat(const SkBitmap& bitmap, Format format); |
39 | 39 |
40 // Compresses the given src data into dst. The src data is assumed to be | 40 // Compresses the given src data into dst. The src data is assumed to be |
41 // large enough to hold width*height pixels. The dst data is expected to | 41 // large enough to hold width*height pixels. The dst data is expected to |
42 // be large enough to hold the compressed data according to the format. | 42 // be large enough to hold the compressed data according to the format. |
43 bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType sr cColorType, | 43 bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType sr cColorType, |
44 int width, int height, int rowBytes, Format form at, | 44 int width, int height, int rowBytes, Format form at, |
45 bool opt = true /* Use optimization if available */); | 45 bool opt = true /* Use optimization if available */); |
46 | 46 |
robertphillips
2014/07/31 15:01:01
typo.
krajcevski
2014/07/31 15:12:18
Done.
| |
47 // Decomrpesses the given src data from the format specified into the | |
48 // destination buffer. The width and height of the data passed corresponds | |
49 // to the width and height of the uncompressed image. The destination buffer (dst) | |
50 // is assumed to be large enough to hold the entire decompressed image. The | |
51 // decompressed image colors are determined based on the passed format: | |
52 // | |
53 // LATC -> Alpha 8 | |
54 // R11_EAC -> Alpha 8 | |
55 // ASTC -> RGBA | |
56 // | |
57 // Note, CompressBufferToFormat compresses A8 data into ASTC. However, | |
58 // general ASTC data encodes RGBA data, so that is what the decompressor | |
59 // operates on. | |
60 // | |
61 // Returns true if successfully decompresses the src data. | |
62 bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t * src, | |
63 int width, int height, Format format); | |
64 | |
47 // This typedef defines what the nominal aspects of a compression function | 65 // This typedef defines what the nominal aspects of a compression function |
48 // are. The typedef is not meant to be used by clients of the API, but rathe r | 66 // are. The typedef is not meant to be used by clients of the API, but rathe r |
49 // allows SIMD optimized compression functions to be implemented. | 67 // allows SIMD optimized compression functions to be implemented. |
50 typedef bool (*CompressionProc)(uint8_t* dst, const uint8_t* src, | 68 typedef bool (*CompressionProc)(uint8_t* dst, const uint8_t* src, |
51 int width, int height, int rowBytes); | 69 int width, int height, int rowBytes); |
52 | 70 |
53 // Returns the blitter for the given compression format. Note, the blitter | 71 // Returns the blitter for the given compression format. Note, the blitter |
54 // is intended to be used with the proper input. I.e. if you try to blit | 72 // is intended to be used with the proper input. I.e. if you try to blit |
55 // RGB source data into an R11 EAC texture, you're gonna have a bad time. | 73 // RGB source data into an R11 EAC texture, you're gonna have a bad time. |
56 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuf fer, | 74 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuf fer, |
57 Format format); | 75 Format format); |
58 | 76 |
59 // Returns the desired dimensions of the block size for the given format. Th ese dimensions | 77 // Returns the desired dimensions of the block size for the given format. Th ese dimensions |
60 // don't necessarily correspond to the hardware-specified dimensions, since there may | 78 // don't necessarily correspond to the hardware-specified dimensions, since there may |
61 // be specialized algorithms that operate on multiple blocks at once. These dimensions | 79 // be specialized algorithms that operate on multiple blocks at once. These dimensions |
62 // reflect that optimization and return the appropriate operable dimensions. | 80 // reflect that optimization and return the appropriate operable dimensions. If the |
63 void GetBlockDimensions(Format format, int* dimX, int* dimY); | 81 // flag 'hardware' is true, then the actual hardware dimensions are returned . |
82 void GetBlockDimensions(Format format, int* dimX, int* dimY, bool hardware = false); | |
64 } | 83 } |
65 | 84 |
66 #endif | 85 #endif |
OLD | NEW |