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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 return get_color_table_fill_value(colorType, colorPtr, fFillIndex); | 501 return get_color_table_fill_value(colorType, colorPtr, fFillIndex); |
502 } | 502 } |
503 | 503 |
504 SkCodec::Result SkGifCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, | 504 SkCodec::Result SkGifCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, |
505 const SkCodec::Options& opts, SkPMColor inputColorPtr[], int* inputColor
Count) { | 505 const SkCodec::Options& opts, SkPMColor inputColorPtr[], int* inputColor
Count) { |
506 return this->prepareToDecode(dstInfo, inputColorPtr, inputColorCount, this->
options()); | 506 return this->prepareToDecode(dstInfo, inputColorPtr, inputColorCount, this->
options()); |
507 } | 507 } |
508 | 508 |
509 void SkGifCodec::handleScanlineFrame(int count, int* rowsBeforeFrame, int* rowsI
nFrame) { | 509 void SkGifCodec::handleScanlineFrame(int count, int* rowsBeforeFrame, int* rowsI
nFrame) { |
510 if (fFrameIsSubset) { | 510 if (fFrameIsSubset) { |
511 const int currRow = this->INHERITED::nextScanline(); | 511 const int currRow = this->currScanline(); |
512 | 512 |
513 // The number of rows that remain to be skipped before reaching rows tha
t we | 513 // The number of rows that remain to be skipped before reaching rows tha
t we |
514 // actually must decode into. | 514 // actually must decode into. |
515 // This must be at least zero. We also make sure that it is less than o
r | 515 // This must be at least zero. We also make sure that it is less than o
r |
516 // equal to count, since we will skip at most count rows. | 516 // equal to count, since we will skip at most count rows. |
517 *rowsBeforeFrame = SkTMin(count, SkTMax(0, fFrameRect.top() - currRow)); | 517 *rowsBeforeFrame = SkTMin(count, SkTMax(0, fFrameRect.top() - currRow)); |
518 | 518 |
519 // Rows left to decode once we reach the start of the frame. | 519 // Rows left to decode once we reach the start of the frame. |
520 const int rowsLeft = count - *rowsBeforeFrame; | 520 const int rowsLeft = count - *rowsBeforeFrame; |
521 | 521 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 int SkGifCodec::onOutputScanline(int inputScanline) const { | 582 int SkGifCodec::onOutputScanline(int inputScanline) const { |
583 if (fGif->Image.Interlace) { | 583 if (fGif->Image.Interlace) { |
584 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { | 584 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { |
585 return inputScanline; | 585 return inputScanline; |
586 } | 586 } |
587 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + | 587 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + |
588 fFrameRect.top(); | 588 fFrameRect.top(); |
589 } | 589 } |
590 return inputScanline; | 590 return inputScanline; |
591 } | 591 } |
OLD | NEW |