- Rewrite NtGdiGetDIBitsInternal, with WINE as a reference.
  - Get back DIB Section creation to classic BITMAPINFO.
This si the beginnig of the end for all this BITMAPV5INFO stuff.
It is horrible, BITMAPCOREINFO->BITMAPINFO is already made in user mode, and V4 and V5 features are not used so often.

svn path=/branches/reactos-yarotows/; revision=48359
This commit is contained in:
Jérôme Gardou 2010-07-29 16:12:43 +00:00
parent 21a56a9d82
commit 5cfcef35dc
3 changed files with 525 additions and 350 deletions

View file

@ -5,15 +5,16 @@
INT FASTCALL
DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse);
HBITMAP APIENTRY
DIB_CreateDIBSection (PDC dc, CONST BITMAPV5INFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
INT APIENTRY
DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, PLONG width, PLONG height, PWORD planes, PWORD bpp, PLONG compr, PLONG size );
DIB_CreateDIBSection (PDC dc, CONST BITMAPINFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
int FASTCALL
DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size );
INT APIENTRY
DIB_GetDIBImageBytes (INT width, INT height, INT depth);
INT FASTCALL
DIB_GetDIBWidthBytes (INT width, INT depth);
RGBQUAD * FASTCALL
DIB_MapPaletteColors(PDC dc, CONST BITMAPV5INFO* lpbmi);
DIB_MapPaletteColors(PDC dc, CONST BITMAPINFO* lpbmi);
HPALETTE FASTCALL
BuildDIBPalette (CONST BITMAPINFO *bmi, PINT paletteType);

View file

@ -309,30 +309,28 @@ IntCreateCompatibleBitmap(
else
{
/* A DIB section is selected in the DC */
BITMAPV5INFO bi;
BYTE buf[sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD)] = {0};
PVOID Bits;
BITMAPINFO* bi = (BITMAPINFO*)buf;
RtlZeroMemory(&bi.bmiHeader, sizeof(bi.bmiHeader));
bi.bmiHeader.bV5Size = sizeof(bi.bmiHeader);
bi.bmiHeader.bV5Width = Width;
bi.bmiHeader.bV5Height = Height;
bi.bmiHeader.bV5Planes = dibs.dsBmih.biPlanes;
bi.bmiHeader.bV5BitCount = dibs.dsBmih.biBitCount;
bi.bmiHeader.bV5Compression = dibs.dsBmih.biCompression;
bi.bmiHeader.bV5SizeImage = 0;
bi.bmiHeader.bV5XPelsPerMeter = dibs.dsBmih.biXPelsPerMeter;
bi.bmiHeader.bV5YPelsPerMeter = dibs.dsBmih.biYPelsPerMeter;
bi.bmiHeader.bV5ClrUsed = dibs.dsBmih.biClrUsed;
bi.bmiHeader.bV5ClrImportant = dibs.dsBmih.biClrImportant;
bi->bmiHeader.biSize = sizeof(bi->bmiHeader);
bi->bmiHeader.biWidth = Width;
bi->bmiHeader.biHeight = Height;
bi->bmiHeader.biPlanes = dibs.dsBmih.biPlanes;
bi->bmiHeader.biBitCount = dibs.dsBmih.biBitCount;
bi->bmiHeader.biCompression = dibs.dsBmih.biCompression;
bi->bmiHeader.biSizeImage = 0;
bi->bmiHeader.biXPelsPerMeter = dibs.dsBmih.biXPelsPerMeter;
bi->bmiHeader.biYPelsPerMeter = dibs.dsBmih.biYPelsPerMeter;
bi->bmiHeader.biClrUsed = dibs.dsBmih.biClrUsed;
bi->bmiHeader.biClrImportant = dibs.dsBmih.biClrImportant;
if (bi.bmiHeader.bV5Compression == BI_BITFIELDS)
if (bi->bmiHeader.biCompression == BI_BITFIELDS)
{
/* Copy the color masks */
bi.bmiHeader.bV5RedMask = dibs.dsBitfields[0];
bi.bmiHeader.bV5GreenMask = dibs.dsBitfields[1];
bi.bmiHeader.bV5BlueMask = dibs.dsBitfields[2];
RtlCopyMemory(bi->bmiColors, dibs.dsBitfields, 3*sizeof(RGBQUAD));
}
else if (bi.bmiHeader.bV5BitCount <= 8)
else if (bi->bmiHeader.biBitCount <= 8)
{
/* Copy the color table */
UINT Index;
@ -350,15 +348,15 @@ IntCreateCompatibleBitmap(
Index < 256 && Index < PalGDI->NumColors;
Index++)
{
bi.bmiColors[Index].rgbRed = PalGDI->IndexedColors[Index].peRed;
bi.bmiColors[Index].rgbGreen = PalGDI->IndexedColors[Index].peGreen;
bi.bmiColors[Index].rgbBlue = PalGDI->IndexedColors[Index].peBlue;
bi.bmiColors[Index].rgbReserved = 0;
bi->bmiColors[Index].rgbRed = PalGDI->IndexedColors[Index].peRed;
bi->bmiColors[Index].rgbGreen = PalGDI->IndexedColors[Index].peGreen;
bi->bmiColors[Index].rgbBlue = PalGDI->IndexedColors[Index].peBlue;
bi->bmiColors[Index].rgbReserved = 0;
}
PALETTE_UnlockPalette(PalGDI);
Bmp = DIB_CreateDIBSection(Dc,
&bi,
bi,
DIB_RGB_COLORS,
&Bits,
NULL,

File diff suppressed because it is too large Load diff