diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-10 18:54:51 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-10 18:54:51 +0400 |
commit | 278179e0c07ac1bc615f77a6a91a51422efe4e4f (patch) | |
tree | 56e8c2dc6a305c32890120d14d72adbdb72ce34d /source/blender/nodes/composite | |
parent | 545dc90a7f660709abdde90078b84f4ff5479f3c (diff) |
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.
Diffstat (limited to 'source/blender/nodes/composite')
-rw-r--r-- | source/blender/nodes/composite/node_composite_util.c | 2 | ||||
-rw-r--r-- | source/blender/nodes/composite/node_composite_util.h | 2 | ||||
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_blur.c | 15 |
3 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index c99cae7ed7b..45f490729e8 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -402,7 +402,7 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type) 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) { diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h index bb606f4202e..02487933849 100644 --- a/source/blender/nodes/composite/node_composite_util.h +++ b/source/blender/nodes/composite/node_composite_util.h @@ -133,6 +133,8 @@ void typecheck_compbuf_color(float *out, float *in, int outtype, int intype); /* **************************************************** */ +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 *), diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index 76827f719f5..fad80723ca3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -455,14 +455,19 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf 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 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf 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; |