Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
SkSwizzler Class Reference

#include <SkSwizzler.h>

Inheritance diagram for SkSwizzler:
SkSampler SkNoncopyable

Public Member Functions

void swizzle (void *dst, const uint8_t *SK_RESTRICT src)
 
int fillWidth () const override
 
int sampleX () const
 
int swizzleWidth () const
 
size_t swizzleOffsetBytes () const
 
- Public Member Functions inherited from SkSampler
int setSampleX (int sampleX)
 
void setSampleY (int sampleY)
 
int sampleY () const
 
bool rowNeeded (int row) const
 
virtual int fillWidth () const =0
 
 SkSampler ()
 
virtual ~SkSampler ()
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 

Static Public Member Functions

static std::unique_ptr< SkSwizzlerMake (const SkEncodedInfo &encodedInfo, const SkPMColor *ctable, const SkImageInfo &dstInfo, const SkCodec::Options &, const SkIRect *frame=nullptr)
 
static std::unique_ptr< SkSwizzlerMakeSimple (int srcBPP, const SkImageInfo &dstInfo, const SkCodec::Options &)
 
- Static Public Member Functions inherited from SkSampler
static void Fill (const SkImageInfo &info, void *dst, size_t rowBytes, SkCodec::ZeroInitialized zeroInit)
 

Detailed Description

Definition at line 24 of file SkSwizzler.h.

Member Function Documentation

◆ fillWidth()

int SkSwizzler::fillWidth ( ) const
inlineoverridevirtual

Implements SkSampler.

Definition at line 72 of file SkSwizzler.h.

72 {
73 return fAllocatedWidth;
74 }

◆ Make()

std::unique_ptr< SkSwizzler > SkSwizzler::Make ( const SkEncodedInfo encodedInfo,
const SkPMColor ctable,
const SkImageInfo dstInfo,
const SkCodec::Options options,
const SkIRect frame = nullptr 
)
static

Create a new SkSwizzler.

Parameters
encodedInfoDescription of the format of the encoded data.
ctableUnowned pointer to an array of up to 256 colors for an index source.
dstInfoDescribes the destination.
optionsContains partial scanline information and whether the dst is zero- initialized.
frameIs non-NULL if the source pixels are part of an image frame that is a subset of the full image.

Note that a deeper discussion of partial scanline subsets and image frame subsets is below. Currently, we do not support both simultaneously. If options->fSubset is non-NULL, frame must be NULL.

Returns
A new SkSwizzler or nullptr on failure.

Definition at line 821 of file SkSwizzler.cpp.

