| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 if (!valid_alpha(dst.alphaType(), src.alphaType())) { | 125 if (!valid_alpha(dst.alphaType(), src.alphaType())) { |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Check for supported color types | 129 // Check for supported color types |
| 130 switch (dst.colorType()) { | 130 switch (dst.colorType()) { |
| 131 case kRGBA_8888_SkColorType: | 131 case kRGBA_8888_SkColorType: |
| 132 case kBGRA_8888_SkColorType: | 132 case kBGRA_8888_SkColorType: |
| 133 return true; | 133 return true; |
| 134 case kRGB_565_SkColorType: | 134 case kRGB_565_SkColorType: |
| 135 return kOpaque_SkAlphaType == dst.alphaType(); | 135 return kOpaque_SkAlphaType == src.alphaType(); |
| 136 case kGray_8_SkColorType: | |
| 137 if (kOpaque_SkAlphaType != dst.alphaType()) { | |
| 138 return false; | |
| 139 } | |
| 140 // Fall through | |
| 141 default: | 136 default: |
| 142 return dst.colorType() == src.colorType(); | 137 return dst.colorType() == src.colorType(); |
| 143 } | 138 } |
| 144 } | 139 } |
| 145 | 140 |
| 146 /* | 141 /* |
| 147 * If there is a color table, get a pointer to the colors, otherwise return null
ptr | 142 * If there is a color table, get a pointer to the colors, otherwise return null
ptr |
| 148 */ | 143 */ |
| 149 inline const SkPMColor* get_color_ptr(SkColorTable* colorTable) { | 144 inline const SkPMColor* get_color_ptr(SkColorTable* colorTable) { |
| 150 return nullptr != colorTable ? colorTable->readColors() : nullptr; | 145 return nullptr != colorTable ? colorTable->readColors() : nullptr; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } else { | 310 } else { |
| 316 if (isRGBA) { | 311 if (isRGBA) { |
| 317 return &SkPackARGB_as_RGBA; | 312 return &SkPackARGB_as_RGBA; |
| 318 } else { | 313 } else { |
| 319 return &SkPackARGB_as_BGRA; | 314 return &SkPackARGB_as_BGRA; |
| 320 } | 315 } |
| 321 } | 316 } |
| 322 } | 317 } |
| 323 | 318 |
| 324 #endif // SkCodecPriv_DEFINED | 319 #endif // SkCodecPriv_DEFINED |
| OLD | NEW |