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 "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkColorTable.h" | 10 #include "SkColorTable.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 sk_memset32(colorPtr, 0xFF000000, maxColors); | 443 sk_memset32(colorPtr, 0xFF000000, maxColors); |
444 } | 444 } |
445 | 445 |
446 fColorTable.reset(new SkColorTable(colorPtr, maxColors)); | 446 fColorTable.reset(new SkColorTable(colorPtr, maxColors)); |
447 copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount)
; | 447 copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount)
; |
448 } | 448 } |
449 | 449 |
450 SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColo
r* inputColorPtr, | 450 SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColo
r* inputColorPtr, |
451 int* inputColorCount, const Options& opts) { | 451 int* inputColorCount, const Options& opts) { |
452 // Check for valid input parameters | 452 // Check for valid input parameters |
453 if (!conversion_possible_ignore_color_space(dstInfo, this->getInfo())) { | 453 if (!conversion_possible(dstInfo, this->getInfo())) { |
454 return gif_error("Cannot convert input type to output type.\n", kInvalid
Conversion); | 454 return gif_error("Cannot convert input type to output type.\n", |
| 455 kInvalidConversion); |
455 } | 456 } |
456 | 457 |
457 // Initialize color table and copy to the client if necessary | 458 // Initialize color table and copy to the client if necessary |
458 this->initializeColorTable(dstInfo, inputColorPtr, inputColorCount); | 459 this->initializeColorTable(dstInfo, inputColorPtr, inputColorCount); |
459 | 460 |
460 this->initializeSwizzler(dstInfo, opts); | 461 this->initializeSwizzler(dstInfo, opts); |
461 return kSuccess; | 462 return kSuccess; |
462 } | 463 } |
463 | 464 |
464 void SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& o
pts) { | 465 void SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& o
pts) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 int SkGifCodec::onOutputScanline(int inputScanline) const { | 598 int SkGifCodec::onOutputScanline(int inputScanline) const { |
598 if (fGif->Image.Interlace) { | 599 if (fGif->Image.Interlace) { |
599 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { | 600 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { |
600 return inputScanline; | 601 return inputScanline; |
601 } | 602 } |
602 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + | 603 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + |
603 fFrameRect.top(); | 604 fFrameRect.top(); |
604 } | 605 } |
605 return inputScanline; | 606 return inputScanline; |
606 } | 607 } |
OLD | NEW |