diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2002-06-30 16:58:50 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2002-06-30 16:58:50 +0000 |
commit | 670ea9f590b5446ede96db8f2862db65deb68bdd (patch) | |
tree | 2b3338d5286664a29b4cacc9ca5129b0f58ae8d5 /src | |
parent | c3be87b84bb657f15b18ecaeb87acd7bd6909372 (diff) |
Added divide by zero check (Jon Perry). Remove dead vars. Fix indentation.
Diffstat (limited to 'src')
-rw-r--r-- | src/glu/sgi/libnurbs/internals/slicer.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/glu/sgi/libnurbs/internals/slicer.cc b/src/glu/sgi/libnurbs/internals/slicer.cc index 70dd550972..bdd360355e 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:50 $ $Revision: 1.2.2.1 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.2.2.1 2002/06/30 16:58:50 brianp Exp $ */ #include <stdlib.h> @@ -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 <Diego.SantaCruz@epfl.ch> // 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; |