summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-10-28 19:38:12 -0600
committerBrian Paul <brianp@vmware.com>2009-10-28 19:38:12 -0600
commit1e7517f059b1f3601502a199b05453eabfe56cdb (patch)
tree594861c025f556f409ace5045c8f8b85c055bd1d /src
parent7ac233ec15743763996e59c8b283f7c2e78a7210 (diff)
swrast: fix texel decoding in opt_sample_rgba_2d()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/swrast/s_texfilter.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index db03c6aa39..0bb988e3ef 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -1391,11 +1391,11 @@ opt_sample_rgba_2d(GLcontext *ctx,
const GLint col = IFLOOR(texcoords[i][0] * width) & colMask;
const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask;
const GLint pos = (row << shift) | col;
- const GLubyte *texel = ((GLubyte *) img->Data) + (pos << 2); /* pos*4 */
- rgba[i][RCOMP] = UBYTE_TO_FLOAT(texel[3]);
- rgba[i][GCOMP] = UBYTE_TO_FLOAT(texel[2]);
- rgba[i][BCOMP] = UBYTE_TO_FLOAT(texel[1]);
- rgba[i][ACOMP] = UBYTE_TO_FLOAT(texel[0]);
+ const GLuint texel = *((GLuint *) img->Data + pos);
+ rgba[i][RCOMP] = UBYTE_TO_FLOAT( (texel >> 24) );
+ rgba[i][GCOMP] = UBYTE_TO_FLOAT( (texel >> 16) & 0xff );
+ rgba[i][BCOMP] = UBYTE_TO_FLOAT( (texel >> 8) & 0xff );
+ rgba[i][ACOMP] = UBYTE_TO_FLOAT( (texel ) & 0xff );
}
}