From: Xiang, Haihao Date: Mon, 30 Jul 2007 08:30:32 +0000 (+0800) Subject: handle LSB_FIRST in _mesa_pack_bitmap by the way used in X-Git-Tag: android-x86-1.6~1861^2~222 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=501b5305b939ac38177dcd73ec72f4a39296e0c4;p=android-x86%2Fexternal-mesa.git handle LSB_FIRST in _mesa_pack_bitmap by the way used in _mesa_unpack_bitmap --- diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ba46cdc1b17..8fccd44f211 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -850,7 +850,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, return NULL; } - if (packing->SkipPixels == 0) { + if ((packing->SkipPixels & 7) == 0) { _mesa_memcpy( dst, src, width_in_bytes ); if (packing->LsbFirst) { flip_bytes( dst, width_in_bytes ); @@ -942,7 +942,7 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, if (!dst) return; - if (packing->SkipPixels == 0) { + if ((packing->SkipPixels & 7) == 0) { _mesa_memcpy( dst, src, width_in_bytes ); if (packing->LsbFirst) { flip_bytes( dst, width_in_bytes ); @@ -961,20 +961,20 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, if (*s & srcMask) { *d |= dstMask; } - if (srcMask == 128) { - srcMask = 1; + if (srcMask == 1) { + srcMask = 128; s++; } else { - srcMask = srcMask << 1; + srcMask = srcMask >> 1; } - if (dstMask == 1) { - dstMask = 128; + if (dstMask == 128) { + dstMask = 1; d++; *d = 0; } else { - dstMask = dstMask >> 1; + dstMask = dstMask << 1; } } }