[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50971] trunk/blender/source/blender/imbuf : style cleanup: define float sizes for interpolation functions, add retirn 's on newlines (to better add breakpoints).

Campbell Barton ideasman42 at gmail.com
Mon Oct 1 08:18:45 CEST 2012


Revision: 50971
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50971
Author:   campbellbarton
Date:     2012-10-01 06:18:45 +0000 (Mon, 01 Oct 2012)
Log Message:
-----------
style cleanup: define float sizes for interpolation functions, add retirn's on newlines (to better add breakpoints).

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/IMB_imbuf.h
    trunk/blender/source/blender/imbuf/intern/imageprocess.c

Modified: trunk/blender/source/blender/imbuf/IMB_imbuf.h
===================================================================
--- trunk/blender/source/blender/imbuf/IMB_imbuf.h	2012-10-01 05:19:57 UTC (rev 50970)
+++ trunk/blender/source/blender/imbuf/IMB_imbuf.h	2012-10-01 06:18:45 UTC (rev 50971)
@@ -410,10 +410,10 @@
 void neareast_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
 void bilinear_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
 
-void bicubic_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);
-void neareast_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);
-void bilinear_interpolation_color(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);
-void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *col, float *col_float, float u, float v);
+void bicubic_interpolation_color(struct ImBuf *in, unsigned char col[4], float col_float[4], float u, float v);
+void neareast_interpolation_color(struct ImBuf *in, unsigned char col[4], float col_float[4], float u, float v);
+void bilinear_interpolation_color(struct ImBuf *in, unsigned char col[4], float col_float[4], float u, float v);
+void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char col[4], float col_float[4], float u, float v);
 
 /**
  *

Modified: trunk/blender/source/blender/imbuf/intern/imageprocess.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/imageprocess.c	2012-10-01 05:19:57 UTC (rev 50970)
+++ trunk/blender/source/blender/imbuf/intern/imageprocess.c	2012-10-01 06:18:45 UTC (rev 50971)
@@ -125,15 +125,16 @@
 }
 #endif
 
-void bicubic_interpolation_color(struct ImBuf *in, unsigned char *outI, float *outF, float u, float v)
+void bicubic_interpolation_color(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
 {
 	int i, j, n, m, x1, y1;
 	unsigned char *dataI;
 	float a, b, w, wx, wy[4], outR, outG, outB, outA, *dataF;
 
 	/* sample area entirely outside image? */
-	if (ceil(u) < 0 || floor(u) > in->x - 1 || ceil(v) < 0 || floor(v) > in->y - 1)
+	if (ceil(u) < 0 || floor(u) > in->x - 1 || ceil(v) < 0 || floor(v) > in->y - 1) {
 		return;
+	}
 
 	/* ImBuf in must have a valid rect or rect_float, assume this is already checked */
 
@@ -226,11 +227,12 @@
 
 void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
 {
-	
 	unsigned char *outI = NULL;
 	float *outF = NULL;
 	
-	if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
+	if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
+		return;
+	}
 	
 	pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
 	
@@ -239,7 +241,7 @@
 
 /* function assumes out to be zero'ed, only does RGBA */
 /* BILINEAR INTERPOLATION */
-void bilinear_interpolation_color(struct ImBuf *in, unsigned char *outI, float *outF, float u, float v)
+void bilinear_interpolation_color(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
 {
 	float *row1, *row2, *row3, *row4, a, b;
 	unsigned char *row1I, *row2I, *row3I, *row4I;
@@ -257,7 +259,9 @@
 	y2 = (int)ceil(v);
 
 	/* sample area entirely outside image? */
-	if (x2 < 0 || x1 > in->x - 1 || y2 < 0 || y1 > in->y - 1) return;
+	if (x2 < 0 || x1 > in->x - 1 || y2 < 0 || y1 > in->y - 1) {
+		return;
+	}
 
 	if (outF) {
 		/* sample including outside of edges of image */
@@ -315,7 +319,7 @@
 /* Note about wrapping, the u/v still needs to be within the image bounds,
  * just the interpolation is wrapped.
  * This the same as bilinear_interpolation_color except it wraps rather than using empty and emptyI */
-void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *outI, float *outF, float u, float v)
+void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
 {
 	float *row1, *row2, *row3, *row4, a, b;
 	unsigned char *row1I, *row2I, *row3I, *row4I;
@@ -331,7 +335,9 @@
 	y2 = (int)ceil(v);
 
 	/* sample area entirely outside image? */
-	if (x2 < 0 || x1 > in->x - 1 || y2 < 0 || y1 > in->y - 1) return;
+	if (x2 < 0 || x1 > in->x - 1 || y2 < 0 || y1 > in->y - 1) {
+		return;
+	}
 
 	/* wrap interpolation pixels - main difference from bilinear_interpolation_color  */
 	if (x1 < 0) x1 = in->x + x1;
@@ -378,11 +384,12 @@
 
 void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
 {
-	
 	unsigned char *outI = NULL;
 	float *outF = NULL;
 	
-	if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
+	if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
+		return;
+	}
 	
 	pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
 	
@@ -391,7 +398,7 @@
 
 /* function assumes out to be zero'ed, only does RGBA */
 /* NEAREST INTERPOLATION */
-void neareast_interpolation_color(struct ImBuf *in, unsigned char *outI, float *outF, float u, float v)
+void neareast_interpolation_color(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
 {
 	float *dataF;
 	unsigned char *dataI;
@@ -403,7 +410,9 @@
 	y1 = (int)(v);
 
 	/* sample area entirely outside image? */
-	if (x1 < 0 || x1 > in->x - 1 || y1 < 0 || y1 > in->y - 1) return;
+	if (x1 < 0 || x1 > in->x - 1 || y1 < 0 || y1 > in->y - 1) {
+		return;
+	}
 
 	/* sample including outside of edges of image */
 	if (x1 < 0 || y1 < 0) {
@@ -440,11 +449,12 @@
 
 void neareast_interpolation(ImBuf *in, ImBuf *out, float x, float y, int xout, int yout)
 {
-	
 	unsigned char *outI = NULL;
 	float *outF = NULL;
 
-	if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
+	if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
+		return;
+	}
 	
 	pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
 	




More information about the Bf-blender-cvs mailing list