OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 "SkCodec_libgif.h" | 8 #include "SkCodec_libgif.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 for (uint32_t i = colorCount; i < maxColors; i++) { | 449 for (uint32_t i = colorCount; i < maxColors; i++) { |
450 colorPtr[i] = colorPtr[fFillIndex]; | 450 colorPtr[i] = colorPtr[fFillIndex]; |
451 } | 451 } |
452 | 452 |
453 fColorTable.reset(new SkColorTable(colorPtr, maxColors)); | 453 fColorTable.reset(new SkColorTable(colorPtr, maxColors)); |
454 copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount)
; | 454 copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount)
; |
455 } | 455 } |
456 | 456 |
457 SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColo
r* inputColorPtr, | 457 SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColo
r* inputColorPtr, |
458 int* inputColorCount, const Options& opts) { | 458 int* inputColorCount, const Options& opts) { |
459 // Rewind if necessary | |
460 if (!this->rewindIfNeeded()) { | |
461 return kCouldNotRewind; | |
462 } | |
463 | |
464 // Check for valid input parameters | 459 // Check for valid input parameters |
465 if (opts.fSubset) { | 460 if (opts.fSubset) { |
466 // Subsets are not supported. | 461 // Subsets are not supported. |
467 return kUnimplemented; | 462 return kUnimplemented; |
468 } | 463 } |
469 if (!conversion_possible(dstInfo, this->getInfo())) { | 464 if (!conversion_possible(dstInfo, this->getInfo())) { |
470 return gif_error("Cannot convert input type to output type.\n", | 465 return gif_error("Cannot convert input type to output type.\n", |
471 kInvalidConversion); | 466 kInvalidConversion); |
472 } | 467 } |
473 | 468 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 } | 661 } |
667 | 662 |
668 int SkGifCodec::onNextScanline() const { | 663 int SkGifCodec::onNextScanline() const { |
669 if (fGif->Image.Interlace) { | 664 if (fGif->Image.Interlace) { |
670 return get_output_row_interlaced(this->INHERITED::onNextScanline(), this
->dstInfo().height()); | 665 return get_output_row_interlaced(this->INHERITED::onNextScanline(), this
->dstInfo().height()); |
671 } else { | 666 } else { |
672 return this->INHERITED::onNextScanline(); | 667 return this->INHERITED::onNextScanline(); |
673 } | 668 } |
674 } | 669 } |
675 | 670 |
OLD | NEW |