gdi32: Use NtGdiCreateDIBitmapInternal for CreateDIBitmap.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0110321640
commit
b2522bfb90
|
@ -1418,35 +1418,30 @@ done:
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
* CreateDIBitmap (GDI32.@)
|
||||
* NtGdiCreateDIBitmapInternal (win32u.@)
|
||||
*
|
||||
* Creates a DDB (device dependent bitmap) from a DIB.
|
||||
* The DDB will have the same color depth as the reference DC.
|
||||
*/
|
||||
HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header,
|
||||
DWORD init, LPCVOID bits, const BITMAPINFO *data,
|
||||
UINT coloruse )
|
||||
HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWORD init,
|
||||
const void *bits, const BITMAPINFO *data,
|
||||
UINT coloruse, UINT max_info, UINT max_bits,
|
||||
ULONG flags, HANDLE xform )
|
||||
{
|
||||
BITMAPINFOHEADER info;
|
||||
HBITMAP handle;
|
||||
LONG height;
|
||||
|
||||
if (!bitmapinfoheader_from_user_bitmapinfo( &info, header )) return 0;
|
||||
if (info.biCompression == BI_JPEG || info.biCompression == BI_PNG) return 0;
|
||||
if (coloruse > DIB_PAL_COLORS + 1) return 0;
|
||||
if (info.biWidth < 0) return 0;
|
||||
if (coloruse > DIB_PAL_COLORS + 1 || width < 0) return 0;
|
||||
|
||||
/* Top-down DIBs have a negative height */
|
||||
height = abs( info.biHeight );
|
||||
height = abs( height );
|
||||
|
||||
TRACE("hdc=%p, header=%p, init=%u, bits=%p, data=%p, coloruse=%u (bitmap: width=%d, height=%d, bpp=%u, compr=%u)\n",
|
||||
hdc, header, init, bits, data, coloruse, info.biWidth, info.biHeight,
|
||||
info.biBitCount, info.biCompression);
|
||||
TRACE( "hdc=%p, init=%u, bits=%p, data=%p, coloruse=%u (bitmap: width=%d, height=%d)\n",
|
||||
hdc, init, bits, data, coloruse, width, height );
|
||||
|
||||
if (hdc == NULL)
|
||||
handle = CreateBitmap( info.biWidth, height, 1, 1, NULL );
|
||||
handle = NtGdiCreateBitmap( width, height, 1, 1, NULL );
|
||||
else
|
||||
handle = CreateCompatibleBitmap( hdc, info.biWidth, height );
|
||||
handle = NtGdiCreateCompatibleBitmap( hdc, width, height );
|
||||
|
||||
if (handle)
|
||||
{
|
||||
|
@ -1454,7 +1449,7 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header,
|
|||
{
|
||||
if (SetDIBits( hdc, handle, 0, height, bits, data, coloruse ) == 0)
|
||||
{
|
||||
DeleteObject( handle );
|
||||
NtGdiDeleteObjectApp( handle );
|
||||
handle = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -725,7 +725,36 @@ UINT WINAPI GetSystemPaletteEntries( HDC hdc, UINT start, UINT count, PALETTEENT
|
|||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetDIBits (GDI32.@)
|
||||
* CreateDIBitmap (GDI32.@)
|
||||
*/
|
||||
HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header, DWORD init,
|
||||
const void *bits, const BITMAPINFO *data, UINT coloruse )
|
||||
{
|
||||
int width, height;
|
||||
|
||||
if (!header) return 0;
|
||||
|
||||
if (header->biSize == sizeof(BITMAPCOREHEADER))
|
||||
{
|
||||
const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)header;
|
||||
width = core->bcWidth;
|
||||
height = core->bcHeight;
|
||||
}
|
||||
else if (header->biSize >= sizeof(BITMAPINFOHEADER))
|
||||
{
|
||||
if (header->biCompression == BI_JPEG || header->biCompression == BI_PNG) return 0;
|
||||
width = header->biWidth;
|
||||
height = header->biHeight;
|
||||
}
|
||||
else return 0;
|
||||
|
||||
if (!width || !height) return GetStockObject( STOCK_LAST + 1 ); /* default 1x1 bitmap */
|
||||
return NtGdiCreateDIBitmapInternal( hdc, width, height, init, bits, data, coloruse,
|
||||
0, 0, 0, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetDIBits (win32u.@)
|
||||
*/
|
||||
INT WINAPI DECLSPEC_HOTPATCH GetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines,
|
||||
void *bits, BITMAPINFO *info, UINT coloruse )
|
||||
|
|
|
@ -218,6 +218,10 @@ BOOL WINAPI NtGdiComputeXformCoefficients( HDC hdc );
|
|||
HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes,
|
||||
UINT bpp, const void *bits );
|
||||
HBITMAP WINAPI NtGdiCreateCompatibleBitmap( HDC hdc, INT width, INT height );
|
||||
HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWORD init,
|
||||
const void *bits, const BITMAPINFO *data,
|
||||
UINT coloruse, UINT max_info, UINT max_bits,
|
||||
ULONG flags, HANDLE xform );
|
||||
HPALETTE WINAPI NtGdiCreateHalftonePalette( HDC hdc );
|
||||
HBRUSH WINAPI NtGdiCreateHatchBrushInternal( INT style, COLORREF color, BOOL pen );
|
||||
HDC WINAPI NtGdiCreateMetafileDC( HDC hdc );
|
||||
|
|
Loading…
Reference in New Issue