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

version» Context lines:

pike.git/src/modules/Image/blit.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: blit.c,v 1.56 2004/03/05 23:04:02 nilsson Exp $ + || $Id: blit.c,v 1.57 2004/05/19 00:10:10 nilsson Exp $   */      #include "global.h"      /*   **! module Image   **! class Image   */      #include <math.h>
pike.git/src/modules/Image/blit.c:208:    INT32 x2,INT32 y2)   {    rgb_group *new;    INT32 xp,yp,xs,ys,tmp;       if (dest->img) { free(dest->img); dest->img=NULL; }       if (x1>x2) tmp=x1, x1=x2, x2=tmp;    if (y1>y2) tmp=y1, y1=y2, y2=tmp;    +  new=xalloc( (x2-x1+1)*(y2-y1+1)*sizeof(rgb_group) + 1); +     if (x1==0 && y1==0 &&    img->xsize-1==x2 && img->ysize-1==y2)    {    *dest=*img; -  new=malloc( (x2-x1+1)*(y2-y1+1)*sizeof(rgb_group) + 1); -  if (!new) -  resource_error(NULL,0,0,"memory",0,"Out of memory.\n"); +     THREADS_ALLOW();    MEMCPY(new,img->img,(x2-x1+1)*(y2-y1+1)*sizeof(rgb_group));    THREADS_DISALLOW();    dest->img=new;    return;    }    -  new=malloc( (x2-x1+1)*(y2-y1+1)*sizeof(rgb_group) +1); -  if (!new) -  resource_error(NULL,0,0,"memory",0,"Out of memory.\n"); -  +     img_clear(new,THIS->rgb,(x2-x1+1)*(y2-y1+1));       dest->xsize=x2-x1+1;    dest->ysize=y2-y1+1;       xp=MAXIMUM(0,-x1);    yp=MAXIMUM(0,-y1);    xs=MAXIMUM(0,x1);    ys=MAXIMUM(0,y1);   
pike.git/src/modules/Image/blit.c:257:    dest->xsize,    img->xsize);       }    dest->img=new;   }      void img_clone(struct image *newimg,struct image *img)   {    if (newimg->img) free(newimg->img); -  newimg->img=malloc(sizeof(rgb_group)*img->xsize*img->ysize +1); -  if (!newimg->img) resource_error(NULL,0,0,"memory",0,"Out of memory.\n"); +  newimg->img=xalloc(sizeof(rgb_group)*img->xsize*img->ysize +1);    THREADS_ALLOW();    MEMCPY(newimg->img,img->img,sizeof(rgb_group)*img->xsize*img->ysize);    THREADS_DISALLOW();    newimg->xsize=img->xsize;    newimg->ysize=img->ysize;    newimg->rgb=img->rgb;   }      /*   **! method object paste(object image)