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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 default: | 101 default: |
102 // We cannot decode a non-opaque image to opaque (or unknown) | 102 // We cannot decode a non-opaque image to opaque (or unknown) |
103 return false; | 103 return false; |
104 } | 104 } |
105 } | 105 } |
106 return true; | 106 return true; |
107 } | 107 } |
108 | 108 |
109 /* | 109 /* |
110 * Most of our codecs support the same conversions: | 110 * Most of our codecs support the same conversions: |
111 * - profileType must be the same | |
112 * - opaque to any alpha type | 111 * - opaque to any alpha type |
113 * - 565 only if opaque | 112 * - 565 only if opaque |
114 * - premul to unpremul and vice versa | 113 * - premul to unpremul and vice versa |
115 * - always support N32 | 114 * - always support N32 |
116 * - otherwise match the src color type | 115 * - otherwise match the src color type |
117 */ | 116 */ |
118 inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) { | 117 inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) { |
119 // FIXME: skbug.com/4895 | |
120 // Currently, we ignore the SkColorProfileType on the SkImageInfo. We | |
121 // will treat the encoded data as linear regardless of what the client | |
122 // requests. | |
123 | |
124 // Ensure the alpha type is valid | 118 // Ensure the alpha type is valid |
125 if (!valid_alpha(dst.alphaType(), src.alphaType())) { | 119 if (!valid_alpha(dst.alphaType(), src.alphaType())) { |
126 return false; | 120 return false; |
127 } | 121 } |
128 | 122 |
129 // Check for supported color types | 123 // Check for supported color types |
130 switch (dst.colorType()) { | 124 switch (dst.colorType()) { |
131 case kRGBA_8888_SkColorType: | 125 case kRGBA_8888_SkColorType: |
132 case kBGRA_8888_SkColorType: | 126 case kBGRA_8888_SkColorType: |
133 return true; | 127 return true; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 } | 303 } |
310 } else { | 304 } else { |
311 if (isRGBA) { | 305 if (isRGBA) { |
312 return &SkPackARGB_as_RGBA; | 306 return &SkPackARGB_as_RGBA; |
313 } else { | 307 } else { |
314 return &SkPackARGB_as_BGRA; | 308 return &SkPackARGB_as_BGRA; |
315 } | 309 } |
316 } | 310 } |
317 } | 311 } |
318 | 312 |
313 inline bool needs_color_xform(const SkImageInfo& dstInfo, const SkImageInfo& src Info) { | |
mtklein
2016/07/29 18:48:56
All these header methods should probably be non-ex
msarett
2016/07/29 20:07:50
Done.
| |
314 // FIXME (msarett): | |
315 // Do a better check for color space equality. | |
316 return (kRGBA_F16_SkColorType == dstInfo.colorType()) || | |
317 (dstInfo.colorSpace() && (dstInfo.colorSpace() != srcInfo.colorSpace( ))); | |
318 } | |
319 | |
319 #endif // SkCodecPriv_DEFINED | 320 #endif // SkCodecPriv_DEFINED |
OLD | NEW |