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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 height = innerHeight; | 302 height = innerHeight; |
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 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER |
312 // FIXME: We could give the caller a choice of images or configs. | 313 // FIXME: We could give the caller a choice of images or configs. |
313 if (!this->chooseFromOneChoice(kIndex_8_SkColorType, width, height))
{ | 314 if (!this->chooseFromOneChoice(kIndex_8_SkColorType, width, height))
{ |
314 return error_return(*bm, "chooseFromOneChoice"); | 315 return error_return(*bm, "chooseFromOneChoice"); |
315 } | 316 } |
| 317 #endif |
316 | 318 |
317 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); | 319 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); |
318 | 320 |
319 bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledH
eight(), | 321 bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledH
eight(), |
320 kIndex_8_SkColorType, kPremul_SkAlphaT
ype)); | 322 kIndex_8_SkColorType, kPremul_SkAlphaT
ype)); |
321 | 323 |
322 if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 324 if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
323 return true; | 325 return true; |
324 } | 326 } |
325 | 327 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); | 531 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); |
530 | 532 |
531 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { | 533 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { |
532 if (is_gif(stream)) { | 534 if (is_gif(stream)) { |
533 return SkImageDecoder::kGIF_Format; | 535 return SkImageDecoder::kGIF_Format; |
534 } | 536 } |
535 return SkImageDecoder::kUnknown_Format; | 537 return SkImageDecoder::kUnknown_Format; |
536 } | 538 } |
537 | 539 |
538 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); | 540 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); |
OLD | NEW |