gdi32: Use NtGdiDeleteObjectApp for DeleteDC.
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
e33cdf89c5
commit
9a53f3ae11
|
@ -827,8 +827,8 @@ BOOL WINAPI MaskBlt(HDC hdcDest, INT nXDest, INT nYDest,
|
|||
DeleteObject(hBitmap2);
|
||||
DeleteObject(hbrMask);
|
||||
|
||||
DeleteDC(hDC1);
|
||||
DeleteDC(hDC2);
|
||||
NtGdiDeleteObjectApp( hDC1 );
|
||||
NtGdiDeleteObjectApp( hDC2 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -923,12 +923,12 @@ error:
|
|||
SetTextColor(hdcDest, oldForeground);
|
||||
if(hdcWork) {
|
||||
NtGdiSelectBitmap(hdcWork, oldWork);
|
||||
DeleteDC(hdcWork);
|
||||
NtGdiDeleteObjectApp( hdcWork );
|
||||
}
|
||||
if(bmpWork) DeleteObject(bmpWork);
|
||||
if(hdcMask) {
|
||||
NtGdiSelectBitmap(hdcMask, oldMask);
|
||||
DeleteDC(hdcMask);
|
||||
NtGdiDeleteObjectApp( hdcMask );
|
||||
}
|
||||
if(bmpMask) DeleteObject(bmpMask);
|
||||
return ret;
|
||||
|
|
|
@ -256,15 +256,6 @@ void update_dc( DC *dc )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DC_DeleteObject
|
||||
*/
|
||||
static BOOL DC_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
return DeleteDC( handle );
|
||||
}
|
||||
|
||||
|
||||
static void set_bk_color( DC *dc, COLORREF color )
|
||||
{
|
||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetBkColor );
|
||||
|
@ -431,6 +422,37 @@ static BOOL reset_dc_state( HDC hdc )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DC_DeleteObject
|
||||
*/
|
||||
static BOOL DC_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
DC *dc;
|
||||
|
||||
TRACE( "%p\n", handle );
|
||||
|
||||
GDI_CheckNotLock();
|
||||
|
||||
if (!(dc = get_dc_ptr( handle ))) return FALSE;
|
||||
if (dc->refcount != 1)
|
||||
{
|
||||
FIXME( "not deleting busy DC %p refcount %u\n", dc->hSelf, dc->refcount );
|
||||
release_dc_ptr( dc );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Call hook procedure to check whether is it OK to delete this DC */
|
||||
if (dc->hookProc && !dc->hookProc( dc->hSelf, DCHC_DELETEDC, dc->dwHookData, 0 ))
|
||||
{
|
||||
release_dc_ptr( dc );
|
||||
return TRUE;
|
||||
}
|
||||
reset_dc_state( handle );
|
||||
free_dc_ptr( dc );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* NtGdiSaveDC (win32u.@)
|
||||
*/
|
||||
|
@ -736,39 +758,6 @@ HDC WINAPI NtGdiCreateCompatibleDC( HDC hdc )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DeleteDC (GDI32.@)
|
||||
*/
|
||||
BOOL WINAPI DeleteDC( HDC hdc )
|
||||
{
|
||||
DC * dc;
|
||||
|
||||
TRACE("%p\n", hdc );
|
||||
|
||||
if (is_meta_dc( hdc )) return METADC_DeleteDC( hdc );
|
||||
|
||||
GDI_CheckNotLock();
|
||||
|
||||
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
|
||||
if (dc->refcount != 1)
|
||||
{
|
||||
FIXME( "not deleting busy DC %p refcount %u\n", dc->hSelf, dc->refcount );
|
||||
release_dc_ptr( dc );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Call hook procedure to check whether is it OK to delete this DC */
|
||||
if (dc->hookProc && !dc->hookProc( dc->hSelf, DCHC_DELETEDC, dc->dwHookData, 0 ))
|
||||
{
|
||||
release_dc_ptr( dc );
|
||||
return TRUE;
|
||||
}
|
||||
reset_dc_state( hdc );
|
||||
free_dc_ptr( dc );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* NtGdiResetDC (win32u.@)
|
||||
*/
|
||||
|
|
|
@ -1687,7 +1687,7 @@ NTSTATUS WINAPI D3DKMTCreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
|
|||
error:
|
||||
if (bmp) HeapFree( GetProcessHeap(), 0, bmp->color_table );
|
||||
HeapFree( GetProcessHeap(), 0, bmp );
|
||||
DeleteDC( dc );
|
||||
NtGdiDeleteObjectApp( dc );
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -1704,7 +1704,7 @@ NTSTATUS WINAPI D3DKMTDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY *des
|
|||
if (GetObjectType( desc->hDc ) != OBJ_MEMDC ||
|
||||
GetObjectType( desc->hBitmap ) != OBJ_BITMAP) return STATUS_INVALID_PARAMETER;
|
||||
DeleteObject( desc->hBitmap );
|
||||
DeleteDC( desc->hDc );
|
||||
NtGdiDeleteObjectApp( desc->hDc );
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,15 @@ HDC WINAPI CreateICW( const WCHAR *driver, const WCHAR *device, const WCHAR *out
|
|||
return CreateDCW( driver, device, output, init_data );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DeleteDC (GDI32.@)
|
||||
*/
|
||||
BOOL WINAPI DeleteDC( HDC hdc )
|
||||
{
|
||||
if (is_meta_dc( hdc )) return METADC_DeleteDC( hdc );
|
||||
return NtGdiDeleteObjectApp( hdc );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ResetDCA (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -153,7 +153,14 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
|
|||
struct hdc_list *hdc_list = NULL;
|
||||
struct wine_rb_entry *entry;
|
||||
|
||||
if (is_meta_dc( obj )) return METADC_DeleteDC( obj );
|
||||
switch (gdi_handle_type( obj ))
|
||||
{
|
||||
case NTGDI_OBJ_DC:
|
||||
case NTGDI_OBJ_MEMDC:
|
||||
case NTGDI_OBJ_ENHMETADC:
|
||||
case NTGDI_OBJ_METADC:
|
||||
return DeleteDC( obj );
|
||||
}
|
||||
|
||||
EnterCriticalSection( &obj_map_cs );
|
||||
|
||||
|
|
Loading…
Reference in New Issue