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-12 21:45:57 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-08-12 21:45:57 +0400
commit7c7cb01aa5641414d9f0c39ab81df0f57205f362 (patch)
tree29731ff090dee60f90ea23ed19e6bcadea58ae6b /source/blender/editors/sculpt_paint/paint_image_2d.c
parent561f375109c063663919e815b3c05c802e9428f8 (diff)
Fix part of T41406
Attempt to make soften brush faster by allowing non-symmetric kernels. Projective painting supports those naturally but for 2D painting there's a small hack to avoid shifting of the texture. Not totally correct but it works for now.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image_2d.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 1cba8a2cf23..14429eb8aca 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -877,8 +877,10 @@ static void paint_2d_lift_soften(ImagePaintState *s, ImBuf *ibuf, ImBuf *ibufb,
for (yk = 0; yk < kernel->side; yk++) {
for (xk = 0; xk < kernel->side; xk++) {
- count += paint_2d_ibuf_add_if(ibuf, xi + xk - kernel->pixel_len,
- yi + yk - kernel->pixel_len, outrgb, is_torus,
+ float x_offs = xk - kernel->pixel_len;
+ float y_offs = yk - kernel->pixel_len;
+ count += paint_2d_ibuf_add_if(ibuf, xi + signf(x_offs) * fabs(x_offs + 0.51f),
+ yi + signf(y_offs) * fabs(y_offs + 0.51f), outrgb, is_torus,
kernel->wdata[xk + yk * kernel->side]);
}
}