825 {
826 if (SkEncodedInfo::kPalette_Color == encodedInfo.color() && nullptr == ctable) {
827 return nullptr;
828 }
829
830 RowProc fastProc = nullptr;
831 RowProc proc = nullptr;
832 SkCodec::ZeroInitialized zeroInit = options.fZeroInitialized;
833 const bool premultiply = (SkEncodedInfo::kOpaque_Alpha != encodedInfo.alpha()) &&
834 (kPremul_SkAlphaType == dstInfo.alphaType());
835
836 switch (encodedInfo.color()) {
838 switch (encodedInfo.bitsPerComponent()) {
839 case 1:
840 switch (dstInfo.colorType()) {
843 proc = &swizzle_bit_to_n32;
844 break;
846 proc = &swizzle_bit_to_565;
847 break;
850 break;
852 proc = &swizzle_bit_to_f16;
853 break;
854 default:
855 return nullptr;
856 }
857 break;
858 case 8:
859 switch (dstInfo.colorType()) {
862 proc = &swizzle_gray_to_n32;
863 fastProc = &fast_swizzle_gray_to_n32;
864 break;
866 proc = &sample1;
867 fastProc = &copy;
868 break;
870 proc = &swizzle_gray_to_565;
871 break;
872 default:
873 return nullptr;
874 }
875 break;
876 default:
877 return nullptr;
878 }
879 break;
882 switch (dstInfo.colorType()) {
885 if (premultiply) {
886 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
887 proc = &SkipLeadingGrayAlphaZerosThen
889 fastProc = &SkipLeadingGrayAlphaZerosThen
891 } else {
894 }
895 } else {
896 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
897 proc = &SkipLeadingGrayAlphaZerosThen
899 fastProc = &SkipLeadingGrayAlphaZerosThen
901 } else {
904 }
905 }
906 break;
909 break;
910 default:
911 return nullptr;
912 }
913 break;
915 // We assume that the color table is premultiplied and swizzled
916 // as desired.
917 switch (encodedInfo.bitsPerComponent()) {
918 case 1:
919 case 2:
920 case 4:
921 switch (dstInfo.colorType()) {
925 break;
928 break;
929 default:
930 return nullptr;
931 }
932 break;
933 case 8:
934 switch (dstInfo.colorType()) {
938 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
940 } else {
941 proc = &swizzle_index_to_n32;
942 }
943 break;
945 proc = &swizzle_index_to_565;
946 break;
947 default:
948 return nullptr;
949 }
950 break;
951 default:
952 return nullptr;
953 }
954 break;
956 // Treat 565 exactly like RGB (since it's still encoded as 8 bits per component).
957 // We just mark as 565 when we have a hint that there are only 5/6/5 "significant"
958 // bits in each channel.
960 switch (dstInfo.colorType()) {
962 if (16 == encodedInfo.bitsPerComponent()) {
963 proc = &swizzle_rgb16_to_rgba;
964 break;
965 }
966
967 SkASSERT(8 == encodedInfo.bitsPerComponent());
968 proc = &swizzle_rgb_to_rgba;
969 fastProc = &fast_swizzle_rgb_to_rgba;
970 break;
972 if (16 == encodedInfo.bitsPerComponent()) {
973 proc = &swizzle_rgb16_to_bgra;
974 break;
975 }
976
977 SkASSERT(8 == encodedInfo.bitsPerComponent());
978 proc = &swizzle_rgb_to_bgra;
979 fastProc = &fast_swizzle_rgb_to_bgra;
980 break;
982 if (16 == encodedInfo.bitsPerComponent()) {
983 proc = &swizzle_rgb16_to_565;
984 break;
985 }
986
987 proc = &swizzle_rgb_to_565;
988 break;
989 default:
990 return nullptr;
991 }
992 break;
994 switch (dstInfo.colorType()) {
996 if (16 == encodedInfo.bitsPerComponent()) {
997 proc = premultiply ? &swizzle_rgba16_to_rgba_premul :
999 break;
1000 }
1001
1002 SkASSERT(8 == encodedInfo.bitsPerComponent());
1003 if (premultiply) {
1004 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
1005 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_rgba_premul>;
1006 fastProc = &SkipLeading8888ZerosThen
1008 } else {
1011 }
1012 } else {
1013 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
1014 proc = &SkipLeading8888ZerosThen<sample4>;
1015 fastProc = &SkipLeading8888ZerosThen<copy>;
1016 } else {
1017 proc = &sample4;
1018 fastProc = &copy;
1019 }
1020 }
1021 break;
1023 if (16 == encodedInfo.bitsPerComponent()) {
1024 proc = premultiply ? &swizzle_rgba16_to_bgra_premul :
1026 break;
1027 }
1028
1029 SkASSERT(8 == encodedInfo.bitsPerComponent());
1030 if (premultiply) {
1031 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
1032 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_premul>;
1033 fastProc = &SkipLeading8888ZerosThen
1035 } else {
1038 }
1039 } else {
1040 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
1041 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_unpremul>;
1042 fastProc = &SkipLeading8888ZerosThen
1044 } else {
1047 }
1048 }
1049 break;
1050 default:
1051 return nullptr;
1052 }
1053 break;
1055 switch (dstInfo.colorType()) {
1057 proc = &swizzle_rgb_to_rgba;
1058 fastProc = &fast_swizzle_rgb_to_rgba;
1059 break;
1061 proc = &swizzle_rgb_to_bgra;
1062 fastProc = &fast_swizzle_rgb_to_bgra;
1063 break;
1065 proc = &swizzle_bgr_to_565;
1066 break;
1067 default:
1068 return nullptr;
1069 }
1070 break;
1072 switch (dstInfo.colorType()) {
1074 proc = &swizzle_rgb_to_rgba;
1075 break;
1077 proc = &swizzle_rgb_to_bgra;
1078 break;
1080 proc = &swizzle_bgr_to_565;
1081 break;
1082 default:
1083 return nullptr;
1084 }
1085 break;
1087 switch (dstInfo.colorType()) {
1089 if (premultiply) {
1090 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
1091 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_rgba_premul>;
1092 fastProc = &SkipLeading8888ZerosThen
1094 } else {
1097 }
1098 } else {
1099 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
1100 proc = &SkipLeading8888ZerosThen<sample4>;
1101 fastProc = &SkipLeading8888ZerosThen<copy>;
1102 } else {
1103 proc = &sample4;
1104 fastProc = &copy;
1105 }
1106 }
1107 break;
1109 if (premultiply) {
1110 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
1111 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_premul>;
1112 fastProc = &SkipLeading8888ZerosThen
1114 } else {
1117 }
1118 } else {
1119 if (SkCodec::kYes_ZeroInitialized == zeroInit) {
1120 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_unpremul>;
1121 fastProc = &SkipLeading8888ZerosThen
1123 } else {
1126 }
1127 }
1128 break;
1129 default:
1130 return nullptr;
1131 }
1132 break;
1134 switch (dstInfo.colorType()) {
1136 proc = &swizzle_cmyk_to_rgba;
1137 fastProc = &fast_swizzle_cmyk_to_rgba;
1138 break;
1140 proc = &swizzle_cmyk_to_bgra;
1141 fastProc = &fast_swizzle_cmyk_to_bgra;
1142 break;
1144 proc = &swizzle_cmyk_to_565;
1145 break;
1146 default:
1147 return nullptr;
1148 }
1149 break;
1150 default:
1151 return nullptr;
1152 }
1153
1154 // Store bpp in bytes if it is an even multiple, otherwise use bits
1155 uint8_t bitsPerPixel = encodedInfo.bitsPerPixel();
1156 int srcBPP = SkIsAlign8(bitsPerPixel) ? bitsPerPixel / 8 : bitsPerPixel;
1157 int dstBPP = dstInfo.bytesPerPixel();
1158 return Make(dstInfo, fastProc, proc, ctable, srcBPP, dstBPP, options, frame);
1159}
const char * options
static constexpr bool SkIsAlign8(T x)
Definition: SkAlign.h:21
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
#define SkASSERT(cond)
Definition: SkAssert.h:116
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition: SkColorType.h:38
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
Definition: SkColorType.h:21
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition: SkColorType.h:35
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkColorType.h:22
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
@ kBGR_101010x_XR_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
Definition: SkColorType.h:31
static void swizzle_cmyk_to_bgra(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:700
static void swizzle_bgr_to_565(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:388
static void fast_swizzle_grayalpha_to_n32_premul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:363
static void swizzle_gray_to_565(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bytesPerPixel, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:311
static void fast_swizzle_cmyk_to_rgba(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:716
static void swizzle_rgb_to_565(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bytesPerPixel, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:448
static void fast_swizzle_cmyk_to_bgra(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:727
static void swizzle_rgba16_to_bgra_premul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:624
static void swizzle_rgb16_to_565(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:564
static void swizzle_rgb_to_rgba(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:402
static void swizzle_gray_to_n32(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:286
static void fast_swizzle_rgb_to_rgba(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:426
static void swizzle_rgba16_to_rgba_premul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:594
static void swizzle_rgba_to_bgra_unpremul(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:508
static void swizzle_rgb16_to_bgra(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:549
static void sample1(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:40
static void swizzle_bit_to_n32(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor *)
Definition: SkSwizzler.cpp:124
static void swizzle_rgba_to_rgba_premul(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:462
static void swizzle_grayalpha_to_n32_premul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:350
static void fast_swizzle_rgba_to_rgba_premul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:486
static void swizzle_rgba16_to_rgba_unpremul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:579
static void swizzle_rgba16_to_bgra_unpremul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:609
static void swizzle_grayalpha_to_n32_unpremul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:325
static void swizzle_rgb16_to_rgba(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:534
static void fast_swizzle_grayalpha_to_n32_unpremul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:337
static void fast_swizzle_gray_to_n32(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:298
static void fast_swizzle_rgba_to_bgra_premul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:497
static void swizzle_small_index_to_565(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:201
static void swizzle_cmyk_to_565(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:738
static void swizzle_bit_to_f16(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor *)
Definition: SkSwizzler.cpp:170
static void swizzle_cmyk_to_rgba(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:684
static void swizzle_small_index_to_n32(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:222
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:31
static void sample4(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:60
static void fast_swizzle_rgb_to_bgra(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:437
static void swizzle_index_to_n32(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:245
static void swizzle_grayalpha_to_a8(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor[])
Definition: SkSwizzler.cpp:376
static void swizzle_rgba_to_bgra_premul(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:474
static void swizzle_rgb_to_bgra(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:414
static void swizzle_index_to_n32_skipZ(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:258
static void swizzle_bit_to_grayscale(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor *)
Definition: SkSwizzler.cpp:99
static void swizzle_index_to_565(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bytesPerPixel, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:273
static void fast_swizzle_rgba_to_bgra_unpremul(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:521
static void swizzle_bit_to_565(void *SK_RESTRICT dstRow, const uint8_t *SK_RESTRICT src, int dstWidth, int bpp, int deltaSrc, int offset, const SkPMColor *)
Definition: SkSwizzler.cpp:147
ZeroInitialized
Definition: SkCodec.h:303
@ kYes_ZeroInitialized
Definition: SkCodec.h:308
static std::unique_ptr< SkSwizzler > Make(const SkEncodedInfo &encodedInfo, const SkPMColor *ctable, const SkImageInfo &dstInfo, const SkCodec::Options &, const SkIRect *frame=nullptr)
Definition: SkSwizzler.cpp:821
double frame
Definition: examples.cpp:31
Color color() const
uint8_t bitsPerPixel() const
Alpha alpha() const
uint8_t bitsPerComponent() const
int bytesPerPixel() const
Definition: SkImageInfo.h:492
SkAlphaType alphaType() const
Definition: SkImageInfo.h:375
SkColorType colorType() const
Definition: SkImageInfo.h:373

◆ MakeSimple()

std::unique_ptr< SkSwizzler > SkSwizzler::MakeSimple ( int  srcBPP,
const SkImageInfo dstInfo,
const SkCodec::Options options 
)
static

Create a simplified swizzler that does not need to do format conversion. The swizzler only needs to sample and/or subset.

Parameters
srcBPPBytes per pixel of the source.
dstInfoDescribes the destination.
optionsContains partial scanline information and whether the dst is zero- initialized.
Returns
A new SkSwizzler or nullptr on failure.

Definition at line 792 of file SkSwizzler.cpp.

793 {
794 RowProc proc = nullptr;
795 switch (srcBPP) {
796 case 1: // kGray_8_SkColorType
797 proc = &sample1;
798 break;
799 case 2: // kRGB_565_SkColorType
800 proc = &sample2;
801 break;
802 case 4: // kRGBA_8888_SkColorType
803 // kBGRA_8888_SkColorType
804 // kRGBA_1010102_SkColorType
805 proc = &sample4;
806 break;
807 case 6: // 16 bit PNG no alpha
808 proc = &sample6;
809 break;
810 case 8: // 16 bit PNG with alpha
811 proc = &sample8;
812 break;
813 default:
814 return nullptr;
815 }
816
817 return Make(dstInfo, &copy, proc, nullptr /*ctable*/, srcBPP,
818 dstInfo.bytesPerPixel(), options, nullptr /*frame*/);
819}
static void sample8(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:81
static void sample6(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:70
static void sample2(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:50
Definition: copy.py:1

◆ sampleX()

int SkSwizzler::sampleX ( ) const
inline

If fSampleX > 1, the swizzler is sampling every fSampleX'th pixel and discarding the rest.

This getter is currently used by SkBmpStandardCodec for Bmp-in-Ico decodes. Ideally, the subclasses of SkCodec would have no knowledge of sampling, but this allows us to apply a transparency mask to pixels after swizzling.

Definition at line 84 of file SkSwizzler.h.

84{ return fSampleX; }

◆ swizzle()

void SkSwizzler::swizzle ( void *  dst,
const uint8_t *SK_RESTRICT  src 
)

Swizzle a line. Generally this will be called height times, once for each row of source. By allowing the caller to pass in the dst pointer, we give the caller flexibility to use the swizzler even when the encoded data does not store the rows in order. This also improves usability for scaled and subset decodes.

Parameters
dstWhere we write the output.
srcThe next row of the source data.

Definition at line 1247 of file SkSwizzler.cpp.

1247 {
1248 SkASSERT(nullptr != dst && nullptr != src);
1249 fActualProc(SkTAddOffset<void>(dst, fDstOffsetBytes), src, fSwizzleWidth, fSrcBPP,
1250 fSampleX * fSrcBPP, fSrcOffsetUnits, fColorTable);
1251}
dst
Definition: cp.py:12

◆ swizzleOffsetBytes()

size_t SkSwizzler::swizzleOffsetBytes ( ) const
inline

Returns the byte offset at which we write to destination memory, taking scaling, subsetting, and partial frames into account.

Definition at line 96 of file SkSwizzler.h.

96{ return fDstOffsetBytes; }

◆ swizzleWidth()

int SkSwizzler::swizzleWidth ( ) const
inline

Returns the actual number of pixels written to destination memory, taking scaling, subsetting, and partial frames into account.

Definition at line 90 of file SkSwizzler.h.

90{ return fSwizzleWidth; }

The documentation for this class was generated from the following files: