summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/texformat.h6
-rw-r--r--src/mesa/main/texformat_tmp.h18
-rw-r--r--src/mesa/main/teximage.c10
4 files changed, 21 insertions, 16 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3b94967e08e..d3c6c6196d3 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.87 2002/09/21 17:34:56 brianp Exp $ */
+/* $Id: mtypes.h,v 1.88 2002/09/23 16:37:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -839,6 +839,7 @@ struct gl_texture_image {
GLuint Width; /* = 2^WidthLog2 + 2*Border */
GLuint Height; /* = 2^HeightLog2 + 2*Border */
GLuint Depth; /* = 2^DepthLog2 + 2*Border */
+ GLuint RowStride; /* == Width unless IsClientData and padded */
GLuint Width2; /* = Width - 2*Border */
GLuint Height2; /* = Height - 2*Border */
GLuint Depth2; /* = Depth - 2*Border */
diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h
index 802f4acefb5..d1e7544a420 100644
--- a/src/mesa/main/texformat.h
+++ b/src/mesa/main/texformat.h
@@ -1,4 +1,4 @@
-/* $Id: texformat.h,v 1.10 2002/09/21 16:51:25 brianp Exp $ */
+/* $Id: texformat.h,v 1.11 2002/09/23 16:37:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -144,8 +144,8 @@ extern const struct gl_texture_format _mesa_texformat_a8;
extern const struct gl_texture_format _mesa_texformat_l8;
extern const struct gl_texture_format _mesa_texformat_i8;
extern const struct gl_texture_format _mesa_texformat_ci8;
-extern const struct gl_texture_format _meas_texformat_ycbcr;
-extern const struct gl_texture_format _meas_texformat_ycbcr_rev;
+extern const struct gl_texture_format _mesa_texformat_ycbcr;
+extern const struct gl_texture_format _mesa_texformat_ycbcr_rev;
/* The null format:
*/
diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h
index 35f89d54936..f796928673f 100644
--- a/src/mesa/main/texformat_tmp.h
+++ b/src/mesa/main/texformat_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: texformat_tmp.h,v 1.7 2002/09/21 16:51:25 brianp Exp $ */
+/* $Id: texformat_tmp.h,v 1.8 2002/09/23 16:37:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -43,13 +43,13 @@
#elif DIM == 2
#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
+ ((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
+ ((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + ((t)->Width * (j) + (i)))
+ ((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i)))
#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i)))
+ ((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)))
#define FETCH(x) fetch_2d_texel_##x
@@ -57,16 +57,16 @@
#define CHAN_SRC( t, i, j, k, sz ) \
(GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz)
+ (t)->RowStride + (i)) * (sz)
#define UBYTE_SRC( t, i, j, k, sz ) \
((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz))
+ (t)->RowStride + (i)) * (sz))
#define USHORT_SRC( t, i, j, k ) \
((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
+ (t)->RowStride + (i)))
#define FLOAT_SRC( t, i, j, k ) \
((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
+ (t)->RowStride + (i)))
#define FETCH(x) fetch_3d_texel_##x
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index e62081be5bd..769f74eda74 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