diff options
-rw-r--r-- | src/mesa/main/colortab.c | 2 | ||||
-rw-r--r-- | src/mesa/main/convolve.c | 35 | ||||
-rw-r--r-- | src/mesa/main/histogram.c | 4 | ||||
-rw-r--r-- | src/mesa/main/image.c | 26 | ||||
-rw-r--r-- | src/mesa/main/image.h | 3 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 9 | ||||
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 6 |
7 files changed, 37 insertions, 48 deletions
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 63d254d6bfd..e9349516eb8 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -807,7 +807,7 @@ _mesa_GetColorTable( GLenum target, GLenum format, data = ADD_POINTERS(buf, data); } - _mesa_pack_rgba_span_float(ctx, table->Size, (const GLfloat (*)[4]) rgba, + _mesa_pack_rgba_span_float(ctx, table->Size, rgba, format, type, data, &ctx->Pack, 0x0); if (ctx->Pack.BufferObj->Name) { diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index 6b97c7f56cd..814c6a0a5a6 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.3 + * Version: 6.5.2 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2006 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"), @@ -560,9 +560,10 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi void GLAPIENTRY -_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) +_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, + GLvoid *image) { - const struct gl_convolution_attrib *filter; + struct gl_convolution_attrib *filter; GLuint row; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -623,10 +624,9 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *im GLvoid *dst = _mesa_image_address2d(&ctx->Pack, image, filter->Width, filter->Height, format, type, row, 0); - const GLfloat *src = filter->Filter + row * filter->Width * 4; - _mesa_pack_rgba_span_float(ctx, filter->Width, - (const GLfloat (*)[4]) src, - format, type, dst, &ctx->Pack, 0); + GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + row * filter->Width * 4); + _mesa_pack_rgba_span_float(ctx, filter->Width, src, + format, type, dst, &ctx->Pack, 0x0); } if (ctx->Pack.BufferObj->Name) { @@ -768,10 +768,11 @@ _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) void GLAPIENTRY -_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) +_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, + GLvoid *row, GLvoid *column, GLvoid *span) { const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; - const struct gl_convolution_attrib *filter; + struct gl_convolution_attrib *filter; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -785,7 +786,8 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, } if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)"); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetConvolutionFilter(format or type)"); return; } @@ -833,18 +835,17 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *dst = _mesa_image_address1d(&ctx->Pack, row, filter->Width, format, type, 0); _mesa_pack_rgba_span_float(ctx, filter->Width, - (const GLfloat (*)[4]) filter->Filter, - format, type, dst, &ctx->Pack, 0); + (GLfloat (*)[4]) filter->Filter, + format, type, dst, &ctx->Pack, 0x0); } /* Column filter */ if (column) { GLvoid *dst = _mesa_image_address1d(&ctx->Pack, column, filter->Height, format, type, 0); - const GLfloat *src = filter->Filter + colStart; - _mesa_pack_rgba_span_float(ctx, filter->Height, - (const GLfloat (*)[4]) src, - format, type, dst, &ctx->Pack, 0); + GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + colStart); + _mesa_pack_rgba_span_float(ctx, filter->Height, src, + format, type, dst, &ctx->Pack, 0x0); } (void) span; /* unused at this time */ diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index 29aced0c7a7..6a7f09489c5 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -748,8 +748,8 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo minmax[1][GCOMP] = CLAMP(ctx->MinMax.Max[GCOMP], 0.0F, 1.0F); minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F); minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F); - _mesa_pack_rgba_span_float(ctx, 2, (CONST GLfloat (*)[4]) minmax, - format, type, values, &ctx->Pack, 0); + _mesa_pack_rgba_span_float(ctx, 2, minmax, + format, type, values, &ctx->Pack, 0x0); } if (ctx->Pack.BufferObj->Name) { diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 55753c22c5a..af116af7e81 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1065,18 +1065,18 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, * by the dstFormat, dstType and dstPacking. Used by glReadPixels, * glGetConvolutionFilter(), etc. * Incoming colors will be clamped to [0,1] if needed. + * Note: the rgba values will be modified by this function when any pixel + * transfer ops are enabled. */ void -_mesa_pack_rgba_span_float( GLcontext *ctx, - GLuint n, CONST GLfloat rgbaIn[][4], - GLenum dstFormat, GLenum dstType, - GLvoid *dstAddr, - const struct gl_pixelstore_attrib *dstPacking, - GLbitfield transferOps ) +_mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4], + GLenum dstFormat, GLenum dstType, + GLvoid *dstAddr, + const struct gl_pixelstore_attrib *dstPacking, + GLbitfield transferOps) { + GLfloat luminance[MAX_WIDTH]; const GLint comps = _mesa_components_in_format(dstFormat); - GLfloat rgbaCopy[MAX_WIDTH][4], luminance[MAX_WIDTH]; - const GLfloat (*rgba)[4]; GLuint i; if (dstType != GL_FLOAT) { @@ -1085,19 +1085,11 @@ _mesa_pack_rgba_span_float( GLcontext *ctx, } if (transferOps) { - /* make copy of incoming data */ - _mesa_memcpy(rgbaCopy, rgbaIn, n * 4 * sizeof(GLfloat)); - _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgbaCopy); - rgba = (const GLfloat (*)[4]) rgbaCopy; - + _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba); if ((transferOps & IMAGE_MIN_MAX_BIT) && ctx->MinMax.Sink) { return; } } - else { - /* use incoming data, not a copy */ - rgba = (const GLfloat (*)[4]) rgbaIn; - } if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) { /* compute luminance values */ diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h index d9d5830ac6a..5d50f5df156 100644 --- a/src/mesa/main/image.h +++ b/src/mesa/main/image.h @@ -116,8 +116,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, GLuint n, GLfloat rgba[][4]); extern void -_mesa_pack_rgba_span_float( GLcontext *ctx, - GLuint n, CONST GLfloat rgba[][4], +_mesa_pack_rgba_span_float( GLcontext *ctx, GLuint n, GLfloat rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, GLbitfield transferOps ); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 72ff73ef054..2a34cfba5a3 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -398,7 +398,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, GLfloat *dst = tempImage + img * (convWidth * convHeight * 4); for (row = 0; row < convHeight; row++) { _mesa_pack_rgba_span_float(ctx, convWidth, - (const GLfloat (*)[4]) src, + (GLfloat (*)[4]) src, logicalBaseFormat, GL_FLOAT, dst, &ctx->DefaultPacking, postConvTransferOps); @@ -3607,10 +3607,9 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, for (col = 0; col < width; col++) { (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); } - _mesa_pack_rgba_span_float(ctx, width, - (const GLfloat (*)[4]) rgba, - format, type, dest, &ctx->Pack, - 0 /* no image transfer */); + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, + format, type, dest, + &ctx->Pack, 0x0 /*image xfer ops*/); } /* format */ } /* row */ } /* img */ diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 3b7fc3f0677..fb39427b621 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -377,8 +377,7 @@ read_rgba_pixels( GLcontext *ctx, GLvoid *dest; dest = _mesa_image_address2d(packing, pixels, width, height, format, type, row, 0); - _mesa_pack_rgba_span_float(ctx, width, - (const GLfloat (*)[4]) src, + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) src, format, type, dest, packing, transferOps & IMAGE_POST_CONVOLUTION_BITS); src += width * 4; @@ -419,8 +418,7 @@ read_rgba_pixels( GLcontext *ctx, } /* pack the row of RGBA pixels into user's buffer */ - _mesa_pack_rgba_span_float(ctx, width, (CONST GLfloat (*)[4]) rgba, - format, type, dst, + _mesa_pack_rgba_span_float(ctx, width, rgba, format, type, dst, packing, ctx->_ImageTransferState); dst += dstStride; |