-/* $Id: osmesa.c,v 1.48 2001/03/03 20:33:29 brianp Exp $ */
+/* $Id: osmesa.c,v 1.49 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
else if (format==OSMESA_RGBA) {
indexBits = 0;
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
- alphaBits = 8;
+ redBits = CHAN_BITS;
+ greenBits = CHAN_BITS;
+ blueBits = CHAN_BITS;
+ alphaBits = CHAN_BITS;
rind = 0;
gind = 1;
bind = 2;
}
else if (format==OSMESA_BGRA) {
indexBits = 0;
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
- alphaBits = 8;
+ redBits = CHAN_BITS;
+ greenBits = CHAN_BITS;
+ blueBits = CHAN_BITS;
+ alphaBits = CHAN_BITS;
rind = 2;
gind = 1;
bind = 0;
}
else if (format==OSMESA_ARGB) {
indexBits = 0;
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
- alphaBits = 8;
+ redBits = CHAN_BITS;
+ greenBits = CHAN_BITS;
+ blueBits = CHAN_BITS;
+ alphaBits = CHAN_BITS;
rind = 1;
gind = 2;
bind = 3;
}
else if (format==OSMESA_RGB) {
indexBits = 0;
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
+ redBits = CHAN_BITS;
+ greenBits = CHAN_BITS;
+ blueBits = CHAN_BITS;
alphaBits = 0;
bshift = 0;
gshift = 8;
}
else if (format==OSMESA_BGR) {
indexBits = 0;
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
+ redBits = CHAN_BITS;
+ greenBits = CHAN_BITS;
+ blueBits = CHAN_BITS;
alphaBits = 0;
bshift = 0;
gshift = 8;
*value = ctx->format;
return;
case OSMESA_TYPE:
- *value = GL_UNSIGNED_BYTE;
+ *value = CHAN_TYPE;
return;
case OSMESA_ROW_LENGTH:
*value = ctx->rowlength;
} while (0)
-#define UNPACK_RED(P) ( ((GLchan *) &(P))[osmesa->rInd] )
-#define UNPACK_GREEN(P) ( ((GLchan *) &(P))[osmesa->gInd] )
-#define UNPACK_BLUE(P) ( ((GLchan *) &(P))[osmesa->bInd] )
-#define UNPACK_ALPHA(P) ( ((GLchan *) &(P))[osmesa->aInd] )
+#define UNPACK_RED(P) ( (P)[osmesa->rInd] )
+#define UNPACK_GREEN(P) ( (P)[osmesa->gInd] )
+#define UNPACK_BLUE(P) ( (P)[osmesa->bInd] )
+#define UNPACK_ALPHA(P) ( (P)[osmesa->aInd] )
#define PIXELADDR1(X,Y) (osmesa->rowaddr[Y] + (X))
-/* $Id: fakeglx.c,v 1.46 2001/02/17 00:17:31 brianp Exp $ */
+/* $Id: fakeglx.c,v 1.47 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* be sure our dispatch table size <= libGL's table */
{
- int size = sizeof(struct _glxapi_table) / sizeof(void *);
+ GLuint size = sizeof(struct _glxapi_table) / sizeof(void *);
(void) size;
assert(_glxapi_get_dispatch_table_size() >= size);
}
-/* $Id: xfonts.c,v 1.12 2001/03/03 20:33:30 brianp Exp $ */
+/* $Id: xfonts.c,v 1.13 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
* determine if a given glyph is valid and return the
* corresponding XCharStruct.
*/
-static XCharStruct *isvalid(XFontStruct *fs, int which)
+static XCharStruct *isvalid(XFontStruct *fs, unsigned int which)
{
unsigned int rows,pages;
- int byte1 = 0,byte2 = 0;
+ unsigned int byte1 = 0,byte2 = 0;
int i,valid = 1;
rows = fs->max_byte1 - fs->min_byte1 + 1;
-/* $Id: xm_api.c,v 1.17 2001/03/03 20:33:30 brianp Exp $ */
+/* $Id: xm_api.c,v 1.18 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
static void FXgetImage( XMesaBuffer b )
{
static unsigned short pixbuf[MAX_WIDTH];
- int x, y;
+ GLuint x, y;
+ int xpos, ypos;
XMesaWindow root;
unsigned int bw, depth, width, height;
XMesaContext xmesa = (XMesaContext) b->xm_context->gl_ctx->DriverCtx;
depth = b->frontbuffer->depth;
#else
XGetGeometry( xmesa->xm_visual->display, b->frontbuffer,
- &root, &x, &y, &width, &height, &bw, &depth);
+ &root, &xpos, &ypos, &width, &height, &bw, &depth);
#endif
if (b->width != width || b->height != height) {
b->width = MIN2((int)width, xmesa->xm_buffer->FXctx->width);
-/* $Id: colormac.h,v 1.7 2001/03/07 03:20:38 brianp Exp $ */
+/* $Id: colormac.h,v 1.8 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 15))
#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 16))
-#define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF) + 0.5F))
+#define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF)))
#define CLAMPED_FLOAT_TO_CHAN(c, f) \
c = ((GLchan) IROUND((f) * CHAN_MAXF))
-/* $Id: texobj.c,v 1.42 2001/03/03 20:33:28 brianp Exp $ */
+/* $Id: texobj.c,v 1.43 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (t->Dimensions == 6) {
/* make sure that all six cube map level 0 images are the same size */
- const GLint w = t->Image[baseLevel]->Width2;
- const GLint h = t->Image[baseLevel]->Height2;
+ const GLuint w = t->Image[baseLevel]->Width2;
+ const GLuint h = t->Image[baseLevel]->Height2;
if (!t->NegX[baseLevel] ||
t->NegX[baseLevel]->Width2 != w ||
t->NegX[baseLevel]->Height2 != h ||
-/* $Id: m_debug_norm.c,v 1.3 2001/03/03 20:57:00 brianp Exp $ */
+/* $Id: m_debug_norm.c,v 1.4 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLubyte mask[],
GLvector3f *dest )
{
- int i;
+ GLuint i;
const GLfloat *s = in->start;
const GLfloat *m = mat->inv;
GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
const GLubyte mask[],
GLvector3f *dest )
{
- int i;
+ GLuint i;
const GLfloat *s = in->start;
const GLfloat *m = mat->inv;
GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
-/* $Id: m_debug_xform.c,v 1.3 2001/03/03 20:33:30 brianp Exp $ */
+/* $Id: m_debug_xform.c,v 1.4 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLubyte *clipmask,
const GLubyte flag )
{
- int i;
+ GLuint i;
GLfloat *s = (GLfloat *)src->start;
GLfloat (*d)[4] = (GLfloat (*)[4])dst->start;
const GLfloat *m = mat->m;
-/* $Id: s_accum.c,v 1.6 2001/03/07 05:06:12 brianp Exp $ */
+/* $Id: s_accum.c,v 1.7 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
&& ctx->Color.ColorMask[ACOMP]) {
_mesa_write_alpha_span(ctx, width, xpos, ypos,
- (CONST GLubyte (*)[4]) rgba, NULL);
+ (CONST GLchan (*)[4]) rgba, NULL);
}
ypos++;
}
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
&& ctx->Color.ColorMask[ACOMP]) {
_mesa_write_alpha_span(ctx, width, xpos, ypos,
- (CONST GLubyte (*)[4]) rgba, NULL);
+ (CONST GLchan (*)[4]) rgba, NULL);
}
ypos++;
}
-/* $Id: s_blend.c,v 1.4 2001/03/03 21:11:33 brianp Exp $ */
+/* $Id: s_blend.c,v 1.5 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLint b = DIV255(rgba[i][BCOMP] * t + dest[i][BCOMP] * s);
const GLint a = DIV255(rgba[i][ACOMP] * t + dest[i][ACOMP] * s);
#undef DIV255
-#else
- const GLint s = CHAN_MAX - t;
- const GLint r = (rgba[i][RCOMP] * t + dest[i][RCOMP] * s) / CHAN_MAX;
- const GLint g = (rgba[i][GCOMP] * t + dest[i][GCOMP] * s) / CHAN_MAX;
- const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s) / CHAN_MAX;
- const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s) / CHAN_MAX;
+#elif CHAN_BITS == 16
+ const GLfloat tt = (GLfloat) t / CHAN_MAXF;
+ const GLfloat s = 1.0 - tt;
+ const GLint r = (GLint) (rgba[i][RCOMP] * tt + dest[i][RCOMP] * s);
+ const GLint g = (GLint) (rgba[i][GCOMP] * tt + dest[i][GCOMP] * s);
+ const GLint b = (GLint) (rgba[i][BCOMP] * tt + dest[i][BCOMP] * s);
+ const GLint a = (GLint) (rgba[i][ACOMP] * tt + dest[i][ACOMP] * s);
+#else /* CHAN_BITS == 32 */
+ const GLfloat tt = (GLfloat) t / CHAN_MAXF;
+ const GLfloat s = 1.0 - tt;
+ const GLfloat r = rgba[i][RCOMP] * tt + dest[i][RCOMP] * s;
+ const GLfloat g = rgba[i][GCOMP] * tt + dest[i][GCOMP] * s;
+ const GLfloat b = rgba[i][BCOMP] * tt + dest[i][BCOMP] * s;
+ const GLfloat a = rgba[i][ACOMP] * tt + dest[i][ACOMP] * s;
#endif
#endif
ASSERT(r <= CHAN_MAX);
_mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest );
SWRAST_CONTEXT(ctx)->BlendFunc( ctx, n, mask, rgba,
- (const GLchan (*)[4])dest );
+ (const GLchan (*)[4]) dest );
}
-/* $Id: s_drawpix.c,v 1.12 2001/03/07 05:06:12 brianp Exp $ */
+/* $Id: s_drawpix.c,v 1.13 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLint row;
for (row=0; row<drawHeight; row++) {
_mesa_write_zoomed_rgb_span(ctx, drawWidth, destX, destY,
- zSpan, 0, (GLchan (*)[3]) src, zoomY0);
+ zSpan, 0, (CONST GLchan (*)[3]) src, zoomY0);
src += rowLength * 3;
destY++;
}
-/* $Id: s_texture.c,v 1.14 2001/03/03 20:33:30 brianp Exp $ */
+/* $Id: s_texture.c,v 1.15 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (wrapMode == GL_CLAMP_TO_EDGE) { \
if (I0 < 0) \
I0 = 0; \
- if (I1 >= SIZE) \
+ if (I1 >= (GLint) SIZE) \
I1 = SIZE - 1; \
} \
} \
j1 += texImage->Border;
}
else {
- if (i0 < 0 || i0 >= width) useBorderTexel |= I0BIT;
- if (i1 < 0 || i1 >= width) useBorderTexel |= I1BIT;
- if (j0 < 0 || j0 >= height) useBorderTexel |= J0BIT;
- if (j1 < 0 || j1 >= height) useBorderTexel |= J1BIT;
+ if (i0 < 0 || i0 >= (GLint) width) useBorderTexel |= I0BIT;
+ if (i1 < 0 || i1 >= (GLint) width) useBorderTexel |= I1BIT;
+ if (j0 < 0 || j0 >= (GLint) height) useBorderTexel |= J0BIT;
+ if (j1 < 0 || j1 >= (GLint) height) useBorderTexel |= J1BIT;
}
/* get four depth samples from the texture */
-/* $Id: s_triangle.c,v 1.15 2001/03/03 20:33:30 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.16 2001/03/08 15:23:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
return; \
} \
tbytesline = obj->Image[b]->Width * comp; \
- tsize = theight * tbytesline;
+ tsize = obj->Image[b]->Height * tbytesline;
/* Instead of defining a function for each mode, a test is done
}
}
-#define SS_COLOR(a,b) COPY_4UBV(a,b)
-#define SS_SPEC(a,b) COPY_4UBV(a,b)
+#define SS_COLOR(a,b) COPY_CHAN4(a,b)
+#define SS_SPEC(a,b) COPY_CHAN4(a,b)
#define SS_IND(a,b) (a = b)
#define IND (0)
*/
#include "glheader.h"
+#include "colormac.h"
#include "macros.h"
#include "swrast/swrast.h"
void
_swsetup_vb_init( GLcontext *ctx )
{
- int i;
+ GLuint i;
(void) ctx;
for (i = 0 ; i < Elements(setup_func) ; i++)
GLfloat *fog;
GLfloat *pointSize;
GLuint tsz[MAX_TEXTURE_UNITS];
- int i;
+ GLuint i;
GLfloat *m = ctx->Viewport._WindowMap.m;
const GLfloat sx = m[0];
const GLfloat sy = m[5];
}
if (IND & COLOR)
- COPY_4UBV(v->color, color[i]);
+ COPY_CHAN4(v->color, color[i]);
if (IND & SPEC)
- COPY_4UBV(v->specular, spec[i]);
+ COPY_CHAN4(v->specular, spec[i]);
if (IND & FOG)
v->fog = fog[i];
-/* $Id: t_imm_elt.c,v 1.4 2001/02/20 18:28:52 keithw Exp $ */
+/* $Id: t_imm_elt.c,v 1.5 2001/03/08 15:23:47 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
-static void _tnl_trans_elt_4chan(GLubyte (*to)[4],
+static void _tnl_trans_elt_4chan(GLchan (*to)[4],
const struct gl_client_array *from,
GLuint *flags,
GLuint *elts,
-/* $Id: t_imm_exec.c,v 1.14 2001/03/03 20:33:31 brianp Exp $ */
+/* $Id: t_imm_exec.c,v 1.15 2001/03/08 15:23:47 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "glheader.h"
+#include "colormac.h"
#include "context.h"
#include "enums.h"
#include "dlist.h"
ctx->Current.EdgeFlag = IM->EdgeFlag[count];
if (flag & VERT_RGBA) {
- COPY_4UBV(ctx->Current.Color, IM->Color[count]);
+ COPY_CHAN4(ctx->Current.Color, IM->Color[count]);
if (ctx->Light.ColorMaterialEnabled) {
_mesa_update_color_material( ctx, ctx->Current.Color );
_mesa_validate_all_lighting_tables( ctx );
}
if (flag & VERT_SPEC_RGB)
- COPY_4UBV(ctx->Current.SecondaryColor, IM->SecondaryColor[count]);
+ COPY_CHAN4(ctx->Current.SecondaryColor, IM->SecondaryColor[count]);
if (flag & VERT_FOG_COORD)
ctx->Current.FogCoord = IM->FogCoord[count];