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

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

Issue 510423005: make allocPixels throw on failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 3 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 | « src/images/SkDecodingImageGenerator.cpp ('k') | src/images/SkImageDecoder_libjpeg.cpp » ('j') | 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return true; 126 return true;
127 } 127 }
128 chooser->begin(1); 128 chooser->begin(1);
129 chooser->inspect(0, SkColorTypeToBitmapConfig(colorType), width, height); 129 chooser->inspect(0, SkColorTypeToBitmapConfig(colorType), width, height);
130 return chooser->choose() == 0; 130 return chooser->choose() == 0;
131 } 131 }
132 #endif 132 #endif
133 133
134 bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap, 134 bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap,
135 SkColorTable* ctable) const { 135 SkColorTable* ctable) const {
136 return bitmap->allocPixels(fAllocator, ctable); 136 return bitmap->tryAllocPixels(fAllocator, ctable);
137 } 137 }
138 138
139 /////////////////////////////////////////////////////////////////////////////// 139 ///////////////////////////////////////////////////////////////////////////////
140 140
141 SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha ) const { 141 SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha ) const {
142 SkColorType ct = fDefaultPref; 142 SkColorType ct = fDefaultPref;
143 if (fPreserveSrcDepth) { 143 if (fPreserveSrcDepth) {
144 switch (srcDepth) { 144 switch (srcDepth) {
145 case kIndex_SrcDepth: 145 case kIndex_SrcDepth:
146 ct = kIndex_8_SkColorType; 146 ct = kIndex_8_SkColorType;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (kUnknown_Format == *format) { 278 if (kUnknown_Format == *format) {
279 if (stream->rewind()) { 279 if (stream->rewind()) {
280 *format = GetStreamFormat(stream); 280 *format = GetStreamFormat(stream);
281 } 281 }
282 } 282 }
283 } 283 }
284 delete codec; 284 delete codec;
285 } 285 }
286 return success; 286 return success;
287 } 287 }
OLDNEW
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/images/SkImageDecoder_libjpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698