mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
create dirty images for some operations
This commit is contained in:
parent
7a1e70d997
commit
19a8649589
14
_imaging.c
14
_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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user