Chromium Code Reviews

Side by Side Diff: include/codec/SkCodec.h

Issue 2335203002: Implement Fill() for incomplete decodes to RGBA_F16 (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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...)
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 32-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 * kRGBA_F16_SkColorType: Transparent or Black, depending on the src alpha t ype
reed1 2016/09/13 14:41:29 Is this list your "default" values? Not clear from
msarett 2016/09/13 14:47:24 Improving comments.
620 * kN32_SkColorType: Transparent or Black, depending on the src alpha type 621 * kN32_SkColorType: Transparent or Black, depending on the src alpha type
621 * kRGB_565_SkColorType: Black 622 * kRGB_565_SkColorType: Black
622 * kGray_8_SkColorType: Black 623 * kGray_8_SkColorType: Black
623 * kIndex_8_SkColorType: First color in color table 624 * kIndex_8_SkColorType: First color in color table
624 */ 625 */
625 virtual uint32_t onGetFillValue(SkColorType /*colorType*/) const { 626 virtual uint64_t onGetFillValue(const SkImageInfo& dstInfo) const;
626 return kOpaque_SkAlphaType == fSrcInfo.alphaType() ? SK_ColorBLACK : SK_ ColorTRANSPARENT;
627 }
628 627
629 /** 628 /**
630 * Get method for the input stream 629 * Get method for the input stream
631 */ 630 */
632 SkStream* stream() { 631 SkStream* stream() {
633 return fStream.get(); 632 return fStream.get();
634 } 633 }
635 634
636 /** 635 /**
637 * The remaining functions revolve around decoding scanlines. 636 * The remaining functions revolve around decoding scanlines.
(...skipping 92 matching lines...)
730 729
731 // For testing with qcms 730 // For testing with qcms
732 // FIXME: Remove these when we are done comparing with qcms. 731 // FIXME: Remove these when we are done comparing with qcms.
733 friend class DM::ColorCodecSrc; 732 friend class DM::ColorCodecSrc;
734 friend class ColorCodecBench; 733 friend class ColorCodecBench;
735 734
736 friend class SkSampledCodec; 735 friend class SkSampledCodec;
737 friend class SkIcoCodec; 736 friend class SkIcoCodec;
738 }; 737 };
739 #endif // SkCodec_DEFINED 738 #endif // SkCodec_DEFINED
OLDNEW
« no previous file with comments | « gyp/codec_android.gyp ('k') | src/codec/SkBmpStandardCodec.h » ('j') | src/codec/SkSampler.cpp » ('J')

Powered by Google App Engine