[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13907] trunk/blender/source/blender: Fix segfault with bad setting in the Image node.
Diego Borghetti
bdiego at gmail.com
Thu Feb 28 21:26:00 CET 2008
Revision: 13907
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13907
Author: bdiego
Date: 2008-02-28 21:26:00 +0100 (Thu, 28 Feb 2008)
Log Message:
-----------
Fix segfault with bad setting in the Image node.
The limit in the UI tooltips to set the amount of
images used in animation allow the zero value,
that cause a segfault.
This commit fix the UI, add a init value of 1 to
the node and also check in case that
node_composit_get_image return NULL.
Modified Paths:
--------------
trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_image.c
trunk/blender/source/blender/src/drawnode.c
Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_image.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_image.c 2008-02-28 18:57:14 UTC (rev 13906)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_image.c 2008-02-28 20:26:00 UTC (rev 13907)
@@ -201,31 +201,33 @@
}
else {
stackbuf= node_composit_get_image(rd, ima, iuser);
+
+ if (stackbuf) {
+ /*respect image premul option*/
+ if (stackbuf->type==CB_RGBA && ima->flag & IMA_DO_PREMUL) {
+ int i;
+ float *pixel;
- /*respect image premul option*/
- if (stackbuf->type==CB_RGBA && ima->flag & IMA_DO_PREMUL) {
- int i;
- float *pixel;
-
- /*first duplicate stackbuf->rect, since it's just a pointer
- to the source imbuf, and we don't want to change that.*/
- stackbuf->rect = MEM_dupallocN(stackbuf->rect);
+ /*first duplicate stackbuf->rect, since it's just a pointer
+ to the source imbuf, and we don't want to change that.*/
+ stackbuf->rect = MEM_dupallocN(stackbuf->rect);
- /*premul the image*/
+ /*premul the image*/
- pixel = stackbuf->rect;
- for (i=0; i<stackbuf->x*stackbuf->y; i++, pixel += 4) {
- pixel[0] *= pixel[3];
- pixel[1] *= pixel[3];
- pixel[2] *= pixel[3];
+ pixel = stackbuf->rect;
+ for (i=0; i<stackbuf->x*stackbuf->y; i++, pixel += 4) {
+ pixel[0] *= pixel[3];
+ pixel[1] *= pixel[3];
+ pixel[2] *= pixel[3];
+ }
}
- }
- /* put image on stack */
- out[0]->data= stackbuf;
+ /* put image on stack */
+ out[0]->data= stackbuf;
- if(out[2]->hasoutput)
- out[2]->data= node_composit_get_zimage(node, rd);
+ if(out[2]->hasoutput)
+ out[2]->data= node_composit_get_zimage(node, rd);
+ }
}
/* alpha and preview for both types */
@@ -242,6 +244,7 @@
{
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
node->storage= iuser;
+ iuser->frames= 1;
iuser->sfra= 1;
iuser->fie_ima= 2;
iuser->ok= 1;
Modified: trunk/blender/source/blender/src/drawnode.c
===================================================================
--- trunk/blender/source/blender/src/drawnode.c 2008-02-28 18:57:14 UTC (rev 13906)
+++ trunk/blender/source/blender/src/drawnode.c 2008-02-28 20:26:00 UTC (rev 13907)
@@ -1004,7 +1004,7 @@
dy-= 19;
uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "Frs:",
xmin, dy, width, 19,
- &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Amount of images used in animation");
+ &iuser->frames, 1.0, MAXFRAMEF, 0, 0, "Amount of images used in animation");
uiDefButI(block, NUM, B_NODE_EXEC+node->nr, "SFra:",
xmin+width, dy, width, 19,
&iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Start frame of animation");
More information about the Bf-blender-cvs
mailing list