Fix T41956, Soften brush does not work

Disallow blur radius zero (versioning error).

Also fix gaussian distibution for blurring

This is to be included in the final release.
This commit is contained in:
Antony Riakiotakis 2014-09-26 14:13:32 +02:00
parent 8f6a993769
commit a5159b5fba

@ -527,6 +527,9 @@ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj)
kernel->pixel_len = radius; kernel->pixel_len = radius;
} }
else { else {
if (br->blur_kernel_radius <= 0)
br->blur_kernel_radius = 1;
radius = br->blur_kernel_radius; radius = br->blur_kernel_radius;
side = kernel->side = radius * 2 + 1; side = kernel->side = radius * 2 + 1;
@ -543,11 +546,11 @@ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj)
case KERNEL_GAUSSIAN: case KERNEL_GAUSSIAN:
{ {
/* at standard deviation of 3.0 kernel is at about zero */ /* at 3.0 standard deviations distance, kernel is about zero */
float standard_dev = radius / 3.0f; float standard_dev = radius / 3.0f;
/* make the necessary adjustment to the value for use in the normal distribution formula */ /* make the necessary adjustment to the value for use in the normal distribution formula */
standard_dev = standard_dev * standard_dev * 2; standard_dev = -standard_dev * standard_dev * 2;
for (i = 0; i < side; i++) { for (i = 0; i < side; i++) {
for (j = 0; j < side; j++) { for (j = 0; j < side; j++) {