From 19a86495897ec3c8bf89423a84123a5b8bbcd8a4 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 6 Aug 2017 13:32:46 +0300 Subject: [PATCH] create dirty images for some operations --- _imaging.c | 14 +++++++------- libImaging/AlphaComposite.c | 2 +- libImaging/Bands.c | 2 +- libImaging/Blend.c | 2 +- libImaging/BoxBlur.c | 2 +- libImaging/Fill.c | 4 ++-- libImaging/Matrix.c | 4 ++-- libImaging/Negative.c | 2 +- libImaging/Offset.c | 2 +- libImaging/Resample.c | 8 ++++---- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/_imaging.c b/_imaging.c index 7b3380b40..a2db5c998 100644 --- a/_imaging.c +++ b/_imaging.c @@ -599,7 +599,7 @@ _fill(PyObject* self, PyObject* args) if (!PyArg_ParseTuple(args, "s|(ii)O", &mode, &xsize, &ysize, &color)) return NULL; - im = ImagingNew(mode, xsize, ysize); + im = ImagingNewDirty(mode, xsize, ysize); if (!im) return NULL; @@ -874,7 +874,7 @@ _gaussian_blur(ImagingObject* self, PyObject* args) return NULL; imIn = self->image; - imOut = ImagingNew(imIn->mode, imIn->xsize, imIn->ysize); + imOut = ImagingNewDirty(imIn->mode, imIn->xsize, imIn->ysize); if (!imOut) return NULL; @@ -1539,7 +1539,7 @@ _resize(ImagingObject* self, PyObject* args) a[0] = (double) imIn->xsize / xsize; a[4] = (double) imIn->ysize / ysize; - imOut = ImagingNew(imIn->mode, xsize, ysize); + imOut = ImagingNewDirty(imIn->mode, xsize, ysize); imOut = ImagingTransform( imOut, imIn, IMAGING_TRANSFORM_AFFINE, @@ -1665,12 +1665,12 @@ _transpose(ImagingObject* self, PyObject* args) case 0: /* flip left right */ case 1: /* flip top bottom */ case 3: /* rotate 180 */ - imOut = ImagingNew(imIn->mode, imIn->xsize, imIn->ysize); + imOut = ImagingNewDirty(imIn->mode, imIn->xsize, imIn->ysize); break; case 2: /* rotate 90 */ case 4: /* rotate 270 */ case 5: /* transpose */ - imOut = ImagingNew(imIn->mode, imIn->ysize, imIn->xsize); + imOut = ImagingNewDirty(imIn->mode, imIn->ysize, imIn->xsize); break; default: PyErr_SetString(PyExc_ValueError, "No such transpose operation"); @@ -1715,7 +1715,7 @@ _unsharp_mask(ImagingObject* self, PyObject* args) return NULL; imIn = self->image; - imOut = ImagingNew(imIn->mode, imIn->xsize, imIn->ysize); + imOut = ImagingNewDirty(imIn->mode, imIn->xsize, imIn->ysize); if (!imOut) return NULL; @@ -1738,7 +1738,7 @@ _box_blur(ImagingObject* self, PyObject* args) return NULL; imIn = self->image; - imOut = ImagingNew(imIn->mode, imIn->xsize, imIn->ysize); + imOut = ImagingNewDirty(imIn->mode, imIn->xsize, imIn->ysize); if (!imOut) return NULL; diff --git a/libImaging/AlphaComposite.c b/libImaging/AlphaComposite.c index 538fd88e3..7e99c59ce 100644 --- a/libImaging/AlphaComposite.c +++ b/libImaging/AlphaComposite.c @@ -42,7 +42,7 @@ ImagingAlphaComposite(Imaging imDst, Imaging imSrc) imDst->ysize != imSrc->ysize) return ImagingError_Mismatch(); - imOut = ImagingNew(imDst->mode, imDst->xsize, imDst->ysize); + imOut = ImagingNewDirty(imDst->mode, imDst->xsize, imDst->ysize); if (!imOut) return NULL; diff --git a/libImaging/Bands.c b/libImaging/Bands.c index cc8d634dd..04976c2b6 100644 --- a/libImaging/Bands.c +++ b/libImaging/Bands.c @@ -43,7 +43,7 @@ ImagingGetBand(Imaging imIn, int band) if (imIn->bands == 2 && band == 1) band = 3; - imOut = ImagingNew("L", imIn->xsize, imIn->ysize); + imOut = ImagingNewDirty("L", imIn->xsize, imIn->ysize); if (!imOut) return NULL; diff --git a/libImaging/Blend.c b/libImaging/Blend.c index 885a1bb82..919856714 100644 --- a/libImaging/Blend.c +++ b/libImaging/Blend.c @@ -40,7 +40,7 @@ ImagingBlend(Imaging imIn1, Imaging imIn2, float alpha) else if (alpha == 1.0) return ImagingCopy(imIn2); - imOut = ImagingNew(imIn1->mode, imIn1->xsize, imIn1->ysize); + imOut = ImagingNewDirty(imIn1->mode, imIn1->xsize, imIn1->ysize); if (!imOut) return NULL; diff --git a/libImaging/BoxBlur.c b/libImaging/BoxBlur.c index 854a53386..1a415ed16 100644 --- a/libImaging/BoxBlur.c +++ b/libImaging/BoxBlur.c @@ -265,7 +265,7 @@ ImagingBoxBlur(Imaging imOut, Imaging imIn, float radius, int n) strcmp(imIn->mode, "La") == 0)) return ImagingError_ModeError(); - imTransposed = ImagingNew(imIn->mode, imIn->ysize, imIn->xsize); + imTransposed = ImagingNewDirty(imIn->mode, imIn->ysize, imIn->xsize); if (!imTransposed) return NULL; diff --git a/libImaging/Fill.c b/libImaging/Fill.c index 15107b6d6..d641a5996 100644 --- a/libImaging/Fill.c +++ b/libImaging/Fill.c @@ -68,7 +68,7 @@ ImagingFillLinearGradient(const char *mode) return (Imaging) ImagingError_ModeError(); } - im = ImagingNew(mode, 256, 256); + im = ImagingNewDirty(mode, 256, 256); if (!im) { return NULL; } @@ -91,7 +91,7 @@ ImagingFillRadialGradient(const char *mode) return (Imaging) ImagingError_ModeError(); } - im = ImagingNew(mode, 256, 256); + im = ImagingNewDirty(mode, 256, 256); if (!im) { return NULL; } diff --git a/libImaging/Matrix.c b/libImaging/Matrix.c index 5d2f031cf..5cc7795a4 100644 --- a/libImaging/Matrix.c +++ b/libImaging/Matrix.c @@ -32,7 +32,7 @@ ImagingConvertMatrix(Imaging im, const char *mode, float m[]) if (strcmp(mode, "L") == 0 && im->bands == 3) { - imOut = ImagingNew("L", im->xsize, im->ysize); + imOut = ImagingNewDirty("L", im->xsize, im->ysize); if (!imOut) return NULL; @@ -49,7 +49,7 @@ ImagingConvertMatrix(Imaging im, const char *mode, float m[]) } else if (strlen(mode) == 3 && im->bands == 3) { - imOut = ImagingNew(mode, im->xsize, im->ysize); + imOut = ImagingNewDirty(mode, im->xsize, im->ysize); if (!imOut) return NULL; diff --git a/libImaging/Negative.c b/libImaging/Negative.c index eaa790768..4dedcb245 100644 --- a/libImaging/Negative.c +++ b/libImaging/Negative.c @@ -29,7 +29,7 @@ ImagingNegative(Imaging im) if (!im) return (Imaging) ImagingError_ModeError(); - imOut = ImagingNew(im->mode, im->xsize, im->ysize); + imOut = ImagingNewDirty(im->mode, im->xsize, im->ysize); if (!imOut) return NULL; diff --git a/libImaging/Offset.c b/libImaging/Offset.c index f6d6e510e..7d69f38a7 100644 --- a/libImaging/Offset.c +++ b/libImaging/Offset.c @@ -27,7 +27,7 @@ ImagingOffset(Imaging im, int xoffset, int yoffset) if (!im) return (Imaging) ImagingError_ModeError(); - imOut = ImagingNew(im->mode, im->xsize, im->ysize); + imOut = ImagingNewDirty(im->mode, im->xsize, im->ysize); if (!imOut) return NULL; diff --git a/libImaging/Resample.c b/libImaging/Resample.c index 0f6a9e9dd..ac010c219 100644 --- a/libImaging/Resample.c +++ b/libImaging/Resample.c @@ -249,7 +249,7 @@ ImagingResampleHorizontal_8bpc(Imaging imIn, int xsize, struct filter *filterp) return (Imaging) ImagingError_MemoryError(); } - imOut = ImagingNew(imIn->mode, xsize, imIn->ysize); + imOut = ImagingNewDirty(imIn->mode, xsize, imIn->ysize); if ( ! imOut) { free(kk); free(xbounds); @@ -354,7 +354,7 @@ ImagingResampleVertical_8bpc(Imaging imIn, int ysize, struct filter *filterp) return (Imaging) ImagingError_MemoryError(); } - imOut = ImagingNew(imIn->mode, imIn->xsize, ysize); + imOut = ImagingNewDirty(imIn->mode, imIn->xsize, ysize); if ( ! imOut) { free(kk); free(xbounds); @@ -451,7 +451,7 @@ ImagingResampleHorizontal_32bpc(Imaging imIn, int xsize, struct filter *filterp) return (Imaging) ImagingError_MemoryError(); } - imOut = ImagingNew(imIn->mode, xsize, imIn->ysize); + imOut = ImagingNewDirty(imIn->mode, xsize, imIn->ysize); if ( ! imOut) { free(kk); free(xbounds); @@ -511,7 +511,7 @@ ImagingResampleVertical_32bpc(Imaging imIn, int ysize, struct filter *filterp) return (Imaging) ImagingError_MemoryError(); } - imOut = ImagingNew(imIn->mode, imIn->xsize, ysize); + imOut = ImagingNewDirty(imIn->mode, imIn->xsize, ysize); if ( ! imOut) { free(kk); free(xbounds);