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>2013-03-19 17:32:57 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-03-19 17:32:57 +0400
commit8c90d23462940c0577c87ccbd6792787b952e9d1 (patch)
tree3ee9243cec8e123f2b198fc9d3d774ed01632e9c /source/blender/imbuf/intern/rectop.c
parentd215f453df2c0eb45f59bc64e123ba8758768908 (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
Diffstat (limited to 'source/blender/imbuf/intern/rectop.c')
-rw-r--r--source/blender/imbuf/intern/rectop.c3
1 files changed, 2 insertions, 1 deletions
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)