mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 22:43:01 +00:00
1. Copy DIB_GetBitmapInfo from wine cvs (date 2/9-2006)
2. Bugfix NtGdiGetDIBits the BITMAPCOREHEADER is not same as BITMAPINFOHEADER we now separate it in if(Bits==NULL) that will allow us pass two more wine tests follow winetest is working now 1. bitmap.c 227 Test failed: GetDIBits doesn't work with a BITMAPCOREHEADER 2. bitmap.c 233 GetDIBits doesn't work with a BITMAPCOREHEADER both of them are fixed now svn path=/trunk/; revision=23891
This commit is contained in:
parent
7bfe48177c
commit
7aa07b393c
2 changed files with 84 additions and 31 deletions
|
@ -8,7 +8,7 @@ DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse);
|
||||||
HBITMAP STDCALL
|
HBITMAP STDCALL
|
||||||
DIB_CreateDIBSection (PDC dc, PBITMAPINFO bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
|
DIB_CreateDIBSection (PDC dc, PBITMAPINFO bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
DIB_GetBitmapInfo (const BITMAPINFOHEADER *header, PDWORD width, PINT height, PWORD bpp, PWORD compr);
|
DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, PLONG width, PLONG height, PWORD planes, PWORD bpp, PLONG compr, PLONG size );
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
DIB_GetDIBImageBytes (INT width, INT height, INT depth);
|
DIB_GetDIBImageBytes (INT width, INT height, INT depth);
|
||||||
INT FASTCALL
|
INT FASTCALL
|
||||||
|
|
|
@ -397,8 +397,17 @@ NtGdiGetDIBits(HDC hDC,
|
||||||
|
|
||||||
if (Bits == NULL)
|
if (Bits == NULL)
|
||||||
{
|
{
|
||||||
if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER) ||
|
if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||||
Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
|
{
|
||||||
|
BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info;
|
||||||
|
coreheader->bcWidth =BitmapObj->SurfObj.sizlBitmap.cx;
|
||||||
|
coreheader->bcHeight = BitmapObj->SurfObj.sizlBitmap.cy;
|
||||||
|
coreheader->bcPlanes = 1;
|
||||||
|
coreheader->bcBitCount = BitsPerFormat(BitmapObj->SurfObj.iBitmapFormat);
|
||||||
|
Result = BitmapObj->SurfObj.sizlBitmap.cy;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Info->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
|
||||||
{
|
{
|
||||||
Info->bmiHeader.biWidth = BitmapObj->SurfObj.sizlBitmap.cx;
|
Info->bmiHeader.biWidth = BitmapObj->SurfObj.sizlBitmap.cx;
|
||||||
Info->bmiHeader.biHeight = BitmapObj->SurfObj.sizlBitmap.cy;
|
Info->bmiHeader.biHeight = BitmapObj->SurfObj.sizlBitmap.cy;
|
||||||
|
@ -671,14 +680,19 @@ IntCreateDIBitmap(PDC Dc, const BITMAPINFOHEADER *header,
|
||||||
UINT coloruse)
|
UINT coloruse)
|
||||||
{
|
{
|
||||||
HBITMAP handle;
|
HBITMAP handle;
|
||||||
BOOL fColor;
|
|
||||||
DWORD width;
|
LONG width;
|
||||||
int height;
|
LONG height;
|
||||||
|
WORD planes;
|
||||||
WORD bpp;
|
WORD bpp;
|
||||||
WORD compr;
|
DWORD compr;
|
||||||
|
DWORD dibsize;
|
||||||
|
BOOL fColor;
|
||||||
SIZEL size;
|
SIZEL size;
|
||||||
|
|
||||||
if (DIB_GetBitmapInfo( header, &width, &height, &bpp, &compr ) == -1) return 0;
|
|
||||||
|
if (DIB_GetBitmapInfo( header, &width, &height, &planes, &bpp, &compr, &dibsize ) == -1) return 0;
|
||||||
|
|
||||||
|
|
||||||
// Check if we should create a monochrome or color bitmap. We create a monochrome bitmap only if it has exactly 2
|
// Check if we should create a monochrome or color bitmap. We create a monochrome bitmap only if it has exactly 2
|
||||||
// colors, which are black followed by white, nothing else. In all other cases, we create a color bitmap.
|
// colors, which are black followed by white, nothing else. In all other cases, we create a color bitmap.
|
||||||
|
@ -1068,28 +1082,67 @@ INT FASTCALL DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INT STDCALL DIB_GetBitmapInfo (const BITMAPINFOHEADER *header,
|
/*
|
||||||
PDWORD width,
|
* DIB_GetBitmapInfo is complete copy of wine cvs 2/9-2006
|
||||||
PINT height,
|
* from file dib.c from gdi32.dll or orginal version
|
||||||
PWORD bpp,
|
* did not calc the info right for some headers.
|
||||||
PWORD compr)
|
*/
|
||||||
|
|
||||||
|
INT STDCALL
|
||||||
|
DIB_GetBitmapInfo( const BITMAPINFOHEADER *header,
|
||||||
|
PLONG width,
|
||||||
|
PLONG height,
|
||||||
|
PWORD planes,
|
||||||
|
PWORD bpp,
|
||||||
|
PLONG compr,
|
||||||
|
PLONG size )
|
||||||
{
|
{
|
||||||
if (header->biSize == sizeof(BITMAPINFOHEADER))
|
|
||||||
{
|
|
||||||
*width = header->biWidth;
|
|
||||||
*height = header->biHeight;
|
|
||||||
*bpp = header->biBitCount;
|
|
||||||
*compr = header->biCompression;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (header->biSize == sizeof(BITMAPCOREHEADER))
|
if (header->biSize == sizeof(BITMAPCOREHEADER))
|
||||||
{
|
{
|
||||||
BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)header;
|
BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)header;
|
||||||
*width = core->bcWidth;
|
*width = core->bcWidth;
|
||||||
*height = core->bcHeight;
|
*height = core->bcHeight;
|
||||||
*bpp = core->bcBitCount;
|
*planes = core->bcPlanes;
|
||||||
*compr = 0;
|
*bpp = core->bcBitCount;
|
||||||
return 0;
|
*compr = 0;
|
||||||
|
*size = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (header->biSize == sizeof(BITMAPINFOHEADER))
|
||||||
|
{
|
||||||
|
*width = header->biWidth;
|
||||||
|
*height = header->biHeight;
|
||||||
|
*planes = header->biPlanes;
|
||||||
|
*bpp = header->biBitCount;
|
||||||
|
*compr = header->biCompression;
|
||||||
|
*size = header->biSizeImage;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (header->biSize == sizeof(BITMAPV4HEADER))
|
||||||
|
{
|
||||||
|
BITMAPV4HEADER *v4hdr = (BITMAPV4HEADER *)header;
|
||||||
|
*width = v4hdr->bV4Width;
|
||||||
|
*height = v4hdr->bV4Height;
|
||||||
|
*planes = v4hdr->bV4Planes;
|
||||||
|
*bpp = v4hdr->bV4BitCount;
|
||||||
|
*compr = v4hdr->bV4V4Compression;
|
||||||
|
*size = v4hdr->bV4SizeImage;
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (header->biSize == sizeof(BITMAPV5HEADER))
|
||||||
|
{
|
||||||
|
BITMAPV5HEADER *v5hdr = (BITMAPV5HEADER *)header;
|
||||||
|
*width = v5hdr->bV5Width;
|
||||||
|
*height = v5hdr->bV5Height;
|
||||||
|
*planes = v5hdr->bV5Planes;
|
||||||
|
*bpp = v5hdr->bV5BitCount;
|
||||||
|
*compr = v5hdr->bV5Compression;
|
||||||
|
*size = v5hdr->bV5SizeImage;
|
||||||
|
return 5;
|
||||||
}
|
}
|
||||||
DPRINT("(%ld): wrong size for header\n", header->biSize );
|
DPRINT("(%ld): wrong size for header\n", header->biSize );
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue