From 179870a5b806a3ee84cb56fa20c3a003f9fc5b97 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 12 Apr 2000 18:54:48 +0000 Subject: more work on GL_SGI_color_table, pixel transfer code clean-up --- src/mesa/main/drawpix.c | 16 +- src/mesa/main/image.c | 563 ++++++++++++++++++++++++------------------------ src/mesa/main/pixel.c | 250 +++++++++++---------- src/mesa/main/pixel.h | 69 +++--- 4 files changed, 447 insertions(+), 451 deletions(-) diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 184248c270..80059124bb 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,4 +1,4 @@ -/* $Id: drawpix.c,v 1.19 2000/04/11 20:42:22 brianp Exp $ */ +/* $Id: drawpix.c,v 1.20 2000/04/12 18:54:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -120,6 +120,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, && !ctx->Pixel.ScaleOrBiasRGBA && !ctx->Pixel.ScaleOrBiasRGBApcm && ctx->ColorMatrix.type == MATRIX_IDENTITY + && !ctx->Pixel.ColorTableEnabled && ctx->Pixel.IndexShift==0 && ctx->Pixel.IndexOffset==0 && ctx->Pixel.MapColorFlag==0 && ctx->Texture.ReallyEnabled == 0 @@ -340,7 +341,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; rowDriver.WriteRGBASpan)(ctx, drawWidth, destX, destY, (const GLubyte (*)[4])rgba, NULL); @@ -354,7 +355,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; rowPixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; + const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; const GLint desty = y; GLint row, drawWidth; @@ -472,7 +474,13 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, const GLvoid *source = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); _mesa_unpack_index_span(ctx, drawWidth, destType, values, - type, source, &ctx->Unpack, GL_TRUE); + type, source, &ctx->Unpack, GL_FALSE); + if (shift_or_offset) { + _mesa_shift_and_offset_stencil( ctx, drawWidth, values ); + } + if (ctx->Pixel.MapStencilFlag) { + _mesa_map_stencil( ctx, drawWidth, values ); + } if (zoom) { gl_write_zoomed_stencil_span( ctx, (GLuint) drawWidth, x, y, diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 28720be9f6..f2de78440b 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.25 2000/04/08 18:57:45 brianp Exp $ */ +/* $Id: image.c,v 1.26 2000/04/12 18:54:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -603,33 +603,36 @@ _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, */ void _mesa_pack_rgba_span( const GLcontext *ctx, - GLuint n, CONST GLubyte rgba[][4], + GLuint n, CONST GLubyte srcRgba[][4], GLenum format, GLenum type, GLvoid *destination, const struct gl_pixelstore_attrib *packing, GLboolean applyTransferOps ) { - applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag); + applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled); /* Test for optimized case first */ if (!applyTransferOps && format == GL_RGBA && type == GL_UNSIGNED_BYTE) { /* common simple case */ - MEMCPY( destination, rgba, n * 4 * sizeof(GLubyte) ); + MEMCPY( destination, srcRgba, n * 4 * sizeof(GLubyte) ); } else if (!applyTransferOps && format == GL_RGB && type == GL_UNSIGNED_BYTE) { /* common simple case */ GLint i; GLubyte *dest = (GLubyte *) destination; for (i = 0; i < n; i++) { - dest[0] = rgba[i][RCOMP]; - dest[1] = rgba[i][GCOMP]; - dest[2] = rgba[i][BCOMP]; + dest[0] = srcRgba[i][RCOMP]; + dest[1] = srcRgba[i][GCOMP]; + dest[2] = srcRgba[i][BCOMP]; dest += 3; } } else { /* general solution */ - GLfloat red[MAX_WIDTH], green[MAX_WIDTH], blue[MAX_WIDTH]; - GLfloat alpha[MAX_WIDTH], luminance[MAX_WIDTH]; + GLfloat rgba[MAX_WIDTH][4], luminance[MAX_WIDTH]; const GLfloat rscale = 1.0F / 255.0F; const GLfloat gscale = 1.0F / 255.0F; const GLfloat bscale = 1.0F / 255.0F; @@ -641,27 +644,38 @@ _mesa_pack_rgba_span( const GLcontext *ctx, /* convert color components to floating point */ for (i=0;iPixel.ScaleOrBiasRGBA) { - gl_scale_and_bias_color( ctx, n, red, green, blue, alpha ); + _mesa_scale_and_bias_rgba( ctx, n, rgba ); } + /* color table lookup */ if (ctx->Pixel.MapColorFlag) { - gl_map_color( ctx, n, red, green, blue, alpha ); + _mesa_map_rgba( ctx, n, rgba ); + } + /* color matrix */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_SGI_color_table lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); } } if (format==GL_LUMINANCE || format==GL_LUMINANCE_ALPHA) { for (i=0;iPixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag || ctx->ColorMatrix.type != MATRIX_IDENTITY || - ctx->Pixel.ScaleOrBiasRGBApcm); + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled); /* Try simple cases first */ if (!applyTransferOps && srcType == GL_UNSIGNED_BYTE) { @@ -2212,8 +2228,8 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } + /* general solution begins here */ { - /* general solution */ GLfloat rgba[MAX_WIDTH][4]; GLint dstComponents; GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; @@ -2233,20 +2249,18 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, unpacking); /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); + _mesa_shift_and_offset_ci(ctx, n, indexes); if (dstFormat == GL_COLOR_INDEX) { if (applyTransferOps) { if (ctx->Pixel.MapColorFlag) { /* Apply lookup table */ - gl_map_ci(ctx, n, indexes); + _mesa_map_ci(ctx, n, indexes); } - if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { - + _mesa_shift_and_offset_ci(ctx, n, indexes); } } - /* convert to GLubyte and return */ { GLuint i; @@ -2257,7 +2271,7 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } else { /* Convert indexes to RGBA */ - gl_map_ci_to_rgba_float(ctx, n, indexes, rgba); + _mesa_map_ci_to_rgba(ctx, n, indexes, rgba); } } else { @@ -2266,29 +2280,23 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, if (applyTransferOps) { /* scale and bias colors */ - _mesa_scale_and_bias_rgba_float(ctx, n, rgba); - + _mesa_scale_and_bias_rgba(ctx, n, rgba); /* color table lookup */ if (ctx->Pixel.MapColorFlag) { - _mesa_map_rgba_float(ctx, n, rgba); + _mesa_map_rgba(ctx, n, rgba); } - + /* color matrix transform */ if (ctx->ColorMatrix.type != MATRIX_IDENTITY || ctx->Pixel.ScaleOrBiasRGBApcm) { _mesa_transform_rgba(ctx, n, rgba); } + /* GL_SGI_color_table lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } } } - - /* - * XXX This is where more color table lookups, convolution, - * histograms, minmax, color matrix, etc would take place if - * implemented. - * See figure 3.7 in the OpenGL 1.2 specification for more info. - */ - - /* clamp to [0,1] */ { GLuint i; @@ -2469,12 +2477,11 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, if (applyTransferOps) { if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); + _mesa_shift_and_offset_ci(ctx, n, indexes); } - if (ctx->Pixel.MapColorFlag) { /* Apply lookup table */ - gl_map_ci(ctx, n, indexes); + _mesa_map_ci(ctx, n, indexes); } } @@ -2569,7 +2576,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, if (applyTransferOps) { if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); + _mesa_shift_and_offset_ci(ctx, n, indexes); } if (ctx->Pixel.MapStencilFlag) { diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 213aa2c894..b3b5f67294 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1,10 +1,10 @@ -/* $Id: pixel.c,v 1.6 2000/04/08 18:57:45 brianp Exp $ */ +/* $Id: pixel.c,v 1.7 2000/04/12 18:54:48 brianp Exp $ */ /* * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 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"), @@ -25,11 +25,6 @@ */ -/* - * glPixelStore, glPixelTransfer, glPixelMap, glPixelZoom, etc. - */ - - #ifdef PC_HEADER #include "all.h" #else @@ -625,62 +620,16 @@ _mesa_PixelTransferi( GLenum pname, GLint param ) - -/* - * Pixel processing functions - */ - - -/* - * Apply scale and bias factors to an array of RGBA pixels. - */ -void gl_scale_and_bias_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ) -{ - GLuint i; - for (i=0;iPixel.RedScale + ctx->Pixel.RedBias; - GLfloat g = green[i] * ctx->Pixel.GreenScale + ctx->Pixel.GreenBias; - GLfloat b = blue[i] * ctx->Pixel.BlueScale + ctx->Pixel.BlueBias; - GLfloat a = alpha[i] * ctx->Pixel.AlphaScale + ctx->Pixel.AlphaBias; - red[i] = CLAMP( r, 0.0F, 1.0F ); - green[i] = CLAMP( g, 0.0F, 1.0F ); - blue[i] = CLAMP( b, 0.0F, 1.0F ); - alpha[i] = CLAMP( a, 0.0F, 1.0F ); - } -} - - -/* - * Apply scale and bias factors to an array of RGBA pixels. - */ -void gl_scale_and_bias_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ) -{ - GLfloat rbias = ctx->Pixel.RedBias * 255.0F; - GLfloat gbias = ctx->Pixel.GreenBias * 255.0F; - GLfloat bbias = ctx->Pixel.BlueBias * 255.0F; - GLfloat abias = ctx->Pixel.AlphaBias * 255.0F; - GLuint i; - for (i=0;iPixel.RedScale + rbias); - GLint g = (GLint) (rgba[i][GCOMP] * ctx->Pixel.GreenScale + gbias); - GLint b = (GLint) (rgba[i][BCOMP] * ctx->Pixel.BlueScale + bbias); - GLint a = (GLint) (rgba[i][ACOMP] * ctx->Pixel.AlphaScale + abias); - rgba[i][RCOMP] = CLAMP( r, 0, 255 ); - rgba[i][GCOMP] = CLAMP( g, 0, 255 ); - rgba[i][BCOMP] = CLAMP( b, 0, 255 ); - rgba[i][ACOMP] = CLAMP( a, 0, 255 ); - } -} +/**********************************************************************/ +/***** Pixel processing functions ******/ +/**********************************************************************/ /* * Apply scale and bias factors to an array of RGBA pixels. */ void -_mesa_scale_and_bias_rgba_float(const GLcontext *ctx, GLuint n, - GLfloat rgba[][4]) +_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) { if (ctx->Pixel.RedScale != 1.0 || ctx->Pixel.RedBias != 0.0) { const GLfloat scale = ctx->Pixel.RedScale; @@ -717,34 +666,11 @@ _mesa_scale_and_bias_rgba_float(const GLcontext *ctx, GLuint n, } -/* - * Apply pixel mapping to an array of RGBA pixels. - */ -void gl_map_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ) -{ - GLfloat rscale = (ctx->Pixel.MapRtoRsize - 1) / 255.0F; - GLfloat gscale = (ctx->Pixel.MapGtoGsize - 1) / 255.0F; - GLfloat bscale = (ctx->Pixel.MapBtoBsize - 1) / 255.0F; - GLfloat ascale = (ctx->Pixel.MapAtoAsize - 1) / 255.0F; - GLuint i; - for (i=0;iPixel.MapRtoR[ir] * 255.0F); - rgba[i][GCOMP] = (GLint) (ctx->Pixel.MapGtoG[ig] * 255.0F); - rgba[i][BCOMP] = (GLint) (ctx->Pixel.MapBtoB[ib] * 255.0F); - rgba[i][ACOMP] = (GLint) (ctx->Pixel.MapAtoA[ia] * 255.0F); - } -} - - /* * Apply pixel mapping to an array of floating point RGBA pixels. */ void -_mesa_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) { const GLfloat rscale = ctx->Pixel.MapRtoRsize - 1; const GLfloat gscale = ctx->Pixel.MapGtoGsize - 1; @@ -793,24 +719,106 @@ _mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) } - /* - * Apply pixel mapping to an array of RGBA pixels. + * Apply a color table lookup to an array of colors. */ -void gl_map_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ) +void +_mesa_lookup_rgba(const struct gl_color_table *table, + GLuint n, GLfloat rgba[][4]) { - GLfloat rscale = ctx->Pixel.MapRtoRsize - 1; - GLfloat gscale = ctx->Pixel.MapGtoGsize - 1; - GLfloat bscale = ctx->Pixel.MapBtoBsize - 1; - GLfloat ascale = ctx->Pixel.MapAtoAsize - 1; - GLuint i; - for (i=0;iPixel.MapRtoR[ (GLint) (red[i] * rscale + 0.5F) ]; - green[i] = ctx->Pixel.MapGtoG[ (GLint) (green[i] * gscale + 0.5F) ]; - blue[i] = ctx->Pixel.MapBtoB[ (GLint) (blue[i] * bscale + 0.5F) ]; - alpha[i] = ctx->Pixel.MapAtoA[ (GLint) (alpha[i] * ascale + 0.5F) ]; + switch (table->Format) { + case GL_INTENSITY: + { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = table->Table; + GLuint i; + /* replace RGBA with I */ + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLubyte c = lut[j]; + rgba[i][RCOMP] = rgba[i][GCOMP] = + rgba[i][BCOMP] = rgba[i][ACOMP] = c; + } + } + break; + case GL_LUMINANCE: + { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = table->Table; + GLuint i; + /* replace RGB with L */ + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLubyte c = lut[j]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + break; + case GL_ALPHA: + { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = table->Table; + GLuint i; + /* replace A with A */ + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][ACOMP] = lut[j]; + } + } + break; + case GL_LUMINANCE_ALPHA: + { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = table->Table; + GLuint i; + /* replace RGBA with LLLA */ + for (i = 0; i < n; i++) { + GLint jL = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + GLubyte luminance = lut[jL * 2 + 0]; + GLubyte alpha = lut[jA * 2 + 1]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + } + break; + case GL_RGB: + { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = table->Table; + GLuint i; + /* replace RGB with RGB */ + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 3 + 0]; + rgba[i][GCOMP] = lut[jG * 3 + 1]; + rgba[i][BCOMP] = lut[jB * 3 + 2]; + } + } + break; + case GL_RGBA: + { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = table->Table; + GLuint i; + /* replace RGBA with RGBA */ + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 4 + 0]; + rgba[i][GCOMP] = lut[jG * 4 + 1]; + rgba[i][BCOMP] = lut[jB * 4 + 2]; + rgba[i][ACOMP] = lut[jA * 4 + 3]; + } + } + break; + default: + gl_problem(NULL, "Bad format in _mesa_lookup_rgba"); + return; } } @@ -819,7 +827,8 @@ void gl_map_color( const GLcontext *ctx, GLuint n, /* * Apply color index shift and offset to an array of pixels. */ -void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) +void +_mesa_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) { GLint shift = ctx->Pixel.IndexShift; GLint offset = ctx->Pixel.IndexOffset; @@ -846,7 +855,8 @@ void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) /* * Apply color index mapping to color indexes. */ -void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) +void +_mesa_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) { GLuint mask = ctx->Pixel.MapItoIsize - 1; GLuint i; @@ -859,8 +869,9 @@ void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) /* * Map color indexes to rgba values. */ -void gl_map_ci_to_rgba( const GLcontext *ctx, GLuint n, const GLuint index[], - GLubyte rgba[][4] ) +void +_mesa_map_ci_to_rgba_ubyte( const GLcontext *ctx, GLuint n, + const GLuint index[], GLubyte rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -883,8 +894,9 @@ void gl_map_ci_to_rgba( const GLcontext *ctx, GLuint n, const GLuint index[], /* * Map color indexes to float rgba values. */ -void gl_map_ci_to_rgba_float( const GLcontext *ctx, GLuint n, const GLuint index[], - GLfloat rgba[][4] ) +void +_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n, + const GLuint index[], GLfloat rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -907,8 +919,9 @@ void gl_map_ci_to_rgba_float( const GLcontext *ctx, GLuint n, const GLuint index /* * Map 8-bit color indexes to rgb values. */ -void gl_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], - GLubyte rgba[][4] ) +void +_mesa_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], + GLubyte rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -928,27 +941,9 @@ void gl_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], } -void gl_map_ci_to_color( const GLcontext *ctx, GLuint n, const GLuint index[], - GLfloat r[], GLfloat g[], - GLfloat b[], GLfloat a[] ) -{ - GLuint rmask = ctx->Pixel.MapItoRsize - 1; - GLuint gmask = ctx->Pixel.MapItoGsize - 1; - GLuint bmask = ctx->Pixel.MapItoBsize - 1; - GLuint amask = ctx->Pixel.MapItoAsize - 1; - GLuint i; - for (i=0;iPixel.MapItoR[index[i] & rmask]; - g[i] = ctx->Pixel.MapItoG[index[i] & gmask]; - b[i] = ctx->Pixel.MapItoB[index[i] & bmask]; - a[i] = ctx->Pixel.MapItoA[index[i] & amask]; - } -} - - - -void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, - GLstencil stencil[] ) +void +_mesa_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, + GLstencil stencil[] ) { GLuint i; GLint shift = ctx->Pixel.IndexShift; @@ -973,8 +968,8 @@ void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, } - -void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) +void +_mesa_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) { GLuint mask = ctx->Pixel.MapStoSsize - 1; GLuint i; @@ -982,4 +977,3 @@ void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) stencil[i] = ctx->Pixel.MapStoS[ stencil[i] & mask ]; } } - diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h index b40af4929f..27d200825e 100644 --- a/src/mesa/main/pixel.h +++ b/src/mesa/main/pixel.h @@ -1,10 +1,10 @@ -/* $Id: pixel.h,v 1.4 2000/04/08 18:57:45 brianp Exp $ */ +/* $Id: pixel.h,v 1.5 2000/04/12 18:54:48 brianp Exp $ */ /* * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 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"), @@ -76,69 +76,56 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ); * Pixel processing functions */ -extern void gl_scale_and_bias_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ); - - -extern void gl_scale_and_bias_rgba( const GLcontext *ctx, GLuint n, - GLubyte rgba[][4] ); - - extern void -_mesa_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n, - GLfloat rgba[][4] ); - - -extern void gl_map_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ); +_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); extern void -_mesa_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ); +_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); extern void _mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); -extern void gl_map_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ); - - -extern void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, - GLuint indexes[] ); +extern void +_mesa_lookup_rgba(const struct gl_color_table *table, + GLuint n, GLfloat rgba[][4]); -extern void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ); +extern void +_mesa_shift_and_offset_ci(const GLcontext *ctx, GLuint n, + GLuint indexes[]); -extern void gl_map_ci_to_rgba( const GLcontext *ctx, - GLuint n, const GLuint index[], - GLubyte rgba[][4] ); +extern void +_mesa_map_ci(const GLcontext *ctx, GLuint n, GLuint index[]); -extern void gl_map_ci_to_rgba_float( const GLcontext *ctx, - GLuint n, const GLuint index[], - GLfloat rgba[][4] ); +extern void +_mesa_map_ci_to_rgba_ubyte(const GLcontext *ctx, + GLuint n, const GLuint index[], + GLubyte rgba[][4]); -extern void gl_map_ci8_to_rgba( const GLcontext *ctx, - GLuint n, const GLubyte index[], - GLubyte rgba[][4] ); +extern void +_mesa_map_ci_to_rgba(const GLcontext *ctx, + GLuint n, const GLuint index[], GLfloat rgba[][4]); -extern void gl_map_ci_to_color( const GLcontext *ctx, - GLuint n, const GLuint index[], - GLfloat r[], GLfloat g[], - GLfloat b[], GLfloat a[] ); +extern void +_mesa_map_ci8_to_rgba(const GLcontext *ctx, + GLuint n, const GLubyte index[], + GLubyte rgba[][4]); -extern void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, - GLstencil indexes[] ); +extern void +_mesa_shift_and_offset_stencil(const GLcontext *ctx, GLuint n, + GLstencil indexes[]); -extern void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil index[] ); +extern void +_mesa_map_stencil(const GLcontext *ctx, GLuint n, GLstencil index[]); #endif -- cgit v1.2.3