OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 | 8 |
9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 /////////////////////////////////////////////////////////////////////////////// | 215 /////////////////////////////////////////////////////////////////////////////// |
216 | 216 |
217 bool SkImageDecoder::DecodeFile(const char file[], SkBitmap* bm, SkColorType pre
f, Mode mode, | 217 bool SkImageDecoder::DecodeFile(const char file[], SkBitmap* bm, SkColorType pre
f, Mode mode, |
218 Format* format) { | 218 Format* format) { |
219 SkASSERT(file); | 219 SkASSERT(file); |
220 SkASSERT(bm); | 220 SkASSERT(bm); |
221 | 221 |
222 SkAutoTDelete<SkStreamRewindable> stream(SkStream::NewFromFile(file)); | 222 SkAutoTDelete<SkStreamRewindable> stream(SkStream::NewFromFile(file)); |
223 if (stream.get()) { | 223 if (stream.get()) { |
224 if (SkImageDecoder::DecodeStream(stream, bm, pref, mode, format)) { | 224 if (SkImageDecoder::DecodeStream(stream, bm, pref, mode, format)) { |
225 bm->pixelRef()->setURI(file); | 225 if (SkPixelRef* pr = bm->pixelRef()) { |
| 226 pr->setURI(file); |
| 227 } |
226 return true; | 228 return true; |
227 } | 229 } |
228 } | 230 } |
229 return false; | 231 return false; |
230 } | 232 } |
231 | 233 |
232 bool SkImageDecoder::DecodeMemory(const void* buffer, size_t size, SkBitmap* bm,
SkColorType pref, | 234 bool SkImageDecoder::DecodeMemory(const void* buffer, size_t size, SkBitmap* bm,
SkColorType pref, |
233 Mode mode, Format* format) { | 235 Mode mode, Format* format) { |
234 if (0 == size) { | 236 if (0 == size) { |
235 return false; | 237 return false; |
(...skipping 27 matching lines...) Expand all Loading... |
263 return success; | 265 return success; |
264 } | 266 } |
265 | 267 |
266 bool SkImageDecoder::decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3
], void* planes[3], | 268 bool SkImageDecoder::decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3
], void* planes[3], |
267 size_t rowBytes[3], SkYUVColorSpace* color
Space) { | 269 size_t rowBytes[3], SkYUVColorSpace* color
Space) { |
268 // we reset this to false before calling onDecodeYUV8Planes | 270 // we reset this to false before calling onDecodeYUV8Planes |
269 fShouldCancelDecode = false; | 271 fShouldCancelDecode = false; |
270 | 272 |
271 return this->onDecodeYUV8Planes(stream, componentSizes, planes, rowBytes, co
lorSpace); | 273 return this->onDecodeYUV8Planes(stream, componentSizes, planes, rowBytes, co
lorSpace); |
272 } | 274 } |
OLD | NEW |