do not rotate image between passes

This commit is contained in:
homm 2016-05-27 07:24:22 +03:00
parent c051f1d79d
commit 4ea0c83450

View File

@ -490,10 +490,11 @@ ImagingResampleVertical_32bpc(Imaging imIn, int ysize, struct filter *filterp)
Imaging Imaging
ImagingResample(Imaging imIn, int xsize, int ysize, int filter) ImagingResample(Imaging imIn, int xsize, int ysize, int filter)
{ {
Imaging imTemp1, imTemp2, imTemp3; Imaging imTemp;
Imaging imOut; Imaging imOut;
struct filter *filterp; struct filter *filterp;
Imaging (*ResampleHorizontal)(Imaging imIn, int xsize, struct filter *filterp); Imaging (*ResampleHorizontal)(Imaging imIn, int xsize, struct filter *filterp);
Imaging (*ResampleVertical)(Imaging imIn, int xsize, struct filter *filterp);
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();
@ -502,14 +503,17 @@ ImagingResample(Imaging imIn, int xsize, int ysize, int filter)
return (Imaging) ImagingError_ModeError(); return (Imaging) ImagingError_ModeError();
} else if (imIn->image8) { } else if (imIn->image8) {
ResampleHorizontal = ImagingResampleHorizontal_8bpc; ResampleHorizontal = ImagingResampleHorizontal_8bpc;
ResampleVertical = ImagingResampleVertical_8bpc;
} else { } else {
switch(imIn->type) { switch(imIn->type) {
case IMAGING_TYPE_UINT8: case IMAGING_TYPE_UINT8:
ResampleHorizontal = ImagingResampleHorizontal_8bpc; ResampleHorizontal = ImagingResampleHorizontal_8bpc;
ResampleVertical = ImagingResampleVertical_8bpc;
break; break;
case IMAGING_TYPE_INT32: case IMAGING_TYPE_INT32:
case IMAGING_TYPE_FLOAT32: case IMAGING_TYPE_FLOAT32:
ResampleHorizontal = ImagingResampleHorizontal_32bpc; ResampleHorizontal = ImagingResampleHorizontal_32bpc;
ResampleVertical = ImagingResampleVertical_32bpc;
break; break;
default: default:
return (Imaging) ImagingError_ModeError(); return (Imaging) ImagingError_ModeError();
@ -534,25 +538,13 @@ ImagingResample(Imaging imIn, int xsize, int ysize, int filter)
} }
/* two-pass resize, first pass */ /* two-pass resize, first pass */
imTemp1 = ResampleHorizontal(imIn, xsize, filterp); imTemp = ResampleHorizontal(imIn, xsize, filterp);
if ( ! imTemp1) if ( ! imTemp)
return NULL;
/* transpose image once */
imTemp2 = ImagingTransposeToNew(imTemp1);
ImagingDelete(imTemp1);
if ( ! imTemp2)
return NULL; return NULL;
/* second pass */ /* second pass */
imTemp3 = ResampleHorizontal(imTemp2, ysize, filterp); imOut = ResampleVertical(imTemp, ysize, filterp);
ImagingDelete(imTemp2); ImagingDelete(imTemp);
if ( ! imTemp3)
return NULL;
/* transpose result */
imOut = ImagingTransposeToNew(imTemp3);
ImagingDelete(imTemp3);
if ( ! imOut) if ( ! imOut)
return NULL; return NULL;