From 89f9cf8addb7f6d36f466ffdcd622b70fa607ffb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 30 Jun 2002 16:58:11 +0000 Subject: Added divide by zero check (Jon Perry). Remove dead vars. Fix indentation. --- src/glu/sgi/libnurbs/internals/slicer.cc | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/glu/sgi') diff --git a/src/glu/sgi/libnurbs/internals/slicer.cc b/src/glu/sgi/libnurbs/internals/slicer.cc index 70dd550972..0d7149144d 100644 --- a/src/glu/sgi/libnurbs/internals/slicer.cc +++ b/src/glu/sgi/libnurbs/internals/slicer.cc @@ -35,8 +35,8 @@ /* * slicer.c++ * - * $Date: 2001/05/01 14:56:00 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.2 2001/05/01 14:56:00 brianp Exp $ + * $Date: 2002/06/30 16:58:11 $ $Revision: 1.3 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.3 2002/06/30 16:58:11 brianp Exp $ */ #include @@ -309,7 +309,6 @@ static void triangulateRectAux(PwlArc* top, PwlArc* bot, PwlArc* left, PwlArc* r static void triangulateRect(Arc_ptr loop, Backend& backend, int TB_or_LR, int ulinear, int vlinear) { - int i; //we know the loop is a rectangle, but not sure which is top Arc_ptr top, bot, left, right; if(loop->tail()[1] == loop->head()[1]) @@ -572,8 +571,6 @@ static void triangulateRectCenter(int n_ulines, REAL* u_val, int n_vlines, REAL* v_val, Backend& backend) { - TrimVertex trimVert; - trimVert.nuid = 0;//???? // XXX this code was patched by Diego Santa Cruz // to fix a problem in which glMapGrid2f() was called with bad parameters. @@ -1075,18 +1072,21 @@ void Slicer::slice_new(Arc_ptr loop) mydu = (du>0)? du: -du; mydv = (dv>0)? dv: -dv; - for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next) - { - - if(jarc->tail()[0] < uMin) - uMin = jarc->tail()[0]; - if(jarc->tail()[0] > uMax) - uMax = jarc->tail()[0]; - if(jarc->tail()[1] < vMin) - vMin = jarc->tail()[1]; - if(jarc->tail()[1] > vMax) - vMax = jarc->tail()[1]; - } + for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next) + { + + if(jarc->tail()[0] < uMin) + uMin = jarc->tail()[0]; + if(jarc->tail()[0] > uMax) + uMax = jarc->tail()[0]; + if(jarc->tail()[1] < vMin) + vMin = jarc->tail()[1]; + if(jarc->tail()[1] > vMax) + vMax = jarc->tail()[1]; + } + + if (uMax == uMin) + return; // prevent divide-by-zero. Jon Perry. 17 June 2002 if(mydu > uMax - uMin) num_ulines = 2; -- cgit v1.2.3