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 #include "SkTextureCompressor_ASTC.h" | 8 #include "SkTextureCompressor_ASTC.h" |
9 #include "SkTextureCompressor_Blitter.h" | 9 #include "SkTextureCompressor_Blitter.h" |
10 | 10 |
11 #include "SkBlitter.h" | 11 #include "SkBlitter.h" |
12 #include "SkEndian.h" | 12 #include "SkEndian.h" |
13 #include "SkMath.h" | 13 #include "SkMathPriv.h" |
14 | 14 |
15 // This table contains the weight values for each texel. This is used in determi
ning | 15 // This table contains the weight values for each texel. This is used in determi
ning |
16 // how to convert a 12x12 grid of alpha values into a 6x5 grid of index values.
Since | 16 // how to convert a 12x12 grid of alpha values into a 6x5 grid of index values.
Since |
17 // we have a 6x5 grid, that gives 30 values that we have to compute. For each in
dex, | 17 // we have a 6x5 grid, that gives 30 values that we have to compute. For each in
dex, |
18 // we store up to 20 different triplets of values. In order the triplets are: | 18 // we store up to 20 different triplets of values. In order the triplets are: |
19 // weight, texel-x, texel-y | 19 // weight, texel-x, texel-y |
20 // The weight value corresponds to the amount that this index contributes to the
final | 20 // The weight value corresponds to the amount that this index contributes to the
final |
21 // index value of the given texel. Hence, we need to reconstruct the 6x5 index g
rid | 21 // index value of the given texel. Hence, we need to reconstruct the 6x5 index g
rid |
22 // from their relative contribution to the 12x12 texel grid. | 22 // from their relative contribution to the 12x12 texel grid. |
23 // | 23 // |
(...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 read_astc_block(&data, src); | 2092 read_astc_block(&data, src); |
2093 decompress_astc_block(reinterpret_cast<uint8_t*>(colorPtr + x), dstR
owBytes, data); | 2093 decompress_astc_block(reinterpret_cast<uint8_t*>(colorPtr + x), dstR
owBytes, data); |
2094 | 2094 |
2095 // ASTC encoded blocks are 16 bytes (128 bits) large. | 2095 // ASTC encoded blocks are 16 bytes (128 bits) large. |
2096 src += 16; | 2096 src += 16; |
2097 } | 2097 } |
2098 } | 2098 } |
2099 } | 2099 } |
2100 | 2100 |
2101 } // SkTextureCompressor | 2101 } // SkTextureCompressor |
OLD | NEW |