summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/format_unpack.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-11-28 11:08:01 -0700
committerBrian Paul <[email protected]>2011-11-30 06:57:36 -0700
commit25c8a112abf4bbf271c6972f7539ca2a1c7683bd (patch)
tree1bf1438509498983e9ba1710939e9b82c0aaf160 /src/mesa/main/format_unpack.c
parent2134d2f35baadf4117e48aa3315608403622b79a (diff)
mesa: access pixels as GLushort in unpack_SL8()
Per the format comments and the texstore code, use a GLushort to access the pixel. The code was OK as-is on little endian machines.
Diffstat (limited to 'src/mesa/main/format_unpack.c')
-rw-r--r--src/mesa/main/format_unpack.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index 0ab6940144b..0411f5fb740 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -749,13 +749,13 @@ unpack_SL8(const void *src, GLfloat dst[][4], GLuint n)
static void
unpack_SLA8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLubyte *s = (const GLubyte *) src;
+ const GLushort *s = (const GLushort *) src;
GLuint i;
for (i = 0; i < n; i++) {
dst[i][RCOMP] =
dst[i][GCOMP] =
- dst[i][BCOMP] = nonlinear_to_linear(s[i*2+0]);
- dst[i][ACOMP] = UBYTE_TO_FLOAT(s[i*2+1]); /* linear! */
+ dst[i][BCOMP] = nonlinear_to_linear(s[i] & 0xff);
+ dst[i][ACOMP] = UBYTE_TO_FLOAT(s[i] >> 8); /* linear! */
}
}