[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43259] trunk/blender/source/blender/nodes /composite: Fix #29827: 2.61 Scale and translate bugs

Sergey Sharybin sergey.vfx at gmail.com
Tue Jan 10 15:54:59 CET 2012


Revision: 43259
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43259
Author:   nazgul
Date:     2012-01-10 14:54:51 +0000 (Tue, 10 Jan 2012)
Log Message:
-----------
Fix #29827: 2.61 Scale and translate bugs

Scale lead to crash because of incorrect check for buffer size.
Translate bug was caused by ignoring buffer offset.

Modified Paths:
--------------
    trunk/blender/source/blender/nodes/composite/node_composite_util.c
    trunk/blender/source/blender/nodes/composite/node_composite_util.h
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_blur.c

Modified: trunk/blender/source/blender/nodes/composite/node_composite_util.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/node_composite_util.c	2012-01-10 14:24:18 UTC (rev 43258)
+++ trunk/blender/source/blender/nodes/composite/node_composite_util.c	2012-01-10 14:54:51 UTC (rev 43259)
@@ -402,7 +402,7 @@
 	return inbuf;
 }
 
-static float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad)
+float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad)
 {
 	if(cbuf) {
 		if(cbuf->rect_procedural) {

Modified: trunk/blender/source/blender/nodes/composite/node_composite_util.h
===================================================================
--- trunk/blender/source/blender/nodes/composite/node_composite_util.h	2012-01-10 14:24:18 UTC (rev 43258)
+++ trunk/blender/source/blender/nodes/composite/node_composite_util.h	2012-01-10 14:54:51 UTC (rev 43259)
@@ -133,6 +133,8 @@
 
 /* **************************************************** */
 
+float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad);
+
 /* Pixel-to-Pixel operation, 1 Image in, 1 out */
 void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, float *src_col,
 									  void (*func)(bNode *, float *, float *), 

Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_blur.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/nodes/node_composite_blur.c	2012-01-10 14:24:18 UTC (rev 43258)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_blur.c	2012-01-10 14:54:51 UTC (rev 43259)
@@ -455,14 +455,19 @@
 	int x, y, pix= img->type;
 	int i, j;
 	float *src, *dest, *refd, *blurd;
+	float defcol[4] = {1.0f, 1.0f, 1.0f, 1.0f};	/* default color for compbuf_get_pixel */
+	float proccol[4];	/* local color if compbuf is procedural */
+	int refradx, refrady;
 
-	if(ref->x!=img->x && ref->y!=img->y)
+	if(ref->x!=img->x || ref->y!=img->y)
 		return;
 	
 	ref_use= typecheck_compbuf(ref, CB_VAL);
 	
 	/* trick is; we blur the reference image... but only works with clipped values*/
 	blurbuf= alloc_compbuf(imgx, imgy, CB_VAL, 1);
+	blurbuf->xof= ref_use->xof;
+	blurbuf->yof= ref_use->yof;
 	blurd= blurbuf->rect;
 	refd= ref_use->rect;
 	for(x= imgx*imgy; x>0; x--, refd++, blurd++) {
@@ -492,15 +497,15 @@
 	for(i= 0; i<x; i++)
 		maintabs[i]= make_gausstab(nbd->filtertype, i+1);
 	
-	refd= blurbuf->rect;
 	dest= new->rect;
 	radxf= (float)radx;
 	radyf= (float)rady;
 	
 	for (y = 0; y < imgy; y++) {
-		for (x = 0; x < imgx ; x++, dest+=pix, refd++) {
-			int refradx= (int)(refd[0]*radxf);
-			int refrady= (int)(refd[0]*radyf);
+		for (x = 0; x < imgx ; x++, dest+=pix) {
+			refd= compbuf_get_pixel(blurbuf, defcol, proccol, x-blurbuf->xrad, y-blurbuf->yrad, blurbuf->xrad, blurbuf->yrad);
+			refradx= (int)(refd[0]*radxf);
+			refrady= (int)(refd[0]*radyf);
 			
 			if(refradx>radx) refradx= radx;
 			else if(refradx<1) refradx= 1;



More information about the Bf-blender-cvs mailing list