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 height = innerHeight; | 303 height = innerHeight; |
304 imageTop = 0; | 304 imageTop = 0; |
305 } else if (imageTop + innerHeight > height) { | 305 } else if (imageTop + innerHeight > height) { |
306 gif_warning(*bm, "shifting image up to fit"); | 306 gif_warning(*bm, "shifting image up to fit"); |
307 imageTop = height - innerHeight; | 307 imageTop = height - innerHeight; |
308 } else if (imageTop < 0) { | 308 } else if (imageTop < 0) { |
309 gif_warning(*bm, "shifting image down to fit"); | 309 gif_warning(*bm, "shifting image down to fit"); |
310 imageTop = 0; | 310 imageTop = 0; |
311 } | 311 } |
312 | 312 |
313 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER | |
314 // FIXME: We could give the caller a choice of images or configs. | |
315 if (!this->chooseFromOneChoice(kIndex_8_SkColorType, width, height))
{ | |
316 return error_return(*bm, "chooseFromOneChoice"); | |
317 } | |
318 #endif | |
319 | |
320 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); | 313 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); |
321 | 314 |
322 bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledH
eight(), | 315 bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledH
eight(), |
323 kIndex_8_SkColorType, kPremul_SkAlphaT
ype)); | 316 kIndex_8_SkColorType, kPremul_SkAlphaT
ype)); |
324 | 317 |
325 if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 318 if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
326 return kSuccess; | 319 return kSuccess; |
327 } | 320 } |
328 | 321 |
329 | 322 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); | 521 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); |
529 | 522 |
530 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { | 523 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { |
531 if (is_gif(stream)) { | 524 if (is_gif(stream)) { |
532 return SkImageDecoder::kGIF_Format; | 525 return SkImageDecoder::kGIF_Format; |
533 } | 526 } |
534 return SkImageDecoder::kUnknown_Format; | 527 return SkImageDecoder::kUnknown_Format; |
535 } | 528 } |
536 | 529 |
537 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); | 530 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); |
OLD | NEW |