use mode structs in JpegEncode.c

This commit is contained in:
Yay295 2024-04-21 20:00:42 -05:00
parent 6f127e0f53
commit 68028fd513

View File

@ -114,7 +114,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) {
break; break;
case 24: case 24:
context->cinfo.input_components = 3; context->cinfo.input_components = 3;
if (strcmp(im->mode, "YCbCr") == 0) { if (im->mode == IMAGING_MODE_YCbCr) {
context->cinfo.in_color_space = JCS_YCbCr; context->cinfo.in_color_space = JCS_YCbCr;
} else { } else {
context->cinfo.in_color_space = JCS_RGB; context->cinfo.in_color_space = JCS_RGB;
@ -124,7 +124,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) {
context->cinfo.input_components = 4; context->cinfo.input_components = 4;
context->cinfo.in_color_space = JCS_CMYK; context->cinfo.in_color_space = JCS_CMYK;
#ifdef JCS_EXTENSIONS #ifdef JCS_EXTENSIONS
if (strcmp(context->rawmode, "RGBX") == 0) { if (context->rawmode == IMAGING_RAWMODE_RGBX) {
context->cinfo.in_color_space = JCS_EXT_RGBX; context->cinfo.in_color_space = JCS_EXT_RGBX;
} }
#endif #endif