[Bf-blender-cvs] [1940cf5] master: After discussion on irc change new function to only allocate from a buffer only. scaling can be done separately

Antony Riakiotakis noreply at git.blender.org
Mon Feb 23 16:30:53 CET 2015


Commit: 1940cf5a0b24d5d4e4b21b495fd84433d68483da
Author: Antony Riakiotakis
Date:   Mon Feb 23 16:30:37 2015 +0100
Branches: master
https://developer.blender.org/rB1940cf5a0b24d5d4e4b21b495fd84433d68483da

After discussion on irc change new function to only allocate from a
buffer only. scaling can be done separately

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

M	source/blender/imbuf/IMB_imbuf.h
M	source/blender/imbuf/intern/scaling.c

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

diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 27cb934..299918a 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -353,12 +353,11 @@ struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1);
 struct ImBuf *IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy);
 
 /**
- * Scales an array of pixels and returns the result to a new ImBuf
+ * Create a copy of a pixel buffer and wrap it to a new ImBuf
  * \attention Defined in scaling.c
  */
-struct ImBuf *IMB_scaleArray(const unsigned int *rect, const float *frect,
-                             unsigned int oldw, unsigned int oldh,
-                             unsigned int neww, unsigned int newh);
+struct ImBuf *IMB_allocFromBuffer(const unsigned int *rect, const float *frect,
+                                  unsigned int w, unsigned int h);
 
 /**
  *
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index f2731e5..f750421 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -1545,29 +1545,24 @@ struct ImBuf *IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int
 	return(ibuf);
 }
 
-struct ImBuf *IMB_scaleArray(const unsigned int *rect, const float *frect,
-                             unsigned int oldw, unsigned int oldh,
-                             unsigned int neww, unsigned int newh)
+struct ImBuf *IMB_allocFromBuffer(const unsigned int *rect, const float *frect,
+                                  unsigned int w, unsigned int h)
 {
 	ImBuf *ibuf = NULL;
-	ImBuf *tmpibuf = IMB_allocImBuf(oldw, oldh, 32, 0);
+	ImBuf *tmpibuf = IMB_allocImBuf(w, h, 32, 0);
 
 	if (frect) {
 		/* allocate new image buffer and set the temporary buffer float buffer correctly */
-		ibuf = IMB_allocImBuf(oldw, oldh, 32, IB_rectfloat);
+		ibuf = IMB_allocImBuf(w, h, 32, IB_rectfloat);
 		tmpibuf->rect_float = (float *)frect;
 
-		IMB_rectcpy(ibuf, tmpibuf, 0, 0, 0, 0, oldw, oldh);
-
-		IMB_scaleImBuf(ibuf, neww, newh);
+		IMB_rectcpy(ibuf, tmpibuf, 0, 0, 0, 0, w, h);
 	}
 	else if (rect) {
-		ibuf = IMB_allocImBuf(oldw, oldh, 32, IB_rect);
+		ibuf = IMB_allocImBuf(w, h, 32, IB_rect);
 		tmpibuf->rect = (unsigned int *)rect;
 
-		IMB_rectcpy(ibuf, tmpibuf, 0, 0, 0, 0, oldw, oldh);
-
-		IMB_scaleImBuf(ibuf, neww, newh);
+		IMB_rectcpy(ibuf, tmpibuf, 0, 0, 0, 0, w, h);
 	}
 
 	/* important, else we clean the source image imbufs! */




More information about the Bf-blender-cvs mailing list