| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 case kJPEG_Type: | 202 case kJPEG_Type: |
| 203 type = kUTTypeJPEG; | 203 type = kUTTypeJPEG; |
| 204 break; | 204 break; |
| 205 case kPNG_Type: | 205 case kPNG_Type: |
| 206 // PNG encoding an ARGB_4444 bitmap gives the following errors in GM
: | 206 // PNG encoding an ARGB_4444 bitmap gives the following errors in GM
: |
| 207 // <Error>: CGImageDestinationAddImage image could not be converted
to destination | 207 // <Error>: CGImageDestinationAddImage image could not be converted
to destination |
| 208 // format. | 208 // format. |
| 209 // <Error>: CGImageDestinationFinalize image destination does not ha
ve enough images | 209 // <Error>: CGImageDestinationFinalize image destination does not ha
ve enough images |
| 210 // So instead we copy to 8888. | 210 // So instead we copy to 8888. |
| 211 if (bm.colorType() == kARGB_4444_SkColorType) { | 211 if (bm.colorType() == kARGB_4444_SkColorType) { |
| 212 bm.copyTo(&bitmap8888, kPMColor_SkColorType); | 212 bm.copyTo(&bitmap8888, kN32_SkColorType); |
| 213 bmPtr = &bitmap8888; | 213 bmPtr = &bitmap8888; |
| 214 } | 214 } |
| 215 type = kUTTypePNG; | 215 type = kUTTypePNG; |
| 216 break; | 216 break; |
| 217 default: | 217 default: |
| 218 return false; | 218 return false; |
| 219 } | 219 } |
| 220 | 220 |
| 221 CGImageDestinationRef dst = SkStreamToImageDestination(stream, type); | 221 CGImageDestinationRef dst = SkStreamToImageDestination(stream, type); |
| 222 if (NULL == dst) { | 222 if (NULL == dst) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); | 287 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); |
| 288 const CFStringRef name = CGImageSourceGetType(imageSrc); | 288 const CFStringRef name = CGImageSourceGetType(imageSrc); |
| 289 if (NULL == name) { | 289 if (NULL == name) { |
| 290 return SkImageDecoder::kUnknown_Format; | 290 return SkImageDecoder::kUnknown_Format; |
| 291 } | 291 } |
| 292 return UTType_to_Format(name); | 292 return UTType_to_Format(name); |
| 293 } | 293 } |
| 294 | 294 |
| 295 static SkImageDecoder_FormatReg gFormatReg(get_format_cg); | 295 static SkImageDecoder_FormatReg gFormatReg(get_format_cg); |
| OLD | NEW |