Commit 3dbe180e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Extend NtGdiSetDIBitsToDeviceInternal for SetDIBits implementation.

parent ab88c7cb
......@@ -1970,6 +1970,21 @@ BOOL WINAPI GdiAlphaBlend( HDC hdc_dst, int x_dst, int y_dst, int width_dst, int
*(DWORD *)&blend_function, 0 /* FIXME */ );
}
/******************************************************************************
* SetDIBits (GDI32.@)
*
* Sets pixels in a bitmap using colors from DIB.
*/
INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
UINT lines, const void *bits, const BITMAPINFO *info,
UINT coloruse )
{
/* Wine-specific: pass hbitmap to NtGdiSetDIBitsToDeviceInternal */
return NtGdiSetDIBitsToDeviceInternal( hdc, 0, 0, 0, 0, 0, 0,
startscan, lines, bits, info, coloruse,
0, 0, FALSE, hbitmap );
}
/***********************************************************************
* SetDIBitsToDevice (GDI32.@)
*/
......
......@@ -655,27 +655,10 @@ INT WINAPI NtGdiStretchDIBitsInternal( HDC hdc, INT xDst, INT yDst, INT widthDst
}
/******************************************************************************
* SetDIBits [GDI32.@]
*
* Sets pixels in a bitmap using colors from DIB.
*
* PARAMS
* hdc [I] Handle to device context
* hbitmap [I] Handle to bitmap
* startscan [I] Starting scan line
* lines [I] Number of scan lines
* bits [I] Array of bitmap bits
* info [I] Address of structure with data
* coloruse [I] Type of color indexes to use
*
* RETURNS
* Success: Number of scan lines copied
* Failure: 0
*/
INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
UINT lines, LPCVOID bits, const BITMAPINFO *info,
UINT coloruse )
/* Sets pixels in a bitmap using colors from DIB, see SetDIBits */
static int set_di_bits( HDC hdc, HBITMAP hbitmap, UINT startscan,
UINT lines, LPCVOID bits, const BITMAPINFO *info,
UINT coloruse )
{
BITMAPOBJ *bitmap;
char src_bmibuf[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
......@@ -913,6 +896,8 @@ INT WINAPI NtGdiSetDIBitsToDeviceInternal( HDC hdc, INT xDest, INT yDest, DWORD
INT ret = 0;
DC *dc;
if (xform) return set_di_bits( hdc, xform, startscan, lines, bits, bmi, coloruse );
if (!bits) return 0;
if (!bitmapinfo_from_user_bitmapinfo( info, bmi, coloruse, TRUE ))
{
......@@ -1468,7 +1453,7 @@ HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWOR
{
if (init & CBM_INIT)
{
if (SetDIBits( hdc, handle, 0, height, bits, data, coloruse ) == 0)
if (set_di_bits( hdc, handle, 0, height, bits, data, coloruse ) == 0)
{
NtGdiDeleteObjectApp( handle );
handle = 0;
......
......@@ -1030,7 +1030,6 @@ BOOL WINAPI NtGdiSetColorAdjustment( HDC hdc, const COLORADJUSTMENT *ca )
static struct unix_funcs unix_funcs =
{
SetDIBits,
__wine_get_file_outline_text_metric,
__wine_get_icm_profile,
__wine_send_input,
......
......@@ -1324,6 +1324,5 @@
@ cdecl __wine_send_input(long ptr ptr)
# gdi32
@ stdcall SetDIBits(long long long long ptr ptr long)
@ cdecl __wine_get_icm_profile(long long ptr ptr)
@ cdecl __wine_get_file_outline_text_metric(wstr ptr)
......@@ -35,9 +35,6 @@
struct unix_funcs
{
/* Wine-specific functions */
INT (WINAPI *pSetDIBits)( HDC hdc, HBITMAP hbitmap, UINT startscan,
UINT lines, const void *bits, const BITMAPINFO *info,
UINT coloruse );
BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm );
BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename );
BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput );
......
......@@ -24,14 +24,6 @@
static const struct unix_funcs *unix_funcs;
INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
UINT lines, const void *bits, const BITMAPINFO *info,
UINT coloruse )
{
if (!unix_funcs) return 0;
return unix_funcs->pSetDIBits( hdc, hbitmap, startscan, lines, bits, info, coloruse );
}
BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename )
{
if (!unix_funcs) return FALSE;
......
......@@ -1497,7 +1497,9 @@ Pixmap create_pixmap_from_image( HDC hdc, const XVisualInfo *vis, const BITMAPIN
{
if (src_info->bmiHeader.biBitCount == 1 && !src_info->bmiHeader.biClrUsed)
memcpy( src_info->bmiColors, default_colortable, sizeof(default_colortable) );
SetDIBits( hdc, dib, 0, abs(info->bmiHeader.biHeight), bits->ptr, src_info, coloruse );
NtGdiSetDIBitsToDeviceInternal( hdc, 0, 0, 0, 0, 0, 0, 0,
abs(info->bmiHeader.biHeight), bits->ptr, src_info, coloruse,
0, 0, FALSE, dib ); /* SetDIBits */
dst_bits.free = NULL;
dst_bits.is_copy = TRUE;
err = put_pixmap_image( pixmap, vis, dst_info, &dst_bits );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment