OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 #include "SkCGUtils.h" | 8 #include "SkCGUtils.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 break; | 212 break; |
213 case kJPEG_Type: | 213 case kJPEG_Type: |
214 type = kUTTypeJPEG; | 214 type = kUTTypeJPEG; |
215 break; | 215 break; |
216 case kPNG_Type: | 216 case kPNG_Type: |
217 // PNG encoding an ARGB_4444 bitmap gives the following errors in GM
: | 217 // PNG encoding an ARGB_4444 bitmap gives the following errors in GM
: |
218 // <Error>: CGImageDestinationAddImage image could not be converted
to destination | 218 // <Error>: CGImageDestinationAddImage image could not be converted
to destination |
219 // format. | 219 // format. |
220 // <Error>: CGImageDestinationFinalize image destination does not ha
ve enough images | 220 // <Error>: CGImageDestinationFinalize image destination does not ha
ve enough images |
221 // So instead we copy to 8888. | 221 // So instead we copy to 8888. |
222 if (bm.getConfig() == SkBitmap::kARGB_4444_Config) { | 222 if (bm.config() == SkBitmap::kARGB_4444_Config) { |
223 bm.copyTo(&bitmap8888, SkBitmap::kARGB_8888_Config); | 223 bm.copyTo(&bitmap8888, SkBitmap::kARGB_8888_Config); |
224 bmPtr = &bitmap8888; | 224 bmPtr = &bitmap8888; |
225 } | 225 } |
226 type = kUTTypePNG; | 226 type = kUTTypePNG; |
227 break; | 227 break; |
228 default: | 228 default: |
229 return false; | 229 return false; |
230 } | 230 } |
231 | 231 |
232 CGImageDestinationRef dst = SkStreamToImageDestination(stream, type); | 232 CGImageDestinationRef dst = SkStreamToImageDestination(stream, type); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); | 298 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); |
299 const CFStringRef name = CGImageSourceGetType(imageSrc); | 299 const CFStringRef name = CGImageSourceGetType(imageSrc); |
300 if (NULL == name) { | 300 if (NULL == name) { |
301 return SkImageDecoder::kUnknown_Format; | 301 return SkImageDecoder::kUnknown_Format; |
302 } | 302 } |
303 return UTType_to_Format(name); | 303 return UTType_to_Format(name); |
304 } | 304 } |
305 | 305 |
306 static SkImageDecoder_FormatReg gFormatReg(get_format_cg); | 306 static SkImageDecoder_FormatReg gFormatReg(get_format_cg); |
OLD | NEW |