OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The Android Open Source Project | 2 * Copyright 2015 The Android Open Source Project |
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 SkCodecPriv_DEFINED | 8 #ifndef SkCodecPriv_DEFINED |
9 #define SkCodecPriv_DEFINED | 9 #define SkCodecPriv_DEFINED |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 uint8_t zeroAlpha = 0; \ | 24 uint8_t zeroAlpha = 0; \ |
25 uint8_t maxAlpha = 0xFF; | 25 uint8_t maxAlpha = 0xFF; |
26 | 26 |
27 #define UPDATE_RESULT_ALPHA(alpha) \ | 27 #define UPDATE_RESULT_ALPHA(alpha) \ |
28 zeroAlpha |= (alpha); \ | 28 zeroAlpha |= (alpha); \ |
29 maxAlpha &= (alpha); | 29 maxAlpha &= (alpha); |
30 | 30 |
31 #define COMPUTE_RESULT_ALPHA \ | 31 #define COMPUTE_RESULT_ALPHA \ |
32 SkSwizzler::GetResult(zeroAlpha, maxAlpha); | 32 SkSwizzler::GetResult(zeroAlpha, maxAlpha); |
33 | 33 |
| 34 inline float get_scale_from_sample_size(uint32_t sampleSize) { return 1.0f / (fl
oat) sampleSize; } |
| 35 |
34 /* | 36 /* |
35 * returns a scaled dimension based on the original dimension and the sampleSize | 37 * returns a scaled dimension based on the original dimension and the sampleSize |
36 * NOTE: we round down here for scaled dimension to match the behavior of SkImag
eDecoder | 38 * NOTE: we round down here for scaled dimension to match the behavior of SkImag
eDecoder |
37 */ | 39 */ |
38 inline int get_scaled_dimension(int srcDimension, int sampleSize) { | 40 inline int get_scaled_dimension(int srcDimension, int sampleSize) { |
39 if (sampleSize > srcDimension) { | 41 if (sampleSize > srcDimension) { |
40 return 1; | 42 return 1; |
41 } | 43 } |
42 return srcDimension / sampleSize; | 44 return srcDimension / sampleSize; |
43 } | 45 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 #endif | 264 #endif |
263 } | 265 } |
264 | 266 |
265 #ifdef SK_PRINT_CODEC_MESSAGES | 267 #ifdef SK_PRINT_CODEC_MESSAGES |
266 #define SkCodecPrintf SkDebugf | 268 #define SkCodecPrintf SkDebugf |
267 #else | 269 #else |
268 #define SkCodecPrintf(...) | 270 #define SkCodecPrintf(...) |
269 #endif | 271 #endif |
270 | 272 |
271 #endif // SkCodecPriv_DEFINED | 273 #endif // SkCodecPriv_DEFINED |
OLD | NEW |