Skip to content

Commit bbd5a87

Browse files
committed
Combined conditions
1 parent 4241836 commit bbd5a87

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

src/_imagingcms.c

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -213,34 +213,37 @@ cms_transform_dealloc(CmsTransformObject *self) {
213213

214214
static cmsUInt32Number
215215
findLCMStype(char *PILmode) {
216-
if (strcmp(PILmode, "RGB") == 0) {
216+
if (
217+
strcmp(PILmode, "RGB") == 0 ||
218+
strcmp(PILmode, "RGBA") == 0 ||
219+
strcmp(PILmode, "RGBX") == 0
220+
) {
217221
return TYPE_RGBA_8;
218-
} else if (strcmp(PILmode, "RGBA") == 0) {
219-
return TYPE_RGBA_8;
220-
} else if (strcmp(PILmode, "RGBX") == 0) {
221-
return TYPE_RGBA_8;
222-
} else if (strcmp(PILmode, "RGBA;16B") == 0) {
222+
}
223+
if (strcmp(PILmode, "RGBA;16B") == 0) {
223224
return TYPE_RGBA_16;
224-
} else if (strcmp(PILmode, "CMYK") == 0) {
225+
}
226+
if (strcmp(PILmode, "CMYK") == 0) {
225227
return TYPE_CMYK_8;
226-
} else if (strcmp(PILmode, "L") == 0) {
227-
return TYPE_GRAY_8;
228-
} else if (strcmp(PILmode, "L;16") == 0) {
228+
}
229+
if (strcmp(PILmode, "L;16") == 0) {
229230
return TYPE_GRAY_16;
230-
} else if (strcmp(PILmode, "L;16B") == 0) {
231+
}
232+
if (strcmp(PILmode, "L;16B") == 0) {
231233
return TYPE_GRAY_16_SE;
232-
} else if (strcmp(PILmode, "YCCA") == 0) {
233-
return TYPE_YCbCr_8;
234-
} else if (strcmp(PILmode, "YCC") == 0) {
234+
}
235+
if (
236+
strcmp(PILmode, "YCCA") == 0 ||
237+
strcmp(PILmode, "YCC") == 0
238+
) {
235239
return TYPE_YCbCr_8;
236-
} else if (strcmp(PILmode, "LAB") == 0) {
240+
}
241+
if (strcmp(PILmode, "LAB") == 0) {
237242
// LabX equivalent like ALab, but not reversed -- no #define in lcms2
238243
return (COLORSPACE_SH(PT_LabV2) | CHANNELS_SH(3) | BYTES_SH(1) | EXTRA_SH(1));
239244
}
240-
else {
241-
/* take a wild guess... */
242-
return TYPE_GRAY_8;
243-
}
245+
/* presume "L" by default */
246+
return TYPE_GRAY_8;
244247
}
245248

246249
#define Cms_Min(a, b) ((a) < (b) ? (a) : (b))

0 commit comments

Comments
 (0)