[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44282] trunk/blender/source/blender/ blenlib/intern/math_color_inline.c: Fix broken predivide option for reading in images, patch by Troy Sobotka.

Brecht Van Lommel brechtvanlommel at pandora.be
Mon Feb 20 21:55:39 CET 2012


Revision: 44282
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44282
Author:   blendix
Date:     2012-02-20 20:55:30 +0000 (Mon, 20 Feb 2012)
Log Message:
-----------
Fix broken predivide option for reading in images, patch by Troy Sobotka.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/math_color_inline.c

Modified: trunk/blender/source/blender/blenlib/intern/math_color_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_color_inline.c	2012-02-20 15:58:01 UTC (rev 44281)
+++ trunk/blender/source/blender/blenlib/intern/math_color_inline.c	2012-02-20 20:55:30 UTC (rev 44282)
@@ -179,7 +179,7 @@
 
 MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4])
 {
-	float alpha, inv_alpha;
+	float fsrgb[4];
 	int i;
 
 	if(srgb[3] == 255 || srgb[3] == 0) {
@@ -187,13 +187,10 @@
 		return;
 	}
 
-	alpha = srgb[3] * (1.0f/255.0f);
-	inv_alpha = 1.0f/alpha;
+	for (i=0; i<4; i++)
+		fsrgb[i] = srgb[i] * (1.0f/255.0f);
 
-	for(i=0; i<3; ++i)
-		linear[i] = linearrgb_to_srgb(srgb[i] * inv_alpha) * alpha;
-
-	linear[3] = alpha;
+	srgb_to_linearrgb_predivide_v4(linear, fsrgb);
 }
 
 #endif /* BLI_MATH_COLOR_INLINE_H */




More information about the Bf-blender-cvs mailing list