- if (width<=0.0) {
- gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
- return;
- }
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineWidth");
-
- if (ctx->Line.Width != width) {
- ctx->Line.Width = width;
- ctx->TriangleCaps &= ~DD_LINE_WIDTH;
- if (width != 1.0) ctx->TriangleCaps |= DD_LINE_WIDTH;
- ctx->NewState |= NEW_RASTER_OPS;
- if (ctx->Driver.LineWidth)
- (*ctx->Driver.LineWidth)(ctx, width);
- }
-}
-
-
-
-void
-_mesa_LineStipple( GLint factor, GLushort pattern )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple");
- ctx->Line.StippleFactor = CLAMP( factor, 1, 256 );
- ctx->Line.StipplePattern = pattern;
- ctx->NewState |= NEW_RASTER_OPS;
-
- if (ctx->Driver.LineStipple)
- ctx->Driver.LineStipple( ctx, factor, pattern );
-}
-
-
-
-/**********************************************************************/
-/***** Rasterization *****/
-/**********************************************************************/
-
-
-/*
- * There are 4 pairs (RGBA, CI) of line drawing functions:
- * 1. simple: width=1 and no special rasterization functions (fastest)
- * 2. flat: width=1, non-stippled, flat-shaded, any raster operations
- * 3. smooth: width=1, non-stippled, smooth-shaded, any raster operations
- * 4. general: any other kind of line (slowest)
- */
-
-
-/*
- * All line drawing functions have the same arguments:
- * v1, v2 - indexes of first and second endpoints into vertex buffer arrays
- * pv - provoking vertex: which vertex color/index to use for flat shading.
- */
-
-
-
-
-
-
-#if MAX_WIDTH > MAX_HEIGHT
-# define MAXPOINTS MAX_WIDTH
-#else
-# define MAXPOINTS MAX_HEIGHT
-#endif
-
-
-/* Flat, color index line */
-static void flat_ci_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
-{
- PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
-
-#define INTERP_XY 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
-
-#include "linetemp.h"
-
- gl_flush_pb(ctx);
-}
-
-
-
-/* Flat, color index line with Z interpolation/testing */
-static void flat_ci_z_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
-{
- PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
-
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
-
-#include "linetemp.h"
-
- gl_flush_pb(ctx);
-}
-
-
-
-/* Flat-shaded, RGBA line */
-static void flat_rgba_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
-{
- const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
- PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
-
-#define INTERP_XY 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
-
-#include "linetemp.h"
-
- gl_flush_pb(ctx);
-}
-
-
-
-/* Flat-shaded, RGBA line with Z interpolation/testing */
-static void flat_rgba_z_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
-{
- const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
- PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
-
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
-
-#include "linetemp.h"
-
- gl_flush_pb(ctx);
-}
-
-
-
-/* Smooth shaded, color index line */
-static void smooth_ci_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
-{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLuint *pbi = ctx->PB->index;
- (void) pvert;
-
- ctx->PB->mono = GL_FALSE;
-
-#define INTERP_XY 1
-#define INTERP_INDEX 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbi[count] = I; \
- count++;
-
-#include "linetemp.h"
-
- ctx->PB->count = count;
- gl_flush_pb(ctx);
-}
-
-
-
-/* Smooth shaded, color index line with Z interpolation/testing */
-static void smooth_ci_z_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
-{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLuint *pbi = ctx->PB->index;
- (void) pvert;
-
- ctx->PB->mono = GL_FALSE;
-
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_INDEX 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbi[count] = I; \
- count++;
-
-#include "linetemp.h"
-
- ctx->PB->count = count;
- gl_flush_pb(ctx);
-}
-
-
-
-/* Smooth-shaded, RGBA line */
-static void smooth_rgba_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
-{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLubyte (*pbrgba)[4] = ctx->PB->rgba;
- (void) pvert;
-
- ctx->PB->mono = GL_FALSE;
-
-#define INTERP_XY 1
-#define INTERP_RGB 1
-#define INTERP_ALPHA 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- count++;
-
-#include "linetemp.h"
-
- ctx->PB->count = count;
- gl_flush_pb(ctx);
-}
-
-
-
-/* Smooth-shaded, RGBA line with Z interpolation/testing */
-static void smooth_rgba_z_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
-{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLubyte (*pbrgba)[4] = ctx->PB->rgba;
- (void) pvert;
-
- ctx->PB->mono = GL_FALSE;
-
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_RGB 1
-#define INTERP_ALPHA 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- count++;
-
-#include "linetemp.h"