diff --git a/win32ss/gdi/dib/dib1bpp.c b/win32ss/gdi/dib/dib1bpp.c index 6a90282808..588d6cf502 100644 --- a/win32ss/gdi/dib/dib1bpp.c +++ b/win32ss/gdi/dib/dib1bpp.c @@ -65,6 +65,7 @@ DIB_1BPP_BitBltSrcCopy_From1BPP ( BOOLEAN bTopToBottom, BOOLEAN bLeftToRight ) { + DWORD Index; LONG Height = RECTL_lGetHeight(DestRect); BOOLEAN XorBit = !!XLATEOBJ_iXlate(pxlo, 0); @@ -74,25 +75,77 @@ DIB_1BPP_BitBltSrcCopy_From1BPP ( ASSERT(Height > 0); ASSERT(RECTL_lGetWidth(DestRect) > 0); - while (Height--) + if (!bLeftToRight && !bTopToBottom) { + while (Height--) + { LONG yDst = DestRect->top + Height; - LONG ySrc = bTopToBottom ? - SourcePoint->y + RECTL_lGetHeight(DestRect) - Height - : SourcePoint->y + Height; + LONG ySrc = SourcePoint->y + Height; LONG Width = RECTL_lGetWidth(DestRect); while (Width--) { LONG xDst = DestRect->left + Width; - LONG xSrc = bLeftToRight ? - SourcePoint->x + RECTL_lGetWidth(DestRect) - Width - : SourcePoint->x + Width; + LONG xSrc = SourcePoint->x + Width; ULONG 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"); + + /* Allocate enough pixels for a row in DWORD's */ + DWORD *store = ExAllocatePoolWithTag(NonPagedPool, + (RECTL_lGetWidth(DestRect) + 1) * 4, TAG_DIB); + if (store == NULL) + { + DPRINT1("Storage Allocation Failed.\n"); + return; + } + + while (Height--) + { + LONG yDst = DestRect->top + Height; + LONG ySrc = SourcePoint->y + Height; + + LONG Width = RECTL_lGetWidth(DestRect); + Index = 0; + + while (Width--) + { + LONG xSrc = SourcePoint->x + RECTL_lGetWidth(DestRect) - Width - 1; + ULONG PixelPut = DIB_1BPP_GetPixel(SourceSurf, xSrc, ySrc); + if (XorBit) + PixelPut = !PixelPut; + store[Index] = PixelPut; + Index++; + } + + Width = RECTL_lGetWidth(DestRect); + Index = 0; + + while (Width--) + { + LONG xDst = DestRect->left + Width; + DIB_1BPP_PutPixel(DestSurf, xDst, yDst, store[Index]); + Index++; } + + } // While (Height--) + + ExFreePoolWithTag(store, TAG_DIB); + } + else if (!bLeftToRight && bTopToBottom) + { + DPRINT1("bTopToBottom and no bLeftToRight not handled yet!\n"); + } + else + { + DPRINT1("Both bLeftToRight and bTopToBottom not handled yet!\n"); } }