summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2014-03-04 09:10:00 -0700
committerBrian Paul <brianp@vmware.com>2014-03-05 16:06:54 -0700
commit48a9094b69db621c4b8a432adc63d6f4439ab3d1 (patch)
treee895ee88a2b719f88bb2f9354c64c95704ac006c /src/mesa/main
parent171ec9585f214c2dff3cfc97acebf5286bb5001d (diff)
downloadexternal_mesa3d-48a9094b69db621c4b8a432adc63d6f4439ab3d1.zip
external_mesa3d-48a9094b69db621c4b8a432adc63d6f4439ab3d1.tar.gz
external_mesa3d-48a9094b69db621c4b8a432adc63d6f4439ab3d1.tar.bz2
mesa: fix packing/unpacking for MESA_FORMAT_A4R4G4B4_UNORM
Spotted by Chia-I Wu. v2: also fix unpack_ubyte_ARGB4444_REV() Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/format_pack.c2
-rw-r--r--src/mesa/main/format_unpack.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c
index 2772ff2..ee505ec 100644
--- a/src/mesa/main/format_pack.c
+++ b/src/mesa/main/format_pack.c
@@ -567,7 +567,7 @@ static void
pack_ubyte_ARGB4444_REV(const GLubyte src[4], void *dst)
{
GLushort *d = ((GLushort *) dst);
- *d = PACK_COLOR_4444(src[GCOMP], src[BCOMP], src[ACOMP], src[RCOMP]);
+ *d = PACK_COLOR_4444(src[BCOMP], src[GCOMP], src[RCOMP], src[ACOMP]);
}
static void
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index 276ba55..f9c42e7 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -267,10 +267,10 @@ unpack_ARGB4444_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] = ((s[i] ) & 0xf) * (1.0F / 15.0F);
- dst[i][GCOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
- dst[i][BCOMP] = ((s[i] >> 8) & 0xf) * (1.0F / 15.0F);
- dst[i][ACOMP] = ((s[i] >> 4) & 0xf) * (1.0F / 15.0F);
+ dst[i][RCOMP] = ((s[i] >> 4) & 0xf) * (1.0F / 15.0F);
+ dst[i][GCOMP] = ((s[i] >> 8) & 0xf) * (1.0F / 15.0F);
+ dst[i][BCOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
+ dst[i][ACOMP] = ((s[i] ) & 0xf) * (1.0F / 15.0F);
}
}
@@ -2738,10 +2738,10 @@ unpack_ubyte_ARGB4444_REV(const void *src, GLubyte dst[][4], GLuint n)
const GLushort *s = ((const GLushort *) src);
GLuint i;
for (i = 0; i < n; i++) {
- dst[i][RCOMP] = EXPAND_4_8((s[i] ) & 0xf);
- dst[i][GCOMP] = EXPAND_4_8((s[i] >> 12) & 0xf);
- dst[i][BCOMP] = EXPAND_4_8((s[i] >> 8) & 0xf);
- dst[i][ACOMP] = EXPAND_4_8((s[i] >> 4) & 0xf);
+ dst[i][RCOMP] = EXPAND_4_8((s[i] >> 4) & 0xf);
+ dst[i][GCOMP] = EXPAND_4_8((s[i] >> 8) & 0xf);
+ dst[i][BCOMP] = EXPAND_4_8((s[i] >> 12) & 0xf);
+ dst[i][ACOMP] = EXPAND_4_8((s[i] ) & 0xf);
}
}