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

version» Context lines:

pike.git/src/modules/Image/togif.c:1:   /*      togif      Pontus Hagland, law@infovav.se    - $Id: togif.c,v 1.15 1997/05/29 19:38:18 mirar Exp $ + $Id: togif.c,v 1.16 1997/09/01 14:18:17 per Exp $      */      /*   **! module Image   **! note - **! $Id: togif.c,v 1.15 1997/05/29 19:38:18 mirar Exp $<br> + **! $Id: togif.c,v 1.16 1997/09/01 14:18:17 per Exp $<br>   **! class image   */      #include "global.h"      #include <math.h>   #include <ctype.h>      #include "stralloc.h"   #include "global.h"
pike.git/src/modules/Image/togif.c:220:    bpp=(src[10]&7)+1;       THREADS_ALLOW();    if (src[10]&128)    {    global_palette=(rgb_group*)(src+13);    src+=3*(1<<bpp);    len-=3*(1<<bpp);    rgb=dest->img;    i=dest->xsize*dest->ysize; - /* -  while (i--) -  *rgb=global_palette[src[11]]; * paint with background color */ -  +     }    else    global_palette=NULL;    MEMSET(dest->img,0,sizeof(rgb_group)*dest->xsize*dest->ysize);    src+=13; len-=13;       do    {    switch (*src)    {
pike.git/src/modules/Image/togif.c:516:       sprintf(buf,"%c%c%c%c%c%c%c%c",33,0xf9,4,1,0,0,i,0);       push_string(make_shared_binary_string(buf,8));   }      static struct colortable *img_gif_add(INT32 args,int fs,int lm)   {    INT32 x=0,y=0,i;    struct lzw lzw; +  int xs, ys;    rgb_group *rgb;    struct colortable *ct=NULL;    dynamic_buffer buf;    int colors,bpp;    int closest=0;      CHRONO("gif add init");       buf.s.str=NULL;    initialize_buf(&buf);
pike.git/src/modules/Image/togif.c:607:    low_my_putchar(0,&buf);    }    }       low_my_putchar( bpp, &buf );       i=THIS->xsize*THIS->ysize;    rgb=THIS->img;      CHRONO("begin pack"); +  xs = THIS->xsize; +  ys = THIS->ysize;       THREADS_ALLOW();    lzw_init(&lzw,bpp);    if (!fs)    while (i--) lzw_add(&lzw,colortable_rgb(ct,*(rgb++)));    else    {    rgbl_group *errb;    rgb_group corgb;    int w,*cres,j; -  errb=(rgbl_group*)xalloc(sizeof(rgbl_group)*THIS->xsize); -  cres=(int*)xalloc(sizeof(int)*THIS->xsize); -  for (i=0; i<THIS->xsize; i++) +  errb=(rgbl_group*)xalloc(sizeof(rgbl_group)*xs); +  cres=(int*)xalloc(sizeof(int)*xs); +  for (i=0; i<xs; i++)    errb[i].r=(rand()%(FS_SCALE*2+1))-FS_SCALE,    errb[i].g=(rand()%(FS_SCALE*2+1))-FS_SCALE,    errb[i].b=(rand()%(FS_SCALE*2+1))-FS_SCALE;       w=0; -  i=THIS->ysize; -  while (i--) +  while (ys--)    { -  image_floyd_steinberg(rgb,THIS->xsize,errb,w=!w,cres,ct,closest); -  for (j=0; j<THIS->xsize; j++) +  image_floyd_steinberg(rgb,xs,errb,w=!w,cres,ct,closest); +  for (j=0; j<xs; j++)    lzw_add(&lzw,cres[j]); -  rgb+=THIS->xsize; +  rgb+=xs;    }       free(errb);    free(cres);    }       lzw_write_last(&lzw);      CHRONO("end pack");