From edc16a5f7a89584490be0824a1d96e2f3426998b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 26 Apr 2006 18:43:22 +0000 Subject: fix a few stride computations in _mesa_texstore_rgba() --- src/mesa/main/texstore.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/mesa/main/texstore.c') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index fab0fad3b4..2b614e90d3 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -560,7 +560,7 @@ swizzle_copy(GLubyte *dst, GLuint dstComponents, const GLubyte *src, GLuint srcComponents, const GLubyte *map, GLuint count) { GLubyte tmp[8]; - GLint i; + GLuint i; tmp[ZERO] = 0x0; tmp[ONE] = 0xff; @@ -637,6 +637,8 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx, + dstYoffset * dstRowStride + dstXoffset * dstComponents; + (void) ctx; + compute_component_mapping(srcFormat, GL_RGBA, srcmap); for (i = 0; i < 4; i++) @@ -790,10 +792,10 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims, srcType == CHAN_TYPE) { /* extract RGB from RGBA */ int img, row, col; - GLchan *dstImage = (GLchan *) (GLubyte *) dstAddr - + dstZoffset * dstImageStride - + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + GLchan *dstImage = (GLchan *) ((GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes); for (img = 0; img < srcDepth; img++) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); @@ -806,10 +808,10 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims, dstRow[col * 3 + GCOMP] = srcRow[col * 4 + GCOMP]; dstRow[col * 3 + BCOMP] = srcRow[col * 4 + BCOMP]; } - dstRow += dstRowStride; + dstRow += dstRowStride / sizeof(GLchan); srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride); } - dstImage += dstImageStride; + dstImage += dstImageStride / sizeof(GLchan); } } else { -- cgit v1.2.3