diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2013-03-19 17:32:57 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2013-03-19 17:32:57 +0400 |
commit | 8c90d23462940c0577c87ccbd6792787b952e9d1 (patch) | |
tree | 3ee9243cec8e123f2b198fc9d3d774ed01632e9c | |
parent | d215f453df2c0eb45f59bc64e123ba8758768908 (diff) |
Fix: Clamp alpha to 1.0 or adding alpha in paint creates "isolines" due
to integer overflow. One of the beautiful bugs that is sad to see fixed.
Also remove unused timer variable
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/rectop.c | 3 |
2 files changed, 2 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 92a55151b66..4f935ebdd8c 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -398,7 +398,6 @@ typedef struct PaintOperation { double starttime; ViewContext vc; - wmTimer *timer; } PaintOperation; void paint_brush_init_tex(Brush *brush) @@ -531,9 +530,6 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke) paint_redraw(C, pop, 1); - if (pop->timer) - WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), pop->timer); - settings->imapaint.flag &= ~IMAGEPAINT_DRAWING; if (pop->mode == PAINT_MODE_3D_PROJECT) { diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index 446833ccf3b..958070c1479 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -138,7 +138,7 @@ static void blend_color_add_alpha(char cp[4], const char cp1[4], const char cp2[ cp[0] = cp1[0]; cp[1] = cp1[1]; cp[2] = cp1[2]; - cp[3] = (temp < 0) ? 0 : temp; + cp[3] = (temp > 255)? 255 : ((temp < 0) ? 0 : temp); } @@ -269,6 +269,7 @@ static void blend_color_add_alpha_float(float cp[4], const float cp1[4], const f cp[3] = (cp1[3] + fac * cp2[3]); if (cp[3] < 0.0f) cp[3] = 0.0f; + if (cp[3] > 1.0f) cp[3] = 1.0f; } void IMB_blend_color_float(float *dst, float *src1, float *src2, float fac, IMB_BlendMode mode) |