1e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
2e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Mesa 3-D graphics library
39e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian * Version:  7.0
422144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes *
50552abce0ec54dbb3f8de2fb9665fd5e58451543Brian * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
622144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes *
7e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
8e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * copy of this software and associated documentation files (the "Software"),
9e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * to deal in the Software without restriction, including without limitation
10e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * and/or sell copies of the Software, and to permit persons to whom the
12e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Software is furnished to do so, subject to the following conditions:
1322144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes *
14e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * The above copyright notice and this permission notice shall be included
15e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * in all copies or substantial portions of the Software.
1622144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes *
17e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
24e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
25e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
26e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
27e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Line Rasterizer Template
28e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
29e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * This file is #include'd to generate custom line rasterizers.
30e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
31e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * The following macros may be defined to indicate what auxillary information
32e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * must be interplated along the line:
3395e02a210ed339ad20b0c16284dcdcf9af2dc755Brian Paul *    INTERP_Z        - if defined, interpolate Z values
349ede048127ea71282fd97e01516dedcfb03e2a23Brian *    INTERP_ATTRIBS  - if defined, interpolate attribs (texcoords, varying, etc)
35e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
36e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * When one can directly address pixels in the color buffer the following
37e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * macros can be defined and used to directly compute pixel addresses during
38e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * rasterization (see pixelPtr):
39e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *    PIXEL_TYPE          - the datatype of a pixel (GLubyte, GLushort, GLuint)
40e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *    BYTES_PER_ROW       - number of bytes per row in the color buffer
41e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *    PIXEL_ADDRESS(X,Y)  - returns the address of pixel at (X,Y) where
42e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *                          Y==0 at bottom of screen and increases upward.
43e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
44e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Similarly, for direct depth buffer access, this type is used for depth
45e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * buffer addressing:
46e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *    DEPTH_TYPE          - either GLushort or GLuint
47e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
48e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Optionally, one may provide one-time setup code
49e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *    SETUP_CODE    - code which is to be executed once per line
50e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
51b37a084357dd08573b86d6d8c5ba43d65bdc1bd7Brian Paul * To actually "plot" each pixel the PLOT macro must be defined...
52e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *    PLOT(X,Y) - code to plot a pixel.  Example:
53e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *                if (Z < *zPtr) {
54e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *                   *zPtr = Z;
55e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *                   color = pack_rgb( FixedToInt(r0), FixedToInt(g0),
56e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *                                     FixedToInt(b0) );
57e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *                   put_pixel( X, Y, color );
58e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *                }
59e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
60e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * This code was designed for the origin to be in the lower-left corner.
61e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
62e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
63e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
64e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
6522a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paulstatic void
66f9995b30756140724f41daf963fa06167912be7fKristian HøgsbergNAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 )
67e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
68dd34fe8679fa200e55cfaf8e80bbecdecea084e3Brian   const SWcontext *swrast = SWRAST_CONTEXT(ctx);
69cdb27e8242215271364602995d85607cfc06d441Brian Paul   SWspan span;
7022a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   GLuint interpFlags = 0;
719e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian   GLint x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0];
729e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian   GLint x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0];
739e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian   GLint y0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1];
749e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian   GLint y1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1];
75e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint dx, dy;
7622a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   GLint numPixels;
77e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint xstep, ystep;
7822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#if defined(DEPTH_TYPE)
79113b0a7f2e83f02ae9da6977ff416df5cf9671deBrian   const GLint depthBits = ctx->DrawBuffer->Visual.depthBits;
80e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0;
81e4b2356c07d31fbeeabb13b2fb47db703b473080Brian Paul   struct gl_renderbuffer *zrb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
8222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#define FixedToDepth(F)  ((F) >> fixedToDepthShift)
83cd03ed4f54444d96e4e47cdb118a3dfd94d92bb0Keith Whitwell   GLint zPtrXstep, zPtrYstep;
84cd03ed4f54444d96e4e47cdb118a3dfd94d92bb0Keith Whitwell   DEPTH_TYPE *zPtr;
8522a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#elif defined(INTERP_Z)
86113b0a7f2e83f02ae9da6977ff416df5cf9671deBrian   const GLint depthBits = ctx->DrawBuffer->Visual.depthBits;
87e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
88e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
89e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   PIXEL_TYPE *pixelPtr;
90e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint pixelXstep, pixelYstep;
91e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
9222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul
9322a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef SETUP_CODE
9422a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   SETUP_CODE
95e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
96e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
97dd34fe8679fa200e55cfaf8e80bbecdecea084e3Brian   (void) swrast;
98dd34fe8679fa200e55cfaf8e80bbecdecea084e3Brian
99ef4f5b391e560e535b25b372f797e41edeef09f1Keith Whitwell   /* Cull primitives with malformed coordinates.
100ef4f5b391e560e535b25b372f797e41edeef09f1Keith Whitwell    */
101ef4f5b391e560e535b25b372f797e41edeef09f1Keith Whitwell   {
1029e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian      GLfloat tmp = vert0->attrib[FRAG_ATTRIB_WPOS][0] + vert0->attrib[FRAG_ATTRIB_WPOS][1]
1039e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian                  + vert1->attrib[FRAG_ATTRIB_WPOS][0] + vert1->attrib[FRAG_ATTRIB_WPOS][1];
104ef4f5b391e560e535b25b372f797e41edeef09f1Keith Whitwell      if (IS_INF_OR_NAN(tmp))
105ef4f5b391e560e535b25b372f797e41edeef09f1Keith Whitwell	 return;
106ef4f5b391e560e535b25b372f797e41edeef09f1Keith Whitwell   }
107e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
108658702df9706860c0b6777593bf3a1791cc988e6Brian Paul   /*
109658702df9706860c0b6777593bf3a1791cc988e6Brian Paul   printf("%s():\n", __FUNCTION__);
110e307931314f1145305ac2946f13f5e2f020313ecBrian Paul   printf(" (%f, %f, %f) -> (%f, %f, %f)\n",
1119e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert0->attrib[FRAG_ATTRIB_WPOS][0],
1129e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert0->attrib[FRAG_ATTRIB_WPOS][1],
1139e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert0->attrib[FRAG_ATTRIB_WPOS][2],
1149e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert1->attrib[FRAG_ATTRIB_WPOS][0],
1159e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert1->attrib[FRAG_ATTRIB_WPOS][1],
1169e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert1->attrib[FRAG_ATTRIB_WPOS][2]);
117658702df9706860c0b6777593bf3a1791cc988e6Brian Paul   printf(" (%d, %d, %d) -> (%d, %d, %d)\n",
118658702df9706860c0b6777593bf3a1791cc988e6Brian Paul          vert0->color[0], vert0->color[1], vert0->color[2],
119658702df9706860c0b6777593bf3a1791cc988e6Brian Paul          vert1->color[0], vert1->color[1], vert1->color[2]);
120658702df9706860c0b6777593bf3a1791cc988e6Brian Paul   printf(" (%d, %d, %d) -> (%d, %d, %d)\n",
121658702df9706860c0b6777593bf3a1791cc988e6Brian Paul          vert0->specular[0], vert0->specular[1], vert0->specular[2],
122658702df9706860c0b6777593bf3a1791cc988e6Brian Paul          vert1->specular[0], vert1->specular[1], vert1->specular[2]);
123658702df9706860c0b6777593bf3a1791cc988e6Brian Paul   */
124658702df9706860c0b6777593bf3a1791cc988e6Brian Paul
125e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
126e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Despite being clipped to the view volume, the line's window coordinates
127e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * may just lie outside the window bounds.  That is, if the legal window
128e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * coordinates are [0,W-1][0,H-1], it's possible for x==W and/or y==H.
129e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * This quick and dirty code nudges the endpoints inside the window if
130e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * necessary.
131e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
132e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef CLIP_HACK
133e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   {
134e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      GLint w = ctx->DrawBuffer->Width;
135e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      GLint h = ctx->DrawBuffer->Height;
136e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      if ((x0==w) | (x1==w)) {
137e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         if ((x0==w) & (x1==w))
138e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell           return;
139e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         x0 -= x0==w;
140e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         x1 -= x1==w;
141e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
142e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      if ((y0==h) | (y1==h)) {
143e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         if ((y0==h) & (y1==h))
144e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell           return;
145e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         y0 -= y0==h;
146e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         y1 -= y1==h;
147e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
148e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
149e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
15022a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul
151e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   dx = x1 - x0;
152e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   dy = y1 - y0;
15322a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   if (dx == 0 && dy == 0)
154e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      return;
155e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
1569e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian   /*
1579e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian   printf("%s %d,%d  %g %g %g %g  %g %g %g %g\n", __FUNCTION__, dx, dy,
1589e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert0->attrib[FRAG_ATTRIB_COL1][0],
1599e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert0->attrib[FRAG_ATTRIB_COL1][1],
1609e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert0->attrib[FRAG_ATTRIB_COL1][2],
1619e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert0->attrib[FRAG_ATTRIB_COL1][3],
1629e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert1->attrib[FRAG_ATTRIB_COL1][0],
1639e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert1->attrib[FRAG_ATTRIB_COL1][1],
1649e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert1->attrib[FRAG_ATTRIB_COL1][2],
1659e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian          vert1->attrib[FRAG_ATTRIB_COL1][3]);
1669e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian   */
1679e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian
16822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
1697cf2d75d4f5397629a058b9ea9b20df688b79e5cBrian Paul   zPtr = (DEPTH_TYPE *) _swrast_pixel_address(zrb, x0, y0);
170e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
171e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
172e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   pixelPtr = (PIXEL_TYPE *) PIXEL_ADDRESS(x0,y0);
173e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
174e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
175e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (dx<0) {
176e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      dx = -dx;   /* make positive */
177e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      xstep = -1;
17822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
179e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      zPtrXstep = -((GLint)sizeof(DEPTH_TYPE));
180e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
181e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
182e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      pixelXstep = -((GLint)sizeof(PIXEL_TYPE));
183e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
184e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
185e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
186e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      xstep = 1;
18722a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
188e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      zPtrXstep = ((GLint)sizeof(DEPTH_TYPE));
189e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
190e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
191e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      pixelXstep = ((GLint)sizeof(PIXEL_TYPE));
192e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
193e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
194e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
195e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (dy<0) {
196e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      dy = -dy;   /* make positive */
197e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      ystep = -1;
19822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
199d0570646bd67eae8152b63ccaf5c73970b1f56eaBrian Paul      zPtrYstep = -((GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE)));
200e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
201e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
202e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      pixelYstep = BYTES_PER_ROW;
203e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
204e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
205e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
206e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      ystep = 1;
20722a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
208d0570646bd67eae8152b63ccaf5c73970b1f56eaBrian Paul      zPtrYstep = (GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE));
209e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
210e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
211e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      pixelYstep = -(BYTES_PER_ROW);
212e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
213e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
214e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
21522a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   ASSERT(dx >= 0);
21622a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   ASSERT(dy >= 0);
217e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
2181fe3b1d96459b59381be449a8dc869421071a430Brian Paul   numPixels = MAX2(dx, dy);
21922a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul
2201fe3b1d96459b59381be449a8dc869421071a430Brian Paul   /*
2211fe3b1d96459b59381be449a8dc869421071a430Brian Paul    * Span setup: compute start and step values for all interpolated values.
2221fe3b1d96459b59381be449a8dc869421071a430Brian Paul    */
2231fe3b1d96459b59381be449a8dc869421071a430Brian Paul   interpFlags |= SPAN_RGBA;
22422a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   if (ctx->Light.ShadeModel == GL_SMOOTH) {
22522a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.red   = ChanToFixed(vert0->color[0]);
22622a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.green = ChanToFixed(vert0->color[1]);
22722a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.blue  = ChanToFixed(vert0->color[2]);
22822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.alpha = ChanToFixed(vert0->color[3]);
22922a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.redStep   = (ChanToFixed(vert1->color[0]) - span.red  ) / numPixels;
23022a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.greenStep = (ChanToFixed(vert1->color[1]) - span.green) / numPixels;
23122a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.blueStep  = (ChanToFixed(vert1->color[2]) - span.blue ) / numPixels;
23222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.alphaStep = (ChanToFixed(vert1->color[3]) - span.alpha) / numPixels;
23322a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   }
23422a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   else {
23522a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.red   = ChanToFixed(vert1->color[0]);
23622a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.green = ChanToFixed(vert1->color[1]);
23722a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.blue  = ChanToFixed(vert1->color[2]);
23822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.alpha = ChanToFixed(vert1->color[3]);
23922a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.redStep   = 0;
24022a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.greenStep = 0;
24122a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.blueStep  = 0;
24222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      span.alphaStep = 0;
24322a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   }
24422a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#if defined(INTERP_Z) || defined(DEPTH_TYPE)
2451fe3b1d96459b59381be449a8dc869421071a430Brian Paul   interpFlags |= SPAN_Z;
24622a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   {
24722a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      if (depthBits <= 16) {
2489e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         span.z = FloatToFixed(vert0->attrib[FRAG_ATTRIB_WPOS][2]) + FIXED_HALF;
2499e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         span.zStep = FloatToFixed(  vert1->attrib[FRAG_ATTRIB_WPOS][2]
2509e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian                                   - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels;
251e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
25222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      else {
2534039cb8ca82d59451a6de8902fe35e693cdca3baBrian Paul         /* don't use fixed point */
2549e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         span.z = (GLuint) vert0->attrib[FRAG_ATTRIB_WPOS][2];
2559e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         span.zStep = (GLint) ((  vert1->attrib[FRAG_ATTRIB_WPOS][2]
2569e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian                                - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels);
257e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
25822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   }
259e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
2609ede048127ea71282fd97e01516dedcfb03e2a23Brian#if defined(INTERP_ATTRIBS)
2610552abce0ec54dbb3f8de2fb9665fd5e58451543Brian   {
262392d9701e30f4c7b4cbd25cb8714a42ba2512bd4Brian      const GLfloat invLen = 1.0F / numPixels;
2639e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian      const GLfloat invw0 = vert0->attrib[FRAG_ATTRIB_WPOS][3];
2649e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian      const GLfloat invw1 = vert1->attrib[FRAG_ATTRIB_WPOS][3];
2659e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian
2669e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian      span.attrStart[FRAG_ATTRIB_WPOS][3] = invw0;
2679e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian      span.attrStepX[FRAG_ATTRIB_WPOS][3] = (invw1 - invw0) * invLen;
2689e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian      span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0;
2699e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian
2700bdf216dd06d5136b8529297297aa962bab548c2Brian      ATTRIB_LOOP_BEGIN
2719e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         if (swrast->_InterpMode[attr] == GL_FLAT) {
2729e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian            COPY_4V(span.attrStart[attr], vert1->attrib[attr]);
2739e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian            ASSIGN_4V(span.attrStepX[attr], 0.0, 0.0, 0.0, 0.0);
2749e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         }
2759e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         else {
2769e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian            GLuint c;
2779e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian            for (c = 0; c < 4; c++) {
2789e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian               float da;
2799e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian               span.attrStart[attr][c] = invw0 * vert0->attrib[attr][c];
2809e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian               da = (invw1 * vert1->attrib[attr][c]) - span.attrStart[attr][c];
2819e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian               span.attrStepX[attr][c] = da * invLen;
2829e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian            }
2839e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         }
2849e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         ASSIGN_4V(span.attrStepY[attr], 0.0, 0.0, 0.0, 0.0);
2850bdf216dd06d5136b8529297297aa962bab548c2Brian      ATTRIB_LOOP_END
286392d9701e30f4c7b4cbd25cb8714a42ba2512bd4Brian   }
287392d9701e30f4c7b4cbd25cb8714a42ba2512bd4Brian#endif
288b37a084357dd08573b86d6d8c5ba43d65bdc1bd7Brian Paul
289f4b103dc993491355ec3e3640d9cb060138175c2Brian   INIT_SPAN(span, GL_LINE);
290f4b103dc993491355ec3e3640d9cb060138175c2Brian   span.end = numPixels;
291f4b103dc993491355ec3e3640d9cb060138175c2Brian   span.interpMask = interpFlags;
292f4b103dc993491355ec3e3640d9cb060138175c2Brian   span.arrayMask = SPAN_XY;
2931fe3b1d96459b59381be449a8dc869421071a430Brian Paul
294fcd7c37fd3d0f61cf6ac81170bc0b3fca64ad9bbBrian   span.facing = swrast->PointLineFacing;
295fcd7c37fd3d0f61cf6ac81170bc0b3fca64ad9bbBrian
296fcd7c37fd3d0f61cf6ac81170bc0b3fca64ad9bbBrian
29722a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   /*
29822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul    * Draw
29922a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul    */
300b37a084357dd08573b86d6d8c5ba43d65bdc1bd7Brian Paul
30122a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   if (dx > dy) {
30222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      /*** X-major line ***/
30322a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      GLint i;
30422a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      GLint errorInc = dy+dy;
30522a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      GLint error = errorInc-dx;
30622a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      GLint errorDec = error-dx;
30722a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul
30822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul      for (i = 0; i < dx; i++) {
30922a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
3103e37bafab0a339021354b9c78f983d05d433d735Brian Paul         GLuint Z = FixedToDepth(span.z);
311e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
31222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef PLOT
31322a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         PLOT( x0, y0 );
31422a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#else
31522a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         span.array->x[i] = x0;
31622a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         span.array->y[i] = y0;
317e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
31822a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         x0 += xstep;
31922a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
32022a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep);
32122a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         span.z += span.zStep;
322e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
323e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
324e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep);
325e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
3269e8a961dd7d7b717a9fb4ecdea1c1b60ea355efeBrian         if (error < 0) {
327e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            error += errorInc;
328e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
329e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         else {
330e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            error += errorDec;
331e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            y0 += ystep;
33222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
333e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep);
334e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
335e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
336e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep);
337e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
338e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
339e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
340e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
341e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
342e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /*** Y-major line ***/
343e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      GLint i;
344e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      GLint errorInc = dx+dx;
345e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      GLint error = errorInc-dy;
346e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      GLint errorDec = error-dy;
347e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
348e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      for (i=0;i<dy;i++) {
34922a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
3503e37bafab0a339021354b9c78f983d05d433d735Brian Paul         GLuint Z = FixedToDepth(span.z);
351e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
35222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef PLOT
35322a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         PLOT( x0, y0 );
35422a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#else
35522a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         span.array->x[i] = x0;
35622a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         span.array->y[i] = y0;
357e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
358e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         y0 += ystep;
35922a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
360e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep);
36122a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul         span.z += span.zStep;
362e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
363e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
364e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep);
365e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
366e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         if (error<0) {
367e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            error += errorInc;
368e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
369e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         else {
370e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            error += errorDec;
371e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            x0 += xstep;
37222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef DEPTH_TYPE
373e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep);
374e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
375e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef PIXEL_ADDRESS
376e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep);
377e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
378e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
379e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
380e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
381e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
38222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#ifdef RENDER_SPAN
38322a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul   RENDER_SPAN( span );
38422a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#endif
38522a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul
38622ae633d1ea636e0e07ba044a0f8fa2195c83bc6Alan Hourihane   (void)span;
38722ae633d1ea636e0e07ba044a0f8fa2195c83bc6Alan Hourihane
388e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
389e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
390e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
39122a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#undef NAME
392e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#undef INTERP_Z
3939ede048127ea71282fd97e01516dedcfb03e2a23Brian#undef INTERP_ATTRIBS
394e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#undef PIXEL_ADDRESS
395e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#undef PIXEL_TYPE
396e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#undef DEPTH_TYPE
397e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#undef BYTES_PER_ROW
398e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#undef SETUP_CODE
399e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#undef PLOT
400e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#undef CLIP_HACK
401e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#undef FixedToDepth
40222a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70Brian Paul#undef RENDER_SPAN
403