X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_aaline.c;h=b3a209923fd2ed83d48b0199ba65c92b3dfc8596;hb=c9b33ecd7c07cace0a6553ccfdaf7b021959c934;hp=92103cb296d2338e555d853bb78018cf5d11a5e7;hpb=733a4b602bbbfda83ee03b7ae4f3737bbe659034;p=mesa.git diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c index 92103cb296d..b3a209923fd 100644 --- a/src/mesa/swrast/s_aaline.c +++ b/src/mesa/swrast/s_aaline.c @@ -1,10 +1,8 @@ -/* $Id: s_aaline.c,v 1.13 2002/02/02 17:24:11 brianp Exp $ */ - /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 6.1 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -26,12 +24,13 @@ #include "glheader.h" +#include "imports.h" +#include "macros.h" #include "swrast/s_aaline.h" #include "swrast/s_context.h" #include "swrast/s_span.h" #include "swrast/swrast.h" #include "mtypes.h" -#include "mmath.h" #define SUB_PIXEL 4 @@ -69,14 +68,15 @@ struct LineInfo /* DO_SPEC */ GLfloat srPlane[4], sgPlane[4], sbPlane[4]; /* DO_TEX or DO_MULTITEX */ - GLfloat sPlane[MAX_TEXTURE_UNITS][4]; - GLfloat tPlane[MAX_TEXTURE_UNITS][4]; - GLfloat uPlane[MAX_TEXTURE_UNITS][4]; - GLfloat vPlane[MAX_TEXTURE_UNITS][4]; - GLfloat lambda[MAX_TEXTURE_UNITS]; - GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS]; - - struct sw_span span; + GLfloat sPlane[MAX_TEXTURE_COORD_UNITS][4]; + GLfloat tPlane[MAX_TEXTURE_COORD_UNITS][4]; + GLfloat uPlane[MAX_TEXTURE_COORD_UNITS][4]; + GLfloat vPlane[MAX_TEXTURE_COORD_UNITS][4]; + GLfloat lambda[MAX_TEXTURE_COORD_UNITS]; + GLfloat texWidth[MAX_TEXTURE_COORD_UNITS]; + GLfloat texHeight[MAX_TEXTURE_COORD_UNITS]; + + SWspan span; }; @@ -179,12 +179,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) (GLint) z; + else if (z > CHAN_MAX) + return CHAN_MAX; + return (GLchan) IROUND_POS(z); +#endif } @@ -206,7 +210,7 @@ compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], if (rho2 == 0.0F) return 0.0; else - return (GLfloat) (log(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */ + return (GLfloat) (LOGF(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */ } @@ -327,6 +331,19 @@ compute_coveragef(const struct LineInfo *info, } +/** + * Compute coverage value for color index mode. + * XXX this may not be quite correct. + * \return coverage in [0,15]. + */ +static GLfloat +compute_coveragei(const struct LineInfo *info, + GLint winx, GLint winy) +{ + return compute_coveragef(info, winx, winy) * 15.0F; +} + + typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line, int ix, int iy); @@ -513,8 +530,8 @@ _swrast_choose_aa_line_function(GLcontext *ctx) if (ctx->Visual.rgbMode) { /* RGBA */ - if (ctx->Texture._ReallyEnabled) { - if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY) { + if (ctx->Texture._EnabledCoordUnits != 0) { + if (ctx->Texture._EnabledCoordUnits > 1) { /* Multitextured! */ if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR || ctx->Fog.ColorSumEnabled)