Mesa (mesa_7_7_branch): mesa: Fix bad conversion in AL1616_REV texstore.

Eric Anholt anholt at kemper.freedesktop.org
Thu Dec 3 00:21:16 UTC 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: db352f58fab419c475b89418cd27b35f5f5d3822
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=db352f58fab419c475b89418cd27b35f5f5d3822

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Dec  2 12:42:36 2009 -0800

mesa: Fix bad conversion in AL1616_REV texstore.

---

 src/mesa/main/texstore.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 5387eb1..792c831 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -2197,18 +2197,22 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS)
             GLuint *dstUI = (GLuint *) dstRow;
             if (dstFormat == MESA_FORMAT_AL1616) {
                for (col = 0; col < srcWidth; col++) {
-                  /* src[0] is luminance, src[1] is alpha */
-                 dstUI[col] = PACK_COLOR_1616( FLOAT_TO_USHORT(src[1]),
-					       FLOAT_TO_USHORT(src[0]) );
-                 src += 2;
+		  GLushort l, a;
+
+		  UNCLAMPED_FLOAT_TO_USHORT(l, src[0]);
+		  UNCLAMPED_FLOAT_TO_USHORT(a, src[1]);
+		  dstUI[col] = PACK_COLOR_1616(a, l);
+		  src += 2;
                }
             }
             else {
                for (col = 0; col < srcWidth; col++) {
-                  /* src[0] is luminance, src[1] is alpha */
-                 dstUI[col] = PACK_COLOR_1616_REV( FLOAT_TO_UBYTE(src[1]),
-						   FLOAT_TO_UBYTE(src[0]) );
-                 src += 2;
+		  GLushort l, a;
+
+		  UNCLAMPED_FLOAT_TO_USHORT(l, src[0]);
+		  UNCLAMPED_FLOAT_TO_USHORT(a, src[1]);
+		  dstUI[col] = PACK_COLOR_1616_REV(a, l);
+		  src += 2;
                }
             }
             dstRow += dstRowStride;




More information about the mesa-commit mailing list