Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Side by Side Diff: src/images/SkImageDecoder.cpp

Issue 1004313002: check for null-pixelref (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698