Skip to content

Commit

Permalink
Combined conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 25, 2024
1 parent 4241836 commit bbd5a87
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions src/_imagingcms.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,34 +213,37 @@ cms_transform_dealloc(CmsTransformObject *self) {

static cmsUInt32Number
findLCMStype(char *PILmode) {
if (strcmp(PILmode, "RGB") == 0) {
if (
strcmp(PILmode, "RGB") == 0 ||
strcmp(PILmode, "RGBA") == 0 ||
strcmp(PILmode, "RGBX") == 0
) {
return TYPE_RGBA_8;
} else if (strcmp(PILmode, "RGBA") == 0) {
return TYPE_RGBA_8;
} else if (strcmp(PILmode, "RGBX") == 0) {
return TYPE_RGBA_8;
} else if (strcmp(PILmode, "RGBA;16B") == 0) {
}
if (strcmp(PILmode, "RGBA;16B") == 0) {
return TYPE_RGBA_16;
} else if (strcmp(PILmode, "CMYK") == 0) {
}
if (strcmp(PILmode, "CMYK") == 0) {
return TYPE_CMYK_8;
} else if (strcmp(PILmode, "L") == 0) {
return TYPE_GRAY_8;
} else if (strcmp(PILmode, "L;16") == 0) {
}
if (strcmp(PILmode, "L;16") == 0) {
return TYPE_GRAY_16;
} else if (strcmp(PILmode, "L;16B") == 0) {
}
if (strcmp(PILmode, "L;16B") == 0) {
return TYPE_GRAY_16_SE;
} else if (strcmp(PILmode, "YCCA") == 0) {
return TYPE_YCbCr_8;
} else if (strcmp(PILmode, "YCC") == 0) {
}
if (
strcmp(PILmode, "YCCA") == 0 ||
strcmp(PILmode, "YCC") == 0
) {
return TYPE_YCbCr_8;
} else if (strcmp(PILmode, "LAB") == 0) {
}
if (strcmp(PILmode, "LAB") == 0) {
// LabX equivalent like ALab, but not reversed -- no #define in lcms2
return (COLORSPACE_SH(PT_LabV2) | CHANNELS_SH(3) | BYTES_SH(1) | EXTRA_SH(1));
}
else {
/* take a wild guess... */
return TYPE_GRAY_8;
}
/* presume "L" by default */
return TYPE_GRAY_8;
}

#define Cms_Min(a, b) ((a) < (b) ? (a) : (b))
Expand Down

0 comments on commit bbd5a87

Please sign in to comment.