changed imaging functions to _mesa_ prefix

This commit is contained in:
Brian Paul
2000-03-21 01:03:40 +00:00
parent 43911c8ef0
commit b7d076fc96
6 changed files with 119 additions and 111 deletions

View File

@@ -463,7 +463,7 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
+ (winX + px); + (winX + px);
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
const GLubyte *src = (const GLubyte *) gl_pixel_addr_in_image( finalUnpack, const GLubyte *src = (const GLubyte *) _mesa_image_address( finalUnpack,
bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
if (finalUnpack->LsbFirst) { if (finalUnpack->LsbFirst) {
/* least significan bit first */ /* least significan bit first */

View File

@@ -1,4 +1,4 @@
/* $Id: colortab.c,v 1.9 2000/02/28 20:38:37 brianp Exp $ */ /* $Id: colortab.c,v 1.10 2000/03/21 01:03:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -163,7 +163,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
assert(palette); assert(palette);
if (!gl_is_legal_format_and_type(format, type)) { if (!_mesa_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)"); gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)");
return; return;
} }
@@ -246,7 +246,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
assert(palette); assert(palette);
if (!gl_is_legal_format_and_type(format, type)) { if (!_mesa_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)"); gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)");
return; return;
} }
@@ -256,7 +256,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
return; return;
} }
comps = gl_components_in_format(format); comps = _mesa_components_in_format(format);
assert(comps > 0); /* error should be caught sooner */ assert(comps > 0); /* error should be caught sooner */
if (start + count > palette->Size) { if (start + count > palette->Size) {
@@ -370,8 +370,8 @@ _mesa_GetColorTable( GLenum target, GLenum format,
return; return;
} }
gl_pack_rgba_span(ctx, palette->Size, (const GLubyte (*)[]) rgba, _mesa_pack_rgba_span(ctx, palette->Size, (const GLubyte (*)[]) rgba,
format, type, table, &ctx->Pack, GL_FALSE); format, type, table, &ctx->Pack, GL_FALSE);
(void) format; (void) format;
(void) type; (void) type;

View File

@@ -1,4 +1,4 @@
/* $Id: drawpix.c,v 1.14 2000/03/03 17:54:56 brianp Exp $ */ /* $Id: drawpix.c,v 1.15 2000/03/21 01:03:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -425,7 +425,7 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
*/ */
for (row = 0; row < height; row++, y++) { for (row = 0; row < height; row++, y++) {
GLuint indexes[MAX_WIDTH]; GLuint indexes[MAX_WIDTH];
const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack, const GLvoid *source = _mesa_image_address(&ctx->Unpack,
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0);
_mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT, indexes, _mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT, indexes,
type, source, &ctx->Unpack, GL_TRUE); type, source, &ctx->Unpack, GL_TRUE);
@@ -471,7 +471,7 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
GLstencil values[MAX_WIDTH]; GLstencil values[MAX_WIDTH];
GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte)) GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte))
? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT; ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack, const GLvoid *source = _mesa_image_address(&ctx->Unpack,
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0);
_mesa_unpack_index_span(ctx, drawWidth, destType, values, _mesa_unpack_index_span(ctx, drawWidth, destType, values,
type, source, &ctx->Unpack, GL_TRUE); type, source, &ctx->Unpack, GL_TRUE);
@@ -541,7 +541,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
GLint row; GLint row;
for (row = 0; row < height; row++, y++) { for (row = 0; row < height; row++, y++) {
GLdepth zspan[MAX_WIDTH]; GLdepth zspan[MAX_WIDTH];
const GLushort *zptr = gl_pixel_addr_in_image(&ctx->Unpack, const GLushort *zptr = _mesa_image_address(&ctx->Unpack,
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
GLint i; GLint i;
for (i = 0; i < width; i++) for (i = 0; i < width; i++)
@@ -554,7 +554,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
/* Special case: directly write 32-bit depth values */ /* Special case: directly write 32-bit depth values */
GLint row; GLint row;
for (row = 0; row < height; row++, y++) { for (row = 0; row < height; row++, y++) {
const GLuint *zptr = gl_pixel_addr_in_image(&ctx->Unpack, const GLuint *zptr = _mesa_image_address(&ctx->Unpack,
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP ); gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP );
} }
@@ -564,7 +564,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
GLint row; GLint row;
for (row = 0; row < height; row++, y++) { for (row = 0; row < height; row++, y++) {
GLdepth zspan[MAX_WIDTH]; GLdepth zspan[MAX_WIDTH];
const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, const GLvoid *src = _mesa_image_address(&ctx->Unpack,
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
_mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src, _mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src,
&ctx->Unpack, GL_TRUE ); &ctx->Unpack, GL_TRUE );
@@ -640,7 +640,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
if (width > MAX_WIDTH) if (width > MAX_WIDTH)
width = MAX_WIDTH; width = MAX_WIDTH;
for (row = 0; row < height; row++, y++) { for (row = 0; row < height; row++, y++) {
const GLvoid *source = gl_pixel_addr_in_image(unpack, const GLvoid *source = _mesa_image_address(unpack,
pixels, width, height, format, type, 0, row, 0); pixels, width, height, format, type, 0, row, 0);
_mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba, _mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba,
format, type, source, unpack, GL_TRUE); format, type, source, unpack, GL_TRUE);

View File

@@ -1,4 +1,4 @@
/* $Id: image.c,v 1.21 2000/03/21 00:48:53 brianp Exp $ */ /* $Id: image.c,v 1.22 2000/03/21 01:03:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -63,7 +63,8 @@ struct gl_pixelstore_attrib _mesa_native_packing = {
/* /*
* Flip the 8 bits in each byte of the given array. * Flip the 8 bits in each byte of the given array.
*/ */
void gl_flip_bytes( GLubyte *p, GLuint n ) static void
flip_bytes( GLubyte *p, GLuint n )
{ {
register GLuint i, a, b; register GLuint i, a, b;
@@ -85,7 +86,8 @@ void gl_flip_bytes( GLubyte *p, GLuint n )
/* /*
* Flip the order of the 2 bytes in each word in the given array. * Flip the order of the 2 bytes in each word in the given array.
*/ */
void gl_swap2( GLushort *p, GLuint n ) void
_mesa_swap2( GLushort *p, GLuint n )
{ {
register GLuint i; register GLuint i;
@@ -99,7 +101,8 @@ void gl_swap2( GLushort *p, GLuint n )
/* /*
* Flip the order of the 4 bytes in each word in the given array. * Flip the order of the 4 bytes in each word in the given array.
*/ */
void gl_swap4( GLuint *p, GLuint n ) void
_mesa_swap4( GLuint *p, GLuint n )
{ {
register GLuint i, a, b; register GLuint i, a, b;
@@ -121,7 +124,7 @@ void gl_swap4( GLuint *p, GLuint n )
* Return 0 if GL_BITMAP. * Return 0 if GL_BITMAP.
* Return -1 if invalid type enum. * Return -1 if invalid type enum.
*/ */
GLint gl_sizeof_type( GLenum type ) GLint _mesa_sizeof_type( GLenum type )
{ {
switch (type) { switch (type) {
case GL_BITMAP: case GL_BITMAP:
@@ -147,10 +150,10 @@ GLint gl_sizeof_type( GLenum type )
/* /*
* Same as gl_sizeof_packed_type() but we also accept the * Same as _mesa_sizeof_packed_type() but we also accept the
* packed pixel format datatypes. * packed pixel format datatypes.
*/ */
GLint gl_sizeof_packed_type( GLenum type ) GLint _mesa_sizeof_packed_type( GLenum type )
{ {
switch (type) { switch (type) {
case GL_BITMAP: case GL_BITMAP:
@@ -204,7 +207,7 @@ GLint gl_sizeof_packed_type( GLenum type )
* Return the number of components in a GL enum pixel type. * Return the number of components in a GL enum pixel type.
* Return -1 if bad format. * Return -1 if bad format.
*/ */
GLint gl_components_in_format( GLenum format ) GLint _mesa_components_in_format( GLenum format )
{ {
switch (format) { switch (format) {
case GL_COLOR_INDEX: case GL_COLOR_INDEX:
@@ -244,9 +247,9 @@ GLint gl_components_in_format( GLenum format )
* Return bytes per pixel for given format and type * Return bytes per pixel for given format and type
* Return -1 if bad format or type. * Return -1 if bad format or type.
*/ */
GLint gl_bytes_per_pixel( GLenum format, GLenum type ) GLint _mesa_bytes_per_pixel( GLenum format, GLenum type )
{ {
GLint comps = gl_components_in_format( format ); GLint comps = _mesa_components_in_format( format );
if (comps < 0) if (comps < 0)
return -1; return -1;
@@ -302,7 +305,8 @@ GLint gl_bytes_per_pixel( GLenum format, GLenum type )
* Test if the given pixel format and type are legal. * Test if the given pixel format and type are legal.
* Return GL_TRUE for legal, GL_FALSE for illegal. * Return GL_TRUE for legal, GL_FALSE for illegal.
*/ */
GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type ) GLboolean
_mesa_is_legal_format_and_type( GLenum format, GLenum type )
{ {
switch (format) { switch (format) {
case GL_COLOR_INDEX: case GL_COLOR_INDEX:
@@ -400,10 +404,11 @@ GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type )
* row, column - location of pixel in the image * row, column - location of pixel in the image
* Return: address of pixel at (image,row,column) in image or NULL if error. * Return: address of pixel at (image,row,column) in image or NULL if error.
*/ */
GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, GLvoid *
const GLvoid *image, GLsizei width, _mesa_image_address( const struct gl_pixelstore_attrib *packing,
GLsizei height, GLenum format, GLenum type, const GLvoid *image, GLsizei width,
GLint img, GLint row, GLint column ) GLsizei height, GLenum format, GLenum type,
GLint img, GLint row, GLint column )
{ {
GLint alignment; /* 1, 2 or 4 */ GLint alignment; /* 1, 2 or 4 */
GLint pixels_per_row; GLint pixels_per_row;
@@ -438,13 +443,13 @@ GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing,
GLint bytes_per_image; GLint bytes_per_image;
/* Compute bytes per component */ /* Compute bytes per component */
bytes_per_comp = gl_sizeof_packed_type( type ); bytes_per_comp = _mesa_sizeof_packed_type( type );
if (bytes_per_comp<0) { if (bytes_per_comp<0) {
return NULL; return NULL;
} }
/* Compute number of components per pixel */ /* Compute number of components per pixel */
comp_per_pixel = gl_components_in_format( format ); comp_per_pixel = _mesa_components_in_format( format );
if (comp_per_pixel<0 && type != GL_BITMAP) { if (comp_per_pixel<0 && type != GL_BITMAP) {
return NULL; return NULL;
} }
@@ -463,7 +468,7 @@ GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing,
/* Non-BITMAP data */ /* Non-BITMAP data */
GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image;
bytes_per_pixel = gl_bytes_per_pixel( format, type ); bytes_per_pixel = _mesa_bytes_per_pixel( format, type );
/* The pixel type and format should have been error checked earlier */ /* The pixel type and format should have been error checked earlier */
assert(bytes_per_pixel > 0); assert(bytes_per_pixel > 0);
@@ -511,7 +516,7 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
} }
else { else {
/* Non-BITMAP data */ /* Non-BITMAP data */
const GLint bytesPerPixel = gl_bytes_per_pixel(format, type); const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
if (bytesPerPixel <= 0) if (bytesPerPixel <= 0)
return -1; /* error */ return -1; /* error */
if (packing->RowLength == 0) { if (packing->RowLength == 0) {
@@ -595,11 +600,12 @@ _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
* packing - pixel packing parameters * packing - pixel packing parameters
* applyTransferOps - apply scale/bias/lookup-table ops? * applyTransferOps - apply scale/bias/lookup-table ops?
*/ */
void gl_pack_rgba_span( const GLcontext *ctx, void
GLuint n, CONST GLubyte rgba[][4], _mesa_pack_rgba_span( const GLcontext *ctx,
GLenum format, GLenum type, GLvoid *destination, GLuint n, CONST GLubyte rgba[][4],
const struct gl_pixelstore_attrib *packing, GLenum format, GLenum type, GLvoid *destination,
GLboolean applyTransferOps ) const struct gl_pixelstore_attrib *packing,
GLboolean applyTransferOps )
{ {
applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag); applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag);
@@ -627,7 +633,7 @@ void gl_pack_rgba_span( const GLcontext *ctx,
const GLfloat gscale = 1.0F / 255.0F; const GLfloat gscale = 1.0F / 255.0F;
const GLfloat bscale = 1.0F / 255.0F; const GLfloat bscale = 1.0F / 255.0F;
const GLfloat ascale = 1.0F / 255.0F; const GLfloat ascale = 1.0F / 255.0F;
const GLint comps = gl_components_in_format(format); const GLint comps = _mesa_components_in_format(format);
GLuint i; GLuint i;
assert(n <= MAX_WIDTH); assert(n <= MAX_WIDTH);
@@ -732,7 +738,7 @@ void gl_pack_rgba_span( const GLcontext *ctx,
} }
break; break;
default: default:
gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
} }
} }
break; break;
@@ -804,7 +810,7 @@ void gl_pack_rgba_span( const GLcontext *ctx,
} }
break; break;
default: default:
gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
} }
} }
break; break;
@@ -877,10 +883,10 @@ void gl_pack_rgba_span( const GLcontext *ctx,
} }
break; break;
default: default:
gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
} }
if (packing->SwapBytes) { if (packing->SwapBytes) {
gl_swap2( (GLushort *) dst, n * comps); _mesa_swap2( (GLushort *) dst, n * comps);
} }
} }
break; break;
@@ -952,10 +958,10 @@ void gl_pack_rgba_span( const GLcontext *ctx,
} }
break; break;
default: default:
gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
} }
if (packing->SwapBytes) { if (packing->SwapBytes) {
gl_swap2( (GLushort *) dst, n * comps ); _mesa_swap2( (GLushort *) dst, n * comps );
} }
} }
break; break;
@@ -1028,10 +1034,10 @@ void gl_pack_rgba_span( const GLcontext *ctx,
} }
break; break;
default: default:
gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
} }
if (packing->SwapBytes) { if (packing->SwapBytes) {
gl_swap4( (GLuint *) dst, n * comps ); _mesa_swap4( (GLuint *) dst, n * comps );
} }
} }
break; break;
@@ -1104,10 +1110,10 @@ void gl_pack_rgba_span( const GLcontext *ctx,
} }
break; break;
default: default:
gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
} }
if (packing->SwapBytes) { if (packing->SwapBytes) {
gl_swap4( (GLuint *) dst, n * comps ); _mesa_swap4( (GLuint *) dst, n * comps );
} }
} }
break; break;
@@ -1180,10 +1186,10 @@ void gl_pack_rgba_span( const GLcontext *ctx,
} }
break; break;
default: default:
gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
} }
if (packing->SwapBytes) { if (packing->SwapBytes) {
gl_swap4( (GLuint *) dst, n * comps ); _mesa_swap4( (GLuint *) dst, n * comps );
} }
} }
break; break;
@@ -1388,7 +1394,7 @@ void gl_pack_rgba_span( const GLcontext *ctx,
} }
break; break;
default: default:
gl_problem( ctx, "bad type in gl_pack_rgba_span" ); gl_problem( ctx, "bad type in _mesa_pack_rgba_span" );
} }
} }
} }
@@ -2196,7 +2202,7 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx,
} }
} }
else if (dstFormat == srcFormat) { else if (dstFormat == srcFormat) {
GLint comps = gl_components_in_format(srcFormat); GLint comps = _mesa_components_in_format(srcFormat);
assert(comps > 0); assert(comps > 0);
MEMCPY( dest, source, n * comps * sizeof(GLubyte) ); MEMCPY( dest, source, n * comps * sizeof(GLubyte) );
return; return;
@@ -2211,7 +2217,7 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx,
GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex;
GLint dstLuminanceIndex, dstIntensityIndex; GLint dstLuminanceIndex, dstIntensityIndex;
dstComponents = gl_components_in_format( dstFormat ); dstComponents = _mesa_components_in_format( dstFormat );
/* source & dest image formats should have been error checked by now */ /* source & dest image formats should have been error checked by now */
assert(dstComponents > 0); assert(dstComponents > 0);
@@ -2721,8 +2727,8 @@ _mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth,
compsPerRow = 0; compsPerRow = 0;
} }
else { else {
const GLint bytesPerPixel = gl_bytes_per_pixel(format, type); const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
const GLint components = gl_components_in_format(format); const GLint components = _mesa_components_in_format(format);
GLint bytesPerComp; GLint bytesPerComp;
if (bytesPerPixel <= 0 || components <= 0) if (bytesPerPixel <= 0 || components <= 0)
return NULL; /* bad format or type. generate error later */ return NULL; /* bad format or type. generate error later */
@@ -2745,18 +2751,18 @@ _mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth,
dst = destBuffer; dst = destBuffer;
for (img = 0; img < depth; img++) { for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
const GLvoid *src = gl_pixel_addr_in_image(unpack, pixels, const GLvoid *src = _mesa_image_address(unpack, pixels,
width, height, format, type, img, row, 0); width, height, format, type, img, row, 0);
MEMCPY(dst, src, bytesPerRow); MEMCPY(dst, src, bytesPerRow);
/* byte flipping/swapping */ /* byte flipping/swapping */
if (flipBytes) { if (flipBytes) {
gl_flip_bytes((GLubyte *) dst, bytesPerRow); flip_bytes((GLubyte *) dst, bytesPerRow);
} }
else if (swap2) { else if (swap2) {
gl_swap2((GLushort*) dst, compsPerRow); _mesa_swap2((GLushort*) dst, compsPerRow);
} }
else if (swap4) { else if (swap4) {
gl_swap4((GLuint*) dst, compsPerRow); _mesa_swap4((GLuint*) dst, compsPerRow);
} }
dst += bytesPerRow; dst += bytesPerRow;
} }
@@ -2790,9 +2796,9 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
width_in_bytes = CEILING( width, 8 ); width_in_bytes = CEILING( width, 8 );
dst = buffer; dst = buffer;
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
GLubyte *src = gl_pixel_addr_in_image( packing, pixels, width, height, GLubyte *src = _mesa_image_address( packing, pixels, width, height,
GL_COLOR_INDEX, GL_BITMAP, GL_COLOR_INDEX, GL_BITMAP,
0, row, 0 ); 0, row, 0 );
if (!src) { if (!src) {
FREE(buffer); FREE(buffer);
return NULL; return NULL;
@@ -2801,7 +2807,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
if (packing->SkipPixels == 0) { if (packing->SkipPixels == 0) {
MEMCPY( dst, src, width_in_bytes ); MEMCPY( dst, src, width_in_bytes );
if (packing->LsbFirst) { if (packing->LsbFirst) {
gl_flip_bytes( dst, width_in_bytes ); flip_bytes( dst, width_in_bytes );
} }
} }
else { else {
@@ -2885,16 +2891,16 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
width_in_bytes = CEILING( width, 8 ); width_in_bytes = CEILING( width, 8 );
src = source; src = source;
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
GLubyte *dst = gl_pixel_addr_in_image( packing, dest, width, height, GLubyte *dst = _mesa_image_address( packing, dest, width, height,
GL_COLOR_INDEX, GL_BITMAP, GL_COLOR_INDEX, GL_BITMAP,
0, row, 0 ); 0, row, 0 );
if (!dst) if (!dst)
return; return;
if (packing->SkipPixels == 0) { if (packing->SkipPixels == 0) {
MEMCPY( dst, src, width_in_bytes ); MEMCPY( dst, src, width_in_bytes );
if (packing->LsbFirst) { if (packing->LsbFirst) {
gl_flip_bytes( dst, width_in_bytes ); flip_bytes( dst, width_in_bytes );
} }
} }
else { else {

View File

@@ -1,4 +1,4 @@
/* $Id: image.h,v 1.5 2000/03/21 00:48:53 brianp Exp $ */ /* $Id: image.h,v 1.6 2000/03/21 01:03:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -35,30 +35,33 @@
extern struct gl_pixelstore_attrib _mesa_native_packing; extern struct gl_pixelstore_attrib _mesa_native_packing;
extern void gl_flip_bytes( GLubyte *p, GLuint n ); extern void
_mesa_swap2( GLushort *p, GLuint n );
extern void
_mesa_swap4( GLuint *p, GLuint n );
extern void gl_swap2( GLushort *p, GLuint n ); extern GLint
_mesa_sizeof_type( GLenum type );
extern void gl_swap4( GLuint *p, GLuint n ); extern GLint
_mesa_sizeof_packed_type( GLenum type );
extern GLint
_mesa_components_in_format( GLenum format );
extern GLint gl_sizeof_type( GLenum type ); extern GLint
_mesa_bytes_per_pixel( GLenum format, GLenum type );
extern GLint gl_sizeof_packed_type( GLenum type ); extern GLboolean
_mesa_is_legal_format_and_type( GLenum format, GLenum type );
extern GLint gl_components_in_format( GLenum format );
extern GLint gl_bytes_per_pixel( GLenum format, GLenum type );
extern GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type );
extern GLvoid * extern GLvoid *
gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, _mesa_image_address( const struct gl_pixelstore_attrib *packing,
const GLvoid *image, GLsizei width, const GLvoid *image, GLsizei width,
GLsizei height, GLenum format, GLenum type, GLsizei height, GLenum format, GLenum type,
GLint img, GLint row, GLint column ); GLint img, GLint row, GLint column );
extern GLint extern GLint
@@ -77,11 +80,11 @@ _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
extern void extern void
gl_pack_rgba_span( const GLcontext *ctx, _mesa_pack_rgba_span( const GLcontext *ctx,
GLuint n, CONST GLubyte rgba[][4], GLuint n, CONST GLubyte rgba[][4],
GLenum format, GLenum type, GLvoid *dest, GLenum format, GLenum type, GLvoid *dest,
const struct gl_pixelstore_attrib *packing, const struct gl_pixelstore_attrib *packing,
GLboolean applyTransferOps ); GLboolean applyTransferOps );
extern void extern void

View File

@@ -1,4 +1,4 @@
/* $Id: teximage.c,v 1.22 2000/03/21 00:49:33 brianp Exp $ */ /* $Id: teximage.c,v 1.23 2000/03/21 01:03:40 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -483,7 +483,7 @@ make_texture_image( GLcontext *ctx,
/* This will cover the common GL_RGB, GL_RGBA, GL_ALPHA, /* This will cover the common GL_RGB, GL_RGBA, GL_ALPHA,
* GL_LUMINANCE_ALPHA, etc. texture formats. * GL_LUMINANCE_ALPHA, etc. texture formats.
*/ */
const GLubyte *src = (const GLubyte *) gl_pixel_addr_in_image( const GLubyte *src = (const GLubyte *) _mesa_image_address(
unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0); unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0);
const GLint srcStride = _mesa_image_row_stride(unpacking, width, const GLint srcStride = _mesa_image_row_stride(unpacking, width,
srcFormat, srcType); srcFormat, srcType);
@@ -504,7 +504,7 @@ make_texture_image( GLcontext *ctx,
} }
else if (srcFormat == GL_RGBA && internalFormat == GL_RGB) { else if (srcFormat == GL_RGBA && internalFormat == GL_RGB) {
/* commonly used by Quake */ /* commonly used by Quake */
const GLubyte *src = (const GLubyte *) gl_pixel_addr_in_image( const GLubyte *src = (const GLubyte *) _mesa_image_address(
unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0); unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0);
const GLint srcStride = _mesa_image_row_stride(unpacking, width, const GLint srcStride = _mesa_image_row_stride(unpacking, width,
srcFormat, srcType); srcFormat, srcType);
@@ -536,7 +536,7 @@ make_texture_image( GLcontext *ctx,
GLint img, row; GLint img, row;
for (img = 0; img < depth; img++) { for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
const GLvoid *source = gl_pixel_addr_in_image(unpacking, const GLvoid *source = _mesa_image_address(unpacking,
pixels, width, height, srcFormat, srcType, img, row, 0); pixels, width, height, srcFormat, srcType, img, row, 0);
_mesa_unpack_index_span(ctx, width, dstType, dest, _mesa_unpack_index_span(ctx, width, dstType, dest,
srcType, source, unpacking, GL_TRUE); srcType, source, unpacking, GL_TRUE);
@@ -552,7 +552,7 @@ make_texture_image( GLcontext *ctx,
GLint img, row; GLint img, row;
for (img = 0; img < depth; img++) { for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
const GLvoid *source = gl_pixel_addr_in_image(unpacking, const GLvoid *source = _mesa_image_address(unpacking,
pixels, width, height, srcFormat, srcType, img, row, 0); pixels, width, height, srcFormat, srcType, img, row, 0);
_mesa_unpack_ubyte_color_span(ctx, width, dstFormat, dest, _mesa_unpack_ubyte_color_span(ctx, width, dstFormat, dest,
srcFormat, srcType, source, unpacking, GL_TRUE); srcFormat, srcType, source, unpacking, GL_TRUE);
@@ -725,7 +725,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
return GL_TRUE; return GL_TRUE;
} }
if (!gl_is_legal_format_and_type( format, type )) { if (!_mesa_is_legal_format_and_type( format, type )) {
/* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there /* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there
* is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4. * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4.
*/ */
@@ -841,7 +841,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
} }
} }
if (!gl_is_legal_format_and_type(format, type)) { if (!_mesa_is_legal_format_and_type(format, type)) {
char message[100]; char message[100];
sprintf(message, "glTexSubImage%dD(format or type)", dimensions); sprintf(message, "glTexSubImage%dD(format or type)", dimensions);
gl_error(ctx, GL_INVALID_ENUM, message); gl_error(ctx, GL_INVALID_ENUM, message);
@@ -1297,7 +1297,7 @@ get_teximage_from_driver( GLcontext *ctx, GLenum target, GLint level,
assert(destComponents > 0); assert(destComponents > 0);
numPixels = texImage->Width * texImage->Height * texImage->Depth; numPixels = texImage->Width * texImage->Height * texImage->Depth;
assert(numPixels > 0); assert(numPixels > 0);
srcBytesPerTexel = gl_bytes_per_pixel(imgFormat, imgType); srcBytesPerTexel = _mesa_bytes_per_pixel(imgFormat, imgType);
assert(srcBytesPerTexel > 0); assert(srcBytesPerTexel > 0);
if (!texImage->Data) { if (!texImage->Data) {
@@ -1373,12 +1373,12 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
return; return;
} }
if (gl_sizeof_type(type) <= 0) { if (_mesa_sizeof_type(type) <= 0) {
gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" ); gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" );
return; return;
} }
if (gl_components_in_format(format) <= 0) { if (_mesa_components_in_format(format) <= 0) {
gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" ); gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" );
return; return;
} }
@@ -1423,16 +1423,15 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
/* compute destination address in client memory */ /* compute destination address in client memory */
GLvoid *dest = gl_pixel_addr_in_image( &ctx->Unpack, pixels, GLvoid *dest = _mesa_image_address( &ctx->Unpack, pixels,
width, height, width, height,
format, type, 0, row, 0); format, type, 0, row, 0);
assert(dest); assert(dest);
if (texImage->Format == GL_RGBA) { if (texImage->Format == GL_RGBA) {
const GLubyte *src = texImage->Data + row * width * 4 * sizeof(GLubyte); const GLubyte *src = texImage->Data + row * width * 4 * sizeof(GLubyte);
gl_pack_rgba_span( ctx, width, (CONST GLubyte (*)[4]) src, _mesa_pack_rgba_span( ctx, width, (CONST GLubyte (*)[4]) src,
format, type, dest, format, type, dest, &ctx->Pack, GL_TRUE );
&ctx->Pack, GL_TRUE );
} }
else { else {
/* fetch RGBA row from texture image then pack it in client mem */ /* fetch RGBA row from texture image then pack it in client mem */
@@ -1495,8 +1494,8 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
default: default:
gl_problem( ctx, "bad format in gl_GetTexImage" ); gl_problem( ctx, "bad format in gl_GetTexImage" );
} }
gl_pack_rgba_span( ctx, width, (const GLubyte (*)[4])rgba, _mesa_pack_rgba_span( ctx, width, (const GLubyte (*)[4])rgba,
format, type, dest, &ctx->Pack, GL_TRUE ); format, type, dest, &ctx->Pack, GL_TRUE );
} }
} }
@@ -1542,14 +1541,14 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
GLubyte *dst = destTex->Data + xoffsetb * texComponents; GLubyte *dst = destTex->Data + xoffsetb * texComponents;
if (texFormat == GL_COLOR_INDEX) { if (texFormat == GL_COLOR_INDEX) {
/* color index texture */ /* color index texture */
const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels,
width, 1, format, type, 0, 0, 0); width, 1, format, type, 0, 0, 0);
_mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst,
type, src, &ctx->Unpack, GL_TRUE); type, src, &ctx->Unpack, GL_TRUE);
} }
else { else {
/* color texture */ /* color texture */
const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels,
width, 1, format, type, 0, 0, 0); width, 1, format, type, 0, 0, 0);
_mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst,
format, type, src, &ctx->Unpack, GL_TRUE); format, type, src, &ctx->Unpack, GL_TRUE);
@@ -1616,7 +1615,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
const GLint stride = destTex->Width * sizeof(GLubyte); const GLint stride = destTex->Width * sizeof(GLubyte);
GLint row; GLint row;
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels,
width, height, format, type, 0, row, 0); width, height, format, type, 0, row, 0);
_mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst,
type, src, &ctx->Unpack, GL_TRUE); type, src, &ctx->Unpack, GL_TRUE);
@@ -1628,7 +1627,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
const GLint stride = destTex->Width * texComponents * sizeof(GLubyte); const GLint stride = destTex->Width * texComponents * sizeof(GLubyte);
GLint row; GLint row;
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels,
width, height, format, type, 0, row, 0); width, height, format, type, 0, row, 0);
_mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst,
format, type, src, &ctx->Unpack, GL_TRUE); format, type, src, &ctx->Unpack, GL_TRUE);
@@ -1702,7 +1701,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
GLint img, row; GLint img, row;
for (img = 0; img < depth; img++) { for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels,
width, height, format, type, img, row, 0); width, height, format, type, img, row, 0);
_mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst,
type, src, &ctx->Unpack, GL_TRUE); type, src, &ctx->Unpack, GL_TRUE);
@@ -1716,7 +1715,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
GLint img, row; GLint img, row;
for (img = 0; img < depth; img++) { for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) { for (row = 0; row < height; row++) {
const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels,
width, height, format, type, img, row, 0); width, height, format, type, img, row, 0);
_mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst,
format, type, src, &ctx->Unpack, GL_TRUE); format, type, src, &ctx->Unpack, GL_TRUE);