OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
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 #import <CoreGraphics/CoreGraphics.h> | 8 #import <CoreGraphics/CoreGraphics.h> |
9 #include <CoreGraphics/CGColorSpace.h> | 9 #include <CoreGraphics/CGColorSpace.h> |
10 #import <UIKit/UIKit.h> | 10 #import <UIKit/UIKit.h> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #define BITMAP_INFO (kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast) | 22 #define BITMAP_INFO (kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast) |
23 | 23 |
24 bool SkImageDecoder_iOS::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { | 24 bool SkImageDecoder_iOS::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { |
25 | 25 |
26 NSData* data = NSData_dataWithStream(stream); | 26 NSData* data = NSData_dataWithStream(stream); |
27 | 27 |
28 UIImage* uimage = [UIImage imageWithData:data]; | 28 UIImage* uimage = [UIImage imageWithData:data]; |
29 | 29 |
30 const int width = uimage.size.width; | 30 const int width = uimage.size.width; |
31 const int height = uimage.size.height; | 31 const int height = uimage.size.height; |
32 SkColorType ct = SkBitmapConfigToColorType(SkBitmap::kARGB_8888_Config); | 32 bm->setInfo(SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType), 0); |
33 bm->setInfo(SkImageInfo::Make(width, height, ct, kPremul_SkAlphaType), 0); | |
34 if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 33 if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
35 return true; | 34 return true; |
36 } | 35 } |
37 | 36 |
38 if (!this->allocPixelRef(bm, NULL)) { | 37 if (!this->allocPixelRef(bm, NULL)) { |
39 return false; | 38 return false; |
40 } | 39 } |
41 | 40 |
42 bm->lockPixels(); | 41 bm->lockPixels(); |
43 bm->eraseColor(0); | 42 bm->eraseColor(0); |
(...skipping 16 matching lines...) Expand all Loading... |
60 } | 59 } |
61 | 60 |
62 SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) { | 61 SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) { |
63 return NULL; | 62 return NULL; |
64 } | 63 } |
65 | 64 |
66 SkImageEncoder* SkImageEncoder::Create(Type t) { | 65 SkImageEncoder* SkImageEncoder::Create(Type t) { |
67 return NULL; | 66 return NULL; |
68 } | 67 } |
69 | 68 |
OLD | NEW |