summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-02-28 15:08:49 +0000
committerBrian Paul <[email protected]>2003-02-28 15:08:49 +0000
commita20ed720032d1a04a5206374020234140dd5ef08 (patch)
tree61e14120da956ed4fc73c533f63725f44d020696
parent13c4c046a5ff6130fa27385bb93d2464e0ff0f83 (diff)
fix GLchan==GLfloat bug in solve_plane_chan (bug 694546)
-rw-r--r--src/mesa/swrast/s_aaline.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c
index deaae01f711..5d391a2ad37 100644
--- a/src/mesa/swrast/s_aaline.c
+++ b/src/mesa/swrast/s_aaline.c
@@ -1,4 +1,4 @@
-/* $Id: s_aaline.c,v 1.18 2003/02/27 23:37:53 brianp Exp $ */
+/* $Id: s_aaline.c,v 1.19 2003/02/28 15:08:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -180,12 +180,16 @@ solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4])
static INLINE GLchan
solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4])
{
- GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2] + 0.5F;
- if (z < 0.0F)
+ const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2];
+#if CHAN_TYPE == GL_FLOAT
+ return CLAMP(z, 0.0F, CHAN_MAXF);
+#else
+ if (z < 0)
return 0;
- else if (z > CHAN_MAXF)
- return (GLchan) CHAN_MAXF;
- return (GLchan) z;
+ else if (z > CHAN_MAX)
+ return CHAN_MAX;
+ return (GLchan) IROUND_POS(z);
+#endif
}