| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); | 61 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); |
| 62 | 62 |
| 63 CGImageRef image = CGImageSourceCreateImageAtIndex(imageSrc, 0, NULL); | 63 CGImageRef image = CGImageSourceCreateImageAtIndex(imageSrc, 0, NULL); |
| 64 if (NULL == image) { | 64 if (NULL == image) { |
| 65 return false; | 65 return false; |
| 66 } | 66 } |
| 67 SkAutoTCallVProc<CGImage, CGImageRelease> arimage(image); | 67 SkAutoTCallVProc<CGImage, CGImageRelease> arimage(image); |
| 68 | 68 |
| 69 const int width = SkToInt(CGImageGetWidth(image)); | 69 const int width = SkToInt(CGImageGetWidth(image)); |
| 70 const int height = SkToInt(CGImageGetHeight(image)); | 70 const int height = SkToInt(CGImageGetHeight(image)); |
| 71 SkImageInfo skinfo = SkImageInfo::MakeN32Premul(width, height); | |
| 72 | 71 |
| 73 bm->setInfo(skinfo); | 72 bm->setInfo(SkImageInfo::MakeN32Premul(width, height)); |
| 74 if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 73 if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
| 75 return true; | 74 return true; |
| 76 } | 75 } |
| 77 | 76 |
| 78 if (!this->allocPixelRef(bm, NULL)) { | 77 if (!this->allocPixelRef(bm, NULL)) { |
| 79 return false; | 78 return false; |
| 80 } | 79 } |
| 81 | 80 |
| 82 SkAutoLockPixels alp(*bm); | 81 SkAutoLockPixels alp(*bm); |
| 83 | 82 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 282 |
| 284 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); | 283 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); |
| 285 const CFStringRef name = CGImageSourceGetType(imageSrc); | 284 const CFStringRef name = CGImageSourceGetType(imageSrc); |
| 286 if (NULL == name) { | 285 if (NULL == name) { |
| 287 return SkImageDecoder::kUnknown_Format; | 286 return SkImageDecoder::kUnknown_Format; |
| 288 } | 287 } |
| 289 return UTType_to_Format(name); | 288 return UTType_to_Format(name); |
| 290 } | 289 } |
| 291 | 290 |
| 292 static SkImageDecoder_FormatReg gFormatReg(get_format_cg); | 291 static SkImageDecoder_FormatReg gFormatReg(get_format_cg); |
| OLD | NEW |