mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
fixed some divide by zero problems found w/ conform
This commit is contained in:
parent
bd3d9b9d04
commit
dbed202744
3 changed files with 17 additions and 13 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_aaline.c,v 1.8 2001/04/10 15:46:51 brianp Exp $ */
|
||||
/* $Id: s_aaline.c,v 1.9 2001/05/10 17:41:41 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -201,7 +201,10 @@ compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4],
|
|||
GLfloat r2 = dvdx * dvdx + dvdy * dvdy;
|
||||
GLfloat rho2 = r1 + r2;
|
||||
/* return log base 2 of rho */
|
||||
return log(rho2) * 1.442695 * 0.5; /* 1.442695 = 1/log(2) */
|
||||
if (rho2 == 0.0F)
|
||||
return 0.0;
|
||||
else
|
||||
return log(rho2) * 1.442695 * 0.5; /* 1.442695 = 1/log(2) */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_aalinetemp.h,v 1.8 2001/05/03 22:13:32 brianp Exp $ */
|
||||
/* $Id: s_aalinetemp.h,v 1.9 2001/05/10 17:41:41 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -166,14 +166,12 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
|
|||
line.dy = line.y1 - line.y0;
|
||||
line.len = sqrt(line.dx * line.dx + line.dy * line.dy);
|
||||
line.halfWidth = 0.5F * ctx->Line.Width;
|
||||
if (line.len == 0.0) {
|
||||
line.xAdj = 0.0;
|
||||
line.yAdj = 0.0;
|
||||
}
|
||||
else {
|
||||
line.xAdj = line.dx / line.len * line.halfWidth;
|
||||
line.yAdj = line.dy / line.len * line.halfWidth;
|
||||
}
|
||||
|
||||
if (line.len == 0.0)
|
||||
return;
|
||||
|
||||
line.xAdj = line.dx / line.len * line.halfWidth;
|
||||
line.yAdj = line.dy / line.len * line.halfWidth;
|
||||
|
||||
#ifdef DO_Z
|
||||
compute_plane(line.x0, line.y0, line.x1, line.y1,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_aatriangle.c,v 1.13 2001/04/10 15:46:51 brianp Exp $ */
|
||||
/* $Id: s_aatriangle.c,v 1.14 2001/05/10 17:41:41 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -341,7 +341,10 @@ compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4],
|
|||
GLfloat r2 = dvdx * dvdx + dvdy * dvdy;
|
||||
GLfloat rho2 = r1 + r2;
|
||||
/* return log base 2 of rho */
|
||||
return log(rho2) * 1.442695 * 0.5; /* 1.442695 = 1/log(2) */
|
||||
if (rho2 == 0.0F)
|
||||
return 0.0;
|
||||
else
|
||||
return log(rho2) * 1.442695 * 0.5; /* 1.442695 = 1/log(2) */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue