Jacek Caban : gdi32: Move get_full_gdi_handle to objects.c.
Alexandre Julliard
julliard at winehq.org
Tue Sep 7 16:25:19 CDT 2021
Module: wine
Branch: master
Commit: c0cdf0652f9f8c630d6c0e6a82e580d43d42463a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c0cdf0652f9f8c630d6c0e6a82e580d43d42463a
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Sep 7 14:11:15 2021 +0200
gdi32: Move get_full_gdi_handle to objects.c.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/emfdc.c | 2 +-
dlls/gdi32/gdi_private.h | 1 +
dlls/gdi32/gdidc.c | 1 +
dlls/gdi32/gdiobj.c | 18 ------------------
dlls/gdi32/metadc.c | 2 +-
dlls/gdi32/ntgdi_private.h | 1 -
dlls/gdi32/objects.c | 10 ++++++++++
dlls/gdi32/palette.c | 3 ---
8 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/dlls/gdi32/emfdc.c b/dlls/gdi32/emfdc.c
index 0fb2d99dcef..2e237ff26ae 100644
--- a/dlls/gdi32/emfdc.c
+++ b/dlls/gdi32/emfdc.c
@@ -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)
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 7a4a8773f3f..7ed11a17e2e 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -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;
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 7f1a5a9cd24..d5645595984 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -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;
diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c
index 70148cdcb77..5787231d087 100644
--- a/dlls/gdi32/gdiobj.c
+++ b/dlls/gdi32/gdiobj.c
@@ -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
*
diff --git a/dlls/gdi32/metadc.c b/dlls/gdi32/metadc.c
index f4b313ba5db..f988118f29a 100644
--- a/dlls/gdi32/metadc.c
+++ b/dlls/gdi32/metadc.c
@@ -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)
diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h
index b8273e8a405..3f241a87dbc 100644
--- a/dlls/gdi32/ntgdi_private.h
+++ b/dlls/gdi32/ntgdi_private.h
@@ -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;
diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c
index 5b1145c52a2..97b0fec5ecf 100644
--- a/dlls/gdi32/objects.c
+++ b/dlls/gdi32/objects.c
@@ -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 );
}
diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c
index a14ba9aeb08..e48d4501c6d 100644
--- a/dlls/gdi32/palette.c
+++ b/dlls/gdi32/palette.c
@@ -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);
More information about the wine-cvs
mailing list