Merge pull request #10 from hugovk/radarhere-effect_spread

Small optimisation: move distance==0 comparison to outer loop
This commit is contained in:
Andrew Murray 2020-09-09 18:36:01 +10:00 committed by GitHub
commit 272f519a40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,11 +131,15 @@ ImagingEffectSpread(Imaging imIn, int distance)
}
#define SPREAD(type, image)\
for (y = 0; y < imOut->ysize; y++) {\
for (x = 0; x < imOut->xsize; x++) {\
if (distance == 0) {\
if (distance == 0) {\
for (y = 0; y < imOut->ysize; y++) {\
for (x = 0; x < imOut->xsize; 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 yy = y + (rand() % distance) - distance/2;\
if (xx >= 0 && xx < imIn->xsize && yy >= 0 && yy < imIn->ysize) {\