[Bf-blender-cvs] [d52191616b] master: Fix for last fix of fix: (unsigned)char is limited to 255

Germano Cavalcante noreply at git.blender.org
Fri Mar 24 08:36:35 CET 2017


Commit: d52191616b5fecbdf4012909dae9a5446987ee54
Author: Germano Cavalcante
Date:   Fri Mar 24 04:35:17 2017 -0300
Branches: master
https://developer.blender.org/rBd52191616b5fecbdf4012909dae9a5446987ee54

Fix for last fix of fix: (unsigned)char is limited to 255

setting char as value outside its range will wrap

===================================================================

M	source/blender/blenkernel/intern/customdata.c

===================================================================

diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index debc7491fb..ea2c4f0542 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -831,18 +831,15 @@ static void layerInterp_mloopcol(
 		}
 	}
 
-	/* delay writing to the destination incase dest is in sources */
-	mc->r = iroundf(col.r);
-	mc->g = iroundf(col.g);
-	mc->b = iroundf(col.b);
-	mc->a = iroundf(col.a);
 
 	/* Subdivide smooth or fractal can cause problems without clamping
 	 * although weights should also not cause this situation */
-	CLAMP(mc->a, 0, 255);
-	CLAMP(mc->r, 0, 255);
-	CLAMP(mc->g, 0, 255);
-	CLAMP(mc->b, 0, 255);
+
+	/* also delay writing to the destination incase dest is in sources */
+	mc->r = CLAMPIS(iroundf(col.r), 0, 255);
+	mc->g = CLAMPIS(iroundf(col.g), 0, 255);
+	mc->b = CLAMPIS(iroundf(col.b), 0, 255);
+	mc->a = CLAMPIS(iroundf(col.a), 0, 255);
 }
 
 static int layerMaxNum_mloopcol(void)




More information about the Bf-blender-cvs mailing list