OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The Android Open Source Project | 2 * Copyright 2015 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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
10 #include "SkImageGenerator.h" | 10 #include "SkImageGenerator.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 SkData* onRefEncodedData() SK_OVERRIDE { | 46 SkData* onRefEncodedData() SK_OVERRIDE { |
47 return SkRef(fData.get()); | 47 return SkRef(fData.get()); |
48 } | 48 } |
49 | 49 |
50 virtual bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { | 50 virtual bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { |
51 *info = fInfo; | 51 *info = fInfo; |
52 return true; | 52 return true; |
53 } | 53 } |
54 | 54 |
55 virtual Result onGetPixels(const SkImageInfo& info, void* pixels, size_t row
Bytes, | 55 virtual Result onGetPixels(const SkImageInfo& info, void* pixels, size_t row
Bytes, |
| 56 const Options&, |
56 SkPMColor ctableEntries[], int* ctableCount) SK_O
VERRIDE { | 57 SkPMColor ctableEntries[], int* ctableCount) SK_O
VERRIDE { |
57 SkMemoryStream stream(fData->data(), fData->size(), false); | 58 SkMemoryStream stream(fData->data(), fData->size(), false); |
58 SkAutoTUnref<BareMemoryAllocator> allocator(SkNEW_ARGS(BareMemoryAllocat
or, | 59 SkAutoTUnref<BareMemoryAllocator> allocator(SkNEW_ARGS(BareMemoryAllocat
or, |
59 (info, pixels, ro
wBytes))); | 60 (info, pixels, ro
wBytes))); |
60 fDecoder->setAllocator(allocator); | 61 fDecoder->setAllocator(allocator); |
61 fDecoder->setRequireUnpremultipliedColors(kUnpremul_SkAlphaType == info.
alphaType()); | 62 fDecoder->setRequireUnpremultipliedColors(kUnpremul_SkAlphaType == info.
alphaType()); |
62 | 63 |
63 SkBitmap bm; | 64 SkBitmap bm; |
64 const SkImageDecoder::Result result = fDecoder->decode(&stream, &bm, inf
o.colorType(), | 65 const SkImageDecoder::Result result = fDecoder->decode(&stream, &bm, inf
o.colorType(), |
65 SkImageDecoder::k
DecodePixels_Mode); | 66 SkImageDecoder::k
DecodePixels_Mode); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 108 |
108 SkBitmap bm; | 109 SkBitmap bm; |
109 stream.rewind(); | 110 stream.rewind(); |
110 if (!decoder->decode(&stream, &bm, kUnknown_SkColorType, SkImageDecoder::kDe
codeBounds_Mode)) { | 111 if (!decoder->decode(&stream, &bm, kUnknown_SkColorType, SkImageDecoder::kDe
codeBounds_Mode)) { |
111 SkDELETE(decoder); | 112 SkDELETE(decoder); |
112 return NULL; | 113 return NULL; |
113 } | 114 } |
114 | 115 |
115 return SkNEW_ARGS(SkImageDecoderGenerator, (bm.info(), decoder, data)); | 116 return SkNEW_ARGS(SkImageDecoderGenerator, (bm.info(), decoder, data)); |
116 } | 117 } |
OLD | NEW |