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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return SkColorSpaceXform::kRGBA_F16_ColorFormat; | 154 return SkColorSpaceXform::kRGBA_F16_ColorFormat; |
155 default: | 155 default: |
156 SkASSERT(false); | 156 SkASSERT(false); |
157 return SkColorSpaceXform::kRGBA_8888_ColorFormat; | 157 return SkColorSpaceXform::kRGBA_8888_ColorFormat; |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 /* | 161 /* |
162 * Given that the encoded image uses a color table, return the fill value | 162 * Given that the encoded image uses a color table, return the fill value |
163 */ | 163 */ |
164 static inline uint64_t get_color_table_fill_value(SkColorType colorType, SkAlpha
Type alphaType, | 164 static inline uint64_t get_color_table_fill_value(SkColorType dstColorType, SkAl
phaType alphaType, |
165 const SkPMColor* colorPtr, uint8_t fillIndex, SkColorSpaceXform* colorXf
orm) { | 165 const SkPMColor* colorPtr, uint8_t fillIndex, SkColorSpaceXform* colorXf
orm) { |
166 SkASSERT(nullptr != colorPtr); | 166 SkASSERT(nullptr != colorPtr); |
167 switch (colorType) { | 167 switch (dstColorType) { |
168 case kRGBA_8888_SkColorType: | 168 case kRGBA_8888_SkColorType: |
169 case kBGRA_8888_SkColorType: | 169 case kBGRA_8888_SkColorType: |
170 return colorPtr[fillIndex]; | 170 return colorPtr[fillIndex]; |
171 case kRGB_565_SkColorType: | 171 case kRGB_565_SkColorType: |
172 return SkPixel32ToPixel16(colorPtr[fillIndex]); | 172 return SkPixel32ToPixel16(colorPtr[fillIndex]); |
173 case kIndex_8_SkColorType: | 173 case kIndex_8_SkColorType: |
174 return fillIndex; | 174 return fillIndex; |
175 case kRGBA_F16_SkColorType: { | 175 case kRGBA_F16_SkColorType: { |
176 SkASSERT(colorXform); | 176 SkASSERT(colorXform); |
177 uint64_t dstColor; | 177 uint64_t dstColor; |
178 uint32_t srcColor = colorPtr[fillIndex]; | 178 uint32_t srcColor = colorPtr[fillIndex]; |
179 colorXform->apply(&dstColor, &srcColor, 1, select_xform_format(color
Type), alphaType); | 179 colorXform->apply(&dstColor, &srcColor, 1, select_xform_format(dstCo
lorType), |
| 180 SkColorSpaceXform::kRGBA_8888_ColorFormat, alphaTy
pe); |
180 return dstColor; | 181 return dstColor; |
181 } | 182 } |
182 default: | 183 default: |
183 SkASSERT(false); | 184 SkASSERT(false); |
184 return 0; | 185 return 0; |
185 } | 186 } |
186 } | 187 } |
187 | 188 |
188 /* | 189 /* |
189 * | 190 * |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 return kOpaque_SkAlphaType == src.alphaType() && !needs_color_xform(
dst, src); | 393 return kOpaque_SkAlphaType == src.alphaType() && !needs_color_xform(
dst, src); |
393 case kGray_8_SkColorType: | 394 case kGray_8_SkColorType: |
394 return kGray_8_SkColorType == src.colorType() && | 395 return kGray_8_SkColorType == src.colorType() && |
395 kOpaque_SkAlphaType == src.alphaType() && !needs_color_xform(
dst, src); | 396 kOpaque_SkAlphaType == src.alphaType() && !needs_color_xform(
dst, src); |
396 default: | 397 default: |
397 return false; | 398 return false; |
398 } | 399 } |
399 } | 400 } |
400 | 401 |
401 #endif // SkCodecPriv_DEFINED | 402 #endif // SkCodecPriv_DEFINED |
OLD | NEW |