[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53224] trunk/blender/source/blender/ editors/space_view3d/view3d_project.c: correct ed_view3d_project__internal( ) was unnecessarily casting (float -> short -> float).

Campbell Barton ideasman42 at gmail.com
Fri Dec 21 03:36:10 CET 2012


Revision: 53224
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53224
Author:   campbellbarton
Date:     2012-12-21 02:36:07 +0000 (Fri, 21 Dec 2012)
Log Message:
-----------
correct ed_view3d_project__internal() was unnecessarily casting (float -> short -> float).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_project.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_project.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_project.c	2012-12-21 02:28:59 UTC (rev 53223)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_project.c	2012-12-21 02:36:07 UTC (rev 53224)
@@ -116,7 +116,7 @@
                                                   float perspmat[4][4], const int is_local,  /* normally hidden */
                                                   const float co[3], float r_co[2], const eV3DProjTest flag)
 {
-	float fx, fy, vec4[4];
+	float vec4[4];
 
 	/* check for bad flags */
 	BLI_assert((flag & V3D_PROJ_TEST_ALL) == flag);
@@ -135,12 +135,12 @@
 	mul_m4_v4(perspmat, vec4);
 
 	if (vec4[3] > (float)BL_NEAR_CLIP) {
-		fx = ((float)ar->winx / 2.0f) * (1.0f + vec4[0] / vec4[3]);
+		const float fx = ((float)ar->winx / 2.0f) * (1.0f + vec4[0] / vec4[3]);
 		if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fx > 0 && fx < ar->winx)) {
-			fy = ((float)ar->winy / 2.0f) * (1.0f + vec4[1] / vec4[3]);
+			const float fy = ((float)ar->winy / 2.0f) * (1.0f + vec4[1] / vec4[3]);
 			if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fy > 0.0f && fy < (float)ar->winy)) {
-				r_co[0] = (short)floor(fx);
-				r_co[1] = (short)floor(fy);
+				r_co[0] = floorf(fx);
+				r_co[1] = floorf(fy);
 			}
 			else {
 				return V3D_PROJ_RET_CLIP_WIN;




More information about the Bf-blender-cvs mailing list