From 6517211e12c4f19c784b31727f6052561956fb7b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Jan 2001 15:32:32 +0000 Subject: [PATCH] added divide by zero check --- src/mesa/swrast/s_aalinetemp.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 71da5f0c5cc..d16fe2c1290 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -1,4 +1,4 @@ -/* $Id: s_aalinetemp.h,v 1.2 2000/11/19 23:10:26 brianp Exp $ */ +/* $Id: s_aalinetemp.h,v 1.3 2001/01/04 15:32:32 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -166,8 +166,14 @@ 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; - line.xAdj = line.dx / line.len * line.halfWidth; - line.yAdj = line.dy / line.len * line.halfWidth; + 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; + } #ifdef DO_Z compute_plane(line.x0, line.y0, line.x1, line.y1, -- 2.30.2