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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 * Subclasses should do any set up needed after a rewind. | 594 * Subclasses should do any set up needed after a rewind. |
595 */ | 595 */ |
596 virtual bool onRewind() { | 596 virtual bool onRewind() { |
597 return true; | 597 return true; |
598 } | 598 } |
599 | 599 |
600 /** | 600 /** |
601 * On an incomplete input, getPixels() and getScanlines() will fill any unin
itialized | 601 * On an incomplete input, getPixels() and getScanlines() will fill any unin
itialized |
602 * scanlines. This allows the subclass to indicate what value to fill with. | 602 * scanlines. This allows the subclass to indicate what value to fill with. |
603 * | 603 * |
604 * @param colorType Destination color type. | 604 * @param dstInfo Describes the destination. |
605 * @return The value with which to fill uninitialized pixels. | 605 * @return The value with which to fill uninitialized pixels. |
606 * | 606 * |
607 * Note that we can interpret the return value as an SkPMColor, a 16-bit 565
color, | 607 * Note that we can interpret the return value as a 64-bit Float16 color, a
SkPMColor, |
608 * an 8-bit gray color, or an 8-bit index into a color table, depending on t
he color | 608 * a 16-bit 565 color, an 8-bit gray color, or an 8-bit index into a color t
able, |
609 * type. | 609 * depending on the color type. |
610 */ | 610 */ |
611 uint32_t getFillValue(SkColorType colorType) const { | 611 uint64_t getFillValue(const SkImageInfo& dstInfo) const { |
612 return this->onGetFillValue(colorType); | 612 return this->onGetFillValue(dstInfo); |
613 } | 613 } |
614 | 614 |
615 /** | 615 /** |
616 * Some subclasses will override this function, but this is a useful default
for the color | 616 * Some subclasses will override this function, but this is a useful default
for the color |
617 * types that we support. Note that for color types that do not use the ful
l 32-bits, | 617 * types that we support. Note that for color types that do not use the ful
l 64-bits, |
618 * we will simply take the low bits of the fill value. | 618 * we will simply take the low bits of the fill value. |
619 * | 619 * |
| 620 * The defaults are: |
| 621 * kRGBA_F16_SkColorType: Transparent or Black, depending on the src alpha t
ype |
620 * kN32_SkColorType: Transparent or Black, depending on the src alpha type | 622 * kN32_SkColorType: Transparent or Black, depending on the src alpha type |
621 * kRGB_565_SkColorType: Black | 623 * kRGB_565_SkColorType: Black |
622 * kGray_8_SkColorType: Black | 624 * kGray_8_SkColorType: Black |
623 * kIndex_8_SkColorType: First color in color table | 625 * kIndex_8_SkColorType: First color in color table |
624 */ | 626 */ |
625 virtual uint32_t onGetFillValue(SkColorType /*colorType*/) const { | 627 virtual uint64_t onGetFillValue(const SkImageInfo& dstInfo) const; |
626 return kOpaque_SkAlphaType == fSrcInfo.alphaType() ? SK_ColorBLACK : SK_
ColorTRANSPARENT; | |
627 } | |
628 | 628 |
629 /** | 629 /** |
630 * Get method for the input stream | 630 * Get method for the input stream |
631 */ | 631 */ |
632 SkStream* stream() { | 632 SkStream* stream() { |
633 return fStream.get(); | 633 return fStream.get(); |
634 } | 634 } |
635 | 635 |
636 /** | 636 /** |
637 * The remaining functions revolve around decoding scanlines. | 637 * The remaining functions revolve around decoding scanlines. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 730 |
731 // For testing with qcms | 731 // For testing with qcms |
732 // FIXME: Remove these when we are done comparing with qcms. | 732 // FIXME: Remove these when we are done comparing with qcms. |
733 friend class DM::ColorCodecSrc; | 733 friend class DM::ColorCodecSrc; |
734 friend class ColorCodecBench; | 734 friend class ColorCodecBench; |
735 | 735 |
736 friend class SkSampledCodec; | 736 friend class SkSampledCodec; |
737 friend class SkIcoCodec; | 737 friend class SkIcoCodec; |
738 }; | 738 }; |
739 #endif // SkCodec_DEFINED | 739 #endif // SkCodec_DEFINED |
OLD | NEW |