summaryrefslogtreecommitdiff
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-09-23 16:37:13 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-09-23 16:37:13 +0000
commit681b8c9d1ba06c8c82e687a5ced369b72e6b1eb9 (patch)
treebfe222c6384be8ef34eadddb44262c9bd9ddc1c2 /src/mesa/main/teximage.c
parentb7808884bb26b6abdd44a03ff47885fb646686a5 (diff)
merge gl_texture_image RowStride from DRI 4.0.4
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index e62081be5b..769f74eda7 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.115 2002/09/21 16:51:25 brianp Exp $ */
+/* $Id: teximage.c,v 1.116 2002/09/23 16:37:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -99,7 +99,7 @@ static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img)
_mesa_printf(ctx, "%02x%02x%02x ", data[0], data[1], data[2]);
else if (c==4)
_mesa_printf(ctx, "%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]);
- data += c;
+ data += (img->RowStride - img->Width) * c;
}
_mesa_printf(ctx, "\n");
}
@@ -611,6 +611,7 @@ clear_teximage_fields(struct gl_texture_image *img)
img->Width = 0;
img->Height = 0;
img->Depth = 0;
+ img->RowStride = 0;
img->Width2 = 0;
img->Height2 = 0;
img->Depth2 = 0;
@@ -642,6 +643,7 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
img->Width = width;
img->Height = height;
img->Depth = depth;
+ img->RowStride = width;
img->WidthLog2 = logbase2(width - 2 * border);
if (height == 1) /* 1-D texture */
img->HeightLog2 = 0;
@@ -1413,7 +1415,9 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
}
else if (format == GL_YCBCR_MESA) {
/* No pixel transfer */
- MEMCPY(dest, (const GLushort *) texImage->Data + row * width,
+ const GLint rowstride = texImage->RowStride;
+ MEMCPY(dest,
+ (const GLushort *) texImage->Data + row * rowstride,
width * sizeof(GLushort));
/* check for byte swapping */
if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR