Commit 30550d2e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Introduce NtGdiSelectBitmap.

parent 4dd693a7
......@@ -423,9 +423,9 @@ LONG WINAPI SetBitmapBits(
/***********************************************************************
* BITMAP_SelectObject
* NtGdiSelectBitmap (win32u.@)
*/
static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
HGDIOBJ WINAPI NtGdiSelectBitmap( HDC hdc, HGDIOBJ handle )
{
HGDIOBJ ret;
BITMAPOBJ *bitmap;
......@@ -456,7 +456,8 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
goto done;
}
if (bitmap->dib.dsBm.bmBitsPixel != 1 &&
if (!is_bitmapobj_dib( bitmap ) &&
bitmap->dib.dsBm.bmBitsPixel != 1 &&
bitmap->dib.dsBm.bmBitsPixel != GetDeviceCaps( hdc, BITSPIXEL ))
{
WARN( "Wrong format bitmap %u bpp\n", bitmap->dib.dsBm.bmBitsPixel );
......@@ -491,6 +492,14 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
return ret;
}
/***********************************************************************
* BITMAP_SelectObject
*/
static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
{
return NtGdiSelectBitmap( hdc, handle );
}
/***********************************************************************
* BITMAP_DeleteObject
......
......@@ -1722,59 +1722,7 @@ NTSTATUS WINAPI D3DKMTDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY *des
*/
static HGDIOBJ DIB_SelectObject( HGDIOBJ handle, HDC hdc )
{
HGDIOBJ ret;
BITMAPOBJ *bitmap;
DC *dc;
PHYSDEV physdev;
if (!(dc = get_dc_ptr( hdc ))) return 0;
if (GetObjectType( hdc ) != OBJ_MEMDC)
{
ret = 0;
goto done;
}
ret = dc->hBitmap;
if (handle == dc->hBitmap) goto done; /* nothing to do */
if (!(bitmap = GDI_GetObjPtr( handle, OBJ_BITMAP )))
{
ret = 0;
goto done;
}
if (GDI_get_ref_count( handle ))
{
WARN( "Bitmap already selected in another DC\n" );
GDI_ReleaseObj( handle );
ret = 0;
goto done;
}
physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );
if (!physdev->funcs->pSelectBitmap( physdev, handle ))
{
GDI_ReleaseObj( handle );
ret = 0;
}
else
{
dc->hBitmap = handle;
GDI_inc_ref_count( handle );
dc->dirty = 0;
dc->vis_rect.left = 0;
dc->vis_rect.top = 0;
dc->vis_rect.right = bitmap->dib.dsBm.bmWidth;
dc->vis_rect.bottom = bitmap->dib.dsBm.bmHeight;
dc->device_rect = dc->vis_rect;
GDI_ReleaseObj( handle );
DC_InitDC( dc );
GDI_dec_ref_count( ret );
}
done:
release_dc_ptr( dc );
return ret;
return NtGdiSelectBitmap( hdc, handle );
}
......
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