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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 int* inputColorCount, const Options& opts) { | 429 int* inputColorCount, const Options& opts) { |
430 // Check for valid input parameters | 430 // Check for valid input parameters |
431 if (!conversion_possible(dstInfo, this->getInfo())) { | 431 if (!conversion_possible(dstInfo, this->getInfo())) { |
432 return gif_error("Cannot convert input type to output type.\n", | 432 return gif_error("Cannot convert input type to output type.\n", |
433 kInvalidConversion); | 433 kInvalidConversion); |
434 } | 434 } |
435 | 435 |
436 // Initialize color table and copy to the client if necessary | 436 // Initialize color table and copy to the client if necessary |
437 this->initializeColorTable(dstInfo, inputColorPtr, inputColorCount); | 437 this->initializeColorTable(dstInfo, inputColorPtr, inputColorCount); |
438 | 438 |
439 return this->initializeSwizzler(dstInfo, opts); | 439 this->initializeSwizzler(dstInfo, opts); |
| 440 return kSuccess; |
440 } | 441 } |
441 | 442 |
442 SkCodec::Result SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, const
Options& opts) { | 443 void SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& o
pts) { |
443 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); | 444 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); |
444 const SkIRect* frameRect = fFrameIsSubset ? &fFrameRect : nullptr; | 445 const SkIRect* frameRect = fFrameIsSubset ? &fFrameRect : nullptr; |
445 fSwizzler.reset(SkSwizzler::CreateSwizzler(SkSwizzler::kIndex, colorPtr, dst
Info, opts, | 446 fSwizzler.reset(SkSwizzler::CreateSwizzler(SkSwizzler::kIndex, colorPtr, dst
Info, opts, |
446 frameRect)); | 447 frameRect)); |
447 | 448 SkASSERT(fSwizzler); |
448 if (nullptr != fSwizzler.get()) { | |
449 return kSuccess; | |
450 } | |
451 return kUnimplemented; | |
452 } | 449 } |
453 | 450 |
454 bool SkGifCodec::readRow() { | 451 bool SkGifCodec::readRow() { |
455 return GIF_ERROR != DGifGetLine(fGif, fSrcBuffer.get(), fFrameRect.width()); | 452 return GIF_ERROR != DGifGetLine(fGif, fSrcBuffer.get(), fFrameRect.width()); |
456 } | 453 } |
457 | 454 |
458 /* | 455 /* |
459 * Initiates the gif decode | 456 * Initiates the gif decode |
460 */ | 457 */ |
461 SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo, | 458 SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 int SkGifCodec::onOutputScanline(int inputScanline) const { | 576 int SkGifCodec::onOutputScanline(int inputScanline) const { |
580 if (fGif->Image.Interlace) { | 577 if (fGif->Image.Interlace) { |
581 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { | 578 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { |
582 return inputScanline; | 579 return inputScanline; |
583 } | 580 } |
584 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + | 581 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + |
585 fFrameRect.top(); | 582 fFrameRect.top(); |
586 } | 583 } |
587 return inputScanline; | 584 return inputScanline; |
588 } | 585 } |
OLD | NEW |