summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>1999-10-22 12:49:52 +0000
committerBrian Paul <[email protected]>1999-10-22 12:49:52 +0000
commit64b7da799fe82f566706f8b6771b9d12477e4373 (patch)
tree6d813e31bdc42801f73b76ec2299b56da48b675e /src
parent3428162e27c5937291a3ea16d4cd339728ee7f52 (diff)
fixed byteswapping bug in gl_pack_rgba_span()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/image.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index aef37bfa8e4..70aa5ef3c4f 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.8 1999/10/22 10:59:15 brianp Exp $ */
+/* $Id: image.c,v 1.9 1999/10/22 12:49:52 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1701,10 +1701,11 @@ void gl_pack_rgba_span( const GLcontext *ctx,
else {
GLfloat red[MAX_WIDTH], green[MAX_WIDTH], blue[MAX_WIDTH];
GLfloat alpha[MAX_WIDTH], luminance[MAX_WIDTH];
- GLfloat rscale = 1.0F / 255.0F;
- GLfloat gscale = 1.0F / 255.0F;
- GLfloat bscale = 1.0F / 255.0F;
- GLfloat ascale = 1.0F / 255.0F;
+ const GLfloat rscale = 1.0F / 255.0F;
+ const GLfloat gscale = 1.0F / 255.0F;
+ const GLfloat bscale = 1.0F / 255.0F;
+ const GLfloat ascale = 1.0F / 255.0F;
+ const GLint comps = gl_components_in_format(format);
GLuint i;
assert( n < MAX_WIDTH );
@@ -1957,7 +1958,7 @@ void gl_pack_rgba_span( const GLcontext *ctx,
gl_problem(ctx, "bad format in gl_pack_rgba_span\n");
}
if (packing->SwapBytes) {
- gl_swap2( (GLushort *) dst, n );
+ gl_swap2( (GLushort *) dst, n * comps);
}
}
break;
@@ -2032,7 +2033,7 @@ void gl_pack_rgba_span( const GLcontext *ctx,
gl_problem(ctx, "bad format in gl_pack_rgba_span\n");
}
if (packing->SwapBytes) {
- gl_swap2( (GLushort *) dst, n );
+ gl_swap2( (GLushort *) dst, n * comps );
}
}
break;
@@ -2108,7 +2109,7 @@ void gl_pack_rgba_span( const GLcontext *ctx,
gl_problem(ctx, "bad format in gl_pack_rgba_span\n");
}
if (packing->SwapBytes) {
- gl_swap4( (GLuint *) dst, n );
+ gl_swap4( (GLuint *) dst, n * comps );
}
}
break;
@@ -2184,7 +2185,7 @@ void gl_pack_rgba_span( const GLcontext *ctx,
gl_problem(ctx, "bad format in gl_pack_rgba_span\n");
}
if (packing->SwapBytes) {
- gl_swap4( (GLuint *) dst, n );
+ gl_swap4( (GLuint *) dst, n * comps );
}
}
break;
@@ -2260,7 +2261,7 @@ void gl_pack_rgba_span( const GLcontext *ctx,
gl_problem(ctx, "bad format in gl_pack_rgba_span\n");
}
if (packing->SwapBytes) {
- gl_swap4( (GLuint *) dst, n );
+ gl_swap4( (GLuint *) dst, n * comps );
}
}
break;