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 "SkColor.h" | 8 #include "SkColor.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkColorTable.h" | 10 #include "SkColorTable.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 imageTop = 0; | 303 imageTop = 0; |
304 } else if (imageTop + innerHeight > height) { | 304 } else if (imageTop + innerHeight > height) { |
305 gif_warning(*bm, "shifting image up to fit"); | 305 gif_warning(*bm, "shifting image up to fit"); |
306 imageTop = height - innerHeight; | 306 imageTop = height - innerHeight; |
307 } else if (imageTop < 0) { | 307 } else if (imageTop < 0) { |
308 gif_warning(*bm, "shifting image down to fit"); | 308 gif_warning(*bm, "shifting image down to fit"); |
309 imageTop = 0; | 309 imageTop = 0; |
310 } | 310 } |
311 | 311 |
312 // FIXME: We could give the caller a choice of images or configs. | 312 // FIXME: We could give the caller a choice of images or configs. |
313 if (!this->chooseFromOneChoice(SkBitmap::kIndex8_Config, width, heig
ht)) { | 313 if (!this->chooseFromOneChoice(kIndex_8_SkColorType, width, height))
{ |
314 return error_return(*bm, "chooseFromOneChoice"); | 314 return error_return(*bm, "chooseFromOneChoice"); |
315 } | 315 } |
316 | 316 |
317 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); | 317 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); |
318 | 318 |
319 bm->setConfig(SkBitmap::kIndex8_Config, sampler.scaledWidth(), | 319 bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledH
eight(), |
320 sampler.scaledHeight()); | 320 kIndex_8_SkColorType, kPremul_SkAlphaT
ype)); |
321 | 321 |
322 if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 322 if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
323 return true; | 323 return true; |
324 } | 324 } |
325 | 325 |
326 | 326 |
327 // now we decode the colortable | 327 // now we decode the colortable |
328 int colorCount = 0; | 328 int colorCount = 0; |
329 { | 329 { |
330 // Declare colorPtr here for scope. | 330 // Declare colorPtr here for scope. |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); | 529 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); |
530 | 530 |
531 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { | 531 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { |
532 if (is_gif(stream)) { | 532 if (is_gif(stream)) { |
533 return SkImageDecoder::kGIF_Format; | 533 return SkImageDecoder::kGIF_Format; |
534 } | 534 } |
535 return SkImageDecoder::kUnknown_Format; | 535 return SkImageDecoder::kUnknown_Format; |
536 } | 536 } |
537 | 537 |
538 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); | 538 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); |
OLD | NEW |