[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47053] trunk/blender/source/blender: code cleanup: use array size and const for vector args

Campbell Barton ideasman42 at gmail.com
Sat May 26 18:04:32 CEST 2012


Revision: 47053
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47053
Author:   campbellbarton
Date:     2012-05-26 16:04:31 +0000 (Sat, 26 May 2012)
Log Message:
-----------
code cleanup: use array size and const for vector args

Modified Paths:
--------------
    trunk/blender/source/blender/blenpluginapi/iff.h
    trunk/blender/source/blender/editors/mesh/editmesh_bvh.c
    trunk/blender/source/blender/editors/space_view3d/drawvolume.c
    trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c
    trunk/blender/source/blender/imbuf/IMB_imbuf.h
    trunk/blender/source/blender/imbuf/intern/rectop.c
    trunk/blender/source/blender/render/intern/include/pixelblending.h
    trunk/blender/source/blender/render/intern/include/shading.h
    trunk/blender/source/blender/render/intern/include/sss.h
    trunk/blender/source/blender/render/intern/include/texture.h
    trunk/blender/source/blender/render/intern/source/imagetexture.c
    trunk/blender/source/blender/render/intern/source/pixelblending.c
    trunk/blender/source/blender/render/intern/source/pixelshading.c
    trunk/blender/source/blender/render/intern/source/rayshade.c
    trunk/blender/source/blender/render/intern/source/render_texture.c
    trunk/blender/source/blender/render/intern/source/rendercore.c
    trunk/blender/source/blender/render/intern/source/shadeoutput.c
    trunk/blender/source/blender/render/intern/source/sss.c

Modified: trunk/blender/source/blender/blenpluginapi/iff.h
===================================================================
--- trunk/blender/source/blender/blenpluginapi/iff.h	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/blenpluginapi/iff.h	2012-05-26 16:04:31 UTC (rev 47053)
@@ -114,7 +114,7 @@
 	int destx, int desty, int srcx, int srcy, int width, int height);
 
 LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]);
-LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
+LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2);
 LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
 LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);
 

Modified: trunk/blender/source/blender/editors/mesh/editmesh_bvh.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_bvh.c	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/editors/mesh/editmesh_bvh.c	2012-05-26 16:04:31 UTC (rev 47053)
@@ -380,7 +380,7 @@
 	return f;
 }
 
-static void scale_point(float *c1, float *p, float s)
+static void scale_point(float c1[3], const float p[3], const float s)
 {
 	sub_v3_v3(c1, p);
 	mul_v3_fl(c1, s);

Modified: trunk/blender/source/blender/editors/space_view3d/drawvolume.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawvolume.c	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/editors/space_view3d/drawvolume.c	2012-05-26 16:04:31 UTC (rev 47053)
@@ -146,7 +146,7 @@
 	return numpoints;
 }
 
-static int convex(float *p0, float *up, float *a, float *b)
+static int convex(const float p0[3], const float up[3], const float a[3], const float b[3])
 {
 	// Vec3 va = a-p0, vb = b-p0;
 	float va[3], vb[3], tmp[3];

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c	2012-05-26 16:04:31 UTC (rev 47053)
@@ -3596,7 +3596,7 @@
 	int axis, ntri;
 } SmoothNode;
 
-static void p_barycentric_2d(float *v1, float *v2, float *v3, float *p, float *b)
+static void p_barycentric_2d(const float v1[2], const float v2[2], const float v3[2], float p[2], float b[2])
 {
 	float a[2], c[2], h[2], div;
 

Modified: trunk/blender/source/blender/imbuf/IMB_imbuf.h
===================================================================
--- trunk/blender/source/blender/imbuf/IMB_imbuf.h	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/imbuf/IMB_imbuf.h	2012-05-26 16:04:31 UTC (rev 47053)
@@ -480,7 +480,7 @@
  * \attention Defined in rectop.c
  */
 void IMB_rectfill(struct ImBuf *drect, const float col[4]);
-void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
+void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2);
 void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value);
 
 /* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */

Modified: trunk/blender/source/blender/imbuf/intern/rectop.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/rectop.c	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/imbuf/intern/rectop.c	2012-05-26 16:04:31 UTC (rev 47053)
@@ -566,7 +566,7 @@
 	}
 }
 
-void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2)
+void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2)
 {
 	if (!ibuf) return;
 	buf_rectfill_area((unsigned char *) ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y, col, x1, y1, x2, y2);

Modified: trunk/blender/source/blender/render/intern/include/pixelblending.h
===================================================================
--- trunk/blender/source/blender/render/intern/include/pixelblending.h	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/render/intern/include/pixelblending.h	2012-05-26 16:04:31 UTC (rev 47053)
@@ -36,30 +36,30 @@
  * add 1 pixel to into filtered three lines
  * (float vecs to float vec)
  */
-void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w);
+void add_filt_fmask(unsigned int mask, const float col[4], float *rowbuf, int row_w);
 void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row_w, int pixsize);
-void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w, int col_h, int x, int y);
+void add_filt_fmask_coord(float filt[][3], const float col[4], float *rowbuf, int row_w, int col_h, int x, int y);
 void mask_array(unsigned int mask, float filt[][3]);
 
 /**
  * Alpha-over blending for floats.
  */
