mirror of
https://github.com/reactos/reactos.git
synced 2024-10-23 14:36:11 +00:00
Fixed bug in DIB_GetDIBWidthBytes
accdoing OSR it is number of bytes to next scanline in the bitmap, wine version did align it, that why wrong number of bytes was reported also fixed overflow bug in the math, and make sure if some part of win32k send in negtive width, it will not calc it wrong, Remove one hack in win32k, thx of this, Thx fireball that suggest this functions mabey was wrong svn path=/trunk/; revision=33782
This commit is contained in:
parent
2027d8d907
commit
9ae5fa0777
|
@ -665,7 +665,9 @@ NtGdiGetDIBitsInternal(HDC hDC,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ScanLines = min(ScanLines, BitmapObj->SurfObj.sizlBitmap.cy - StartScan);
|
ScanLines = min(ScanLines, BitmapObj->SurfObj.sizlBitmap.cy - StartScan);
|
||||||
|
|
||||||
DestSize.cx = BitmapObj->SurfObj.sizlBitmap.cx;
|
DestSize.cx = BitmapObj->SurfObj.sizlBitmap.cx;
|
||||||
DestSize.cy = ScanLines;
|
DestSize.cy = ScanLines;
|
||||||
|
|
||||||
|
@ -686,9 +688,9 @@ NtGdiGetDIBitsInternal(HDC hDC,
|
||||||
|
|
||||||
if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
|
if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
|
||||||
{
|
{
|
||||||
|
|
||||||
hDestBitmap = EngCreateBitmap(DestSize,
|
hDestBitmap = EngCreateBitmap(DestSize,
|
||||||
/* DIB_GetDIBWidthBytes(DestSize.cx, Info->bmiHeader.biBitCount), */
|
DIB_GetDIBWidthBytes(DestSize.cx, Info->bmiHeader.biBitCount),
|
||||||
DestSize.cx * (Info->bmiHeader.biBitCount >> 3), /* HACK */
|
|
||||||
BitmapFormat(Info->bmiHeader.biBitCount, Info->bmiHeader.biCompression),
|
BitmapFormat(Info->bmiHeader.biBitCount, Info->bmiHeader.biCompression),
|
||||||
0 < Info->bmiHeader.biHeight ? 0 : BMF_TOPDOWN,
|
0 < Info->bmiHeader.biHeight ? 0 : BMF_TOPDOWN,
|
||||||
Bits);
|
Bits);
|
||||||
|
@ -1218,7 +1220,12 @@ DIB_CreateDIBSection(
|
||||||
*/
|
*/
|
||||||
INT FASTCALL DIB_GetDIBWidthBytes (INT width, INT depth)
|
INT FASTCALL DIB_GetDIBWidthBytes (INT width, INT depth)
|
||||||
{
|
{
|
||||||
return ((width * depth + 31) & ~31) >> 3;
|
/* http://www.osronline.com/DDKx/graphics/gdifncs_9pgn.htm say it must be exacly
|
||||||
|
* number of byte to next scanline in the bitmap
|
||||||
|
*/
|
||||||
|
UINT bytes = ((UINT)(abs(width)) * (UINT)depth) >> 3;
|
||||||
|
// FIXME : this is wrong return (width * depth + 31) & ~31) >> 3;
|
||||||
|
return (INT)bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
Loading…
Reference in a new issue