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

version» Context lines:

pike.git/src/modules/Image/blit.c:1: - /* $Id: blit.c,v 1.21 1997/11/23 07:22:44 per Exp $ */ + /* $Id: blit.c,v 1.22 1997/11/23 21:58:53 per Exp $ */   #include "global.h"      /*   **! module Image   **! note - **! $Id: blit.c,v 1.21 1997/11/23 07:22:44 per Exp $ + **! $Id: blit.c,v 1.22 1997/11/23 21:58:53 per Exp $   **! class image   */      #include <math.h>   #include <ctype.h>      #include "stralloc.h"   #include "global.h"   #include "pike_macros.h"   #include "object.h"
pike.git/src/modules/Image/blit.c:97:    img->alpha=sp[3-args+args_start].u.integer;    else    img->alpha=0;   }      /*** end internals ***/         void img_clear(rgb_group *dest,rgb_group rgb,INT32 size)   { -  int ok = 0; +  if(!size) return;    THREADS_ALLOW(); -  if(sizeof(rgb.r) == 1) -  { -  if(rgb.r == rgb.b && rgb.b == rgb.g) -  (ok = 1),MEMSET(dest, rgb.r, size*sizeof(rgb_group)); -  } else { +     if(!rgb.r && !rgb.b && !rgb.g) -  (ok = 1),MEMSET(dest, 0, size*sizeof(rgb_group)); -  } -  if(!ok) +  MEMSET(dest, 0, size*sizeof(rgb_group)); +  else if((sizeof(rgb.r) == 1) && (rgb.r == rgb.b && rgb.b == rgb.g)) +  MEMSET(dest, rgb.r, size*sizeof(rgb_group)); +  else if(size)    {    int increment = 1;    rgb_group *from = dest;    *(dest++)=rgb; -  for (; size > increment; size-=increment,dest+=increment,increment*=2) +  size--; +  for (; size > increment; size-=increment,dest+=increment) +  {    MEMCPY(dest,from,increment*sizeof(rgb_group)); -  MEMCPY(dest,from,size*sizeof(rgb_group)); +  if(increment < 1024) increment *= 2;    } -  +  if(size>0) MEMCPY(dest,from,size*sizeof(rgb_group)); +  }    THREADS_DISALLOW();   }      void img_box_nocheck(INT32 x1,INT32 y1,INT32 x2,INT32 y2)   {    INT32 x,mod;    rgb_group *foo,*end,rgb;    struct image *this;       this=THIS;