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

Side by Side Diff: src/images/SkImageDecoder_libico.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_libgif.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 /* 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 /*int */test = w & 0x1F; //the low 5 bits - we are rounding up to the next 32 (2^5) 226 /*int */test = w & 0x1F; //the low 5 bits - we are rounding up to the next 32 (2^5)
227 /*int */mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | te st) & 0x1); //either 0xFFFFFFFF or 0 227 /*int */mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | te st) & 0x1); //either 0xFFFFFFFF or 0
228 int andLineWidth = (w & 0xFFFFFFE0) + (0x20 & mask); 228 int andLineWidth = (w & 0xFFFFFFE0) + (0x20 & mask);
229 //if we allow different Configs, everything is the same til here 229 //if we allow different Configs, everything is the same til here
230 //change the config, and use different address getter, and place index vs co lor, and add the color table 230 //change the config, and use different address getter, and place index vs co lor, and add the color table
231 //FIXME: what is the tradeoff in size? 231 //FIXME: what is the tradeoff in size?
232 //if the andbitmap (mask) is all zeroes, then we can easily do an index bitm ap 232 //if the andbitmap (mask) is all zeroes, then we can easily do an index bitm ap
233 //however, with small images with large colortables, maybe it's better to st ill do argb_8888 233 //however, with small images with large colortables, maybe it's better to st ill do argb_8888
234 234
235 bm->setConfig(SkBitmap::kARGB_8888_Config, w, h, calculateRowBytesFor8888(w, bitCount));
236
235 if (SkImageDecoder::kDecodeBounds_Mode == mode) { 237 if (SkImageDecoder::kDecodeBounds_Mode == mode) {
236 bm->setConfig(SkBitmap::kARGB_8888_Config, w, h, calculateRowBytesFor888 8(w, bitCount));
237 delete[] colors; 238 delete[] colors;
238 return true; 239 return true;
239 } 240 }
240 // No Bitmap reuse supported for this format
241 if (!bm->isNull()) {
242 return false;
243 }
244 bm->setConfig(SkBitmap::kARGB_8888_Config, w, h, calculateRowBytesFor8888(w, bitCount));
245 241
246 if (!this->allocPixelRef(bm, NULL)) 242 if (!this->allocPixelRef(bm, NULL))
247 { 243 {
248 delete[] colors; 244 delete[] colors;
249 return false; 245 return false;
250 } 246 }
251 247
252 SkAutoLockPixels alp(*bm); 248 SkAutoLockPixels alp(*bm);
253 249
254 for (int y = 0; y < h; y++) 250 for (int y = 0; y < h; y++)
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_libico_dfactory); 396 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_libico_dfactory);
401 397
402 static SkImageDecoder::Format get_format_ico(SkStream* stream) { 398 static SkImageDecoder::Format get_format_ico(SkStream* stream) {
403 if (is_ico(stream)) { 399 if (is_ico(stream)) {
404 return SkImageDecoder::kICO_Format; 400 return SkImageDecoder::kICO_Format;
405 } 401 }
406 return SkImageDecoder::kUnknown_Format; 402 return SkImageDecoder::kUnknown_Format;
407 } 403 }
408 404
409 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_ico) ; 405 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_ico) ;
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libgif.cpp ('k') | src/images/SkImageDecoder_libjpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698