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_libgif.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 | « src/images/SkImageDecoder_libbmp.cpp ('k') | src/images/SkImageDecoder_libico.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 width = gif->SWidth; 197 width = gif->SWidth;
198 height = gif->SHeight; 198 height = gif->SHeight;
199 if (width <= 0 || height <= 0 || 199 if (width <= 0 || height <= 0 ||
200 !this->chooseFromOneChoice(SkBitmap::kIndex8_Config, 200 !this->chooseFromOneChoice(SkBitmap::kIndex8_Config,
201 width, height)) { 201 width, height)) {
202 return error_return(gif, *bm, "chooseFromOneChoice"); 202 return error_return(gif, *bm, "chooseFromOneChoice");
203 } 203 }
204 204
205 bm->setConfig(SkBitmap::kIndex8_Config, width, height);
205 if (SkImageDecoder::kDecodeBounds_Mode == mode) { 206 if (SkImageDecoder::kDecodeBounds_Mode == mode) {
206 bm->setConfig(SkBitmap::kIndex8_Config, width, height);
207 return true; 207 return true;
208 } 208 }
209 209
210 // No Bitmap reuse supported for this format
211 if (!bm->isNull()) {
212 return false;
213 }
214
215 bm->setConfig(SkBitmap::kIndex8_Config, width, height);
216 SavedImage* image = &gif->SavedImages[gif->ImageCount-1]; 210 SavedImage* image = &gif->SavedImages[gif->ImageCount-1];
217 const GifImageDesc& desc = image->ImageDesc; 211 const GifImageDesc& desc = image->ImageDesc;
218 212
219 // check for valid descriptor 213 // check for valid descriptor
220 if ( (desc.Top | desc.Left) < 0 || 214 if ( (desc.Top | desc.Left) < 0 ||
221 desc.Left + desc.Width > width || 215 desc.Left + desc.Width > width ||
222 desc.Top + desc.Height > height) { 216 desc.Top + desc.Height > height) {
223 return error_return(gif, *bm, "TopLeft"); 217 return error_return(gif, *bm, "TopLeft");
224 } 218 }
225 219
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_libgif_dfactory); 380 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_libgif_dfactory);
387 381
388 static SkImageDecoder::Format get_format_gif(SkStream* stream) { 382 static SkImageDecoder::Format get_format_gif(SkStream* stream) {
389 if (is_gif(stream)) { 383 if (is_gif(stream)) {
390 return SkImageDecoder::kGIF_Format; 384 return SkImageDecoder::kGIF_Format;
391 } 385 }
392 return SkImageDecoder::kUnknown_Format; 386 return SkImageDecoder::kUnknown_Format;
393 } 387 }
394 388
395 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_gif) ; 389 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_gif) ;
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libbmp.cpp ('k') | src/images/SkImageDecoder_libico.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698