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

version» Context lines:

pike.git/src/modules/Image/layers.c:451:    { \    (D)->C=COMBINE_ALPHA_V((S)->C,(L)->C,0,(LA)->C,V); \    } \    else \    { \    (D)->C=COMBINE_ALPHA_V((S)->C,(L)->C,(SA)->C,(LA)->C,V); \    } \    } while (0)       - static INLINE void smear_color(rgb_group *d,rgb_group s,int len) + static inline void smear_color(rgb_group *d,rgb_group s,int len)   {    while (len--)    *(d++)=s;   }      #define MAX3(X,Y,Z) MAXIMUM(MAXIMUM(X,Y),Z)   #define MIN3(X,Y,Z) MINIMUM(MINIMUM(X,Y),Z)      /* Pike_sp was renamed to not_sp by hubbe */ - static INLINE void rgb_to_hsv(rgb_group color, + static inline void rgb_to_hsv(rgb_group color,    double *hp,    double *not_sp,    double *vp)   {    double max,min,delta;    double r,g,b;       if (color.r==color.g && color.g==color.b)    {    *hp=*not_sp=0.0;
pike.git/src/modules/Image/layers.c:494:       *not_sp = (max - min)/max;       delta = max-min;       if(r==max) *hp = 6+(g-b)/delta;    else if(g==max) *hp = 2+(b-r)/delta;    else /*if(b==max)*/ *hp = 4+(r-g)/delta;   }    - static INLINE void hsv_to_rgb(double h,double s,double v,rgb_group *colorp) + static inline void hsv_to_rgb(double h,double s,double v,rgb_group *colorp)   {    if (s==0.0)    {    colorp->r=colorp->g=colorp->b=F2C(v);    return;    }      #define i floor(h)   #define f (h-i)   #define p F2C(v * (1 - s))
pike.git/src/modules/Image/layers.c:528:    default: Pike_fatal("unhandled case\n");    }   #undef V   #undef i   #undef f   #undef p   #undef q   #undef t   }    - static INLINE int hls_value(double n1, double n2, double hue) + static inline int hls_value(double n1, double n2, double hue)   {    double value;       if (hue > 255)    hue -= 255;    else if (hue < 0)    hue += 255;    if (hue < 42.5)    value = n1 + (n2 - n1) * (hue / 42.5);    else if (hue < 127.5)    value = n2;    else if (hue < 170)    value = n1 + (n2 - n1) * ((170 - hue) / 42.5);    else    value = n1;       return (int) (value * 255);   }       - static INLINE void hls_to_rgb(double h,double l,double s,rgb_group *rgb) + static inline void hls_to_rgb(double h,double l,double s,rgb_group *rgb)   {    double m1, m2;       if (s == 0)    {   /* achromatic case */    rgb->r = (COLORTYPE)l;    rgb->g = (COLORTYPE)l;    rgb->b = (COLORTYPE)l;    }
pike.git/src/modules/Image/layers.c:576:       m1 = (l / 127.5) - m2;      /* chromatic case */    rgb->r = hls_value (m1, m2, h + 85);    rgb->g = hls_value (m1, m2, h);    rgb->b = hls_value (m1, m2, h - 85);    }   }    - static INLINE void rgb_to_hls(rgb_group color, + static inline void rgb_to_hls(rgb_group color,    double *hue,    double *lightness,    double *saturation)   {    int r, g, b;    double h, l, s;    int min, max;    int delta;       r = color.r;
pike.git/src/modules/Image/layers.c:1298:   **! values and fill the whole layer with an   **! opaque color.   **!   **! All values can be modified after object creation.   **!   **! note:   **! image and alpha channel must be of the same size.   **!   */    - static INLINE void try_parameter(char *a,void (*f)(INT32)) + static inline void try_parameter(char *a,void (*f)(INT32))   {    stack_dup();    push_text(a);    f_index(2);       if (!IS_UNDEFINED(Pike_sp-1))    f(1);    pop_stack();   }    - static INLINE void try_parameter_pair(char *a,char *b,void (*f)(INT32)) + static inline void try_parameter_pair(char *a,char *b,void (*f)(INT32))   {    stack_dup(); /* map map */    stack_dup(); /* map map map */    push_text(a); /* map map map a */    f_index(2); /* map map map[a] */    stack_swap(); /* map map[a] map */    push_text(b); /* map map[a] map b */    f_index(2); /* map map[a] map[b] */       if (!IS_UNDEFINED(Pike_sp-2) ||
pike.git/src/modules/Image/layers.c:2458:    da->g=MINIMUM(sa->g+DOUBLE_TO_COLORTYPE(alpha*l->g),COLORMAX);    da->b=MINIMUM(sa->b+DOUBLE_TO_COLORTYPE(alpha*l->b),COLORMAX);    }    da++; sa++; la++; s++; d++;    }    }   }      /*** the add-layer function ***************************/    - static INLINE void img_lay_first_line(struct layer *l, + static inline void img_lay_first_line(struct layer *l,    int xoffs,int xsize,    int y, /* in _this_ layer */    rgb_group *d,rgb_group *da)   {    if (!l->tiled)    {    rgb_group *s,*sa;    int len;       if (y<0 ||
pike.git/src/modules/Image/layers.c:2556:    if (sa) memcpy(d,sa,l->xsize*sizeof(rgb_group));    da+=l->xsize;    d+=l->xsize;    xsize-=l->xsize;    }    if (s) memcpy(d,s,xsize*sizeof(rgb_group));    if (sa) memcpy(d,sa,xsize*sizeof(rgb_group));    }   }    - static INLINE void img_lay_stroke(struct layer *ly, + static inline void img_lay_stroke(struct layer *ly,    rgb_group *l,    rgb_group *la,    rgb_group *s,    rgb_group *sa,    rgb_group *d,    rgb_group *da,    int len)   {    if (len<0) Pike_error("internal error: stroke len < 0\n");    if (!ly->row_func) Pike_error("internal error: row_func=NULL\n");
pike.git/src/modules/Image/layers.c:2624:    sa+=SNUMPIXS; da+=SNUMPIXS;    if (la) la+=SNUMPIXS;    len-=SNUMPIXS;    }    if (len)    (ly->row_func)(s, ly->sfill, d, sa, la?la: ly->sfill_alpha,    da, len, ly->alpha_value);    }   }    - static INLINE void img_lay_line(struct layer *ly, + static inline void img_lay_line(struct layer *ly,    rgb_group *s,rgb_group *sa,    int xoffs,int xsize,    int y, /* y in ly layer */    rgb_group *d,rgb_group *da)   {   /* fprintf(stderr,"tiled:%d xoffs:%d xsize:%d y:%d\n", */   /* ly->tiled,xoffs,xsize,y); */       if (!ly->tiled)    {
pike.git/src/modules/Image/layers.c:2996:       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) + static inline struct layer *push_new_layer(void)   {    push_object(clone_object(image_layer_program,0));    return get_storage(Pike_sp[-1].u.object,image_layer_program);   }    - static INLINE struct layer *clone_this_layer(void) + static inline struct layer *clone_this_layer(void)   {    struct layer *l;    l=push_new_layer();    l->xsize=THIS->xsize;    l->ysize=THIS->ysize;    l->xoffs=THIS->xoffs;    l->yoffs=THIS->yoffs;    l->image=THIS->image;    l->alpha=THIS->alpha;    l->img=THIS->img;