comparison mac/dw.c @ 425:4fe2df53ec9f

Division by zero fix in the layout engine.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 18 May 2003 08:42:10 +0000
parents 4be57ee7e006
children f225f16bebbd
comparison
equal deleted inserted replaced
424:5cc81d3c2bca 425:4fe2df53ec9f
401 401
402 if(tmp) 402 if(tmp)
403 { 403 {
404 if(*depth > 0) 404 if(*depth > 0)
405 { 405 {
406 float calcval;
407
406 if(thisbox->type == DW_VERT) 408 if(thisbox->type == DW_VERT)
407 { 409 {
408 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); 410 calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
411 if(calcval == 0.0)
412 tmp->xratio = thisbox->xratio;
413 else
414 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
409 tmp->width = thisbox->items[z].width; 415 tmp->width = thisbox->items[z].width;
410 } 416 }
411 if(thisbox->type == DW_HORZ) 417 if(thisbox->type == DW_HORZ)
412 { 418 {
413 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); 419 calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
420 if(calcval == 0.0)
421 tmp->yratio = thisbox->yratio;
422 else
423 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
414 tmp->height = thisbox->items[z].height; 424 tmp->height = thisbox->items[z].height;
415 } 425 }
416 } 426 }
417 427
418 (*depth)++; 428 (*depth)++;