diff --git a/win32ss/gdi/dib/dib1bpp.c b/win32ss/gdi/dib/dib1bpp.c index 6a90282808..d3aee83730 100644 --- a/win32ss/gdi/dib/dib1bpp.c +++ b/win32ss/gdi/dib/dib1bpp.c @@ -67,6 +67,8 @@ DIB_1BPP_BitBltSrcCopy_From1BPP ( { LONG Height = RECTL_lGetHeight(DestRect); BOOLEAN XorBit = !!XLATEOBJ_iXlate(pxlo, 0); + LONG xSrc, ySrc, xDst, yDst, Width, i, StoredPixel; + ULONG PixelPut; /* Make sure this is as expected */ ASSERT(DestRect->left >= 0); @@ -74,25 +76,82 @@ DIB_1BPP_BitBltSrcCopy_From1BPP ( ASSERT(Height > 0); ASSERT(RECTL_lGetWidth(DestRect) > 0); - while (Height--) + if (!bLeftToRight && !bTopToBottom) { - LONG yDst = DestRect->top + Height; - LONG ySrc = bTopToBottom ? - SourcePoint->y + RECTL_lGetHeight(DestRect) - Height - : SourcePoint->y + Height; - LONG Width = RECTL_lGetWidth(DestRect); + while (Height--) + { + yDst = DestRect->top + Height; + ySrc = SourcePoint->y + Height; + Width = RECTL_lGetWidth(DestRect); while (Width--) { - LONG xDst = DestRect->left + Width; - LONG xSrc = bLeftToRight ? - SourcePoint->x + RECTL_lGetWidth(DestRect) - Width - : SourcePoint->x + Width; - ULONG PixelPut = DIB_1BPP_GetPixel(SourceSurf, xSrc, ySrc); + xDst = DestRect->left + Width; + xSrc = SourcePoint->x + Width; + PixelPut = DIB_1BPP_GetPixel(SourceSurf, xSrc, ySrc); if (XorBit) PixelPut = !PixelPut; DIB_1BPP_PutPixel(DestSurf, xDst, yDst, PixelPut); - } + } + } + } + else if (bLeftToRight && !bTopToBottom) + { + DPRINT1("Flip is bLeftToRight.\n"); + + while (Height--) + { + yDst = DestRect->top + Height; + ySrc = SourcePoint->y + Height; + + Width = RECTL_lGetWidth(DestRect); + + /* Horizontal Flip code starts here */ + for (i = 0; i < RECTL_lGetWidth(DestRect) / 2 ; i++) + { + /* Get the rightmost pixel to save so that it can be overwritten */ + xSrc = SourcePoint->x + Width; + StoredPixel = DIB_1BPP_GetPixel(SourceSurf, xSrc, ySrc); + if (XorBit) + StoredPixel = !StoredPixel; + + /* Get the leftmost pixel value and write it over the rightmost */ + xSrc = SourcePoint->x + RECTL_lGetWidth(DestRect) - Width - 1; + PixelPut = DIB_1BPP_GetPixel(SourceSurf, xSrc, ySrc); + if (XorBit) + PixelPut = !PixelPut; + xDst = DestRect->left + Width; + DIB_1BPP_PutPixel(DestSurf, xDst, yDst, PixelPut); + + /* Copy stored rightmost pixel to leftmost pixel */ + xDst = DestRect->left + RECTL_lGetWidth(DestRect) - Width - 1; + DIB_1BPP_PutPixel(DestSurf, xDst, yDst, StoredPixel); + + Width--; + + } + if (RECTL_lGetWidth(DestRect) % 2) + { + /* If we had an odd number of columns we handle the center one here */ + DPRINT("Handling Left To Right flip with Odd Number of columns.\n"); + xSrc = SourcePoint->x + RECTL_lGetWidth(DestRect) / 2; + StoredPixel = DIB_1BPP_GetPixel(SourceSurf, xSrc, ySrc); + if (XorBit) + StoredPixel = !StoredPixel; + xDst = DestRect->left + RECTL_lGetWidth(DestRect) / 2; + DIB_1BPP_PutPixel(DestSurf, xDst, yDst, StoredPixel); + + } + } + + } + else if (!bLeftToRight && bTopToBottom) + { + DPRINT1("bTopToBottom and no bLeftToRight not handled yet!\n"); + } + else + { + DPRINT1("Both bLeftToRight and bTopToBottom not handled yet!\n"); } }