/* ** Copyright 1991,1992, Silicon Graphics, Inc. ** All Rights Reserved. ** ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; ** the contents of this file may not be disclosed to third parties, copied or ** duplicated in any form, in whole or in part, without the prior written ** permission of Silicon Graphics, Inc. ** ** RESTRICTED RIGHTS LEGEND: ** Use, duplication or disclosure by the Government is subject to restrictions ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - ** rights reserved under the Copyright Laws of the United States. */ #include "precomp.h" #pragma hdrstop /* ** This file contains routines to unpack data from the user's data space ** into a span of pixels which can then be rendered. */ /* ** Return the number of elements per group of a specified format */ GLint FASTCALL __glElementsPerGroup(GLenum format) { switch(format) { case GL_RGB: #ifdef GL_EXT_bgra case GL_BGR_EXT: #endif return 3; case GL_LUMINANCE_ALPHA: case __GL_RED_ALPHA: return 2; case GL_RGBA: #ifdef GL_EXT_bgra case GL_BGRA_EXT: #endif return 4; default: return 1; } } /* ** Return the number of bytes per element, based on the element type */ __GLfloat FASTCALL __glBytesPerElement(GLenum type) { switch(type) { case GL_BITMAP: return ((__GLfloat) 1.0 / (__GLfloat) 8.0); case GL_UNSIGNED_SHORT: case GL_SHORT: return 2; case GL_UNSIGNED_BYTE: case GL_BYTE: return 1; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: default: return 4; } } void FASTCALL __glInitUnpacker(__GLcontext *gc, __GLpixelSpanInfo *spanInfo) { GLint alignment; GLint lsb_first; GLint components; GLint element_size; GLint rowsize; GLint padding; GLint group_size; GLint groups_per_line; GLint skip_pixels, skip_lines; GLint swap_bytes; GLenum format, type; const GLvoid *pixels; format = spanInfo->srcFormat; type = spanInfo->srcType; pixels = spanInfo->srcImage; skip_pixels = spanInfo->srcSkipPixels; skip_lines = spanInfo->srcSkipLines; alignment = spanInfo->srcAlignment; lsb_first = spanInfo->srcLsbFirst; swap_bytes = spanInfo->srcSwapBytes; components = __glElementsPerGroup(format); groups_per_line = spanInfo->srcLineLength; element_size = __glBytesPerElement(type); if (element_size == 1) swap_bytes = 0; group_size = element_size * components; rowsize = groups_per_line * group_size; if (type == GL_BITMAP) { rowsize = (groups_per_line + 7)/8; } padding = (rowsize % alignment); if (padding) { rowsize += alignment - padding; } if (((skip_pixels & 0x7) && type == GL_BITMAP) || (swap_bytes && element_size > 1)) { spanInfo->srcPackedData = GL_FALSE; } else { spanInfo->srcPackedData = GL_TRUE; } if (type == GL_BITMAP) { spanInfo->srcCurrent = (GLvoid *) (((const GLubyte *) pixels) + skip_lines * rowsize + skip_pixels / 8); spanInfo->srcStartBit = skip_pixels % 8; } else { spanInfo->srcCurrent = (GLvoid *) (((const GLubyte *) pixels) + skip_lines * rowsize + skip_pixels * group_size); } spanInfo->srcRowIncrement = rowsize; spanInfo->srcGroupIncrement = group_size; spanInfo->srcComponents = components; spanInfo->srcElementSize = element_size; } /* ** An unpacker that unpacks from BITMAP source data, into FLOAT spans. ** ** zoomx is assumed to be less than 1.0 and greater than -1.0. */ void __glSpanUnpackBitmap(__GLcontext *gc, __GLpixelSpanInfo *spanInfo, GLvoid *inspan, GLvoid *outspan) { GLint i,j; GLint width; GLvoid *userData; GLfloat *spanData; GLint lsbFirst; GLint startBit; GLint bit; GLubyte ubyte; GLshort *pixelArray; GLint skipCount; __GLfloat zero, one; userData = inspan; spanData = (GLfloat *) outspan; pixelArray = spanInfo->pixelArray; width = spanInfo->width; lsbFirst = spanInfo->srcLsbFirst; startBit = spanInfo->srcStartBit; i = width; bit = startBit; ubyte = *(GLubyte *) userData; zero = __glZero; one = __glOne; skipCount = 1; if (lsbFirst) { switch(bit) { case 1: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x02) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 2: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x04) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 3: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x08) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 4: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x10) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 5: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x20) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 6: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x40) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 7: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x80) *spanData++ = one; else *spanData++ = zero; } i--; userData = (GLvoid *) ((GLubyte *) userData + 1); case 0: break; } while (i >= 8) { ubyte = *(GLubyte *) userData; userData = (GLvoid *) ((GLubyte *) userData + 1); i -= 8; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x01) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x02) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x04) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x08) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x10) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x20) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x40) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x80) *spanData++ = one; else *spanData++ = zero; } } if (i) { ubyte = *(GLubyte *) userData; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x01) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x02) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x04) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x08) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x10) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x20) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x40) *spanData++ = one; else *spanData++ = zero; } } } else { switch(bit) { case 1: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x40) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 2: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x20) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 3: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x10) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 4: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x08) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 5: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x04) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 6: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x02) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) break; case 7: if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x01) *spanData++ = one; else *spanData++ = zero; } i--; userData = (GLvoid *) ((GLubyte *) userData + 1); case 0: break; } while (i >= 8) { ubyte = *(GLubyte *) userData; userData = (GLvoid *) ((GLubyte *) userData + 1); i -= 8; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x80) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x40) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x20) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x10) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x08) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x04) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x02) *spanData++ = one; else *spanData++ = zero; } if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x01) *spanData++ = one; else *spanData++ = zero; } } if (i) { ubyte = *(GLubyte *) userData; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x80) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x40) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x20) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x10) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x08) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x04) *spanData++ = one; else *spanData++ = zero; } if (--i == 0) return; if (--skipCount == 0) { skipCount = *pixelArray++; if (ubyte & 0x02) *spanData++ = one; else *spanData++ = zero; } } } } /* ** An unpacker that unpacks from BITMAP source data, into FLOAT spans. ** ** zoomx is assumed to be less than or equal to -1.0 or greater than or ** equal to 1.0. */ void __glSpanUnpackBitmap2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo, GLvoid *inspan, GLvoid *outspan) { GLint i,j; GLint width; GLvoid *userData; GLfloat *spanData; GLint lsbFirst; GLint startBit; GLint bit; GLubyte ubyte; width = spanInfo->realWidth; userData = inspan; spanData = (GLfloat *) outspan; lsbFirst = spanInfo->srcLsbFirst; startBit = spanInfo->srcStartBit; i = width; bit = startBit; ubyte = *(GLubyte *) userData; if (lsbFirst) { switch(bit) { case 1: if (ubyte & 0x02) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 2: if (ubyte & 0x04) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 3: if (ubyte & 0x08) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 4: if (ubyte & 0x10) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 5: if (ubyte & 0x20) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 6: if (ubyte & 0x40) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 7: if (ubyte & 0x80) *spanData++ = __glOne; else *spanData++ = __glZero; i--; userData = (GLvoid *) ((GLubyte *) userData + 1); case 0: break; } while (i >= 8) { ubyte = *(GLubyte *) userData; userData = (GLvoid *) ((GLubyte *) userData + 1); i -= 8; if (ubyte & 0x01) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x02) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x04) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x08) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x10) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x20) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x40) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x80) *spanData++ = __glOne; else *spanData++ = __glZero; } if (i) { ubyte = *(GLubyte *) userData; if (ubyte & 0x01) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x02) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x04) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x08) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x10) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x20) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x40) *spanData++ = __glOne; else *spanData++ = __glZero; } } else { switch(bit) { case 1: if (ubyte & 0x40) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 2: if (ubyte & 0x20) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 3: if (ubyte & 0x10) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 4: if (ubyte & 0x08) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 5: if (ubyte & 0x04) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 6: if (ubyte & 0x02) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) break; case 7: if (ubyte & 0x01) *spanData++ = __glOne; else *spanData++ = __glZero; i--; userData = (GLvoid *) ((GLubyte *) userData + 1); case 0: break; } while (i >= 8) { ubyte = *(GLubyte *) userData; userData = (GLvoid *) ((GLubyte *) userData + 1); i -= 8; if (ubyte & 0x80) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x40) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x20) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x10) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x08) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x04) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x02) *spanData++ = __glOne; else *spanData++ = __glZero; if (ubyte & 0x01) *spanData++ = __glOne; else *spanData++ = __glZero; } if (i) { ubyte = *(GLubyte *) userData; if (ubyte & 0x80) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x40) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x20) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x10) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x08) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x04) *spanData++ = __glOne; else *spanData++ = __glZero; if (--i == 0) return; if (ubyte & 0x02) *spanData++ = __glOne; else *spanData++ = __glZero; } } } /* ** An unpacker that unpacks from RGB, UNSIGNED_BYTE source data, into ** RGB, UNSIGNED_BYTE spans. ** ** zoomx is assumed to be less than 1.0 and greater than -1.0. */ void __glSpanUnpackRGBubyte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo, GLvoid *inspan, GLvoid *outspan) { GLint i; GLubyte *userData; GLubyte *spanData; GLint width, groupInc; GLshort *pixelArray; GLint skipCount; #ifdef __GL_LINT gc = gc; #endif width = spanInfo->realWidth; groupInc = spanInfo->srcGroupIncrement; userData = (GLubyte *) inspan; spanData = (GLubyte *) outspan; pixelArray = spanInfo->pixelArray; i = 0; do { spanData[0] = userData[0]; spanData[1] = userData[1]; spanData[2] = userData[2]; spanData += 3; skipCount = *pixelArray++; userData = (GLubyte *) ((GLubyte *) userData + 3 * skipCount); i++; } while (irealWidth; groupInc = spanInfo->srcGroupIncrement; userData = (GLubyte *) inspan; spanData = (GLubyte *) outspan; pixelArray = spanInfo->pixelArray; i = 0; do { *spanData = *userData; spanData++; skipCount = *pixelArray++; userData = (GLubyte *) ((GLubyte *) userData + skipCount); i++; } while (irealWidth; groupInc = spanInfo->srcGroupIncrement; userData = (GLubyte *) inspan; spanData = (GLubyte *) outspan; pixelArray = spanInfo->pixelArray; i = 0; do { spanData[0] = userData[0]; spanData[1] = userData[1]; spanData[2] = userData[2]; spanData[3] = userData[3]; spanData += 4; skipCount = *pixelArray++; userData = (GLubyte *) ((GLubyte *) userData + (skipCount << 2)); i++; } while (irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b; GLint components = spanInfo->dstComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b; GLint components = spanInfo->srcComponents; GLint groupInc = spanInfo->srcGroupIncrement; GLshort *pixelArray = spanInfo->pixelArray; GLint skipCount; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b,c,d; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b,c,d; GLint components = spanInfo->dstComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b,c,d; GLint components = spanInfo->srcComponents; GLint groupInc = spanInfo->srcGroupIncrement; GLshort *pixelArray = spanInfo->pixelArray; GLint skipCount; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLint components = spanInfo->srcComponents; GLint groupInc = spanInfo->srcGroupIncrement; GLshort *pixelArray = spanInfo->pixelArray; GLint skipCount; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLushort *inData = (GLushort *) inspan; GLushort *outData = (GLushort *) outspan; GLint components = spanInfo->srcComponents; GLint groupInc = spanInfo->srcGroupIncrement; GLshort *pixelArray = spanInfo->pixelArray; GLint skipCount; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLuint *inData = (GLuint *) inspan; GLuint *outData = (GLuint *) outspan; GLint components = spanInfo->srcComponents; GLint groupInc = spanInfo->srcGroupIncrement; GLshort *pixelArray = spanInfo->pixelArray; GLint skipCount; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b; GLint components = spanInfo->srcComponents; GLint groupInc = spanInfo->srcGroupIncrement; GLshort *pixelArray = spanInfo->pixelArray; GLint skipCount; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b,c,d; GLint components = spanInfo->srcComponents; GLint groupInc = spanInfo->srcGroupIncrement; GLshort *pixelArray = spanInfo->pixelArray; GLint skipCount; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b; GLint components = spanInfo->dstComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b,c,d; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLubyte *outData = (GLubyte *) outspan; GLubyte a,b,c,d; GLint components = spanInfo->dstComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLfloat *outData = (GLfloat *) outspan; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLbyte *inData = (GLbyte *) inspan; GLfloat *outData = (GLfloat *) outspan; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLushort *inData = (GLushort *) inspan; GLfloat *outData = (GLfloat *) outspan; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLshort *inData = (GLshort *) inspan; GLfloat *outData = (GLfloat *) outspan; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLuint *inData = (GLuint *) inspan; GLfloat *outData = (GLfloat *) outspan; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLint *inData = (GLint *) inspan; GLfloat *outData = (GLfloat *) outspan; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLubyte *inData = (GLubyte *) inspan; GLfloat *outData = (GLfloat *) outspan; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLbyte *inData = (GLbyte *) inspan; GLfloat *outData = (GLfloat *) outspan; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLushort *inData = (GLushort *) inspan; GLfloat *outData = (GLfloat *) outspan; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLshort *inData = (GLshort *) inspan; GLfloat *outData = (GLfloat *) outspan; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLuint *inData = (GLuint *) inspan; GLfloat *outData = (GLfloat *) outspan; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLint *inData = (GLint *) inspan; GLfloat *outData = (GLfloat *) outspan; #ifdef __GL_LINT gc = gc; #endif for (i=0; irealWidth; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; GLfloat *inData = (GLfloat *) inspan; GLfloat *outData = (GLfloat *) outspan; GLfloat r, one, zero; one = __glOne; zero = __glZero; for (i=0; i one) r = one; else if (r < zero) r = zero; *outData++ = r; } } /* ** Clamps from a signed FLOAT [-1, 1] to a span of the same format of type ** FLOAT. */ void __glSpanClampSigned(__GLcontext *gc, __GLpixelSpanInfo *spanInfo, GLvoid *inspan, GLvoid *outspan) { GLint i; GLint width = spanInfo->realWidth; GLint components = spanInfo->srcComponents; GLint totalSize = width * components; GLfloat *inData = (GLfloat *) inspan; GLfloat *outData = (GLfloat *) outspan; GLfloat r, zero; zero = __glZero; for (i=0; irealWidth; GLfloat *outData = (GLfloat *) outspan; GLfloat *inData = (GLfloat *) inspan; GLfloat zero = __glZero; GLfloat as = gc->frontBuffer.alphaScale; GLfloat rs = gc->frontBuffer.redScale; for (i=0; irealWidth; GLfloat *outData = (GLfloat *) outspan; GLfloat *inData = (GLfloat *) inspan; GLfloat zero = __glZero; GLfloat gs = gc->frontBuffer.greenScale; GLfloat as = gc->frontBuffer.alphaScale; for (i=0; irealWidth; GLfloat *outData = (GLfloat *) outspan; GLfloat *inData = (GLfloat *) inspan; GLfloat zero = __glZero; GLfloat bs = gc->frontBuffer.blueScale; GLfloat as = gc->frontBuffer.alphaScale; for (i=0; irealWidth; GLfloat *outData = (GLfloat *) outspan; GLfloat *inData = (GLfloat *) inspan; GLfloat zero = __glZero; GLfloat as = gc->frontBuffer.alphaScale; for (i=0; irealWidth; GLfloat *outData = (GLfloat *) outspan; GLfloat *inData = (GLfloat *) inspan; GLfloat r,g,b; GLfloat rs,gs,bs; GLfloat as = gc->frontBuffer.alphaScale; rs = gc->frontBuffer.redScale; gs = gc->frontBuffer.greenScale; bs = gc->frontBuffer.blueScale; for (i=0; irealWidth; GLfloat *outData = (GLfloat *) outspan; GLfloat *inData = (GLfloat *) inspan; GLfloat r,g,b; GLfloat rs,gs,bs; GLfloat as = gc->frontBuffer.alphaScale; rs = gc->frontBuffer.redScale; gs = gc->frontBuffer.greenScale; bs = gc->frontBuffer.blueScale; for (i=0; irealWidth; GLfloat *outData = (GLfloat *) outspan; GLfloat *inData = (GLfloat *) inspan; GLfloat comp; GLfloat rs,gs,bs; GLfloat as = gc->frontBuffer.alphaScale; rs = gc->frontBuffer.redScale; gs = gc->frontBuffer.greenScale; bs = gc->frontBuffer.blueScale; for (i=0; irealWidth; GLfloat *outData = (GLfloat *) outspan; GLfloat *inData = (GLfloat *) inspan; GLfloat comp; GLfloat rs,gs,bs; GLfloat as = gc->frontBuffer.alphaScale; rs = gc->frontBuffer.redScale; gs = gc->frontBuffer.greenScale; bs = gc->frontBuffer.blueScale; for (i=0; irealWidth; GLfloat *outData = (GLfloat *) outspan; GLfloat *inData = (GLfloat *) inspan; GLfloat comp; GLfloat zero; GLfloat rs,gs,bs; GLfloat as = gc->frontBuffer.alphaScale; rs = gc->frontBuffer.redScale; zero = __glZero; for (i=0; irealWidth; inData = (GLfloat *) inspan; outData = (GLfloat *) outspan; rscale = gc->frontBuffer.redScale; gscale = gc->frontBuffer.greenScale; bscale = gc->frontBuffer.blueScale; ascale = gc->frontBuffer.alphaScale; for (i=0; irealWidth; inData = (GLfloat *) inspan; outData = (GLfloat *) outspan; rscale = gc->frontBuffer.oneOverRedScale; gscale = gc->frontBuffer.oneOverGreenScale; bscale = gc->frontBuffer.oneOverBlueScale; ascale = gc->frontBuffer.oneOverAlphaScale; for (i=0; irealWidth; inData = (GLfloat *) inspan; outData = (GLfloat *) outspan; rscale = gc->frontBuffer.redScale; gscale = gc->frontBuffer.greenScale; bscale = gc->frontBuffer.blueScale; ascale = gc->frontBuffer.alphaScale; for (i=0; irealWidth; inData = (GLfloat *) inspan; outData = (GLfloat *) outspan; rscale = gc->frontBuffer.oneOverRedScale; gscale = gc->frontBuffer.oneOverGreenScale; bscale = gc->frontBuffer.oneOverBlueScale; ascale = gc->frontBuffer.oneOverAlphaScale; for (i=0; irealWidth; inData = (GLfloat *) inspan; outData = (GLfloat *) outspan; // Throw in an extra scaling of 1/255 because the palette // data is in ubyte format rscale = gc->frontBuffer.redScale*__glOneOver255; gscale = gc->frontBuffer.greenScale*__glOneOver255; bscale = gc->frontBuffer.blueScale*__glOneOver255; ascale = gc->frontBuffer.alphaScale*__glOneOver255; for (i=0; isrcPalette[(int)((*inData++)* spanInfo->srcPaletteSize)]; red = rgb->rgbRed * rscale; green = rgb->rgbGreen * gscale; *outData++ = red; *outData++ = green; blue = rgb->rgbBlue * bscale; alpha = rgb->rgbReserved * ascale; *outData++ = blue; *outData++ = alpha; } } #endif