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:
authorDiego Borghetti <bdiego@gmail.com>2008-02-28 23:26:00 +0300
committerDiego Borghetti <bdiego@gmail.com>2008-02-28 23:26:00 +0300
commit274543627a37712fb522612390116f43835abaae (patch)
tree38bf948881b40a7fe66decc4ba7910c1795cf7d3 /source/blender/nodes/intern/CMP_nodes/CMP_image.c
parent5f3e8c3fb64146ca2f6dfdb4a39f7862210cafae (diff)
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.
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes/CMP_image.c')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_image.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
index 6a82e8a9254..be5a1d7241b 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
@@ -201,31 +201,33 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, b
}
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 @@ static void node_composit_init_image(bNode* node)
{
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;