Branch: Tag:

1999-06-30

1999-06-30 11:02:56 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

bugfix when using a tiled image as bottom layer,
better size measurements (not counting tiled stuff) in Image.lay()

Rev: src/modules/Image/layers.c:1.23

1:   /*   **! module Image   **! note - **! $Id: layers.c,v 1.22 1999/06/28 00:43:06 per Exp $ + **! $Id: layers.c,v 1.23 1999/06/30 11:02:56 mirar Exp $   **! class Layer   **! see also: layers   **!
152:      #include <math.h> /* floor */    - RCSID("$Id: layers.c,v 1.22 1999/06/28 00:43:06 per Exp $"); + RCSID("$Id: layers.c,v 1.23 1999/06/30 11:02:56 mirar Exp $");      #include "image_machine.h"   
1072:    pop_stack();    return;    } -  else if (sp[-args].type==T_INT) +  else if (sp[-args].type==T_INT && args>1 +  && sp[1-args].type==T_INT)    {    rgb_group col=black,alpha=white;   
1103:       pop_n_elems(args);    } -  else if (sp[-args].type==T_OBJECT) +  else if (sp[-args].type==T_OBJECT || args>1)    {    if (args>2)    {
2103:    /* loop over lines */    for (y=0; y<dest->ysize; y++)    { -  if (layers>1 || layer[0]->row_func!=lm_normal) +  if (layers>1 || layer[0]->row_func!=lm_normal || +  layer[0]->tiled)    {    /* add the bottom layer first */ -  if (layer[0]->row_func==lm_normal) /* cheat */ +  if (layer[0]->row_func==lm_normal && +  !layer[0]->tiled) /* cheat */    {    img_lay_first_line(layer[0],xoffs,xsize,    y+dest->yoffs-layer[0]->yoffs,
2225:    yoffset=l[0]->yoffs;    xsize=l[0]->xsize;    ysize=l[0]->ysize; +  if (l[0]->tiled) /* set size from the first non-tiled */ +  {    for (i=1; i<layers; i++) -  +  if (!l[i]->tiled)    { -  +  xoffset=l[i]->xoffs; +  yoffset=l[i]->yoffs; +  xsize=l[i]->xsize; +  ysize=l[i]->ysize; +  break; +  } +  } +  else i=1; +  for (; i<layers; i++) +  if (!l[i]->tiled) +  {    int t;    if (l[i]->xoffs<xoffset)    t=xoffset-l[i]->xoffs,xoffset-=t,xsize+=t;