summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-09-12 21:10:36 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-09-12 21:10:36 +0000
commit211c30cbc9cd8c0f5fa3f888c59f49f2a874e1b4 (patch)
tree626e2fa7dd4f2dd0c8381de6db0931f826c51211 /src
parent1ef3d8407b6417bc059999d57a8aec0a5a204ac1 (diff)
packing of GLushort packed types was broken
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/image.c82
1 files changed, 77 insertions, 5 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 6d4464dbb88..1d143524115 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.35 2000/06/30 22:12:00 brianp Exp $ */
+/* $Id: image.c,v 1.35.4.1 2000/09/12 21:10:36 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1277,7 +1277,7 @@ _mesa_pack_rgba_span( GLcontext *ctx,
}
break;
case GL_UNSIGNED_SHORT_4_4_4_4:
- if (format == GL_RGB) {
+ if (format == GL_RGBA) {
GLushort *dst = (GLushort *) destination;
for (i=0;i<n;i++) {
dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12)
@@ -1286,9 +1286,27 @@ _mesa_pack_rgba_span( GLcontext *ctx,
| (((GLint) (rgba[i][ACOMP] * 15.0F)) );
}
}
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ for (i=0;i<n;i++) {
+ dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F)) << 12)
+ | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8)
+ | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 4)
+ | (((GLint) (rgba[i][ACOMP] * 15.0F)) );
+ }
+ }
+ else if (format == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) destination;
+ for (i=0;i<n;i++) {
+ dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) << 4)
+ | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8)
+ | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 12)
+ | (((GLint) (rgba[i][RCOMP] * 15.0F)) );
+ }
+ }
break;
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- if (format == GL_RGB) {
+ if (format == GL_RGBA) {
GLushort *dst = (GLushort *) destination;
for (i=0;i<n;i++) {
dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) )
@@ -1297,9 +1315,27 @@ _mesa_pack_rgba_span( GLcontext *ctx,
| (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12);
}
}
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ for (i=0;i<n;i++) {
+ dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F)) )
+ | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4)
+ | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 8)
+ | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12);
+ }
+ }
+ else if (format == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) destination;
+ for (i=0;i<n;i++) {
+ dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) )
+ | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4)
+ | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8)
+ | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12);
+ }
+ }
break;
case GL_UNSIGNED_SHORT_5_5_5_1:
- if (format == GL_RGB) {
+ if (format == GL_RGBA) {
GLushort *dst = (GLushort *) destination;
for (i=0;i<n;i++) {
dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11)
@@ -1308,9 +1344,27 @@ _mesa_pack_rgba_span( GLcontext *ctx,
| (((GLint) (rgba[i][ACOMP] * 1.0F)) );
}
}
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ for (i=0;i<n;i++) {
+ dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11)
+ | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6)
+ | (((GLint) (rgba[i][RCOMP] * 31.0F)) << 1)
+ | (((GLint) (rgba[i][ACOMP] * 1.0F)) );
+ }
+ }
+ else if (format == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) destination;
+ for (i=0;i<n;i++) {
+ dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F)) << 11)
+ | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 6)
+ | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 1)
+ | (((GLint) (rgba[i][RCOMP] * 1.0F)) );
+ }
+ }
break;
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- if (format == GL_RGB) {
+ if (format == GL_RGBA) {
GLushort *dst = (GLushort *) destination;
for (i=0;i<n;i++) {
dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) )
@@ -1319,6 +1373,24 @@ _mesa_pack_rgba_span( GLcontext *ctx,
| (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15);
}
}
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ for (i=0;i<n;i++) {
+ dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F)) )
+ | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5)
+ | (((GLint) (rgba[i][RCOMP] * 31.0F)) << 10)
+ | (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15);
+ }
+ }
+ else if (format == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) destination;
+ for (i=0;i<n;i++) {
+ dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F)) )
+ | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 5)
+ | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 10)
+ | (((GLint) (rgba[i][RCOMP] * 1.0F)) << 15);
+ }
+ }
break;
case GL_UNSIGNED_INT_8_8_8_8:
if (format == GL_RGBA) {