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

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

Issue 17620004: Remove bitmap reuse from SkImageDecoder. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add documentation. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkImageDecoder.h ('k') | src/images/SkImageDecoder_libbmp.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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 config = fDefaultPref; 157 config = fDefaultPref;
158 } 158 }
159 159
160 if (SkBitmap::kNo_Config == config) { 160 if (SkBitmap::kNo_Config == config) {
161 config = SkImageDecoder::GetDeviceConfig(); 161 config = SkImageDecoder::GetDeviceConfig();
162 } 162 }
163 return config; 163 return config;
164 } 164 }
165 165
166 bool SkImageDecoder::decode(SkStream* stream, SkBitmap* bm, 166 bool SkImageDecoder::decode(SkStream* stream, SkBitmap* bm,
167 SkBitmap::Config pref, Mode mode, bool reuseBitmap) { 167 SkBitmap::Config pref, Mode mode) {
168 // we reset this to false before calling onDecode 168 // we reset this to false before calling onDecode
169 fShouldCancelDecode = false; 169 fShouldCancelDecode = false;
170 // assign this, for use by getPrefConfig(), in case fUsePrefTable is false 170 // assign this, for use by getPrefConfig(), in case fUsePrefTable is false
171 fDefaultPref = pref; 171 fDefaultPref = pref;
172 172
173 if (reuseBitmap) {
174 SkAutoLockPixels alp(*bm);
175 if (NULL != bm->getPixels()) {
176 return this->onDecode(stream, bm, mode);
177 }
178 }
179
180 // pass a temporary bitmap, so that if we return false, we are assured of 173 // pass a temporary bitmap, so that if we return false, we are assured of
181 // leaving the caller's bitmap untouched. 174 // leaving the caller's bitmap untouched.
182 SkBitmap tmp; 175 SkBitmap tmp;
183 if (!this->onDecode(stream, &tmp, mode)) { 176 if (!this->onDecode(stream, &tmp, mode)) {
184 return false; 177 return false;
185 } 178 }
186 bm->swap(tmp); 179 bm->swap(tmp);
187 return true; 180 return true;
188 } 181 }
189 182
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 if (kUnknown_Format == *format) { 437 if (kUnknown_Format == *format) {
445 if (stream->rewind()) { 438 if (stream->rewind()) {
446 *format = GetStreamFormat(stream); 439 *format = GetStreamFormat(stream);
447 } 440 }
448 } 441 }
449 } 442 }
450 delete codec; 443 delete codec;
451 } 444 }
452 return success; 445 return success;
453 } 446 }
OLDNEW
« no previous file with comments | « include/core/SkImageDecoder.h ('k') | src/images/SkImageDecoder_libbmp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698