Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Holcomb <bob_holcomb@hotmail.com>2007-07-11 07:00:39 +0400
committerRobert Holcomb <bob_holcomb@hotmail.com>2007-07-11 07:00:39 +0400
commitc313f6db86e06ca4927a0d0ce3abb753e2ecfc7d (patch)
treeab1c9ffc729535f138dfbb09517f97360f5ed7d9 /source/blender/nodes/intern/CMP_nodes/CMP_math.c
parent5e8ed4f0883d4169f839f35890c6f126fad9849f (diff)
After chatting with Broken about grs comments on the default behavior
of the nodes, I realized I had strayed from the path of enlightened blending by causing the math node to create an output the size of the larger of the two inputs. It has been corrected create the output the size of the first image, and in its abscense the second image. In the event of nether input containing image data the node does not function. I also added some early out checks at the beginning of the function to speed it up a tad in these cases and commented the code a bit more.
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes/CMP_math.c')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_math.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
index e7b548052ee..e909b5a3ae3 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
@@ -140,31 +140,25 @@ static void node_composit_exec_math(void *data, bNode *node, bNodeStack **in, bN
CompBuf *cbuf=in[0]->data;
CompBuf *cbuf2=in[1]->data;
CompBuf *stackbuf;
- int maxx=-1, maxy=-1;
- /* stack order out: bw */
- /* stack order in: col */
-
- if(out[0]->hasoutput==0)
- return;
- /* check max size */
+ /* check for inputs and outputs for early out*/
+ if(in[0]->hasinput==0 || in[1]->hasinput==0) return;
+ if(in[0]->data==NULL && in[1]->data==NULL) return;
+ if(out[0]->hasoutput==0) return;
+
+ /*create output based on first input */
if(cbuf) {
- maxx=cbuf->x;
- maxy=cbuf->y;
+ stackbuf=alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
}
- if(cbuf2) {
- if(cbuf2->x > maxx) maxx=cbuf2->x;
- if(cbuf2->y > maxy) maxy=cbuf2->y;
+ /* and if it doesn't exist use the second input since we
+ know that one of them must exist at this point*/
+ else {
+ stackbuf=alloc_compbuf(cbuf2->x, cbuf2->y, CB_VAL, 1);
}
/* operate in case there's valid size */
- if((maxx != -1) && (maxy !=-1)) {
- stackbuf=alloc_compbuf(maxx, maxy, CB_VAL, 1); /* allocs */
-
- composit2_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_math, CB_VAL, CB_VAL);
-
- out[0]->data= stackbuf;
- }
+ composit2_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_math, CB_VAL, CB_VAL);
+ out[0]->data= stackbuf;
}
bNodeType cmp_node_math= {