Commit 901c1997 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Make the push/pop_dc_driver functions available to the drivers.

parent 9a63a25b
......@@ -703,12 +703,12 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
old_physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );
if(old_physdev == &dc->dibdrv.dev)
pop_dc_driver( dc, old_physdev );
old_physdev = pop_dc_driver( &dc->physDev );
if(bitmap->dib)
{
physdev = &dc->dibdrv.dev;
push_dc_driver( dc, physdev, physdev->funcs );
push_dc_driver( &dc->physDev, physdev, physdev->funcs );
}
else
physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );
......@@ -742,8 +742,8 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
done:
if(!ret)
{
if(physdev == &dc->dibdrv.dev) pop_dc_driver( dc, physdev );
if(old_physdev == &dc->dibdrv.dev) push_dc_driver( dc, old_physdev, old_physdev->funcs );
if(physdev == &dc->dibdrv.dev) pop_dc_driver( &dc->physDev );
if(old_physdev == &dc->dibdrv.dev) push_dc_driver( &dc->physDev, old_physdev, old_physdev->funcs );
}
release_dc_ptr( dc );
return ret;
......
......@@ -183,8 +183,7 @@ void free_dc_ptr( DC *dc )
while (dc->physDev != &dc->nulldrv)
{
PHYSDEV physdev = dc->physDev;
pop_dc_driver( dc, physdev );
PHYSDEV physdev = pop_dc_driver( &dc->physDev );
physdev->funcs->pDeleteDC( physdev );
}
free_gdi_handle( dc->hSelf );
......@@ -248,33 +247,6 @@ void update_dc( DC *dc )
/***********************************************************************
* push_dc_driver
*
* Push a driver on top of the DC driver stack.
*/
void push_dc_driver( DC * dc, PHYSDEV physdev, const DC_FUNCTIONS *funcs )
{
physdev->funcs = funcs;
physdev->next = dc->physDev;
physdev->hdc = dc->hSelf;
dc->physDev = physdev;
}
/***********************************************************************
* pop_dc_driver
*
* Pop the top driver from the DC driver stack.
*/
void pop_dc_driver( DC * dc, PHYSDEV physdev )
{
assert( physdev == dc->physDev );
assert( physdev != &dc->nulldrv );
dc->physDev = physdev->next;
}
/***********************************************************************
* DC_DeleteObject
*/
static BOOL DC_DeleteObject( HGDIOBJ handle )
......@@ -662,7 +634,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
WARN("creation aborted by device\n" );
goto error;
}
push_dc_driver( dc, physdev, funcs );
push_dc_driver( &dc->physDev, physdev, funcs );
}
dc->vis_rect.left = 0;
......@@ -786,7 +758,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
WARN("creation aborted by device\n");
goto error;
}
push_dc_driver( dc, physDev, funcs );
push_dc_driver( &dc->physDev, physDev, funcs );
}
DC_InitDC( dc );
release_dc_ptr( dc );
......
......@@ -331,7 +331,7 @@ HDC WINAPI CreateEnhMetaFileW(
return 0;
}
push_dc_driver( dc, &physDev->dev, &EMFDRV_Funcs );
push_dc_driver( &dc->physDev, &physDev->dev, &EMFDRV_Funcs );
physDev->handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0]));
physDev->handles_size = HANDLE_LIST_INC;
......
......@@ -330,8 +330,6 @@ extern void free_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
extern DC *get_dc_ptr( HDC hdc ) DECLSPEC_HIDDEN;
extern void release_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
extern void update_dc( DC *dc ) DECLSPEC_HIDDEN;
extern void push_dc_driver( DC * dc, PHYSDEV physdev, const DC_FUNCTIONS *funcs ) DECLSPEC_HIDDEN;
extern void pop_dc_driver( DC * dc, PHYSDEV physdev ) DECLSPEC_HIDDEN;
extern void DC_InitDC( DC * dc ) DECLSPEC_HIDDEN;
extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN;
......
......@@ -224,7 +224,7 @@ static DC *MFDRV_AllocMetaFile(void)
return NULL;
}
push_dc_driver( dc, &physDev->dev, &MFDRV_Funcs );
push_dc_driver( &dc->physDev, &physDev->dev, &MFDRV_Funcs );
physDev->handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0]));
physDev->handles_size = HANDLE_LIST_INC;
......
......@@ -199,4 +199,19 @@ static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
#define GET_NEXT_PHYSDEV(dev,func) \
get_physdev_entry_point( (dev)->next, FIELD_OFFSET(struct gdi_dc_funcs,func))
static inline void push_dc_driver( PHYSDEV *dev, PHYSDEV physdev, const struct gdi_dc_funcs *funcs )
{
physdev->funcs = funcs;
physdev->next = *dev;
physdev->hdc = (*dev)->hdc;
*dev = physdev;
}
static inline PHYSDEV pop_dc_driver( PHYSDEV *dev )
{
PHYSDEV ret = *dev;
*dev = ret->next;
return ret;
}
#endif /* __WINE_WINE_GDI_DRIVER_H */
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