mirror of
https://github.com/reactos/reactos.git
synced 2024-09-04 09:39:07 +00:00
- Calculate the image size before the height is reported negative, remove redundant if
- Set image size for coreheader in first pass and for both header types in second pass Fixes seven gdi32 bitmap winetests. svn path=/trunk/; revision=36665
This commit is contained in:
parent
f20c6fa6a4
commit
22ed768c30
|
@ -555,7 +555,8 @@ NtGdiGetDIBitsInternal(HDC hDC,
|
||||||
coreheader->bcBitCount = BitsPerFormat(BitmapObj->SurfObj.iBitmapFormat);
|
coreheader->bcBitCount = BitsPerFormat(BitmapObj->SurfObj.iBitmapFormat);
|
||||||
/* Resulting height may be smaller than original height */
|
/* Resulting height may be smaller than original height */
|
||||||
coreheader->bcHeight = min(ScanLines, BitmapObj->SurfObj.sizlBitmap.cy - StartScan);
|
coreheader->bcHeight = min(ScanLines, BitmapObj->SurfObj.sizlBitmap.cy - StartScan);
|
||||||
|
coreheader->bcSize = DIB_GetDIBWidthBytes(coreheader->bcWidth,
|
||||||
|
coreheader->bcBitCount) * coreheader->bcHeight;
|
||||||
if (BitmapObj->SurfObj.lDelta > 0)
|
if (BitmapObj->SurfObj.lDelta > 0)
|
||||||
coreheader->bcHeight = -coreheader->bcHeight;
|
coreheader->bcHeight = -coreheader->bcHeight;
|
||||||
}
|
}
|
||||||
|
@ -567,44 +568,41 @@ NtGdiGetDIBitsInternal(HDC hDC,
|
||||||
Info->bmiHeader.biWidth = BitmapObj->SurfObj.sizlBitmap.cx;
|
Info->bmiHeader.biWidth = BitmapObj->SurfObj.sizlBitmap.cx;
|
||||||
/* Resulting height may be smaller than original height */
|
/* Resulting height may be smaller than original height */
|
||||||
Info->bmiHeader.biHeight = min(ScanLines, BitmapObj->SurfObj.sizlBitmap.cy - StartScan);
|
Info->bmiHeader.biHeight = min(ScanLines, BitmapObj->SurfObj.sizlBitmap.cy - StartScan);
|
||||||
|
Info->bmiHeader.biPlanes = 1;
|
||||||
|
Info->bmiHeader.biBitCount = BitsPerFormat(BitmapObj->SurfObj.iBitmapFormat);
|
||||||
|
switch (BitmapObj->SurfObj.iBitmapFormat)
|
||||||
|
{
|
||||||
|
case BMF_1BPP:
|
||||||
|
case BMF_4BPP:
|
||||||
|
case BMF_8BPP:
|
||||||
|
case BMF_16BPP:
|
||||||
|
case BMF_24BPP:
|
||||||
|
case BMF_32BPP:
|
||||||
|
Info->bmiHeader.biCompression = BI_RGB;
|
||||||
|
break;
|
||||||
|
case BMF_4RLE:
|
||||||
|
Info->bmiHeader.biCompression = BI_RLE4;
|
||||||
|
break;
|
||||||
|
case BMF_8RLE:
|
||||||
|
Info->bmiHeader.biCompression = BI_RLE8;
|
||||||
|
break;
|
||||||
|
case BMF_JPEG:
|
||||||
|
Info->bmiHeader.biCompression = BI_JPEG;
|
||||||
|
break;
|
||||||
|
case BMF_PNG:
|
||||||
|
Info->bmiHeader.biCompression = BI_PNG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* Image size has to be calculated */
|
||||||
|
Info->bmiHeader.biSizeImage = DIB_GetDIBWidthBytes(Info->bmiHeader.biWidth,
|
||||||
|
Info->bmiHeader.biBitCount) * Info->bmiHeader.biHeight;
|
||||||
|
Info->bmiHeader.biXPelsPerMeter = 0; /* FIXME */
|
||||||
|
Info->bmiHeader.biYPelsPerMeter = 0; /* FIXME */
|
||||||
|
Info->bmiHeader.biClrUsed = 0;
|
||||||
|
Info->bmiHeader.biClrImportant = 1 << Info->bmiHeader.biBitCount; /* FIXME */
|
||||||
/* Report negtive height for top-down bitmaps. */
|
/* Report negtive height for top-down bitmaps. */
|
||||||
if (BitmapObj->SurfObj.lDelta > 0)
|
if (BitmapObj->SurfObj.lDelta > 0)
|
||||||
Info->bmiHeader.biHeight = -Info->bmiHeader.biHeight;
|
Info->bmiHeader.biHeight = -Info->bmiHeader.biHeight;
|
||||||
Info->bmiHeader.biPlanes = 1;
|
|
||||||
Info->bmiHeader.biBitCount = BitsPerFormat(BitmapObj->SurfObj.iBitmapFormat);
|
|
||||||
if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
|
|
||||||
{
|
|
||||||
switch (BitmapObj->SurfObj.iBitmapFormat)
|
|
||||||
{
|
|
||||||
case BMF_1BPP:
|
|
||||||
case BMF_4BPP:
|
|
||||||
case BMF_8BPP:
|
|
||||||
case BMF_16BPP:
|
|
||||||
case BMF_24BPP:
|
|
||||||
case BMF_32BPP:
|
|
||||||
Info->bmiHeader.biCompression = BI_RGB;
|
|
||||||
break;
|
|
||||||
case BMF_4RLE:
|
|
||||||
Info->bmiHeader.biCompression = BI_RLE4;
|
|
||||||
break;
|
|
||||||
case BMF_8RLE:
|
|
||||||
Info->bmiHeader.biCompression = BI_RLE8;
|
|
||||||
break;
|
|
||||||
case BMF_JPEG:
|
|
||||||
Info->bmiHeader.biCompression = BI_JPEG;
|
|
||||||
break;
|
|
||||||
case BMF_PNG:
|
|
||||||
Info->bmiHeader.biCompression = BI_PNG;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Image size has to be calculated */
|
|
||||||
Info->bmiHeader.biSizeImage = DIB_GetDIBWidthBytes(Info->bmiHeader.biWidth,
|
|
||||||
Info->bmiHeader.biBitCount) * Info->bmiHeader.biHeight;
|
|
||||||
Info->bmiHeader.biXPelsPerMeter = 0; /* FIXME */
|
|
||||||
Info->bmiHeader.biYPelsPerMeter = 0; /* FIXME */
|
|
||||||
Info->bmiHeader.biClrUsed = 0;
|
|
||||||
Info->bmiHeader.biClrImportant = 1 << Info->bmiHeader.biBitCount; /* FIXME */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_SEH_HANDLE
|
_SEH_HANDLE
|
||||||
|
@ -701,6 +699,8 @@ NtGdiGetDIBitsInternal(HDC hDC,
|
||||||
if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||||
{
|
{
|
||||||
BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info;
|
BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info;
|
||||||
|
coreheader->bcSize = DIB_GetDIBWidthBytes(DestSize.cx,
|
||||||
|
coreheader->bcBitCount) * DestSize.cy;
|
||||||
|
|
||||||
hDestBitmap = EngCreateBitmap(DestSize,
|
hDestBitmap = EngCreateBitmap(DestSize,
|
||||||
DIB_GetDIBWidthBytes(DestSize.cx, coreheader->bcBitCount),
|
DIB_GetDIBWidthBytes(DestSize.cx, coreheader->bcBitCount),
|
||||||
|
@ -711,6 +711,9 @@ NtGdiGetDIBitsInternal(HDC hDC,
|
||||||
|
|
||||||
if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
|
if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
|
||||||
{
|
{
|
||||||
|
Info->bmiHeader.biSizeImage = DIB_GetDIBWidthBytes(DestSize.cx,
|
||||||
|
Info->bmiHeader.biBitCount) * DestSize.cy;
|
||||||
|
|
||||||
hDestBitmap = EngCreateBitmap(DestSize,
|
hDestBitmap = EngCreateBitmap(DestSize,
|
||||||
DIB_GetDIBWidthBytes(DestSize.cx, Info->bmiHeader.biBitCount),
|
DIB_GetDIBWidthBytes(DestSize.cx, Info->bmiHeader.biBitCount),
|
||||||
BitmapFormat(Info->bmiHeader.biBitCount, Info->bmiHeader.biCompression),
|
BitmapFormat(Info->bmiHeader.biBitCount, Info->bmiHeader.biCompression),
|
||||||
|
|
Loading…
Reference in a new issue