pike.git / src / modules / Image / layers.c

version» Context lines:

pike.git/src/modules/Image/layers.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: layers.c,v 1.83 2004/02/03 17:12:12 anders Exp $ + || $Id: layers.c,v 1.84 2004/02/03 20:47:04 grubba Exp $   */      /*   **! module Image   **! class Layer   **! see also: layers   **!      **!   **!
pike.git/src/modules/Image/layers.c:194:   **! return 0;   **! }   **!   **! </execute>   */      #include "global.h"      #include <math.h> /* floor */    - RCSID("$Id: layers.c,v 1.83 2004/02/03 17:12:12 anders Exp $"); + RCSID("$Id: layers.c,v 1.84 2004/02/03 20:47:04 grubba Exp $");      #include "image_machine.h"      #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "array.h"
pike.git/src/modules/Image/layers.c:2900:   */      void image_lay(INT32 args)   {    int layers,i,j;    struct layer **l;    struct object *o;    struct layer *dest;    struct array *a;    INT_TYPE xoffset=0,yoffset=0,xsize=0,ysize=0; +  ONERROR err;       if (!args)    SIMPLE_TOO_FEW_ARGS_ERROR("Image.lay",1);       if (Pike_sp[-args].type!=T_ARRAY)    SIMPLE_BAD_ARG_ERROR("Image.lay",1,    "array(Image.Layer|mapping)");       if (args>1)    {
pike.git/src/modules/Image/layers.c:2929:       if (!layers) /* dummy return empty layer */    {    pop_n_elems(args);    push_object(clone_object(image_layer_program,0));    return;    }       l=(struct layer**)xalloc(sizeof(struct layer)*layers);    +  ONERROR(err, free, l); +     for (i=j=0; i<layers; i++)    {    if (a->item[i].type==T_OBJECT)    {    if (!(l[j]=(struct layer*)get_storage(a->item[i].u.object,    image_layer_program)))    SIMPLE_BAD_ARG_ERROR("Image.lay",1,    "array(Image.Layer|mapping)");    }    else if (a->item[i].type==T_MAPPING)
pike.git/src/modules/Image/layers.c:2955:    else    SIMPLE_BAD_ARG_ERROR("Image.lay",1,    "array(Image.Layer|mapping)");    if (l[j]->xsize && l[j]->ysize) {    j++;    }    }       if (!(layers = j)) /* dummy return empty layer */    { -  free(l); +  CALL_AND_UNSET_ONERROR(err);    pop_n_elems(args);    push_object(clone_object(image_layer_program,0));    return;    }       if (xsize==0) /* figure offset and size */    {    xoffset=l[0]->xoffs;    yoffset=l[0]->yoffs;    xsize=l[0]->xsize;
pike.git/src/modules/Image/layers.c:3007:    push_int(ysize);    push_object(o=clone_object(image_layer_program,2));       dest=(struct layer*)get_storage(o,image_layer_program);    dest->xoffs=xoffset;    dest->yoffs=yoffset;       /* ok, do it! */    img_lay(l,layers,dest);    -  free(l); +  CALL_AND_UNSET_ONERROR(err);       Pike_sp--;    pop_n_elems(args);    push_object(o);   }      /** image-object operations *************************/      static INLINE struct layer *push_new_layer(void)   {