summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2012-06-25 13:45:42 -0700
committerJordan Justen <[email protected]>2012-07-21 16:49:42 -0700
commit1c8812c244d74dd562a3db7c9226405bd6333735 (patch)
treed05fc6075176909fb52b22709266793be0c30cff /src/mesa/main
parent8c265cf5ef47ac8ae8565456d8ac023d6c847d57 (diff)
mesa formats: unpack ARGB8888/XRGB8888
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/format_unpack.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index c42bac19c72..d1daae59ce1 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -2139,6 +2139,32 @@ unpack_int_rgba_RGBA_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
}
static void
+unpack_int_rgba_ARGB8888(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLubyte) src[i * 4 + 2];
+ dst[i][GCOMP] = (GLubyte) src[i * 4 + 1];
+ dst[i][BCOMP] = (GLubyte) src[i * 4 + 0];
+ dst[i][ACOMP] = (GLubyte) src[i * 4 + 3];
+ }
+}
+
+static void
+unpack_int_rgba_XRGB8888(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLubyte) src[i * 4 + 2];
+ dst[i][GCOMP] = (GLubyte) src[i * 4 + 1];
+ dst[i][BCOMP] = (GLubyte) src[i * 4 + 0];
+ dst[i][ACOMP] = (GLubyte) 0xff;
+ }
+}
+
+static void
unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
{
unsigned int i;
@@ -2590,6 +2616,14 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
unpack_int_rgba_RGBA_INT8(src, dst, n);
break;
+ case MESA_FORMAT_ARGB8888:
+ unpack_int_rgba_ARGB8888(src, dst, n);
+ break;
+
+ case MESA_FORMAT_XRGB8888:
+ unpack_int_rgba_XRGB8888(src, dst, n);
+ break;
+
case MESA_FORMAT_RGB_UINT32:
case MESA_FORMAT_RGB_INT32:
unpack_int_rgba_RGB_UINT32(src, dst, n);