Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-08-27 16:44:36 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-08-27 16:44:36 +0400
commitfe7de92c47b79aed701d5c0042a7f22bdcea545a (patch)
treebc06c080e47a1597ac90bd482e1a7c166d558f5b /source/blender/editors/sculpt_paint/paint_image.c
parent2a15ecdb5d3a8b56851e587bbdf0c562bfd2252e (diff)
Revert "Fix part of T41406"
This reverts commit 7c7cb01aa5641414d9f0c39ab81df0f57205f362. The smoothing weights will cause shifting in the image if not calculated as they were in the branch. Solution for better performance will be to force-clip kernel to a square of size two for projective painting.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 5a4fda033d8..e9e1615b27d 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -515,10 +515,10 @@ BlurKernel *paint_new_blur_kernel(Brush *br)
{
int i, j;
BlurKernel *kernel = MEM_mallocN(sizeof(BlurKernel), "blur kernel");
- float pixel_len = br->blur_kernel_radius / 2.0f;
+ int pixel_len = br->blur_kernel_radius;
BlurKernelType type = br->blur_mode;
- kernel->side = br->blur_kernel_radius + 1;
+ kernel->side = pixel_len * 2 + 1;
kernel->side_squared = kernel->side * kernel->side;
kernel->wdata = MEM_mallocN(sizeof(float) * kernel->side_squared, "blur kernel data");
kernel->pixel_len = pixel_len;
@@ -531,19 +531,26 @@ BlurKernel *paint_new_blur_kernel(Brush *br)
case KERNEL_GAUSSIAN:
{
- float standard_dev = pixel_len / 3.0f; /* at standard deviation of 3.0 kernel is at about zero */
+ float standard_dev = pixel_len / 3.0; /* at standard deviation of 3.0 kernel is at about zero */
+ int i_term = pixel_len + 1;
/* make the necessary adjustment to the value for use in the normal distribution formula */
standard_dev = standard_dev * standard_dev * 2;
- for (i = 0; i < kernel->side; i++) {
- for (j = 0; j < kernel->side; j++) {
+ kernel->wdata[pixel_len + pixel_len * kernel->side] = 1.0;
+ /* fill in all four quadrants at once */
+ for (i = 0; i < i_term; i++) {
+ for (j = 0; j < pixel_len; j++) {
float idist = pixel_len - i;
float jdist = pixel_len - j;
float value = exp((idist * idist + jdist * jdist) / standard_dev);
- kernel->wdata[i + j * kernel->side] = value;
+ kernel->wdata[i + j * kernel->side] =
+ kernel->wdata[(kernel->side - j - 1) + i * kernel->side] =
+ kernel->wdata[(kernel->side - i - 1) + (kernel->side - j - 1) * kernel->side] =
+ kernel->wdata[j + (kernel->side - i - 1) * kernel->side] =
+ value;
}
}