From 663f61a3e177a443c36f414a16a9d5f94e74135d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 17 Sep 2011 15:36:13 -0600 Subject: [PATCH] mesa: s/_mesa_make_temp_chan_image()/_mesa_make_temp_ubyte_image() Another step toward eliminating the GLchan type. --- src/mesa/main/texcompress_fxt1.c | 8 +- src/mesa/main/texcompress_rgtc.c | 8 +- src/mesa/main/texcompress_s3tc.c | 16 +-- src/mesa/main/texstore.c | 210 +++++++++++++++---------------- src/mesa/main/texstore.h | 4 +- 5 files changed, 123 insertions(+), 123 deletions(-) diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 1cbaba76230..624c34b9710 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -65,7 +65,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) GLint srcRowStride; GLubyte *dst; const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ - const GLchan *tempImage = NULL; + const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1); ASSERT(dstXoffset % 8 == 0); @@ -79,7 +79,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGB/GLchan */ - tempImage = _mesa_make_temp_chan_image(ctx, dims, + tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, @@ -121,7 +121,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) GLint srcRowStride; GLubyte *dst; GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ - const GLchan *tempImage = NULL; + const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1); ASSERT(dstXoffset % 8 == 0); @@ -135,7 +135,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGBA/GLchan */ - tempImage = _mesa_make_temp_chan_image(ctx, dims, + tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c index 7af3d676263..f18a966252b 100644 --- a/src/mesa/main/texcompress_rgtc.c +++ b/src/mesa/main/texcompress_rgtc.c @@ -93,7 +93,7 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) { GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ - const GLchan *tempImage = NULL; + const GLubyte *tempImage = NULL; int i, j; int numxpixels, numypixels; const GLchan *srcaddr; @@ -109,7 +109,7 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) (void) dstImageOffsets; - tempImage = _mesa_make_temp_chan_image(ctx, dims, + tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, @@ -204,7 +204,7 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) { GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ - const GLchan *tempImage = NULL; + const GLubyte *tempImage = NULL; int i, j; int numxpixels, numypixels; const GLchan *srcaddr; @@ -220,7 +220,7 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) (void) dstZoffset; (void) dstImageOffsets; - tempImage = _mesa_make_temp_chan_image(ctx, dims, + tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 36a56447ea0..161c453661c 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -166,7 +166,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) const GLchan *pixels; GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ - const GLchan *tempImage = NULL; + const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1 || dstFormat == MESA_FORMAT_SRGB_DXT1); @@ -181,7 +181,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGB/GLchan */ - tempImage = _mesa_make_temp_chan_image(ctx, dims, + tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, @@ -225,7 +225,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) const GLchan *pixels; GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ - const GLchan *tempImage = NULL; + const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1 || dstFormat == MESA_FORMAT_SRGBA_DXT1); @@ -240,7 +240,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGBA/GLchan */ - tempImage = _mesa_make_temp_chan_image(ctx, dims, + tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, @@ -283,7 +283,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) const GLchan *pixels; GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ - const GLchan *tempImage = NULL; + const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3 || dstFormat == MESA_FORMAT_SRGBA_DXT3); @@ -298,7 +298,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGBA/GLchan */ - tempImage = _mesa_make_temp_chan_image(ctx, dims, + tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, @@ -340,7 +340,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) const GLchan *pixels; GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ - const GLchan *tempImage = NULL; + const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5 || dstFormat == MESA_FORMAT_SRGBA_DXT5); @@ -355,7 +355,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGBA/GLchan */ - tempImage = _mesa_make_temp_chan_image(ctx, dims, + tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index b958615b582..bb4026dcef9 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -531,7 +531,7 @@ make_temp_uint_image(struct gl_context *ctx, GLuint dims, /** - * Make a temporary (color) texture image with GLchan components. + * Make a temporary (color) texture image with GLubyte components. * Apply all needed pixel unpacking and pixel transfer operations. * Note that there are both logicalBaseFormat and textureBaseFormat parameters. * Suppose the user specifies GL_LUMINANCE as the internal texture format @@ -551,21 +551,21 @@ make_temp_uint_image(struct gl_context *ctx, GLuint dims, * \param srcType source image type * \param srcAddr source image address * \param srcPacking source image pixel packing - * \return resulting image with format = textureBaseFormat and type = GLchan. + * \return resulting image with format = textureBaseFormat and type = GLubyte. */ -GLchan * -_mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims, - GLenum logicalBaseFormat, - GLenum textureBaseFormat, - GLint srcWidth, GLint srcHeight, GLint srcDepth, - GLenum srcFormat, GLenum srcType, - const GLvoid *srcAddr, - const struct gl_pixelstore_attrib *srcPacking) +GLubyte * +_mesa_make_temp_ubyte_image(struct gl_context *ctx, GLuint dims, + GLenum logicalBaseFormat, + GLenum textureBaseFormat, + GLint srcWidth, GLint srcHeight, GLint srcDepth, + GLenum srcFormat, GLenum srcType, + const GLvoid *srcAddr, + const struct gl_pixelstore_attrib *srcPacking) { GLuint transferOps = ctx->_ImageTransferState; const GLint components = _mesa_components_in_format(logicalBaseFormat); GLint img, row; - GLchan *tempImage, *dst; + GLubyte *tempImage, *dst; ASSERT(dims >= 1 && dims <= 3); @@ -588,8 +588,8 @@ _mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims, textureBaseFormat == GL_INTENSITY); /* unpack and transfer the source image */ - tempImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth - * components * sizeof(GLchan)); + tempImage = (GLubyte *) malloc(srcWidth * srcHeight * srcDepth + * components * sizeof(GLubyte)); if (!tempImage) { return NULL; } @@ -616,7 +616,7 @@ _mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims, /* one more conversion step */ GLint texComponents = _mesa_components_in_format(textureBaseFormat); GLint logComponents = _mesa_components_in_format(logicalBaseFormat); - GLchan *newImage; + GLubyte *newImage; GLint i, n; GLubyte map[6]; @@ -629,8 +629,8 @@ _mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims, */ ASSERT(texComponents >= logComponents); - newImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth - * texComponents * sizeof(GLchan)); + newImage = (GLubyte *) malloc(srcWidth * srcHeight * srcDepth + * texComponents * sizeof(GLubyte)); if (!newImage) { free(tempImage); return NULL; @@ -646,7 +646,7 @@ _mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims, if (j == ZERO) newImage[i * texComponents + k] = 0; else if (j == ONE) - newImage[i * texComponents + k] = CHAN_MAX; + newImage[i * texComponents + k] = 255; else newImage[i * texComponents + k] = tempImage[i * logComponents + j]; } @@ -1235,13 +1235,13 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = tempImage; + const GLubyte *src = tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -1255,17 +1255,17 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) /* check for byteswapped format */ if (dstFormat == MESA_FORMAT_RGB565) { for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_565( CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + dstUS[col] = PACK_COLOR_565( src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 3; } } else { for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_565_REV( CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + dstUS[col] = PACK_COLOR_565_REV( src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 3; } } @@ -1361,13 +1361,13 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = tempImage; + const GLubyte *src = tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -1380,19 +1380,19 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == MESA_FORMAT_RGBA8888) { for (col = 0; col < srcWidth; col++) { - dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]), - CHAN_TO_UBYTE(src[ACOMP]) ); + dstUI[col] = PACK_COLOR_8888( src[RCOMP], + src[GCOMP], + src[BCOMP], + src[ACOMP] ); src += 4; } } else { for (col = 0; col < srcWidth; col++) { - dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]), - CHAN_TO_UBYTE(src[ACOMP]) ); + dstUI[col] = PACK_COLOR_8888_REV( src[RCOMP], + src[GCOMP], + src[BCOMP], + src[ACOMP] ); src += 4; } } @@ -1561,13 +1561,13 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = tempImage; + const GLubyte *src = tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -1580,28 +1580,28 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == MESA_FORMAT_ARGB8888) { for (col = 0; col < srcWidth; col++) { - dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]), - CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + dstUI[col] = PACK_COLOR_8888( src[ACOMP], + src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 4; } } else if (dstFormat == MESA_FORMAT_XRGB8888) { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888( 0xff, - CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 4; } } else { for (col = 0; col < srcWidth; col++) { - dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[ACOMP]), - CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + dstUI[col] = PACK_COLOR_8888_REV( src[ACOMP], + src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 4; } } @@ -1690,13 +1690,13 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = (const GLchan *) tempImage; + const GLubyte *src = (const GLubyte *) tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -1709,9 +1709,9 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) #if 0 if (littleEndian) { for (col = 0; col < srcWidth; col++) { - dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]); - dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]); - dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]); + dstRow[col * 3 + 0] = src[RCOMP]; + dstRow[col * 3 + 1] = src[GCOMP]; + dstRow[col * 3 + 2] = src[BCOMP]; srcUB += 3; } } @@ -1725,9 +1725,9 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) } #else for (col = 0; col < srcWidth; col++) { - dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[BCOMP]); - dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]); - dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[RCOMP]); + dstRow[col * 3 + 0] = src[BCOMP]; + dstRow[col * 3 + 1] = src[GCOMP]; + dstRow[col * 3 + 2] = src[RCOMP]; src += 3; } #endif @@ -1816,13 +1816,13 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = (const GLchan *) tempImage; + const GLubyte *src = (const GLubyte *) tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -1833,9 +1833,9 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { - dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]); - dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]); - dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]); + dstRow[col * 3 + 0] = src[RCOMP]; + dstRow[col * 3 + 1] = src[GCOMP]; + dstRow[col * 3 + 2] = src[BCOMP]; src += 3; } dstRow += dstRowStride; @@ -1873,13 +1873,13 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = tempImage; + const GLubyte *src = tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -1892,19 +1892,19 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == MESA_FORMAT_ARGB4444) { for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[ACOMP]), - CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + dstUS[col] = PACK_COLOR_4444( src[ACOMP], + src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 4; } } else { for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_4444_REV( CHAN_TO_UBYTE(src[ACOMP]), - CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + dstUS[col] = PACK_COLOR_4444_REV( src[ACOMP], + src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 4; } } @@ -1941,13 +1941,13 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src =tempImage; + const GLubyte *src =tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -1959,10 +1959,10 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_5551( CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]), - CHAN_TO_UBYTE(src[ACOMP]) ); + dstUS[col] = PACK_COLOR_5551( src[RCOMP], + src[GCOMP], + src[BCOMP], + src[ACOMP] ); src += 4; } dstRow += dstRowStride; @@ -1999,13 +1999,13 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src =tempImage; + const GLubyte *src =tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -2018,19 +2018,19 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == MESA_FORMAT_ARGB1555) { for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_1555( CHAN_TO_UBYTE(src[ACOMP]), - CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + dstUS[col] = PACK_COLOR_1555( src[ACOMP], + src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 4; } } else { for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_1555_REV( CHAN_TO_UBYTE(src[ACOMP]), - CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + dstUS[col] = PACK_COLOR_1555_REV( src[ACOMP], + src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 4; } } @@ -2137,13 +2137,13 @@ _mesa_texstore_unorm44(TEXSTORE_PARAMS) { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = tempImage; + const GLubyte *src = tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -2156,8 +2156,8 @@ _mesa_texstore_unorm44(TEXSTORE_PARAMS) GLubyte *dstUS = (GLubyte *) dstRow; for (col = 0; col < srcWidth; col++) { /* src[0] is luminance, src[1] is alpha */ - dstUS[col] = PACK_COLOR_44( CHAN_TO_UBYTE(src[1]), - CHAN_TO_UBYTE(src[0]) ); + dstUS[col] = PACK_COLOR_44( src[1], + src[0] ); src += 2; } dstRow += dstRowStride; @@ -2248,13 +2248,13 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = tempImage; + const GLubyte *src = tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -2269,16 +2269,16 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_RG88) { for (col = 0; col < srcWidth; col++) { /* src[0] is luminance, src[1] is alpha */ - dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]), - CHAN_TO_UBYTE(src[0]) ); + dstUS[col] = PACK_COLOR_88( src[1], + src[0] ); src += 2; } } else { for (col = 0; col < srcWidth; col++) { /* src[0] is luminance, src[1] is alpha */ - dstUS[col] = PACK_COLOR_88_REV( CHAN_TO_UBYTE(src[1]), - CHAN_TO_UBYTE(src[0]) ); + dstUS[col] = PACK_COLOR_88_REV( src[1], + src[0] ); src += 2; } } @@ -2604,13 +2604,13 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = tempImage; + const GLubyte *src = tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -2621,9 +2621,9 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { - dstRow[col] = PACK_COLOR_332( CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]) ); + dstRow[col] = PACK_COLOR_332( src[RCOMP], + src[GCOMP], + src[BCOMP] ); src += 3; } dstRow += dstRowStride; @@ -2692,13 +2692,13 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) } else { /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); - const GLchan *src = tempImage; + const GLubyte *src = tempImage; GLint img, row, col; if (!tempImage) return GL_FALSE; @@ -2709,7 +2709,7 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { - dstRow[col] = CHAN_TO_UBYTE(src[col]); + dstRow[col] = src[col]; } dstRow += dstRowStride; src += srcWidth; diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index d563187098c..24a254ac492 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -72,8 +72,8 @@ extern GLboolean _mesa_texstore(TEXSTORE_PARAMS); -extern GLchan * -_mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims, +extern GLubyte * +_mesa_make_temp_ubyte_image(struct gl_context *ctx, GLuint dims, GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint srcWidth, GLint srcHeight, GLint srcDepth, -- 2.30.2