| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| 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 = CGImageGetWidth(image); | 69 const int width = SkToInt(CGImageGetWidth(image)); |
| 70 const int height = CGImageGetHeight(image); | 70 const int height = SkToInt(CGImageGetHeight(image)); |
| 71 bm->setConfig(SkBitmap::kARGB_8888_Config, width, height); | 71 bm->setConfig(SkBitmap::kARGB_8888_Config, width, height); |
| 72 if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 72 if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 if (!this->allocPixelRef(bm, NULL)) { | 76 if (!this->allocPixelRef(bm, NULL)) { |
| 77 return false; | 77 return false; |
| 78 } | 78 } |
| 79 | 79 |
| 80 bm->lockPixels(); | 80 bm->lockPixels(); |
| (...skipping 205 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 |