gdi32: Introduce NtGdiSelectBitmap.
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
4dd693a7ea
commit
30550d2e6d
|
@ -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;
|
HGDIOBJ ret;
|
||||||
BITMAPOBJ *bitmap;
|
BITMAPOBJ *bitmap;
|
||||||
|
@ -456,7 +456,8 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
|
||||||
goto done;
|
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 ))
|
bitmap->dib.dsBm.bmBitsPixel != GetDeviceCaps( hdc, BITSPIXEL ))
|
||||||
{
|
{
|
||||||
WARN( "Wrong format bitmap %u bpp\n", bitmap->dib.dsBm.bmBitsPixel );
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* BITMAP_SelectObject
|
||||||
|
*/
|
||||||
|
static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
|
||||||
|
{
|
||||||
|
return NtGdiSelectBitmap( hdc, handle );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* BITMAP_DeleteObject
|
* BITMAP_DeleteObject
|
||||||
|
|
|
@ -1722,59 +1722,7 @@ NTSTATUS WINAPI D3DKMTDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY *des
|
||||||
*/
|
*/
|
||||||
static HGDIOBJ DIB_SelectObject( HGDIOBJ handle, HDC hdc )
|
static HGDIOBJ DIB_SelectObject( HGDIOBJ handle, HDC hdc )
|
||||||
{
|
{
|
||||||
HGDIOBJ ret;
|
return NtGdiSelectBitmap( hdc, handle );
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue