this bug actually was in previous implementation too:

type switch default case was never achieved because special
images is in image8 pointers, not in image32
This commit is contained in:
homm 2014-11-19 03:15:04 +03:00
parent 24ed800fae
commit 6078e6e1a7

View File

@ -208,7 +208,7 @@ ImagingStretchHorizontal(Imaging imIn, int xsize, int filter)
ss += i2f(imIn->image8[yy][x]) * k[x - xmin]; ss += i2f(imIn->image8[yy][x]) * k[x - xmin];
imOut->image8[yy][xx] = clip8(ss); imOut->image8[yy][xx] = clip8(ss);
} }
} else } else {
switch(imIn->type) { switch(imIn->type) {
case IMAGING_TYPE_UINT8: case IMAGING_TYPE_UINT8:
/* n-bit grayscale */ /* n-bit grayscale */
@ -283,13 +283,8 @@ ImagingStretchHorizontal(Imaging imIn, int xsize, int filter)
IMAGING_PIXEL_F(imOut, xx, yy) = ss; IMAGING_PIXEL_F(imOut, xx, yy) = ss;
} }
break; break;
default:
ImagingSectionLeave(&cookie);
ImagingDelete(imOut);
free(kk);
free(xbounds);
return (Imaging) ImagingError_ModeError();
} }
}
} }
ImagingSectionLeave(&cookie); ImagingSectionLeave(&cookie);
free(kk); free(kk);
@ -307,6 +302,9 @@ ImagingStretch(Imaging imIn, int xsize, int ysize, int filter)
if (strcmp(imIn->mode, "P") == 0 || strcmp(imIn->mode, "1") == 0) if (strcmp(imIn->mode, "P") == 0 || strcmp(imIn->mode, "1") == 0)
return (Imaging) ImagingError_ModeError(); return (Imaging) ImagingError_ModeError();
if (imIn->type == IMAGING_TYPE_SPECIAL)
return (Imaging) ImagingError_ModeError();
/* two-pass resize, first pass */ /* two-pass resize, first pass */
imTemp1 = ImagingStretchHorizontal(imIn, xsize, filter); imTemp1 = ImagingStretchHorizontal(imIn, xsize, filter);
if ( ! imTemp1) if ( ! imTemp1)