mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Small optimisation: move distance==0 comparison to outer loop, to check once per call instead of once per pixel
This commit is contained in:
parent
c83ffc6aea
commit
68da661db9
|
@ -131,11 +131,15 @@ ImagingEffectSpread(Imaging imIn, int distance)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SPREAD(type, image)\
|
#define SPREAD(type, image)\
|
||||||
for (y = 0; y < imOut->ysize; y++) {\
|
if (distance == 0) {\
|
||||||
for (x = 0; x < imOut->xsize; x++) {\
|
for (y = 0; y < imOut->ysize; y++) {\
|
||||||
if (distance == 0) {\
|
for (x = 0; x < imOut->xsize; x++) {\
|
||||||
imOut->image[y][x] = imIn->image[y][x];\
|
imOut->image[y][x] = imIn->image[y][x];\
|
||||||
} else {\
|
}\
|
||||||
|
}\
|
||||||
|
} else {\
|
||||||
|
for (y = 0; y < imOut->ysize; y++) {\
|
||||||
|
for (x = 0; x < imOut->xsize; x++) {\
|
||||||
int xx = x + (rand() % distance) - distance/2;\
|
int xx = x + (rand() % distance) - distance/2;\
|
||||||
int yy = y + (rand() % distance) - distance/2;\
|
int yy = y + (rand() % distance) - distance/2;\
|
||||||
if (xx >= 0 && xx < imIn->xsize && yy >= 0 && yy < imIn->ysize) {\
|
if (xx >= 0 && xx < imIn->xsize && yy >= 0 && yy < imIn->ysize) {\
|
||||||
|
|
Loading…
Reference in New Issue
Block a user