use mode structs in GetBBox.c

This commit is contained in:
Yay295 2024-04-21 19:35:06 -05:00
parent d8f9bfbbbe
commit b7c3c3e2b9

View File

@ -89,10 +89,11 @@ ImagingGetBBox(Imaging im, int bbox[4], int alpha_only) {
INT32 mask = 0xffffffff; INT32 mask = 0xffffffff;
if (im->bands == 3) { if (im->bands == 3) {
((UINT8 *)&mask)[3] = 0; ((UINT8 *)&mask)[3] = 0;
} else if (alpha_only && } else if (alpha_only && (
(strcmp(im->mode, "RGBa") == 0 || strcmp(im->mode, "RGBA") == 0 || im->mode == IMAGING_MODE_RGBa || im->mode == IMAGING_MODE_RGBA ||
strcmp(im->mode, "La") == 0 || strcmp(im->mode, "LA") == 0 || im->mode == IMAGING_MODE_La || im->mode == IMAGING_MODE_LA ||
strcmp(im->mode, "PA") == 0)) { im->mode == IMAGING_MODE_PA
)) {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
mask = 0x000000ff; mask = 0x000000ff;
#else #else
@ -208,7 +209,7 @@ ImagingGetExtrema(Imaging im, void *extrema) {
memcpy(((char *)extrema) + sizeof(fmin), &fmax, sizeof(fmax)); memcpy(((char *)extrema) + sizeof(fmin), &fmax, sizeof(fmax));
break; break;
case IMAGING_TYPE_SPECIAL: case IMAGING_TYPE_SPECIAL:
if (strcmp(im->mode, "I;16") == 0) { if (im->mode == IMAGING_MODE_I_16) {
UINT16 v; UINT16 v;
UINT8 *pixel = *im->image8; UINT8 *pixel = *im->image8;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN