89 {
90 auto chooseProc8888 = [&]() {
94 }
96 };
97
98 J_COLOR_SPACE jpegColorType = JCS_EXT_RGBA;
99 int numComponents = 0;
102 fProc = chooseProc8888();
103 jpegColorType = JCS_EXT_RGBA;
104 numComponents = 4;
105 break;
107 fProc = chooseProc8888();
108 jpegColorType = JCS_EXT_BGRA;
109 numComponents = 4;
110 break;
113 jpegColorType = JCS_RGB;
114 numComponents = 3;
115 break;
118 return false;
119 }
120
122 jpegColorType = JCS_RGB;
123 numComponents = 3;
124 break;
128 jpegColorType = JCS_GRAYSCALE;
129 numComponents = 1;
130 break;
135 } else {
137 }
138 jpegColorType = JCS_EXT_RGBA;
139 numComponents = 4;
140 break;
141 default:
142 return false;
143 }
144
145 fCInfo.image_width = srcInfo.
width();
146 fCInfo.image_height = srcInfo.
height();
147 fCInfo.in_color_space = jpegColorType;
148 fCInfo.input_components = numComponents;
149 jpeg_set_defaults(&fCInfo);
150
151 if (numComponents != 1) {
154 SkASSERT(2 == fCInfo.comp_info[0].h_samp_factor);
155 SkASSERT(2 == fCInfo.comp_info[0].v_samp_factor);
156 SkASSERT(1 == fCInfo.comp_info[1].h_samp_factor);
157 SkASSERT(1 == fCInfo.comp_info[1].v_samp_factor);
158 SkASSERT(1 == fCInfo.comp_info[2].h_samp_factor);
159 SkASSERT(1 == fCInfo.comp_info[2].v_samp_factor);
160 break;
162 fCInfo.comp_info[0].h_samp_factor = 2;
163 fCInfo.comp_info[0].v_samp_factor = 1;
164 SkASSERT(1 == fCInfo.comp_info[1].h_samp_factor);
165 SkASSERT(1 == fCInfo.comp_info[1].v_samp_factor);
166 SkASSERT(1 == fCInfo.comp_info[2].h_samp_factor);
167 SkASSERT(1 == fCInfo.comp_info[2].v_samp_factor);
168 break;
170 fCInfo.comp_info[0].h_samp_factor = 1;
171 fCInfo.comp_info[0].v_samp_factor = 1;
172 SkASSERT(1 == fCInfo.comp_info[1].h_samp_factor);
173 SkASSERT(1 == fCInfo.comp_info[1].v_samp_factor);
174 SkASSERT(1 == fCInfo.comp_info[2].h_samp_factor);
175 SkASSERT(1 == fCInfo.comp_info[2].v_samp_factor);
176 break;
177 }
178 }
179
180 initializeCommon(
options, metadataSegments);
181 return true;
182}
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static void transform_scanline_to_premul_legacy(char *dst, const char *src, int width, int)
static void transform_scanline_F16_to_8888(char *dst, const char *src, int width, int)
void(* transform_scanline_proc)(char *dst, const char *src, int width, int bpp)
static void transform_scanline_565(char *dst, const char *src, int width, int)
static void transform_scanline_F16_to_premul_8888(char *dst, const char *src, int width, int)
static void transform_scanline_444(char *dst, const char *src, int width, int)
SkAlphaType alphaType() const
SkColorType colorType() const