-void addAlphaOverFloat(float *dest, float *source);  
+void addAlphaOverFloat(float dest[4], const float source[4]);
 
 /**
  * Alpha-under blending for floats.
  */
-void addAlphaUnderFloat(float *dest, float *source);  
+void addAlphaUnderFloat(float dest[4], const float source[4]);
 
 
 /**
  * Same for floats
  */
-void addalphaAddfacFloat(float *dest, float *source, char addfac);
+void addalphaAddfacFloat(float dest[4], const float source[4], char addfac);
 
 /**
  * dest = dest + source
  */
-void addalphaAddFloat(float *dest, float *source);
+void addalphaAddFloat(float dest[4], const float source[4]);
 
 #endif /* __PIXELBLENDING_H__ */

Modified: trunk/blender/source/blender/render/intern/include/shading.h
===================================================================
--- trunk/blender/source/blender/render/intern/include/shading.h	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/render/intern/include/shading.h	2012-05-26 16:04:31 UTC (rev 47053)
@@ -96,7 +96,7 @@
 float lamp_get_visibility(struct LampRen *lar, const float co[3], float lv[3], float *dist);
 void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real);
 
-float	fresnel_fac(float *view, float *vn, float fresnel, float fac);
+float	fresnel_fac(const float view[3], const float vn[3], float fresnel, float fac);
 
 /* rayshade.c */
 extern void shade_ray(struct Isect *is, struct ShadeInput *shi, struct ShadeResult *shr);

Modified: trunk/blender/source/blender/render/intern/include/sss.h
===================================================================
--- trunk/blender/source/blender/render/intern/include/sss.h	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/render/intern/include/sss.h	2012-05-26 16:04:31 UTC (rev 47053)
@@ -42,13 +42,13 @@
 typedef struct ScatterTree ScatterTree;
 
 ScatterSettings *scatter_settings_new(float refl, float radius, float ior,
-	float reflfac, float frontweight, float backweight);
+                                      float reflfac, float frontweight, float backweight);
 void scatter_settings_free(ScatterSettings *ss);
 
 ScatterTree *scatter_tree_new(ScatterSettings *ss[3], float scale, float error,
-	float (*co)[3], float (*color)[3], float *area, int totpoint);
+                              float (*co)[3], float (*color)[3], float *area, int totpoint);
 void scatter_tree_build(ScatterTree *tree);
-void scatter_tree_sample(ScatterTree *tree, float *co, float *color);
+void scatter_tree_sample(ScatterTree *tree, const float co[3], float color[3]);
 void scatter_tree_free(ScatterTree *tree);
 
 /* Internal renderer API */
@@ -61,7 +61,7 @@
 void sss_add_points(Render *re, float (*co)[3], float (*color)[3], float *area, int totpoint);
 void free_sss(struct Render *re);
 
-int sample_sss(struct Render *re, struct Material *mat, float *co, float *col);
+int sample_sss(struct Render *re, struct Material *mat, const float co[3], float color[3]);
 int sss_pass_done(struct Render *re, struct Material *mat);
 
 #endif /*__SSS_H__*/

Modified: trunk/blender/source/blender/render/intern/include/texture.h
===================================================================
--- trunk/blender/source/blender/render/intern/include/texture.h	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/render/intern/include/texture.h	2012-05-26 16:04:31 UTC (rev 47053)
@@ -67,7 +67,7 @@
 void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float hor[3], float zen[3], float *blend, int skyflag, short thread);
 void do_material_tex(struct ShadeInput *shi, struct Render *re);
 void do_lamp_tex(LampRen *la, const float lavec[3], struct ShadeInput *shi, float col_r[3], int effect);
-void do_volume_tex(struct ShadeInput *shi, const float xyz[3], int mapto_flag, float col[3], float *val, struct Render *re);
+void do_volume_tex(struct ShadeInput *shi, const float xyz[3], int mapto_flag, float col_r[3], float *val, struct Render *re);
 
 void init_render_textures(Render *re);
 void end_render_textures(Render *re);

Modified: trunk/blender/source/blender/render/intern/source/imagetexture.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/imagetexture.c	2012-05-26 15:48:55 UTC (rev 47052)
+++ trunk/blender/source/blender/render/intern/source/imagetexture.c	2012-05-26 16:04:31 UTC (rev 47053)
@@ -76,7 +76,7 @@
 
 
 /* x and y have to be checked for image size */
-static void ibuf_get_color(float *col, struct ImBuf *ibuf, int x, int y)
+static void ibuf_get_color(float col[4], struct ImBuf *ibuf, int x, int y)
 {
 	int ofs = y * ibuf->x + x;
 	
@@ -637,7 +637,7 @@
 
 // similar to ibuf_get_color() but clips/wraps coords according to repeat/extend flags
 // returns true if out of range in clipmode
-static int ibuf_get_color_clip(float *col, ImBuf *ibuf, int x, int y, int extflag)
+static int ibuf_get_color_clip(float col[4], ImBuf *ibuf, int x, int y, int extflag)
 {
 	int clip = 0;
 	switch (extflag) {
@@ -695,7 +695,7 @@
 }
 
 // as above + bilerp
-static int ibuf_get_color_clip_bilerp(float *col, ImBuf *ibuf, float u, float v, int intpol, int extflag)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list