d3dx9: Shift only as much as needed.

This commit is contained in:
Rico Schüller 2013-01-10 17:57:25 +01:00 committed by Alexandre Julliard
parent 275f784009
commit 98ef0ca8e6

View File

@ -1240,8 +1240,16 @@ static inline void fill_texture(const struct pixel_format_desc *format, BYTE *po
{
BYTE byte, mask;
mask = ((1 << format->bits[c]) - 1) << format->shift[c] >> i;
byte = (v << format->shift[c] >> i) & mask;
if (format->shift[c] > i)
{
mask = ((1 << format->bits[c]) - 1) << (format->shift[c] - i);
byte = (v << (format->shift[c] - i)) & mask;
}
else
{
mask = ((1 << format->bits[c]) - 1) >> (i - format->shift[c]);
byte = (v >> (i - format->shift[c])) & mask;
}
pos[i / 8] |= byte;
}
}