gdi32: Move get_full_gdi_handle to objects.c.
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
5863f0af57
commit
c0cdf0652f
|
@ -121,7 +121,7 @@ static UINT emfdc_add_handle( struct emf *emf, HGDIOBJ obj )
|
|||
emf->handles,
|
||||
emf->handles_size * sizeof(emf->handles[0]) );
|
||||
}
|
||||
emf->handles[index] = get_full_gdi_handle( obj );
|
||||
emf->handles[index] = obj;
|
||||
|
||||
emf->cur_handles++;
|
||||
if (emf->cur_handles > emf->emh->nHandles)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
void set_gdi_client_ptr( HGDIOBJ handle, void *ptr ) DECLSPEC_HIDDEN;
|
||||
void *get_gdi_client_ptr( HGDIOBJ handle, DWORD type ) DECLSPEC_HIDDEN;
|
||||
DC_ATTR *get_dc_attr( HDC hdc ) DECLSPEC_HIDDEN;
|
||||
HGDIOBJ get_full_gdi_handle( HGDIOBJ handle ) DECLSPEC_HIDDEN;
|
||||
void GDI_hdc_using_object( HGDIOBJ obj, HDC hdc,
|
||||
void (*delete)( HDC hdc, HGDIOBJ handle )) DECLSPEC_HIDDEN;
|
||||
void GDI_hdc_not_using_object( HGDIOBJ obj, HDC hdc ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -1838,6 +1838,7 @@ HPALETTE WINAPI SelectPalette( HDC hdc, HPALETTE palette, BOOL force_background
|
|||
{
|
||||
DC_ATTR *dc_attr;
|
||||
|
||||
palette = get_full_gdi_handle( palette );
|
||||
if (is_meta_dc( hdc )) return ULongToHandle( METADC_SelectPalette( hdc, palette ) );
|
||||
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
|
||||
if (dc_attr->emf && !EMFDC_SelectPalette( dc_attr, palette )) return 0;
|
||||
|
|
|
@ -817,24 +817,6 @@ void *free_gdi_handle( HGDIOBJ handle )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* get_full_gdi_handle
|
||||
*
|
||||
* Return the full GDI handle from a possibly truncated value.
|
||||
*/
|
||||
HGDIOBJ get_full_gdi_handle( HGDIOBJ handle )
|
||||
{
|
||||
GDI_HANDLE_ENTRY *entry;
|
||||
|
||||
if (!HIWORD( handle ))
|
||||
{
|
||||
EnterCriticalSection( &gdi_section );
|
||||
if ((entry = handle_entry( handle ))) handle = entry_to_handle( entry );
|
||||
LeaveCriticalSection( &gdi_section );
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* get_any_obj_ptr
|
||||
*
|
||||
|
|
|
@ -491,7 +491,7 @@ static UINT metadc_add_handle( struct metadc *metadc, HGDIOBJ obj )
|
|||
metadc->handles,
|
||||
metadc->handles_size * sizeof(metadc->handles[0]) );
|
||||
}
|
||||
metadc->handles[index] = get_full_gdi_handle( obj );
|
||||
metadc->handles[index] = obj;
|
||||
|
||||
metadc->cur_handles++;
|
||||
if (metadc->cur_handles > metadc->mh->mtNoObjects)
|
||||
|
|
|
@ -392,7 +392,6 @@ extern BOOL translate_charset_info( DWORD *src, CHARSETINFO *cs, DWORD flags ) D
|
|||
extern HGDIOBJ alloc_gdi_handle( struct gdi_obj_header *obj, DWORD type,
|
||||
const struct gdi_obj_funcs *funcs ) DECLSPEC_HIDDEN;
|
||||
extern void *free_gdi_handle( HGDIOBJ handle ) DECLSPEC_HIDDEN;
|
||||
extern HGDIOBJ get_full_gdi_handle( HGDIOBJ handle ) DECLSPEC_HIDDEN;
|
||||
extern void *GDI_GetObjPtr( HGDIOBJ, DWORD ) DECLSPEC_HIDDEN;
|
||||
extern void *get_any_obj_ptr( HGDIOBJ, DWORD * ) DECLSPEC_HIDDEN;
|
||||
extern void GDI_ReleaseObj( HGDIOBJ ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -123,6 +123,12 @@ void *get_gdi_client_ptr( HGDIOBJ obj, DWORD type )
|
|||
return (void *)(UINT_PTR)entry->UserPointer;
|
||||
}
|
||||
|
||||
HGDIOBJ get_full_gdi_handle( HGDIOBJ obj )
|
||||
{
|
||||
GDI_HANDLE_ENTRY *entry = handle_entry( obj );
|
||||
return entry ? entry_to_handle( entry ) : 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetObjectType (GDI32.@)
|
||||
*/
|
||||
|
@ -171,6 +177,7 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
|
|||
struct hdc_list *hdc_list = NULL;
|
||||
struct wine_rb_entry *entry;
|
||||
|
||||
obj = get_full_gdi_handle( obj );
|
||||
switch (gdi_handle_type( obj ))
|
||||
{
|
||||
case NTGDI_OBJ_DC:
|
||||
|
@ -302,6 +309,7 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ obj )
|
|||
|
||||
TRACE( "(%p,%p)\n", hdc, obj );
|
||||
|
||||
obj = get_full_gdi_handle( obj );
|
||||
if (is_meta_dc( hdc )) return METADC_SelectObject( hdc, obj );
|
||||
if (!(dc_attr = get_dc_attr( hdc ))) return 0;
|
||||
if (dc_attr->emf && !EMFDC_SelectObject( dc_attr, obj )) return 0;
|
||||
|
@ -747,6 +755,7 @@ UINT WINAPI GetPaletteEntries( HPALETTE palette, UINT start, UINT count, PALETTE
|
|||
UINT WINAPI SetPaletteEntries( HPALETTE palette, UINT start, UINT count,
|
||||
const PALETTEENTRY *entries )
|
||||
{
|
||||
palette = get_full_gdi_handle( palette );
|
||||
return NtGdiDoPalette( palette, start, count, (void *)entries, NtGdiSetPaletteEntries, FALSE );
|
||||
}
|
||||
|
||||
|
@ -755,6 +764,7 @@ UINT WINAPI SetPaletteEntries( HPALETTE palette, UINT start, UINT count,
|
|||
*/
|
||||
BOOL WINAPI AnimatePalette( HPALETTE palette, UINT start, UINT count, const PALETTEENTRY *entries )
|
||||
{
|
||||
palette = get_full_gdi_handle( palette );
|
||||
return NtGdiDoPalette( palette, start, count, (void *)entries, NtGdiAnimatePalette, FALSE );
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,6 @@ static UINT set_palette_entries( HPALETTE hpalette, UINT start, UINT count,
|
|||
|
||||
TRACE("hpal=%p,start=%i,count=%i\n",hpalette,start,count );
|
||||
|
||||
hpalette = get_full_gdi_handle( hpalette );
|
||||
if (hpalette == get_stock_object(DEFAULT_PALETTE)) return 0;
|
||||
palPtr = GDI_GetObjPtr( hpalette, NTGDI_OBJ_PAL );
|
||||
if (!palPtr) return 0;
|
||||
|
@ -254,7 +253,6 @@ static BOOL animate_palette( HPALETTE hPal, UINT StartIndex, UINT NumEntries,
|
|||
{
|
||||
TRACE("%p (%i - %i)\n", hPal, StartIndex,StartIndex+NumEntries);
|
||||
|
||||
hPal = get_full_gdi_handle( hPal );
|
||||
if( hPal != get_stock_object(DEFAULT_PALETTE) )
|
||||
{
|
||||
PALETTEOBJ * palPtr;
|
||||
|
@ -520,7 +518,6 @@ HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg)
|
|||
|
||||
TRACE("%p %p\n", hdc, hpal );
|
||||
|
||||
hpal = get_full_gdi_handle( hpal );
|
||||
if (GetObjectType(hpal) != OBJ_PAL)
|
||||
{
|
||||
WARN("invalid selected palette %p\n",hpal);
|
||||
|
|
Loading…
Reference in New Issue