[Bf-blender-cvs] [5520b8d] master: cleanup: double promotion

Campbell Barton noreply at git.blender.org
Fri Feb 27 04:53:15 CET 2015


Commit: 5520b8df4b578595afcfc074a1acb96359bce49c
Author: Campbell Barton
Date:   Fri Feb 27 14:26:34 2015 +1100
Branches: master
https://developer.blender.org/rB5520b8df4b578595afcfc074a1acb96359bce49c

cleanup: double promotion

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

M	source/blender/editors/curve/editcurve.c
M	source/blender/editors/include/ED_curve.h
M	source/blender/editors/sculpt_paint/paint_image_proj.c
M	source/blender/gpu/intern/gpu_compositing.c
M	source/blender/makesrna/intern/rna_animation.c

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

diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 4aeeaa8..a4c071d 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -234,6 +234,7 @@ static int isNurbsel_count(Curve *cu, Nurb *nu)
 
 /* ******************* PRINTS ********************* */
 
+#if 0
 void printknots(Object *obedit)
 {
 	ListBase *editnurb = object_editcurve_get(obedit);
@@ -253,6 +254,7 @@ void printknots(Object *obedit)
 		}
 	}
 }
+#endif
 
 /* ********************* Shape keys *************** */
 
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index 58e64f3..27e9cad 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -90,7 +90,9 @@ bool ED_curve_active_center(struct Curve *cu, float center[3]);
 
 bool    mouse_font(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
 
+#if 0
 /* debug only */
 void printknots(struct Object *obedit);
+#endif
 
 #endif /* __ED_CURVE_H__ */
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index b6de446..098f0d0 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -1320,7 +1320,7 @@ static float project_paint_uvpixel_mask(
 
 		ca_mask = w[0] * ca1 + w[1] * ca2 + w[2] * ca3;
 		ca_mask = curvemapping_evaluateF(ps->cavity_curve, 0, ca_mask);
-		CLAMP(ca_mask, 0.0, 1.0);
+		CLAMP(ca_mask, 0.0f, 1.0f);
 		mask *= ca_mask;
 	}
 
@@ -2060,8 +2060,10 @@ static void project_bucket_clip_face(
 	/* detect pathological case where face the three vertices are almost colinear in screen space.
 	 * mostly those will be culled but when flood filling or with smooth shading it's a possibility */
 	if (dist_squared_to_line_v2(v1coSS, v2coSS, v3coSS) < 0.5f ||
-		dist_squared_to_line_v2(v2coSS, v3coSS, v1coSS) < 0.5f)
+	    dist_squared_to_line_v2(v2coSS, v3coSS, v1coSS) < 0.5f)
+	{
 		colinear = true;
+	}
 	
 	/* get the UV space bounding box */
 	inside_bucket_flag |= BLI_rctf_isect_pt_v(bucket_bounds, v1coSS);
@@ -3271,7 +3273,7 @@ static void proj_paint_state_cavity_init(ProjPaintState *ps)
 				mul_v3_fl(edges[a], 1.0f / counter[a]);
 				normal_short_to_float_v3(no, mv->no);
 				/* augment the diffe*/
-				cavities[a] = saacos(10.0f * dot_v3v3(no, edges[a])) * M_1_PI;
+				cavities[a] = saacos(10.0f * dot_v3v3(no, edges[a])) * (float)M_1_PI;
 			}
 			else
 				cavities[a] = 0.0;
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index 08291d0..89b8ba2 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -148,22 +148,23 @@ static GPUTexture * create_concentric_sample_texture(int side)
 }
 #endif
 
-static GPUTexture * create_spiral_sample_texture(int numsaples)
+static GPUTexture *create_spiral_sample_texture(int numsaples)
 {
 	GPUTexture *tex;
-	float *texels = (float *)MEM_mallocN(sizeof(float) * 2 * numsaples, "concentric_tex");
+	float (*texels)[2] = MEM_mallocN(sizeof(float[2]) * numsaples, "concentric_tex");
+	const float numsaples_inv = 1.0f / numsaples;
 	int i;
-	/* random number to ensure we don't get conciding samples every circle */
+	/* arbitrary number to ensure we don't get conciding samples every circle */
 	const float spirals = 7.357;
 
 	for (i = 0; i < numsaples; i++) {
-		float r = (i + 0.5f) / (float) numsaples;
-		float phi = 2.0f * M_PI * r * spirals;
-		texels[i * 2] = r * cos(phi);
-		texels[i * 2 + 1] = r * sin(phi);
+		float r = (i + 0.5f) * numsaples_inv;
+		float phi = r * spirals * (float)(2.0 * M_PI);
+		texels[i][0] = r * cosf(phi);
+		texels[i][1] = r * sinf(phi);
 	}
 
-	tex = GPU_texture_create_1D_procedural(numsaples, texels, NULL);
+	tex = GPU_texture_create_1D_procedural(numsaples, (float *)texels, NULL);
 	MEM_freeN(texels);
 	return tex;
 }
@@ -273,8 +274,8 @@ static GPUTexture * create_jitter_texture(void)
 	int i;
 
 	for (i = 0; i < 64 * 64; i++) {
-		jitter[i][0] = 2.0f * BLI_frand() - 1.0;
-		jitter[i][1] = 2.0f * BLI_frand() - 1.0;
+		jitter[i][0] = 2.0f * BLI_frand() - 1.0f;
+		jitter[i][1] = 2.0f * BLI_frand() - 1.0f;
 		normalize_v2(jitter[i]);
 	}
 
@@ -714,7 +715,7 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 		float scale_camera = 0.001f / scale;
 		float aperture = 2.0f * scale_camera * fx_dof->focal_length / fx_dof->fstop;
 
-		dof_params[0] = aperture * fabs(scale_camera * fx_dof->focal_length / (fx_dof->focus_distance - scale_camera * fx_dof->focal_length));
+		dof_params[0] = aperture * fabsf(scale_camera * fx_dof->focal_length / (fx_dof->focus_distance - scale_camera * fx_dof->focal_length));
 		dof_params[1] = fx_dof->focus_distance;
 		dof_params[2] = fx->gbuffer_dim[0] / (scale_camera * fx_dof->sensor);
 		dof_params[3] = 0.0f;
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index e4696d8..df1e6dd 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -574,8 +574,8 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg)
 	prop = RNA_def_property(srna, "use_insertkey_override_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "keyingoverride", INSERTKEY_XYZ2RGB);
 	RNA_def_property_ui_text(prop, "Override F-Curve Colors - XYZ to RGB",
-	                        "Override default setting to set color for newly added transformation F-Curves (Location, Rotation, Scale) "
-							"to be based on the transform axis");
+	                        "Override default setting to set color for newly added transformation F-Curves "
+	                        "(Location, Rotation, Scale) to be based on the transform axis");
 	if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);




More information about the Bf-blender-cvs mailing list