Basic work to support deep color channels:
Replace GLubyte with GLchan Replace 255 with CHAN_MAX
This commit is contained in:
@@ -356,7 +356,7 @@ convertPalette(FxU32 data[256], const struct gl_color_table *table)
|
||||
FxU32 r, g, b, a;
|
||||
GLint i;
|
||||
|
||||
ASSERT(table->TableType == GL_UNSIGNED_BYTE);
|
||||
ASSERT(!table->FloatTable);
|
||||
|
||||
switch (table->Format) {
|
||||
case GL_INTENSITY:
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: accum.c,v 1.27 2000/10/17 00:42:02 brianp Exp $ */
|
||||
/* $Id: accum.c,v 1.28 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -63,7 +63,9 @@
|
||||
*/
|
||||
|
||||
|
||||
#if CHAN_BITS == 8
|
||||
#define USE_OPTIMIZED_ACCUM /* enable the optimization */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -139,7 +141,7 @@ _mesa_Accum( GLenum op, GLfloat value )
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint xpos, ypos, width, height, width4;
|
||||
GLfloat acc_scale;
|
||||
GLubyte rgba[MAX_WIDTH][4];
|
||||
GLchan rgba[MAX_WIDTH][4];
|
||||
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
|
||||
const GLint iChanMax = (1 << (sizeof(GLchan) * 8)) - 1;
|
||||
const GLfloat fChanMax = (1 << (sizeof(GLchan) * 8)) - 1;
|
||||
@@ -387,7 +389,7 @@ _mesa_Accum( GLenum op, GLfloat value )
|
||||
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
|
||||
}
|
||||
(*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
|
||||
(const GLubyte (*)[4])rgba, NULL );
|
||||
(const GLchan (*)[4])rgba, NULL );
|
||||
ypos++;
|
||||
}
|
||||
}
|
||||
@@ -414,7 +416,7 @@ _mesa_Accum( GLenum op, GLfloat value )
|
||||
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
|
||||
}
|
||||
(*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
|
||||
(const GLubyte (*)[4])rgba, NULL );
|
||||
(const GLchan (*)[4])rgba, NULL );
|
||||
ypos++;
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: attrib.c,v 1.28 2000/09/28 22:44:30 brianp Exp $ */
|
||||
/* $Id: attrib.c,v 1.29 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.5
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -568,7 +568,7 @@ _mesa_PopAttrib(void)
|
||||
{
|
||||
GLenum oldDrawBuffer = ctx->Color.DrawBuffer;
|
||||
GLenum oldAlphaFunc = ctx->Color.AlphaFunc;
|
||||
GLubyte oldAlphaRef = ctx->Color.AlphaRef;
|
||||
GLchan oldAlphaRef = ctx->Color.AlphaRef;
|
||||
GLenum oldBlendSrc = ctx->Color.BlendSrcRGB;
|
||||
GLenum oldBlendDst = ctx->Color.BlendDstRGB;
|
||||
GLenum oldLogicOp = ctx->Color.LogicOp;
|
||||
@@ -587,16 +587,16 @@ _mesa_PopAttrib(void)
|
||||
ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
|
||||
}
|
||||
if (ctx->Visual.RGBAflag) {
|
||||
GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
|
||||
GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
|
||||
GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
|
||||
GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
|
||||
GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
|
||||
GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
|
||||
GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
|
||||
GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
|
||||
(*ctx->Driver.ClearColor)( ctx, r, g, b, a );
|
||||
if ((ctx->Color.AlphaFunc != oldAlphaFunc ||
|
||||
ctx->Color.AlphaRef != oldAlphaRef) &&
|
||||
ctx->Driver.AlphaFunc)
|
||||
(*ctx->Driver.AlphaFunc)( ctx, ctx->Color.AlphaFunc,
|
||||
ctx->Color.AlphaRef / 255.0F);
|
||||
ctx->Color.AlphaRef / CHAN_MAXF);
|
||||
if (ctx->Driver.ColorMask) {
|
||||
(*ctx->Driver.ColorMask)(ctx,
|
||||
ctx->Color.ColorMask[0],
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: blend.c,v 1.20 2000/10/23 00:16:28 gareth Exp $ */
|
||||
/* $Id: blend.c,v 1.21 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -332,7 +332,7 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
|
||||
*/
|
||||
static void _BLENDAPI
|
||||
blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
GLubyte rgba[][4], CONST GLubyte dest[][4] )
|
||||
GLchan rgba[][4], CONST GLchan dest[][4] )
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(ctx->Color.BlendEquation==GL_FUNC_ADD_EXT);
|
||||
@@ -342,7 +342,7 @@ blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
|
||||
for (i=0;i<n;i++) {
|
||||
if (mask[i]) {
|
||||
const GLint t = rgba[i][ACOMP]; /* t in [0,255] */
|
||||
const GLint t = rgba[i][ACOMP]; /* t in [0, CHAN_MAX] */
|
||||
if (t == 0) {
|
||||
/* 0% alpha */
|
||||
rgba[i][RCOMP] = dest[i][RCOMP];
|
||||
@@ -371,7 +371,11 @@ blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
#else
|
||||
/* This satisfies Glean and should be reasonably fast */
|
||||
/* Contributed by Nathan Hand */
|
||||
#if CHAN_BITS == 8
|
||||
#define DIV255(X) (((X) << 8) + (X) + 256) >> 16
|
||||
#else
|
||||
XXX todo
|
||||
#endif
|
||||
const GLint s = CHAN_MAX - t;
|
||||
const GLint r = DIV255(rgba[i][RCOMP] * t + dest[i][RCOMP] * s);
|
||||
const GLint g = DIV255(rgba[i][GCOMP] * t + dest[i][GCOMP] * s);
|
||||
@@ -383,10 +387,10 @@ blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
ASSERT(g <= CHAN_MAX);
|
||||
ASSERT(b <= CHAN_MAX);
|
||||
ASSERT(a <= CHAN_MAX);
|
||||
rgba[i][RCOMP] = (GLubyte) r;
|
||||
rgba[i][GCOMP] = (GLubyte) g;
|
||||
rgba[i][BCOMP] = (GLubyte) b;
|
||||
rgba[i][ACOMP] = (GLubyte) a;
|
||||
rgba[i][RCOMP] = (GLchan) r;
|
||||
rgba[i][GCOMP] = (GLchan) g;
|
||||
rgba[i][BCOMP] = (GLchan) b;
|
||||
rgba[i][ACOMP] = (GLchan) a;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,7 +403,7 @@ blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
*/
|
||||
static void _BLENDAPI
|
||||
blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
GLubyte rgba[][4], CONST GLubyte dest[][4] )
|
||||
GLchan rgba[][4], CONST GLchan dest[][4] )
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(ctx->Color.BlendEquation==GL_FUNC_ADD_EXT);
|
||||
@@ -413,10 +417,10 @@ blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
GLint g = rgba[i][GCOMP] + dest[i][GCOMP];
|
||||
GLint b = rgba[i][BCOMP] + dest[i][BCOMP];
|
||||
GLint a = rgba[i][ACOMP] + dest[i][ACOMP];
|
||||
rgba[i][RCOMP] = (GLubyte) MIN2( r, CHAN_MAX );
|
||||
rgba[i][GCOMP] = (GLubyte) MIN2( g, CHAN_MAX );
|
||||
rgba[i][BCOMP] = (GLubyte) MIN2( b, CHAN_MAX );
|
||||
rgba[i][ACOMP] = (GLubyte) MIN2( a, CHAN_MAX );
|
||||
rgba[i][RCOMP] = (GLchan) MIN2( r, CHAN_MAX );
|
||||
rgba[i][GCOMP] = (GLchan) MIN2( g, CHAN_MAX );
|
||||
rgba[i][BCOMP] = (GLchan) MIN2( b, CHAN_MAX );
|
||||
rgba[i][ACOMP] = (GLchan) MIN2( a, CHAN_MAX );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -428,7 +432,7 @@ blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
*/
|
||||
static void _BLENDAPI
|
||||
blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
GLubyte rgba[][4], CONST GLubyte dest[][4] )
|
||||
GLchan rgba[][4], CONST GLchan dest[][4] )
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(ctx->Color.BlendEquation==GL_MIN_EXT);
|
||||
@@ -436,10 +440,10 @@ blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
|
||||
for (i=0;i<n;i++) {
|
||||
if (mask[i]) {
|
||||
rgba[i][RCOMP] = (GLubyte) MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = (GLubyte) MIN2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = (GLubyte) MIN2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = (GLubyte) MIN2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
rgba[i][RCOMP] = (GLchan) MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = (GLchan) MIN2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = (GLchan) MIN2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = (GLchan) MIN2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -451,7 +455,7 @@ blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
*/
|
||||
static void _BLENDAPI
|
||||
blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
GLubyte rgba[][4], CONST GLubyte dest[][4] )
|
||||
GLchan rgba[][4], CONST GLchan dest[][4] )
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(ctx->Color.BlendEquation==GL_MAX_EXT);
|
||||
@@ -459,10 +463,10 @@ blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
|
||||
for (i=0;i<n;i++) {
|
||||
if (mask[i]) {
|
||||
rgba[i][RCOMP] = (GLubyte) MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = (GLubyte) MAX2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = (GLubyte) MAX2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = (GLubyte) MAX2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
rgba[i][RCOMP] = (GLchan) MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = (GLchan) MAX2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = (GLchan) MAX2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = (GLchan) MAX2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -474,7 +478,7 @@ blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
*/
|
||||
static void _BLENDAPI
|
||||
blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
GLubyte rgba[][4], CONST GLubyte dest[][4] )
|
||||
GLchan rgba[][4], CONST GLchan dest[][4] )
|
||||
{
|
||||
GLuint i;
|
||||
(void) ctx;
|
||||
@@ -485,10 +489,10 @@ blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
GLint g = (rgba[i][GCOMP] * dest[i][GCOMP]) >> 8;
|
||||
GLint b = (rgba[i][BCOMP] * dest[i][BCOMP]) >> 8;
|
||||
GLint a = (rgba[i][ACOMP] * dest[i][ACOMP]) >> 8;
|
||||
rgba[i][RCOMP] = (GLubyte) r;
|
||||
rgba[i][GCOMP] = (GLubyte) g;
|
||||
rgba[i][BCOMP] = (GLubyte) b;
|
||||
rgba[i][ACOMP] = (GLubyte) a;
|
||||
rgba[i][RCOMP] = (GLchan) r;
|
||||
rgba[i][GCOMP] = (GLchan) g;
|
||||
rgba[i][BCOMP] = (GLchan) b;
|
||||
rgba[i][ACOMP] = (GLchan) a;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -504,7 +508,7 @@ blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
*/
|
||||
static void _BLENDAPI
|
||||
blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
GLubyte rgba[][4], CONST GLubyte dest[][4] )
|
||||
GLchan rgba[][4], CONST GLchan dest[][4] )
|
||||
{
|
||||
GLfloat rscale = 1.0F / CHAN_MAXF;
|
||||
GLfloat gscale = 1.0F / CHAN_MAXF;
|
||||
@@ -814,10 +818,10 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
|
||||
}
|
||||
|
||||
/* final clamping */
|
||||
rgba[i][RCOMP] = (GLubyte) (GLint) CLAMP( r, 0.0F, CHAN_MAXF );
|
||||
rgba[i][GCOMP] = (GLubyte) (GLint) CLAMP( g, 0.0F, CHAN_MAXF );
|
||||
rgba[i][BCOMP] = (GLubyte) (GLint) CLAMP( b, 0.0F, CHAN_MAXF );
|
||||
rgba[i][ACOMP] = (GLubyte) (GLint) CLAMP( a, 0.0F, CHAN_MAXF );
|
||||
rgba[i][RCOMP] = (GLchan) (GLint) CLAMP( r, 0.0F, CHAN_MAXF );
|
||||
rgba[i][GCOMP] = (GLchan) (GLint) CLAMP( g, 0.0F, CHAN_MAXF );
|
||||
rgba[i][BCOMP] = (GLchan) (GLint) CLAMP( b, 0.0F, CHAN_MAXF );
|
||||
rgba[i][ACOMP] = (GLchan) (GLint) CLAMP( a, 0.0F, CHAN_MAXF );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -890,9 +894,9 @@ static void set_blend_function( GLcontext *ctx )
|
||||
*/
|
||||
void
|
||||
_mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
GLubyte rgba[][4], const GLubyte mask[] )
|
||||
GLchan rgba[][4], const GLubyte mask[] )
|
||||
{
|
||||
GLubyte dest[MAX_WIDTH][4];
|
||||
GLchan dest[MAX_WIDTH][4];
|
||||
|
||||
/* Check if device driver can do the work */
|
||||
if (ctx->Color.BlendEquation==GL_LOGIC_OP &&
|
||||
@@ -906,7 +910,7 @@ _mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
if (!ctx->Color.BlendFunc)
|
||||
set_blend_function(ctx);
|
||||
|
||||
(*ctx->Color.BlendFunc)( ctx, n, mask, rgba, (const GLubyte (*)[4])dest );
|
||||
(*ctx->Color.BlendFunc)( ctx, n, mask, rgba, (const GLchan (*)[4])dest );
|
||||
}
|
||||
|
||||
|
||||
@@ -921,9 +925,9 @@ _mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
void
|
||||
_mesa_blend_pixels( GLcontext *ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
GLubyte rgba[][4], const GLubyte mask[] )
|
||||
GLchan rgba[][4], const GLchan mask[] )
|
||||
{
|
||||
GLubyte dest[PB_SIZE][4];
|
||||
GLchan dest[PB_SIZE][4];
|
||||
|
||||
/* Check if device driver can do the work */
|
||||
if (ctx->Color.BlendEquation==GL_LOGIC_OP &&
|
||||
@@ -940,5 +944,5 @@ _mesa_blend_pixels( GLcontext *ctx,
|
||||
if (!ctx->Color.BlendFunc)
|
||||
set_blend_function(ctx);
|
||||
|
||||
(*ctx->Color.BlendFunc)( ctx, n, mask, rgba, (const GLubyte (*)[4])dest );
|
||||
(*ctx->Color.BlendFunc)( ctx, n, mask, rgba, (const GLchan (*)[4])dest );
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/* $Id: blend.h,v 1.4 2000/02/24 22:04:03 brianp Exp $ */
|
||||
/* $Id: blend.h,v 1.5 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.5
|
||||
*
|
||||
* Copyright (C) 2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2000 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"),
|
||||
@@ -35,13 +35,13 @@
|
||||
|
||||
extern void
|
||||
_mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
GLubyte rgba[][4], const GLubyte mask[] );
|
||||
GLchan rgba[][4], const GLubyte mask[] );
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_blend_pixels( GLcontext *ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
GLubyte rgba[][4], const GLubyte mask[] );
|
||||
GLchan rgba[][4], const GLubyte mask[] );
|
||||
|
||||
|
||||
extern void
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: buffers.c,v 1.14 2000/10/19 18:17:19 brianp Exp $ */
|
||||
/* $Id: buffers.c,v 1.15 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -72,10 +72,10 @@ _mesa_ClearColor( GLclampf red, GLclampf green,
|
||||
ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F );
|
||||
|
||||
if (ctx->Visual.RGBAflag) {
|
||||
GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
|
||||
GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
|
||||
GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
|
||||
GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
|
||||
GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
|
||||
GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
|
||||
GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
|
||||
GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
|
||||
(*ctx->Driver.ClearColor)( ctx, r, g, b, a );
|
||||
}
|
||||
}
|
||||
@@ -96,13 +96,13 @@ clear_color_buffer_with_masking( GLcontext *ctx )
|
||||
|
||||
if (ctx->Visual.RGBAflag) {
|
||||
/* RGBA mode */
|
||||
const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
|
||||
const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
|
||||
const GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
|
||||
const GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
|
||||
const GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
|
||||
const GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
|
||||
const GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
|
||||
const GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
|
||||
GLint i;
|
||||
for (i = 0; i < height; i++) {
|
||||
GLubyte rgba[MAX_WIDTH][4];
|
||||
GLchan rgba[MAX_WIDTH][4];
|
||||
GLint j;
|
||||
for (j=0; j<width; j++) {
|
||||
rgba[j][RCOMP] = r;
|
||||
@@ -112,7 +112,7 @@ clear_color_buffer_with_masking( GLcontext *ctx )
|
||||
}
|
||||
_mesa_mask_rgba_span( ctx, width, x, y + i, rgba );
|
||||
(*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
|
||||
(CONST GLubyte (*)[4])rgba, NULL );
|
||||
(CONST GLchan (*)[4]) rgba, NULL );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -147,11 +147,11 @@ clear_color_buffer(GLcontext *ctx)
|
||||
|
||||
if (ctx->Visual.RGBAflag) {
|
||||
/* RGBA mode */
|
||||
const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
|
||||
const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
|
||||
const GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
|
||||
const GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
|
||||
GLubyte span[MAX_WIDTH][4];
|
||||
const GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
|
||||
const GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
|
||||
const GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
|
||||
const GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
|
||||
GLchan span[MAX_WIDTH][4];
|
||||
GLint i;
|
||||
|
||||
ASSERT(colorMask == 0xffffffff);
|
||||
@@ -164,7 +164,7 @@ clear_color_buffer(GLcontext *ctx)
|
||||
}
|
||||
for (i = 0; i < height; i++) {
|
||||
(*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
|
||||
(CONST GLubyte (*)[4]) span, NULL );
|
||||
(CONST GLchan (*)[4]) span, NULL );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -172,7 +172,7 @@ clear_color_buffer(GLcontext *ctx)
|
||||
ASSERT(ctx->Color.IndexMask == ~0);
|
||||
if (ctx->Visual.IndexBits == 8) {
|
||||
/* 8-bit clear */
|
||||
GLubyte span[MAX_WIDTH];
|
||||
GLchan span[MAX_WIDTH];
|
||||
GLint i;
|
||||
MEMSET(span, ctx->Color.ClearIndex, width);
|
||||
for (i = 0; i < height; i++) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: colortab.c,v 1.21 2000/08/21 14:23:09 brianp Exp $ */
|
||||
/* $Id: colortab.c,v 1.22 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -102,23 +102,23 @@ base_colortab_format( GLenum format )
|
||||
void
|
||||
_mesa_init_colortable( struct gl_color_table *p )
|
||||
{
|
||||
p->TableType = GL_UNSIGNED_BYTE;
|
||||
p->FloatTable = GL_FALSE;
|
||||
/* allocate a width=1 table by default */
|
||||
p->Table = CALLOC(4 * sizeof(GLubyte));
|
||||
p->Table = CALLOC(4 * sizeof(GLchan));
|
||||
if (p->Table) {
|
||||
GLubyte *t = (GLubyte *) p->Table;
|
||||
t[0] = 255;
|
||||
t[1] = 255;
|
||||
t[2] = 255;
|
||||
t[3] = 255;
|
||||
GLchan *t = (GLchan *) p->Table;
|
||||
t[0] = CHAN_MAX;
|
||||
t[1] = CHAN_MAX;
|
||||
t[2] = CHAN_MAX;
|
||||
t[3] = CHAN_MAX;
|
||||
}
|
||||
p->Size = 1;
|
||||
p->IntFormat = GL_RGBA;
|
||||
p->Format = GL_RGBA;
|
||||
p->RedSize = 8;
|
||||
p->GreenSize = 8;
|
||||
p->BlueSize = 8;
|
||||
p->AlphaSize = 8;
|
||||
p->RedSize = CHAN_BITS;
|
||||
p->GreenSize = CHAN_BITS;
|
||||
p->BlueSize = CHAN_BITS;
|
||||
p->AlphaSize = CHAN_BITS;
|
||||
p->IntensitySize = 0;
|
||||
p->LuminanceSize = 0;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ set_component_sizes( struct gl_color_table *table )
|
||||
table->RedSize = 0;
|
||||
table->GreenSize = 0;
|
||||
table->BlueSize = 0;
|
||||
table->AlphaSize = 8;
|
||||
table->AlphaSize = CHAN_BITS;
|
||||
table->IntensitySize = 0;
|
||||
table->LuminanceSize = 0;
|
||||
break;
|
||||
@@ -156,37 +156,37 @@ set_component_sizes( struct gl_color_table *table )
|
||||
table->BlueSize = 0;
|
||||
table->AlphaSize = 0;
|
||||
table->IntensitySize = 0;
|
||||
table->LuminanceSize = 8;
|
||||
table->LuminanceSize = CHAN_BITS;
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
table->RedSize = 0;
|
||||
table->GreenSize = 0;
|
||||
table->BlueSize = 0;
|
||||
table->AlphaSize = 8;
|
||||
table->AlphaSize = CHAN_BITS;
|
||||
table->IntensitySize = 0;
|
||||
table->LuminanceSize = 8;
|
||||
table->LuminanceSize = CHAN_BITS;
|
||||
break;
|
||||
case GL_INTENSITY:
|
||||
table->RedSize = 0;
|
||||
table->GreenSize = 0;
|
||||
table->BlueSize = 0;
|
||||
table->AlphaSize = 0;
|
||||
table->IntensitySize = 8;
|
||||
table->IntensitySize = CHAN_BITS;
|
||||
table->LuminanceSize = 0;
|
||||
break;
|
||||
case GL_RGB:
|
||||
table->RedSize = 8;
|
||||
table->GreenSize = 8;
|
||||
table->BlueSize = 8;
|
||||
table->RedSize = CHAN_BITS;
|
||||
table->GreenSize = CHAN_BITS;
|
||||
table->BlueSize = CHAN_BITS;
|
||||
table->AlphaSize = 0;
|
||||
table->IntensitySize = 0;
|
||||
table->LuminanceSize = 0;
|
||||
break;
|
||||
case GL_RGBA:
|
||||
table->RedSize = 8;
|
||||
table->GreenSize = 8;
|
||||
table->BlueSize = 8;
|
||||
table->AlphaSize = 8;
|
||||
table->RedSize = CHAN_BITS;
|
||||
table->GreenSize = CHAN_BITS;
|
||||
table->BlueSize = CHAN_BITS;
|
||||
table->AlphaSize = CHAN_BITS;
|
||||
table->IntensitySize = 0;
|
||||
table->LuminanceSize = 0;
|
||||
break;
|
||||
@@ -363,7 +363,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
|
||||
format, type, data, &ctx->Unpack,
|
||||
0, GL_FALSE);
|
||||
|
||||
table->TableType = GL_FLOAT;
|
||||
table->FloatTable = GL_TRUE;
|
||||
table->Table = MALLOC(comps * width * sizeof(GLfloat));
|
||||
if (!table->Table) {
|
||||
gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
|
||||
@@ -415,9 +415,9 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* store GLubyte table */
|
||||
table->TableType = GL_UNSIGNED_BYTE;
|
||||
table->Table = MALLOC(comps * width * sizeof(GLubyte));
|
||||
/* store GLchan table */
|
||||
table->FloatTable = GL_FALSE;
|
||||
table->Table = MALLOC(comps * width * sizeof(GLchan));
|
||||
if (!table->Table) {
|
||||
gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
|
||||
return;
|
||||
@@ -534,8 +534,8 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
|
||||
return;
|
||||
}
|
||||
|
||||
if (table->TableType == GL_UNSIGNED_BYTE) {
|
||||
GLubyte *dest = (GLubyte *) table->Table + start * comps * sizeof(GLubyte);
|
||||
if (!table->FloatTable) {
|
||||
GLchan *dest = (GLchan *) table->Table + start * comps * sizeof(GLchan);
|
||||
_mesa_unpack_ubyte_color_span(ctx, count, table->Format, dest,
|
||||
format, type, data, &ctx->Unpack, 0);
|
||||
}
|
||||
@@ -544,7 +544,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
|
||||
GLfloat *tableF;
|
||||
GLuint i;
|
||||
|
||||
ASSERT(table->TableType == GL_FLOAT);
|
||||
ASSERT(table->FloatTable);
|
||||
|
||||
_mesa_unpack_float_color_span(ctx, count, table->Format,
|
||||
tempTab, /* dest */
|
||||
@@ -617,7 +617,7 @@ void
|
||||
_mesa_CopyColorTable(GLenum target, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width)
|
||||
{
|
||||
GLubyte data[MAX_WIDTH][4];
|
||||
GLchan data[MAX_WIDTH][4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorTable");
|
||||
|
||||
@@ -646,7 +646,7 @@ void
|
||||
_mesa_CopyColorSubTable(GLenum target, GLsizei start,
|
||||
GLint x, GLint y, GLsizei width)
|
||||
{
|
||||
GLubyte data[MAX_WIDTH][4];
|
||||
GLchan data[MAX_WIDTH][4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorSubTable");
|
||||
|
||||
@@ -676,7 +676,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
struct gl_color_table *table = NULL;
|
||||
GLubyte rgba[MAX_COLOR_TABLE_SIZE][4];
|
||||
GLchan rgba[MAX_COLOR_TABLE_SIZE][4];
|
||||
GLint i;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTable");
|
||||
@@ -712,17 +712,17 @@ _mesa_GetColorTable( GLenum target, GLenum format,
|
||||
|
||||
switch (table->Format) {
|
||||
case GL_ALPHA:
|
||||
if (table->TableType == GL_FLOAT) {
|
||||
if (table->FloatTable) {
|
||||
const GLfloat *tableF = (const GLfloat *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = 0;
|
||||
rgba[i][GCOMP] = 0;
|
||||
rgba[i][BCOMP] = 0;
|
||||
rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F);
|
||||
rgba[i][ACOMP] = (GLint) (tableF[i] * CHAN_MAXF);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const GLubyte *tableUB = (const GLubyte *) table->Table;
|
||||
const GLchan *tableUB = (const GLchan *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = 0;
|
||||
rgba[i][GCOMP] = 0;
|
||||
@@ -732,37 +732,37 @@ _mesa_GetColorTable( GLenum target, GLenum format,
|
||||
}
|
||||
break;
|
||||
case GL_LUMINANCE:
|
||||
if (table->TableType == GL_FLOAT) {
|
||||
if (table->FloatTable) {
|
||||
const GLfloat *tableF = (const GLfloat *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F);
|
||||
rgba[i][ACOMP] = 255;
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
|
||||
rgba[i][ACOMP] = CHAN_MAX;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const GLubyte *tableUB = (const GLubyte *) table->Table;
|
||||
const GLchan *tableUB = (const GLchan *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = tableUB[i];
|
||||
rgba[i][GCOMP] = tableUB[i];
|
||||
rgba[i][BCOMP] = tableUB[i];
|
||||
rgba[i][ACOMP] = 255;
|
||||
rgba[i][ACOMP] = CHAN_MAX;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
if (table->TableType == GL_FLOAT) {
|
||||
if (table->FloatTable) {
|
||||
const GLfloat *tableF = (const GLfloat *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i*2+0] * 255.0F);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i*2+0] * 255.0F);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i*2+0] * 255.0F);
|
||||
rgba[i][ACOMP] = (GLint) (tableF[i*2+1] * 255.0F);
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i*2+0] * CHAN_MAXF);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i*2+0] * CHAN_MAXF);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i*2+0] * CHAN_MAXF);
|
||||
rgba[i][ACOMP] = (GLint) (tableF[i*2+1] * CHAN_MAXF);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const GLubyte *tableUB = (const GLubyte *) table->Table;
|
||||
const GLchan *tableUB = (const GLchan *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = tableUB[i*2+0];
|
||||
rgba[i][GCOMP] = tableUB[i*2+0];
|
||||
@@ -772,17 +772,17 @@ _mesa_GetColorTable( GLenum target, GLenum format,
|
||||
}
|
||||
break;
|
||||
case GL_INTENSITY:
|
||||
if (table->TableType == GL_FLOAT) {
|
||||
if (table->FloatTable) {
|
||||
const GLfloat *tableF = (const GLfloat *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F);
|
||||
rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F);
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
|
||||
rgba[i][ACOMP] = (GLint) (tableF[i] * CHAN_MAXF);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const GLubyte *tableUB = (const GLubyte *) table->Table;
|
||||
const GLchan *tableUB = (const GLchan *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = tableUB[i];
|
||||
rgba[i][GCOMP] = tableUB[i];
|
||||
@@ -792,37 +792,37 @@ _mesa_GetColorTable( GLenum target, GLenum format,
|
||||
}
|
||||
break;
|
||||
case GL_RGB:
|
||||
if (table->TableType == GL_FLOAT) {
|
||||
if (table->FloatTable) {
|
||||
const GLfloat *tableF = (const GLfloat *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i*3+0] * 255.0F);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i*3+1] * 255.0F);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i*3+2] * 255.0F);
|
||||
rgba[i][ACOMP] = 255;
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i*3+0] * CHAN_MAXF);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i*3+1] * CHAN_MAXF);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i*3+2] * CHAN_MAXF);
|
||||
rgba[i][ACOMP] = CHAN_MAX;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const GLubyte *tableUB = (const GLubyte *) table->Table;
|
||||
const GLchan *tableUB = (const GLchan *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = tableUB[i*3+0];
|
||||
rgba[i][GCOMP] = tableUB[i*3+1];
|
||||
rgba[i][BCOMP] = tableUB[i*3+2];
|
||||
rgba[i][ACOMP] = 255;
|
||||
rgba[i][ACOMP] = CHAN_MAX;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_RGBA:
|
||||
if (table->TableType == GL_FLOAT) {
|
||||
if (table->FloatTable) {
|
||||
const GLfloat *tableF = (const GLfloat *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i*4+0] * 255.0F + 0.5F);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i*4+1] * 255.0F + 0.5F);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i*4+2] * 255.0F + 0.5F);
|
||||
rgba[i][ACOMP] = (GLint) (tableF[i*4+3] * 255.0F + 0.5F);
|
||||
rgba[i][RCOMP] = (GLint) (tableF[i*4+0] * CHAN_MAXF + 0.5F);
|
||||
rgba[i][GCOMP] = (GLint) (tableF[i*4+1] * CHAN_MAXF + 0.5F);
|
||||
rgba[i][BCOMP] = (GLint) (tableF[i*4+2] * CHAN_MAXF + 0.5F);
|
||||
rgba[i][ACOMP] = (GLint) (tableF[i*4+3] * CHAN_MAXF + 0.5F);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const GLubyte *tableUB = (const GLubyte *) table->Table;
|
||||
const GLchan *tableUB = (const GLchan *) table->Table;
|
||||
for (i = 0; i < table->Size; i++) {
|
||||
rgba[i][RCOMP] = tableUB[i*4+0];
|
||||
rgba[i][GCOMP] = tableUB[i*4+1];
|
||||
@@ -836,7 +836,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
|
||||
return;
|
||||
}
|
||||
|
||||
_mesa_pack_rgba_span(ctx, table->Size, (const GLubyte (*)[]) rgba,
|
||||
_mesa_pack_rgba_span(ctx, table->Size, (const GLchan (*)[]) rgba,
|
||||
format, type, data, &ctx->Pack, GL_FALSE);
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: config.h,v 1.19 2000/10/26 19:26:18 brianp Exp $ */
|
||||
/* $Id: config.h,v 1.20 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -164,6 +164,16 @@
|
||||
#define CHAN_BITS 8
|
||||
#define CHAN_MAX ((1 << CHAN_BITS) - 1)
|
||||
#define CHAN_MAXF ((GLfloat) CHAN_MAX)
|
||||
#if CHAN_BITS == 8
|
||||
typedef GLubyte GLchan;
|
||||
#elif CHAN_BITS == 16
|
||||
typedef GLushort GLchan;
|
||||
#else
|
||||
#error illegal number of color channel bits
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: context.c,v 1.96 2000/10/27 16:44:40 keithw Exp $ */
|
||||
/* $Id: context.c,v 1.97 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -884,7 +884,7 @@ init_attrib_groups( GLcontext *ctx )
|
||||
ctx->Color.MultiDrawBuffer = GL_FALSE;
|
||||
|
||||
/* Current group */
|
||||
ASSIGN_4V( ctx->Current.ByteColor, 255, 255, 255, 255);
|
||||
ASSIGN_4V( ctx->Current.ByteColor, CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX );
|
||||
ctx->Current.Index = 1;
|
||||
for (i=0; i<MAX_TEXTURE_UNITS; i++)
|
||||
ASSIGN_4V( ctx->Current.Texcoord[i], 0.0, 0.0, 0.0, 1.0 );
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: convolve.c,v 1.5 2000/09/05 20:28:56 brianp Exp $ */
|
||||
/* $Id: convolve.c,v 1.6 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -472,7 +472,7 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi
|
||||
}
|
||||
|
||||
/* read pixels from framebuffer */
|
||||
gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y, (GLubyte (*)[4]) rgba);
|
||||
gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y, (GLchan (*)[4]) rgba);
|
||||
|
||||
/* store as convolution filter */
|
||||
_mesa_ConvolutionFilter1D(target, internalFormat, width,
|
||||
@@ -513,7 +513,7 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi
|
||||
/* read pixels from framebuffer */
|
||||
for (i = 0; i < height; i++) {
|
||||
gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y + i,
|
||||
(GLubyte (*)[4]) rgba[i]);
|
||||
(GLchan (*)[4]) rgba[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: dd.h,v 1.33 2000/09/28 18:30:39 brianp Exp $ */
|
||||
/* $Id: dd.h,v 1.34 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -158,8 +158,8 @@ struct dd_function_table {
|
||||
* the color buffer when in color index mode.
|
||||
*/
|
||||
|
||||
void (*ClearColor)( GLcontext *ctx, GLubyte red, GLubyte green,
|
||||
GLubyte blue, GLubyte alpha );
|
||||
void (*ClearColor)( GLcontext *ctx, GLchan red, GLchan green,
|
||||
GLchan blue, GLchan alpha );
|
||||
/*
|
||||
* Called whenever glClearColor() is called. Set the color for clearing
|
||||
* the color buffer when in RGBA mode.
|
||||
@@ -185,7 +185,7 @@ struct dd_function_table {
|
||||
*/
|
||||
|
||||
void (*Color)( GLcontext *ctx,
|
||||
GLubyte red, GLubyte green, GLubyte glue, GLubyte alpha );
|
||||
GLchan red, GLchan green, GLchan glue, GLchan alpha );
|
||||
/*
|
||||
* Sets current color for drawing flat-shaded primitives.
|
||||
* This color should also be used in the "mono" drawing functions.
|
||||
@@ -234,10 +234,10 @@ struct dd_function_table {
|
||||
|
||||
void (*WriteRGBASpan)( const GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
CONST GLubyte rgba[][4], const GLubyte mask[] );
|
||||
CONST GLchan rgba[][4], const GLubyte mask[] );
|
||||
void (*WriteRGBSpan)( const GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
CONST GLubyte rgb[][3], const GLubyte mask[] );
|
||||
CONST GLchan rgb[][3], const GLubyte mask[] );
|
||||
/* Write a horizontal run of RGBA or RGB pixels.
|
||||
* If mask is NULL, draw all pixels.
|
||||
* If mask is not null, only draw pixel [i] when mask [i] is true.
|
||||
@@ -251,7 +251,7 @@ struct dd_function_table {
|
||||
|
||||
void (*WriteRGBAPixels)( const GLcontext *ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
CONST GLubyte rgba[][4], const GLubyte mask[] );
|
||||
CONST GLchan rgba[][4], const GLubyte mask[] );
|
||||
/* Write array of RGBA pixels at random locations.
|
||||
*/
|
||||
|
||||
@@ -301,7 +301,7 @@ struct dd_function_table {
|
||||
*/
|
||||
|
||||
void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
GLubyte rgba[][4] );
|
||||
GLchan rgba[][4] );
|
||||
/* Read a horizontal run of RGBA pixels.
|
||||
*/
|
||||
|
||||
@@ -313,7 +313,7 @@ struct dd_function_table {
|
||||
|
||||
void (*ReadRGBAPixels)( const GLcontext *ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
GLubyte rgba[][4], const GLubyte mask[] );
|
||||
GLchan rgba[][4], const GLubyte mask[] );
|
||||
/* Read a random array of RGBA pixels.
|
||||
*/
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: feedback.c,v 1.11 2000/09/26 20:53:53 brianp Exp $ */
|
||||
/* $Id: feedback.c,v 1.12 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -174,7 +174,7 @@ static void feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv )
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH)
|
||||
pv = v;
|
||||
|
||||
UBYTE_RGBA_TO_FLOAT_RGBA( color, VB->ColorPtr->data[pv] );
|
||||
CHAN_RGBA_TO_FLOAT_RGBA( color, VB->ColorPtr->data[pv] );
|
||||
|
||||
if (VB->TexCoordPtr[texUnit]->size == 4 &&
|
||||
VB->TexCoordPtr[texUnit]->data[v][3] != 0.0) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: fog.c,v 1.23 2000/10/28 11:42:12 keithw Exp $ */
|
||||
/* $Id: fog.c,v 1.24 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -261,11 +261,11 @@ void
|
||||
_mesa_fog_rgba_pixels( const GLcontext *ctx,
|
||||
GLuint n,
|
||||
const GLfixed fog[],
|
||||
GLubyte rgba[][4] )
|
||||
GLchan rgba[][4] )
|
||||
{
|
||||
GLfixed rFog = ctx->Fog.Color[0] * 255.0;
|
||||
GLfixed gFog = ctx->Fog.Color[1] * 255.0;
|
||||
GLfixed bFog = ctx->Fog.Color[2] * 255.0;
|
||||
GLfixed rFog = ctx->Fog.Color[0] * CHAN_MAXF;
|
||||
GLfixed gFog = ctx->Fog.Color[1] * CHAN_MAXF;
|
||||
GLfixed bFog = ctx->Fog.Color[2] * CHAN_MAXF;
|
||||
GLuint i;
|
||||
|
||||
for (i=0;i<n;i++) {
|
||||
@@ -378,7 +378,7 @@ _mesa_win_fog_coords_from_z( const GLcontext *ctx,
|
||||
*/
|
||||
void
|
||||
_mesa_depth_fog_rgba_pixels( const GLcontext *ctx,
|
||||
GLuint n, const GLdepth z[], GLubyte rgba[][4] )
|
||||
GLuint n, const GLdepth z[], GLchan rgba[][4] )
|
||||
{
|
||||
GLfixed fog[MAX_WIDTH];
|
||||
_mesa_win_fog_coords_from_z( ctx, n, z, fog );
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: fog.h,v 1.6 2000/10/27 18:31:22 brianp Exp $ */
|
||||
/* $Id: fog.h,v 1.7 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -53,7 +53,7 @@ _mesa_Fogiv(GLenum pname, const GLint *params );
|
||||
extern void
|
||||
_mesa_fog_rgba_pixels( const GLcontext *ctx,
|
||||
GLuint n, const GLfixed fog[],
|
||||
GLubyte rgba[][4] );
|
||||
GLchan rgba[][4] );
|
||||
|
||||
extern void
|
||||
_mesa_fog_ci_pixels( const GLcontext *ctx,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: get.c,v 1.35 2000/10/27 16:44:40 keithw Exp $ */
|
||||
/* $Id: get.c,v 1.36 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -138,7 +138,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
||||
*params = ENUM_TO_BOOL(ctx->Color.AlphaFunc);
|
||||
break;
|
||||
case GL_ALPHA_TEST_REF:
|
||||
*params = FLOAT_TO_BOOL((GLfloat) ctx->Color.AlphaRef / 255.0);
|
||||
*params = FLOAT_TO_BOOL((GLfloat) ctx->Color.AlphaRef / CHAN_MAXF);
|
||||
break;
|
||||
case GL_ATTRIB_STACK_DEPTH:
|
||||
*params = INT_TO_BOOL(ctx->AttribStackDepth);
|
||||
@@ -1329,7 +1329,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
||||
*params = ENUM_TO_DOUBLE(ctx->Color.AlphaFunc);
|
||||
break;
|
||||
case GL_ALPHA_TEST_REF:
|
||||
*params = (GLdouble) ctx->Color.AlphaRef / 255.0;
|
||||
*params = (GLdouble) ctx->Color.AlphaRef / CHAN_MAXF;
|
||||
break;
|
||||
case GL_ATTRIB_STACK_DEPTH:
|
||||
*params = (GLdouble ) (ctx->AttribStackDepth);
|
||||
@@ -1418,10 +1418,10 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
||||
*params = ENUM_TO_DOUBLE(ctx->Polygon.CullFaceMode);
|
||||
break;
|
||||
case GL_CURRENT_COLOR:
|
||||
params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[0]);
|
||||
params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[1]);
|
||||
params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[2]);
|
||||
params[3] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[3]);
|
||||
params[0] = CHAN_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[0]);
|
||||
params[1] = CHAN_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[1]);
|
||||
params[2] = CHAN_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[2]);
|
||||
params[3] = CHAN_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[3]);
|
||||
break;
|
||||
case GL_CURRENT_INDEX:
|
||||
*params = (GLdouble) ctx->Current.Index;
|
||||
@@ -2521,7 +2521,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
||||
*params = ENUM_TO_FLOAT(ctx->Color.AlphaFunc);
|
||||
break;
|
||||
case GL_ALPHA_TEST_REF:
|
||||
*params = (GLfloat) ctx->Color.AlphaRef / 255.0;
|
||||
*params = (GLfloat) ctx->Color.AlphaRef / CHAN_MAXF;
|
||||
break;
|
||||
case GL_ATTRIB_STACK_DEPTH:
|
||||
*params = (GLfloat) (ctx->AttribStackDepth);
|
||||
@@ -2610,7 +2610,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
||||
*params = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);
|
||||
break;
|
||||
case GL_CURRENT_COLOR:
|
||||
UBYTE_RGBA_TO_FLOAT_RGBA(params, ctx->Current.ByteColor);
|
||||
CHAN_RGBA_TO_FLOAT_RGBA(params, ctx->Current.ByteColor);
|
||||
break;
|
||||
case GL_CURRENT_INDEX:
|
||||
*params = (GLfloat) ctx->Current.Index;
|
||||
@@ -3682,7 +3682,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
||||
*params = (GLint) ctx->Color.AlphaEnabled;
|
||||
break;
|
||||
case GL_ALPHA_TEST_REF:
|
||||
*params = FLOAT_TO_INT( (GLfloat) ctx->Color.AlphaRef / 255.0 );
|
||||
*params = FLOAT_TO_INT( (GLfloat) ctx->Color.AlphaRef / CHAN_MAXF );
|
||||
break;
|
||||
case GL_ALPHA_TEST_FUNC:
|
||||
*params = (GLint) ctx->Color.AlphaFunc;
|
||||
@@ -3775,10 +3775,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
||||
*params = (GLint) ctx->Polygon.CullFaceMode;
|
||||
break;
|
||||
case GL_CURRENT_COLOR:
|
||||
params[0] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[0] ) );
|
||||
params[1] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[1] ) );
|
||||
params[2] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[2] ) );
|
||||
params[3] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[3] ) );
|
||||
params[0] = FLOAT_TO_INT( CHAN_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[0] ) );
|
||||
params[1] = FLOAT_TO_INT( CHAN_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[1] ) );
|
||||
params[2] = FLOAT_TO_INT( CHAN_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[2] ) );
|
||||
params[3] = FLOAT_TO_INT( CHAN_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[3] ) );
|
||||
break;
|
||||
case GL_CURRENT_INDEX:
|
||||
*params = (GLint) ctx->Current.Index;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: light.c,v 1.18 2000/10/27 16:44:40 keithw Exp $ */
|
||||
/* $Id: light.c,v 1.19 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.5
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -685,7 +685,7 @@ void gl_update_material( GLcontext *ctx,
|
||||
* set by glColorMaterial().
|
||||
*/
|
||||
void gl_update_color_material( GLcontext *ctx,
|
||||
const GLubyte rgba[4] )
|
||||
const GLchan rgba[4] )
|
||||
{
|
||||
struct gl_light *light, *list = &ctx->Light.EnabledList;
|
||||
GLuint bitmask = ctx->Light.ColorMaterialBitmask;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: light.h,v 1.3 2000/06/26 23:37:46 brianp Exp $ */
|
||||
/* $Id: light.h,v 1.4 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 3.5
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -118,7 +118,7 @@ extern void gl_update_material( GLcontext *ctx,
|
||||
const struct gl_material src[2],
|
||||
GLuint bitmask );
|
||||
|
||||
extern void gl_update_color_material( GLcontext *ctx, const GLubyte rgba[4] );
|
||||
extern void gl_update_color_material( GLcontext *ctx, const GLchan rgba[4] );
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: lines.c,v 1.17 2000/10/27 16:44:40 keithw Exp $ */
|
||||
/* $Id: lines.c,v 1.18 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -149,7 +149,7 @@ static void flat_ci_z_line( GLcontext *ctx,
|
||||
static void flat_rgba_line( GLcontext *ctx,
|
||||
GLuint vert0, GLuint vert1, GLuint pvert )
|
||||
{
|
||||
const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
|
||||
const GLchan *color = ctx->VB->ColorPtr->data[pvert];
|
||||
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
|
||||
|
||||
#define INTERP_XY 1
|
||||
@@ -166,7 +166,7 @@ static void flat_rgba_line( GLcontext *ctx,
|
||||
static void flat_rgba_z_line( GLcontext *ctx,
|
||||
GLuint vert0, GLuint vert1, GLuint pvert )
|
||||
{
|
||||
const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
|
||||
const GLchan *color = ctx->VB->ColorPtr->data[pvert];
|
||||
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
|
||||
|
||||
#define INTERP_XY 1
|
||||
@@ -248,7 +248,7 @@ static void smooth_rgba_line( GLcontext *ctx,
|
||||
GLint count = ctx->PB->count;
|
||||
GLint *pbx = ctx->PB->x;
|
||||
GLint *pby = ctx->PB->y;
|
||||
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
|
||||
GLchan (*pbrgba)[4] = ctx->PB->rgba;
|
||||
(void) pvert;
|
||||
|
||||
ctx->PB->mono = GL_FALSE;
|
||||
@@ -283,7 +283,8 @@ static void smooth_rgba_z_line( GLcontext *ctx,
|
||||
GLint *pby = ctx->PB->y;
|
||||
GLdepth *pbz = ctx->PB->z;
|
||||
GLfixed *pbfog = ctx->PB->fog;
|
||||
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
|
||||
GLchan (*pbrgba)[4] = ctx->PB->rgba;
|
||||
|
||||
(void) pvert;
|
||||
|
||||
ctx->PB->mono = GL_FALSE;
|
||||
@@ -478,7 +479,8 @@ static void general_smooth_rgba_line( GLcontext *ctx,
|
||||
GLint *pby = ctx->PB->y;
|
||||
GLdepth *pbz = ctx->PB->z;
|
||||
GLfixed *pbfog = ctx->PB->fog;
|
||||
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
|
||||
GLchan (*pbrgba)[4] = ctx->PB->rgba;
|
||||
|
||||
(void) pvert;
|
||||
|
||||
ctx->PB->mono = GL_FALSE;
|
||||
@@ -574,7 +576,7 @@ static void general_smooth_rgba_line( GLcontext *ctx,
|
||||
static void general_flat_rgba_line( GLcontext *ctx,
|
||||
GLuint vert0, GLuint vert1, GLuint pvert )
|
||||
{
|
||||
const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
|
||||
const GLchan *color = ctx->VB->ColorPtr->data[pvert];
|
||||
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
|
||||
|
||||
if (ctx->Line.StippleFlag) {
|
||||
@@ -624,7 +626,7 @@ static void flat_textured_line( GLcontext *ctx,
|
||||
GLfloat *pbs = ctx->PB->s[0];
|
||||
GLfloat *pbt = ctx->PB->t[0];
|
||||
GLfloat *pbu = ctx->PB->u[0];
|
||||
GLubyte *color = ctx->VB->ColorPtr->data[pv];
|
||||
GLchan *color = ctx->VB->ColorPtr->data[pv];
|
||||
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
|
||||
count = ctx->PB->count;
|
||||
|
||||
@@ -688,7 +690,7 @@ static void smooth_textured_line( GLcontext *ctx,
|
||||
GLfloat *pbs = ctx->PB->s[0];
|
||||
GLfloat *pbt = ctx->PB->t[0];
|
||||
GLfloat *pbu = ctx->PB->u[0];
|
||||
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
|
||||
GLchan (*pbrgba)[4] = ctx->PB->rgba;
|
||||
(void) pvert;
|
||||
|
||||
ctx->PB->mono = GL_FALSE;
|
||||
@@ -763,8 +765,9 @@ static void smooth_multitextured_line( GLcontext *ctx,
|
||||
GLint *pby = ctx->PB->y;
|
||||
GLdepth *pbz = ctx->PB->z;
|
||||
GLfixed *pbfog = ctx->PB->fog;
|
||||
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
|
||||
GLubyte (*pbspec)[3] = ctx->PB->spec;
|
||||
GLchan (*pbrgba)[4] = ctx->PB->rgba;
|
||||
GLchan (*pbspec)[3] = ctx->PB->spec;
|
||||
|
||||
(void) pvert;
|
||||
|
||||
ctx->PB->mono = GL_FALSE;
|
||||
@@ -859,12 +862,12 @@ static void flat_multitextured_line( GLcontext *ctx,
|
||||
GLint *pby = ctx->PB->y;
|
||||
GLdepth *pbz = ctx->PB->z;
|
||||
GLfixed *pbfog = ctx->PB->fog;
|
||||
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
|
||||
GLubyte (*pbspec)[3] = ctx->PB->spec;
|
||||
GLubyte *color = ctx->VB->ColorPtr->data[pvert];
|
||||
GLubyte sRed = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][0] : 0;
|
||||
GLubyte sGreen = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][1] : 0;
|
||||
GLubyte sBlue = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][2] : 0;
|
||||
GLchan (*pbrgba)[4] = ctx->PB->rgba;
|
||||
GLchan (*pbspec)[3] = ctx->PB->spec;
|
||||
GLchan *color = ctx->VB->ColorPtr->data[pvert];
|
||||
GLchan sRed = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][0] : 0;
|
||||
GLchan sGreen = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][1] : 0;
|
||||
GLchan sBlue = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][2] : 0;
|
||||
|
||||
(void) pvert;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: macros.h,v 1.9 2000/09/17 21:56:07 brianp Exp $ */
|
||||
/* $Id: macros.h,v 1.10 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -368,6 +368,9 @@ do { \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC)
|
||||
|
||||
|
||||
/* Assign scalers to short vectors: */
|
||||
#define ASSIGN_2V( V, V0, V1 ) \
|
||||
do { \
|
||||
@@ -500,4 +503,7 @@ do { \
|
||||
#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) )
|
||||
|
||||
|
||||
/* XXX chan fix me */
|
||||
#define CHAN_TO_FLOAT(C) ( (GLfloat) ((C) * (1.0 / CHAN_MAXF)) )
|
||||
|
||||
#endif
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: pixel.c,v 1.13 2000/10/19 20:09:47 brianp Exp $ */
|
||||
/* $Id: pixel.c,v 1.14 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -745,14 +745,14 @@ void
|
||||
_mesa_lookup_rgba(const struct gl_color_table *table,
|
||||
GLuint n, GLfloat rgba[][4])
|
||||
{
|
||||
ASSERT(table->TableType == GL_FLOAT);
|
||||
ASSERT(table->FloatTable);
|
||||
if (!table->Table)
|
||||
return;
|
||||
|
||||
switch (table->Format) {
|
||||
case GL_INTENSITY:
|
||||
/* replace RGBA with I */
|
||||
if (table->TableType == GL_UNSIGNED_BYTE) {
|
||||
if (!table->FloatTable) {
|
||||
const GLfloat scale = (GLfloat) (table->Size - 1);
|
||||
const GLubyte *lut = (const GLubyte *) table->Table;
|
||||
GLuint i;
|
||||
@@ -778,7 +778,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
|
||||
break;
|
||||
case GL_LUMINANCE:
|
||||
/* replace RGB with L */
|
||||
if (table->TableType == GL_UNSIGNED_BYTE) {
|
||||
if (!table->FloatTable) {
|
||||
const GLfloat scale = (GLfloat) (table->Size - 1);
|
||||
const GLubyte *lut = (const GLubyte *) table->Table;
|
||||
GLuint i;
|
||||
@@ -801,7 +801,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
|
||||
break;
|
||||
case GL_ALPHA:
|
||||
/* replace A with A */
|
||||
if (table->TableType == GL_UNSIGNED_BYTE) {
|
||||
if (!table->FloatTable) {
|
||||
const GLfloat scale = (GLfloat) (table->Size - 1);
|
||||
const GLubyte *lut = (const GLubyte *) table->Table;
|
||||
GLuint i;
|
||||
@@ -822,7 +822,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
/* replace RGBA with LLLA */
|
||||
if (table->TableType == GL_UNSIGNED_BYTE) {
|
||||
if (!table->FloatTable) {
|
||||
const GLfloat scale = (GLfloat) (table->Size - 1);
|
||||
const GLubyte *lut = (const GLubyte *) table->Table;
|
||||
GLuint i;
|
||||
@@ -851,7 +851,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
|
||||
break;
|
||||
case GL_RGB:
|
||||
/* replace RGB with RGB */
|
||||
if (table->TableType == GL_UNSIGNED_BYTE) {
|
||||
if (!table->FloatTable) {
|
||||
const GLfloat scale = (GLfloat) (table->Size - 1);
|
||||
const GLubyte *lut = (const GLubyte *) table->Table;
|
||||
GLuint i;
|
||||
@@ -880,7 +880,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
|
||||
break;
|
||||
case GL_RGBA:
|
||||
/* replace RGBA with RGBA */
|
||||
if (table->TableType == GL_UNSIGNED_BYTE) {
|
||||
if (!table->FloatTable) {
|
||||
const GLfloat scale = (GLfloat) (table->Size - 1);
|
||||
const GLubyte *lut = (const GLubyte *) table->Table;
|
||||
GLuint i;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: points.c,v 1.16 2000/10/27 16:44:41 keithw Exp $ */
|
||||
/* $Id: points.c,v 1.17 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -825,8 +825,7 @@ dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
|
||||
GLint y = (GLint) VB->Win.data[i][1];
|
||||
GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
|
||||
GLfloat dsize=psize*dist[i];
|
||||
GLubyte alpha;
|
||||
|
||||
GLchan alpha;
|
||||
GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
|
||||
|
||||
if (dsize >= ctx->Point.Threshold) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: rastpos.c,v 1.8 2000/09/30 18:42:29 brianp Exp $ */
|
||||
/* $Id: rastpos.c,v 1.9 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -91,8 +91,8 @@ static void raster_pos4f( GLcontext *ctx,
|
||||
else {
|
||||
/* use current color or index */
|
||||
if (ctx->Visual.RGBAflag) {
|
||||
UBYTE_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor,
|
||||
ctx->Current.ByteColor);
|
||||
CHAN_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor,
|
||||
ctx->Current.ByteColor);
|
||||
}
|
||||
else {
|
||||
ctx->Current.RasterIndex = ctx->Current.Index;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: teximage.c,v 1.52 2000/10/16 23:43:12 brianp Exp $ */
|
||||
/* $Id: teximage.c,v 1.53 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -988,7 +988,7 @@ make_null_texture( struct gl_texture_image *texImage )
|
||||
GLint srcRow = 7 - i % 8;
|
||||
for (j = 0; j < texImage->Width; j++) {
|
||||
GLint srcCol = j % 32;
|
||||
GLint texel = (message[srcRow][srcCol]=='X') ? 255 : 70;
|
||||
GLint texel = (message[srcRow][srcCol]=='X') ? CHAN_MAX : 70;
|
||||
for (k=0;k<components;k++) {
|
||||
*imgPtr++ = (GLubyte) texel;
|
||||
}
|
||||
@@ -2321,9 +2321,9 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
|
||||
case GL_ALPHA:
|
||||
src = texImage->Data + row * width * sizeof(GLubyte);
|
||||
for (i = 0; i < width; i++) {
|
||||
rgba[i][RCOMP] = 255;
|
||||
rgba[i][GCOMP] = 255;
|
||||
rgba[i][BCOMP] = 255;
|
||||
rgba[i][RCOMP] = CHAN_MAX;
|
||||
rgba[i][GCOMP] = CHAN_MAX;
|
||||
rgba[i][BCOMP] = CHAN_MAX;
|
||||
rgba[i][ACOMP] = src[i];
|
||||
}
|
||||
break;
|
||||
@@ -2333,7 +2333,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
|
||||
rgba[i][RCOMP] = src[i];
|
||||
rgba[i][GCOMP] = src[i];
|
||||
rgba[i][BCOMP] = src[i];
|
||||
rgba[i][ACOMP] = 255;
|
||||
rgba[i][ACOMP] = CHAN_MAX;
|
||||
}
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
@@ -2351,7 +2351,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
|
||||
rgba[i][RCOMP] = src[i];
|
||||
rgba[i][GCOMP] = src[i];
|
||||
rgba[i][BCOMP] = src[i];
|
||||
rgba[i][ACOMP] = 255;
|
||||
rgba[i][ACOMP] = CHAN_MAX;
|
||||
}
|
||||
break;
|
||||
case GL_RGB:
|
||||
@@ -2360,7 +2360,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
|
||||
rgba[i][RCOMP] = src[i*3+0];
|
||||
rgba[i][GCOMP] = src[i*3+1];
|
||||
rgba[i][BCOMP] = src[i*3+2];
|
||||
rgba[i][ACOMP] = 255;
|
||||
rgba[i][ACOMP] = CHAN_MAX;
|
||||
}
|
||||
break;
|
||||
case GL_COLOR_INDEX:
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: texstate.c,v 1.16 2000/08/01 17:33:53 brianp Exp $ */
|
||||
/* $Id: texstate.c,v 1.17 2000/10/28 18:34:48 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -719,10 +719,10 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_BORDER_COLOR:
|
||||
texObj->BorderColor[0] = (GLubyte) CLAMP((GLint)(params[0]*255.0), 0, 255);
|
||||
texObj->BorderColor[1] = (GLubyte) CLAMP((GLint)(params[1]*255.0), 0, 255);
|
||||
texObj->BorderColor[2] = (GLubyte) CLAMP((GLint)(params[2]*255.0), 0, 255);
|
||||
texObj->BorderColor[3] = (GLubyte) CLAMP((GLint)(params[3]*255.0), 0, 255);
|
||||
texObj->BorderColor[0] = (GLchan) CLAMP((GLint)(params[0]*CHAN_MAXF), 0, CHAN_MAX);
|
||||
texObj->BorderColor[1] = (GLchan) CLAMP((GLint)(params[1]*CHAN_MAXF), 0, CHAN_MAX);
|
||||
texObj->BorderColor[2] = (GLchan) CLAMP((GLint)(params[2]*CHAN_MAXF), 0, CHAN_MAX);
|
||||
texObj->BorderColor[3] = (GLchan) CLAMP((GLint)(params[3]*CHAN_MAXF), 0, CHAN_MAX);
|
||||
break;
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
texObj->MinLod = params[0];
|
||||
@@ -965,10 +965,10 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
|
||||
*params = ENUM_TO_FLOAT(obj->WrapR);
|
||||
break;
|
||||
case GL_TEXTURE_BORDER_COLOR:
|
||||
params[0] = obj->BorderColor[0] / 255.0F;
|
||||
params[1] = obj->BorderColor[1] / 255.0F;
|
||||
params[2] = obj->BorderColor[2] / 255.0F;
|
||||
params[3] = obj->BorderColor[3] / 255.0F;
|
||||
params[0] = obj->BorderColor[0] / CHAN_MAXF;
|
||||
params[1] = obj->BorderColor[1] / CHAN_MAXF;
|
||||
params[2] = obj->BorderColor[2] / CHAN_MAXF;
|
||||
params[3] = obj->BorderColor[3] / CHAN_MAXF;
|
||||
break;
|
||||
case GL_TEXTURE_RESIDENT:
|
||||
{
|
||||
@@ -1035,10 +1035,10 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
|
||||
case GL_TEXTURE_BORDER_COLOR:
|
||||
{
|
||||
GLfloat color[4];
|
||||
color[0] = obj->BorderColor[0] / 255.0F;
|
||||
color[1] = obj->BorderColor[1] / 255.0F;
|
||||
color[2] = obj->BorderColor[2] / 255.0F;
|
||||
color[3] = obj->BorderColor[3] / 255.0F;
|
||||
color[0] = obj->BorderColor[0] / CHAN_MAXF;
|
||||
color[1] = obj->BorderColor[1] / CHAN_MAXF;
|
||||
color[2] = obj->BorderColor[2] / CHAN_MAXF;
|
||||
color[3] = obj->BorderColor[3] / CHAN_MAXF;
|
||||
params[0] = FLOAT_TO_INT( color[0] );
|
||||
params[1] = FLOAT_TO_INT( color[1] );
|
||||
params[2] = FLOAT_TO_INT( color[2] );
|
||||
|
Reference in New Issue
Block a user