diff options
author | Brian Paul <[email protected]> | 2011-11-30 20:35:02 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-12-01 08:07:34 -0700 |
commit | e10942c8e966f7ea45f6b0d3782bbe38593796ae (patch) | |
tree | a6d78adbe4ea294ae198b05d142751e5788155cd /src | |
parent | 478f0d228be1c184adabd1df4dd76a01061b9e24 (diff) |
mesa: fix unpack_ARGB1555_REV()
We weren't doing the necessary byte swap.
v2: use same arithmetic as unpack_ARGB1555() to be consistent.
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/format_unpack.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index 0411f5fb740..b4e4ac4bb78 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -275,10 +275,11 @@ unpack_ARGB1555_REV(const void *src, GLfloat dst[][4], GLuint n) const GLushort *s = ((const GLushort *) src); GLuint i; for (i = 0; i < n; i++) { - dst[i][RCOMP] = UBYTE_TO_FLOAT( ((s[i] >> 7) & 0xf8) | ((s[i] >> 12) & 0x7) ); - dst[i][GCOMP] = UBYTE_TO_FLOAT( ((s[i] >> 2) & 0xf8) | ((s[i] >> 7) & 0x7) ); - dst[i][BCOMP] = UBYTE_TO_FLOAT( ((s[i] << 3) & 0xf8) | ((s[i] >> 2) & 0x7) ); - dst[i][ACOMP] = UBYTE_TO_FLOAT( ((s[i] >> 15) & 0x01) * 255 ); + GLushort tmp = (s[i] << 8) | (s[i] >> 8); /* byteswap */ + dst[i][RCOMP] = ((tmp >> 10) & 0x1f) * (1.0F / 31.0F); + dst[i][GCOMP] = ((tmp >> 5) & 0x1f) * (1.0F / 31.0F); + dst[i][BCOMP] = ((tmp >> 0) & 0x1f) * (1.0F / 31.0F); + dst[i][ACOMP] = ((tmp >> 15) & 0x01) * 1.0F; } } |