| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 case kN32_SkColorType: | 75 case kN32_SkColorType: |
| 76 return true; | 76 return true; |
| 77 case kRGB_565_SkColorType: | 77 case kRGB_565_SkColorType: |
| 78 return src.alphaType() == kOpaque_SkAlphaType; | 78 return src.alphaType() == kOpaque_SkAlphaType; |
| 79 default: | 79 default: |
| 80 return dst.colorType() == src.colorType(); | 80 return dst.colorType() == src.colorType(); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 /* | 84 /* |
| 85 * If there is a color table, get a pointer to the colors, otherwise return NULL | 85 * If there is a color table, get a pointer to the colors, otherwise return null
ptr |
| 86 */ | 86 */ |
| 87 static const SkPMColor* get_color_ptr(SkColorTable* colorTable) { | 87 static const SkPMColor* get_color_ptr(SkColorTable* colorTable) { |
| 88 return NULL != colorTable ? colorTable->readColors() : NULL; | 88 return nullptr != colorTable ? colorTable->readColors() : nullptr; |
| 89 } | 89 } |
| 90 | 90 |
| 91 /* | 91 /* |
| 92 * | 92 * |
| 93 * Copy the codec color table back to the client when kIndex8 color type is requ
ested | 93 * Copy the codec color table back to the client when kIndex8 color type is requ
ested |
| 94 */ | 94 */ |
| 95 static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* co
lorTable, | 95 static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* co
lorTable, |
| 96 SkPMColor* inputColorPtr, int* inputColorCount) { | 96 SkPMColor* inputColorPtr, int* inputColorCount) { |
| 97 if (kIndex_8_SkColorType == dstInfo.colorType()) { | 97 if (kIndex_8_SkColorType == dstInfo.colorType()) { |
| 98 SkASSERT(NULL != inputColorPtr); | 98 SkASSERT(nullptr != inputColorPtr); |
| 99 SkASSERT(NULL != inputColorCount); | 99 SkASSERT(nullptr != inputColorCount); |
| 100 SkASSERT(NULL != colorTable); | 100 SkASSERT(nullptr != colorTable); |
| 101 memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * 4); | 101 memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * 4); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 /* | 105 /* |
| 106 * Compute row bytes for an image using pixels per byte | 106 * Compute row bytes for an image using pixels per byte |
| 107 */ | 107 */ |
| 108 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) { | 108 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) { |
| 109 return (width + pixelsPerByte - 1) / pixelsPerByte; | 109 return (width + pixelsPerByte - 1) / pixelsPerByte; |
| 110 } | 110 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 #endif | 167 #endif |
| 168 } | 168 } |
| 169 | 169 |
| 170 #ifdef SK_PRINT_CODEC_MESSAGES | 170 #ifdef SK_PRINT_CODEC_MESSAGES |
| 171 #define SkCodecPrintf SkDebugf | 171 #define SkCodecPrintf SkDebugf |
| 172 #else | 172 #else |
| 173 #define SkCodecPrintf(...) | 173 #define SkCodecPrintf(...) |
| 174 #endif | 174 #endif |
| 175 | 175 |
| 176 #endif // SkCodecPriv_DEFINED | 176 #endif // SkCodecPriv_DEFINED |
| OLD | NEW |