Author: dgorbachev Date: Sat Apr 28 08:10:33 2007 New Revision: 26554
URL: http://svn.reactos.org/svn/reactos?rev=26554&view=rev Log: - Use hack to prevent Explorer crash.
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c Sat Apr 28 08:10:33 2007 @@ -396,23 +396,23 @@ }
if (Bits == NULL) - { + { if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) - { - BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info; + { + BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info; coreheader->bcWidth =BitmapObj->SurfObj.sizlBitmap.cx; coreheader->bcPlanes = 1; - coreheader->bcBitCount = BitsPerFormat(BitmapObj->SurfObj.iBitmapFormat); - - coreheader->bcHeight = BitmapObj->SurfObj.sizlBitmap.cy; - if (BitmapObj->SurfObj.lDelta > 0) - coreheader->bcHeight = -coreheader->bcHeight; - - Result = BitmapObj->SurfObj.sizlBitmap.cy; - } - - if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) - { + coreheader->bcBitCount = BitsPerFormat(BitmapObj->SurfObj.iBitmapFormat); + + coreheader->bcHeight = BitmapObj->SurfObj.sizlBitmap.cy; + if (BitmapObj->SurfObj.lDelta > 0) + coreheader->bcHeight = -coreheader->bcHeight; + + Result = BitmapObj->SurfObj.sizlBitmap.cy; + } + + if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) + { Info->bmiHeader.biWidth = BitmapObj->SurfObj.sizlBitmap.cx; Info->bmiHeader.biHeight = BitmapObj->SurfObj.sizlBitmap.cy; /* Report negtive height for top-down bitmaps. */ @@ -453,7 +453,7 @@ else { if (StartScan > BitmapObj->SurfObj.sizlBitmap.cy) - { + { Result = 0; } else @@ -462,34 +462,34 @@ DestSize.cx = BitmapObj->SurfObj.sizlBitmap.cx; DestSize.cy = ScanLines;
- DestBitmap = NULL; - if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) - { - DestBitmap = EngCreateBitmap( DestSize, - DIB_GetDIBWidthBytes(DestSize.cx, Info->bmiHeader.biBitCount), - BitmapFormat(Info->bmiHeader.biBitCount, Info->bmiHeader.biCompression), - 0 < Info->bmiHeader.biHeight ? 0 : BMF_TOPDOWN, - Bits); - } - - if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) - { - BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info; - - DestBitmap = EngCreateBitmap( DestSize, - DIB_GetDIBWidthBytes(DestSize.cx, coreheader->bcBitCount), - BitmapFormat(coreheader->bcBitCount, BI_RGB), - 0 < coreheader->bcHeight ? 0 : BMF_TOPDOWN, - Bits); - } - - + DestBitmap = NULL; + if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) + { + DestBitmap = EngCreateBitmap(DestSize, + /* DIB_GetDIBWidthBytes(DestSize.cx, Info->bmiHeader.biBitCount), */ + DestSize.cx * (Info->bmiHeader.biBitCount >> 3), /* HACK */ + BitmapFormat(Info->bmiHeader.biBitCount, Info->bmiHeader.biCompression), + 0 < Info->bmiHeader.biHeight ? 0 : BMF_TOPDOWN, + Bits); + } + + if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info; + + DestBitmap = EngCreateBitmap(DestSize, + DIB_GetDIBWidthBytes(DestSize.cx, coreheader->bcBitCount), + BitmapFormat(coreheader->bcBitCount, BI_RGB), + 0 < coreheader->bcHeight ? 0 : BMF_TOPDOWN, + Bits); + } + if(DestBitmap == NULL) { BITMAPOBJ_UnlockBitmap(BitmapObj); return 0; } - + DestSurfObj = EngLockSurface((HSURF)DestBitmap);
SourcePalette = PALETTE_LockPalette(hSourcePalette);