[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12254] trunk/blender/source/blender/imbuf : == IMBuf fix ==

Peter Schlaile peter at schlaile.de
Fri Oct 12 08:37:21 CEST 2007


Revision: 12254
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12254
Author:   schlaile
Date:     2007-10-12 08:37:20 +0200 (Fri, 12 Oct 2007)

Log Message:
-----------
== IMBuf fix ==

Fixed Campbell's patch for IMB_flipx:
- header file declaration is corrected
- reordered loops to make things faster (less cache misses 
  and no tests for float-buffers on a _per pixel basis_!)

(Campbell: it'd be nice, if you could check with me before patching
the sequencer. Or at least pay attention to compiler warnings :) )

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

Modified: trunk/blender/source/blender/imbuf/IMB_imbuf.h
===================================================================
--- trunk/blender/source/blender/imbuf/IMB_imbuf.h	2007-10-12 02:53:21 UTC (rev 12253)
+++ trunk/blender/source/blender/imbuf/IMB_imbuf.h	2007-10-12 06:37:20 UTC (rev 12254)
@@ -418,15 +418,7 @@
 void IMB_convert_bgra_to_rgba(int size, unsigned int *rect);
 
 /**
- * Flip the image X/Y
  *
- * @attention Defined in imageprocess.c
- */
-void IMB_xflip(struct ImBuf *ibuf);
-void IMB_yflip(struct ImBuf *ibuf);
-
-/**
- *
  * @attention defined in scaling.c
  */
 struct ImBuf *IMB_scalefastfieldImBuf(struct ImBuf *ibuf,
@@ -532,6 +524,7 @@
  *
  * @attention Defined in rotate.c
  */
+void IMB_flipx(struct ImBuf *ibuf);
 void IMB_flipy(struct ImBuf * ibuf);
 
 /**

Modified: trunk/blender/source/blender/imbuf/intern/rotate.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/rotate.c	2007-10-12 02:53:21 UTC (rev 12253)
+++ trunk/blender/source/blender/imbuf/intern/rotate.c	2007-10-12 06:37:20 UTC (rev 12254)
@@ -94,17 +94,23 @@
 	float px_f[4];
 	
 	if (ibuf == NULL) return;
-	if (ibuf->rect == NULL) return;
 
 	x = ibuf->x;
 	y = ibuf->y;
-	for(yi=y-1;yi>=0;yi--) {
-		for(xr=x-1, xl=0; xr>=xl; xr--, xl++) {
-			px =					ibuf->rect[(x*yi)+xr];
-			ibuf->rect[(x*yi)+xr] =	ibuf->rect[(x*yi)+xl];
-			ibuf->rect[(x*yi)+xl] =	px;		
-			
-			if (ibuf->rect_float) {
+
+	if (ibuf->rect) {
+		for(yi=y-1;yi>=0;yi--) {
+			for(xr=x-1, xl=0; xr>=xl; xr--, xl++) {
+				px = ibuf->rect[(x*yi)+xr];
+				ibuf->rect[(x*yi)+xr] =	ibuf->rect[(x*yi)+xl];
+				ibuf->rect[(x*yi)+xl] =	px;		
+			}
+		}
+	}
+	
+	if (ibuf->rect_float) {
+		for(yi=y-1;yi>=0;yi--) {
+			for(xr=x-1, xl=0; xr>=xl; xr--, xl++) {
 				memcpy(&px_f, &ibuf->rect_float[((x*yi)+xr)*4], 4*sizeof(float));
 				memcpy(&ibuf->rect_float[((x*yi)+xr)*4], &ibuf->rect_float[((x*yi)+xl)*4], 4*sizeof(float));
 				memcpy(&ibuf->rect_float[((x*yi)+xl)*4], &px_f, 4*sizeof(float));





More information about the Bf-blender-cvs mailing list