Author: fireball Date: Mon Feb 8 22:42:12 2010 New Revision: 45502
URL: http://svn.reactos.org/svn/reactos?rev=45502&view=rev Log: - Add back DIB section's "bottom down" property, which fixes existing issues (and adds new one in Explorer's start menu). Issue #28 in the Arwinss wiki. - Remove unnecessary abs'es of always positive values. - Add ScanLines/ScanStart bounds checking. - Actually return a real amount of copied scanlines instead of always faking success.
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] Mon Feb 8 22:42:12 2010 @@ -136,7 +136,7 @@
/* Get DIB section size */ szSize.cx = dib->dsBm.bmWidth; - szSize.cy = abs(dib->dsBm.bmHeight); + szSize.cy = dib->dsBm.bmHeight;
/* Get its format */ ulFormat = GrepBitmapFormat(dib->dsBmih.biBitCount * dib->dsBmih.biPlanes, @@ -146,7 +146,7 @@ hbmDIB = GreCreateBitmap(szSize, dib->dsBm.bmWidthBytes, ulFormat, BMF_DONTCACHE | BMF_USERMEM | BMF_NOZEROINIT | - 0, + (dib->dsBmih.biHeight < 0 ? BMF_TOPDOWN : 0), dib->dsBm.bmBits);
dib->dsBmih.biClrUsed = 0; @@ -371,13 +371,13 @@ hBitmap, hUserBitmap, StartScan, ScanLines);
/* Set the bits */ - GreSetDIBits(pDC, - hBitmap, - StartScan, - ScanLines, - Bits, - bmi, - ColorUse); + ScanLines = GreSetDIBits(pDC, + hBitmap, + StartScan, + ScanLines, + Bits, + bmi, + ColorUse);
/* Release DC objects */ DC_Unlock(pDC);
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] Mon Feb 8 22:42:12 2010 @@ -594,6 +594,12 @@ { return 0; } + + if (!ScanLines || (StartScan >= bitmap->SurfObj.sizlBitmap.cy)) + return 0; + + if (StartScan + ScanLines > bitmap->SurfObj.sizlBitmap.cy) + ScanLines = bitmap->SurfObj.sizlBitmap.cy - StartScan;
// Get RGB values if (ColorUse == DIB_PAL_COLORS)