summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2009-12-02 12:42:36 -0800
committerEric Anholt <[email protected]>2009-12-02 16:19:36 -0800
commitdb352f58fab419c475b89418cd27b35f5f5d3822 (patch)
treee5218e5daa4e63280b4dd86fe5bfe9c5c688c8af /src/mesa
parentb47f7316dab5eb81bc7e60dc93bb5dbe824c43d4 (diff)
mesa: Fix bad conversion in AL1616_REV texstore.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texstore.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 5387eb12837..792c83141ec 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;