fix radius == 0

This commit is contained in:
homm 2014-10-12 14:14:56 +04:00
parent c42991120a
commit 51984f4aa8

View File

@ -64,11 +64,15 @@ gblur(Imaging im, Imaging imOut, float radius, float effectiveScale, int channel
maskData = malloc(window * sizeof(float));
for (pix = 0; pix < window; pix++) {
offset = pix - effectiveRadius;
/* http://en.wikipedia.org/wiki/Gaussian_blur
"1 / sqrt(2 * pi * dev)" is constant and will be eliminated by
normalization. */
maskData[pix] = pow(2.718281828459,
-offset * offset / (2 * radius * radius));
if (radius) {
/* http://en.wikipedia.org/wiki/Gaussian_blur
"1 / sqrt(2 * pi * dev)" is constant and will be eliminated
by normalization. */
maskData[pix] = pow(2.718281828459,
-offset * offset / (2 * radius * radius));
} else {
maskData[pix] = 1;
}
}
for (pix = 0; pix < window; pix++) {