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 #ifndef SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED |
9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED |
10 | 10 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 */ | 563 */ |
564 virtual bool onRewind() { | 564 virtual bool onRewind() { |
565 return true; | 565 return true; |
566 } | 566 } |
567 | 567 |
568 /** | 568 /** |
569 * On an incomplete input, getPixels() and getScanlines() will fill any unin
itialized | 569 * On an incomplete input, getPixels() and getScanlines() will fill any unin
itialized |
570 * scanlines. This allows the subclass to indicate what value to fill with. | 570 * scanlines. This allows the subclass to indicate what value to fill with. |
571 * | 571 * |
572 * @param colorType Destination color type. | 572 * @param colorType Destination color type. |
573 * @param alphaType Destination alpha type. | |
574 * @return The value with which to fill uninitialized pixels. | 573 * @return The value with which to fill uninitialized pixels. |
575 * | 574 * |
576 * Note that we can interpret the return value as an SkPMColor, a 16-bit 565
color, | 575 * Note that we can interpret the return value as an SkPMColor, a 16-bit 565
color, |
577 * an 8-bit gray color, or an 8-bit index into a color table, depending on t
he color | 576 * an 8-bit gray color, or an 8-bit index into a color table, depending on t
he color |
578 * type. | 577 * type. |
579 */ | 578 */ |
580 uint32_t getFillValue(SkColorType colorType, SkAlphaType alphaType) const { | 579 uint32_t getFillValue(SkColorType colorType) const { |
581 return this->onGetFillValue(colorType, alphaType); | 580 return this->onGetFillValue(colorType); |
582 } | 581 } |
583 | 582 |
584 /** | 583 /** |
585 * Some subclasses will override this function, but this is a useful default
for the color | 584 * Some subclasses will override this function, but this is a useful default
for the color |
586 * types that we support. Note that for color types that do not use the ful
l 32-bits, | 585 * types that we support. Note that for color types that do not use the ful
l 32-bits, |
587 * we will simply take the low bits of the fill value. | 586 * we will simply take the low bits of the fill value. |
588 * | 587 * |
589 * kN32_SkColorType: Transparent or Black | 588 * kN32_SkColorType: Transparent or Black, depending on the src alpha type |
590 * kRGB_565_SkColorType: Black | 589 * kRGB_565_SkColorType: Black |
591 * kGray_8_SkColorType: Black | 590 * kGray_8_SkColorType: Black |
592 * kIndex_8_SkColorType: First color in color table | 591 * kIndex_8_SkColorType: First color in color table |
593 */ | 592 */ |
594 virtual uint32_t onGetFillValue(SkColorType /*colorType*/, SkAlphaType alpha
Type) const { | 593 virtual uint32_t onGetFillValue(SkColorType /*colorType*/) const { |
595 return kOpaque_SkAlphaType == alphaType ? SK_ColorBLACK : SK_ColorTRANSP
ARENT; | 594 return kOpaque_SkAlphaType == fSrcInfo.alphaType() ? SK_ColorBLACK : SK_
ColorTRANSPARENT; |
596 } | 595 } |
597 | 596 |
598 /** | 597 /** |
599 * Get method for the input stream | 598 * Get method for the input stream |
600 */ | 599 */ |
601 SkStream* stream() { | 600 SkStream* stream() { |
602 return fStream.get(); | 601 return fStream.get(); |
603 } | 602 } |
604 | 603 |
605 /** | 604 /** |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 * not affect ownership. | 696 * not affect ownership. |
698 * | 697 * |
699 * Only valid during scanline decoding. | 698 * Only valid during scanline decoding. |
700 */ | 699 */ |
701 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} | 700 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} |
702 | 701 |
703 friend class SkSampledCodec; | 702 friend class SkSampledCodec; |
704 friend class SkIcoCodec; | 703 friend class SkIcoCodec; |
705 }; | 704 }; |
706 #endif // SkCodec_DEFINED | 705 #endif // SkCodec_DEFINED |
OLD | NEW |