From 6cc3c9cd47fecd60a4a369bd970470cd50df2993 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Thu, 11 Mar 2010 21:41:19 +0000 Subject: [PATCH] [WIN32K]: Enable the alignment code and reduce the number of hacks, leaving only one for 1bpp top-down output (Freetype?) which doesn't seem to like when the lDelta is aligned to the correct bit-boundary. This should fix the crashes and graphic cltches recently introduced. svn path=/trunk/; revision=46117 --- reactos/subsystems/win32/win32k/eng/surface.c | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/reactos/subsystems/win32/win32k/eng/surface.c b/reactos/subsystems/win32/win32k/eng/surface.c index 423972ce3fb..1fcf4cc6b85 100644 --- a/reactos/subsystems/win32/win32k/eng/surface.c +++ b/reactos/subsystems/win32/win32k/eng/surface.c @@ -475,27 +475,27 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, switch (BitmapInfo->Format) { case BMF_1BPP: - //ScanLine = ((BitmapInfo->Width + 31) & ~31) / 8; + ScanLine = ((BitmapInfo->Width + 31) & ~31) >> 3; break; case BMF_4BPP: - //ScanLine = ((BitmapInfo->Width + 7) & ~7) / 2; + ScanLine = ((BitmapInfo->Width + 7) & ~7) >> 1; break; case BMF_8BPP: - //ScanLine = ((BitmapInfo->Width + 3) & ~3); + ScanLine = (BitmapInfo->Width + 3) & ~3; break; case BMF_16BPP: - //ScanLine = ((BitmapInfo->Width + 1) & ~1) * 2; + ScanLine = ((BitmapInfo->Width + 1) & ~1) << 1; break; case BMF_24BPP: - //ScanLine = ((BitmapInfo->Width * 3) + 3) & ~3; + ScanLine = ((BitmapInfo->Width * 3) + 3) & ~3; break; case BMF_32BPP: - // ScanLine = BitmapInfo->Width * 4; + ScanLine = BitmapInfo->Width << 2; break; case BMF_8RLE: @@ -510,8 +510,6 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, return NULL; } - ScanLine = BitmapInfo->Width; - /* Does the device manage its own surface? */ if (!Bits) { @@ -604,6 +602,9 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, /* For topdown, the base address starts with the bits */ pso->pvScan0 = pso->pvBits; pso->lDelta = ScanLine; + + /* Hack for FreeType/Font Rendering, cannot use the Aligned ScanLine */ + if (BitmapInfo->Format == BMF_1BPP) pso->lDelta = BitmapInfo->Width / 8; } else { @@ -669,7 +670,6 @@ EngCreateBitmap(IN SIZEL Size, */ if ((Bits) && (Width)) { - #if 0 switch (BitmapInfo.Format) { /* Do the conversion for each bit depth we support */ @@ -692,9 +692,6 @@ EngCreateBitmap(IN SIZEL Size, BitmapInfo.Width = Width / 4; break; } -#endif - BitmapInfo.Width = Width; - } /* Now create the surface */ -- 2.17.1