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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 * Most of our codecs support the same conversions: | 110 * Most of our codecs support the same conversions: |
111 * - profileType must be the same | 111 * - profileType must be the same |
112 * - opaque to any alpha type | 112 * - opaque to any alpha type |
113 * - 565 only if opaque | 113 * - 565 only if opaque |
114 * - premul to unpremul and vice versa | 114 * - premul to unpremul and vice versa |
115 * - always support N32 | 115 * - always support N32 |
116 * - otherwise match the src color type | 116 * - otherwise match the src color type |
117 */ | 117 */ |
118 inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src)
{ | 118 inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src)
{ |
119 // FIXME: skbug.com/4895 | 119 // FIXME: skbug.com/4895 |
120 // Currently, we treat both kLinear and ksRGB encoded images as if they are
kLinear. | 120 // Currently, we ignore the SkColorProfileType on the SkImageInfo. We |
121 // This makes sense while we do not have proper support for ksRGB. This is
also | 121 // will treat the encoded data as linear regardless of what the client |
122 // the reason why we always allow the client to request kLinear. | 122 // requests. |
123 if (dst.profileType() != src.profileType() && | |
124 kLinear_SkColorProfileType != dst.profileType()) { | |
125 return false; | |
126 } | |
127 | 123 |
128 // Ensure the alpha type is valid | 124 // Ensure the alpha type is valid |
129 if (!valid_alpha(dst.alphaType(), src.alphaType())) { | 125 if (!valid_alpha(dst.alphaType(), src.alphaType())) { |
130 return false; | 126 return false; |
131 } | 127 } |
132 | 128 |
133 // Check for supported color types | 129 // Check for supported color types |
134 switch (dst.colorType()) { | 130 switch (dst.colorType()) { |
135 case kN32_SkColorType: | 131 case kN32_SkColorType: |
136 return true; | 132 return true; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 265 |
270 inline uint16_t get_endian_short(const uint8_t* data, bool littleEndian) { | 266 inline uint16_t get_endian_short(const uint8_t* data, bool littleEndian) { |
271 if (littleEndian) { | 267 if (littleEndian) { |
272 return (data[1] << 8) | (data[0]); | 268 return (data[1] << 8) | (data[0]); |
273 } | 269 } |
274 | 270 |
275 return (data[0] << 8) | (data[1]); | 271 return (data[0] << 8) | (data[1]); |
276 } | 272 } |
277 | 273 |
278 #endif // SkCodecPriv_DEFINED | 274 #endif // SkCodecPriv_DEFINED |
OLD | NEW |