| OLD | NEW |
| 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 #include "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
| 9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
| 10 #include "SkStream.h" | 10 #include "SkStream.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 /*int */test = w & 0x1F; //the low 5 bits - we are rounding up to the next
32 (2^5) | 240 /*int */test = w & 0x1F; //the low 5 bits - we are rounding up to the next
32 (2^5) |
| 241 /*int */mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | te
st) & 0x1); //either 0xFFFFFFFF or 0 | 241 /*int */mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | te
st) & 0x1); //either 0xFFFFFFFF or 0 |
| 242 int andLineWidth = (w & 0xFFFFFFE0) + (0x20 & mask); | 242 int andLineWidth = (w & 0xFFFFFFE0) + (0x20 & mask); |
| 243 //if we allow different Configs, everything is the same til here | 243 //if we allow different Configs, everything is the same til here |
| 244 //change the config, and use different address getter, and place index vs co
lor, and add the color table | 244 //change the config, and use different address getter, and place index vs co
lor, and add the color table |
| 245 //FIXME: what is the tradeoff in size? | 245 //FIXME: what is the tradeoff in size? |
| 246 //if the andbitmap (mask) is all zeroes, then we can easily do an index bitm
ap | 246 //if the andbitmap (mask) is all zeroes, then we can easily do an index bitm
ap |
| 247 //however, with small images with large colortables, maybe it's better to st
ill do argb_8888 | 247 //however, with small images with large colortables, maybe it's better to st
ill do argb_8888 |
| 248 | 248 |
| 249 bm->setConfig(SkBitmap::kARGB_8888_Config, w, h, calculateRowBytesFor8888(w,
bitCount)); | 249 bm->setInfo(SkImageInfo::MakeN32Premul(w, h), calculateRowBytesFor8888(w, bi
tCount)); |
| 250 | 250 |
| 251 if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 251 if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
| 252 delete[] colors; | 252 delete[] colors; |
| 253 return true; | 253 return true; |
| 254 } | 254 } |
| 255 | 255 |
| 256 if (!this->allocPixelRef(bm, NULL)) | 256 if (!this->allocPixelRef(bm, NULL)) |
| 257 { | 257 { |
| 258 delete[] colors; | 258 delete[] colors; |
| 259 return false; | 259 return false; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory); | 408 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory); |
| 409 | 409 |
| 410 static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) { | 410 static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) { |
| 411 if (is_ico(stream)) { | 411 if (is_ico(stream)) { |
| 412 return SkImageDecoder::kICO_Format; | 412 return SkImageDecoder::kICO_Format; |
| 413 } | 413 } |
| 414 return SkImageDecoder::kUnknown_Format; | 414 return SkImageDecoder::kUnknown_Format; |
| 415 } | 415 } |
| 416 | 416 |
| 417 static SkImageDecoder_FormatReg gFormatReg(get_format_ico); | 417 static SkImageDecoder_FormatReg gFormatReg(get_format_ico); |
| OLD | NEW |