Fixed bug in SDL_OrderedDither that causes incorrect alpha values if src has 0 alpha bits

This commit is contained in:
Chris Danford
2002-11-25 04:23:33 +00:00
parent 3f8785113e
commit 285a9099e1
+4 -2
View File
@@ -97,8 +97,10 @@ void SM_SDL_OrderedDither(const SDL_Surface *src, SDL_Surface *dst)
colors[c] = DitherPixel(col, row, colors[c], conv[c]);
}
/* Convert the alpha channel, which we didn't dither. */
colors[3] >>= src_cbits[3] - dst_cbits[3];
if( src_cbits[3] == 0 ) /* src doesn't have alpha */
colors[3] = (1<<dst_cbits[3]) - 1; /* Give dst full alpha */
else /* src does have alpha */
colors[3] >>= src_cbits[3] - dst_cbits[3]; /* Convert the alpha channel, which we didn't dither. */
/* Raw value -> int -> pixel */
mySDL_SetRawRGBAV(dstp, dst, colors);