| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Ensure the alpha type is valid | 129 // Ensure the alpha type is valid |
| 130 if (!valid_alpha(dst.alphaType(), src.alphaType())) { | 130 if (!valid_alpha(dst.alphaType(), src.alphaType())) { |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Check for supported color types | 134 // Check for supported color types |
| 135 switch (dst.colorType()) { | 135 switch (dst.colorType()) { |
| 136 case kN32_SkColorType: | 136 case kN32_SkColorType: |
| 137 return true; | 137 return true; |
| 138 case kRGB_565_SkColorType: | 138 case kRGB_565_SkColorType: |
| 139 return src.alphaType() == kOpaque_SkAlphaType; | 139 return kOpaque_SkAlphaType == dst.alphaType(); |
| 140 case kGray_8_SkColorType: |
| 141 if (kOpaque_SkAlphaType != dst.alphaType()) { |
| 142 return false; |
| 143 } |
| 144 // Fall through |
| 140 default: | 145 default: |
| 141 return dst.colorType() == src.colorType(); | 146 return dst.colorType() == src.colorType(); |
| 142 } | 147 } |
| 143 } | 148 } |
| 144 | 149 |
| 145 /* | 150 /* |
| 146 * If there is a color table, get a pointer to the colors, otherwise return null
ptr | 151 * If there is a color table, get a pointer to the colors, otherwise return null
ptr |
| 147 */ | 152 */ |
| 148 inline const SkPMColor* get_color_ptr(SkColorTable* colorTable) { | 153 inline const SkPMColor* get_color_ptr(SkColorTable* colorTable) { |
| 149 return nullptr != colorTable ? colorTable->readColors() : nullptr; | 154 return nullptr != colorTable ? colorTable->readColors() : nullptr; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 uint32_t result; | 246 uint32_t result; |
| 242 memcpy(&result, &(buffer[i]), 4); | 247 memcpy(&result, &(buffer[i]), 4); |
| 243 #ifdef SK_CPU_BENDIAN | 248 #ifdef SK_CPU_BENDIAN |
| 244 return SkEndianSwap32(result); | 249 return SkEndianSwap32(result); |
| 245 #else | 250 #else |
| 246 return result; | 251 return result; |
| 247 #endif | 252 #endif |
| 248 } | 253 } |
| 249 | 254 |
| 250 #endif // SkCodecPriv_DEFINED | 255 #endif // SkCodecPriv_DEFINED |
| OLD | NEW |