| 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 |
| 11 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
| 12 #include "SkColorTable.h" | 12 #include "SkColorTable.h" |
| 13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
| 14 #include "SkSwizzler.h" | |
| 15 #include "SkTypes.h" | 14 #include "SkTypes.h" |
| 16 #include "SkUtils.h" | 15 #include "SkUtils.h" |
| 17 | 16 |
| 18 /* | |
| 19 * | |
| 20 * Helper routine for alpha result codes | |
| 21 * | |
| 22 */ | |
| 23 #define INIT_RESULT_ALPHA \ | |
| 24 uint8_t zeroAlpha = 0; \ | |
| 25 uint8_t maxAlpha = 0xFF; | |
| 26 | |
| 27 #define UPDATE_RESULT_ALPHA(alpha) \ | |
| 28 zeroAlpha |= (alpha); \ | |
| 29 maxAlpha &= (alpha); | |
| 30 | |
| 31 #define COMPUTE_RESULT_ALPHA \ | |
| 32 SkSwizzler::GetResult(zeroAlpha, maxAlpha); | |
| 33 | |
| 34 // FIXME: Consider sharing with dm, nanbench, and tools. | 17 // FIXME: Consider sharing with dm, nanbench, and tools. |
| 35 inline float get_scale_from_sample_size(int sampleSize) { | 18 inline float get_scale_from_sample_size(int sampleSize) { |
| 36 return 1.0f / ((float) sampleSize); | 19 return 1.0f / ((float) sampleSize); |
| 37 } | 20 } |
| 38 | 21 |
| 39 inline bool is_valid_subset(const SkIRect& subset, const SkISize& imageDims) { | 22 inline bool is_valid_subset(const SkIRect& subset, const SkISize& imageDims) { |
| 40 return SkIRect::MakeSize(imageDims).contains(subset); | 23 return SkIRect::MakeSize(imageDims).contains(subset); |
| 41 } | 24 } |
| 42 | 25 |
| 43 /* | 26 /* |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 #endif | 230 #endif |
| 248 } | 231 } |
| 249 | 232 |
| 250 #ifdef SK_PRINT_CODEC_MESSAGES | 233 #ifdef SK_PRINT_CODEC_MESSAGES |
| 251 #define SkCodecPrintf SkDebugf | 234 #define SkCodecPrintf SkDebugf |
| 252 #else | 235 #else |
| 253 #define SkCodecPrintf(...) | 236 #define SkCodecPrintf(...) |
| 254 #endif | 237 #endif |
| 255 | 238 |
| 256 #endif // SkCodecPriv_DEFINED | 239 #endif // SkCodecPriv_DEFINED |
| OLD | NEW |