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

This commit is contained in:
Alexandre Julliard 2011-09-07 14:39:46 +02:00
parent 9a63a25b9d
commit 901c1997cb
6 changed files with 24 additions and 39 deletions

View File

@ -703,12 +703,12 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
old_physdev = GET_DC_PHYSDEV( dc, pSelectBitmap ); old_physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );
if(old_physdev == &dc->dibdrv.dev) if(old_physdev == &dc->dibdrv.dev)
pop_dc_driver( dc, old_physdev ); old_physdev = pop_dc_driver( &dc->physDev );
if(bitmap->dib) if(bitmap->dib)
{ {
physdev = &dc->dibdrv.dev; physdev = &dc->dibdrv.dev;
push_dc_driver( dc, physdev, physdev->funcs ); push_dc_driver( &dc->physDev, physdev, physdev->funcs );
} }
else else
physdev = GET_DC_PHYSDEV( dc, pSelectBitmap ); physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );
@ -742,8 +742,8 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
done: done:
if(!ret) if(!ret)
{ {
if(physdev == &dc->dibdrv.dev) pop_dc_driver( dc, physdev ); 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(old_physdev == &dc->dibdrv.dev) push_dc_driver( &dc->physDev, old_physdev, old_physdev->funcs );
} }
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;

View File

@ -183,8 +183,7 @@ void free_dc_ptr( DC *dc )
while (dc->physDev != &dc->nulldrv) while (dc->physDev != &dc->nulldrv)
{ {
PHYSDEV physdev = dc->physDev; PHYSDEV physdev = pop_dc_driver( &dc->physDev );
pop_dc_driver( dc, physdev );
physdev->funcs->pDeleteDC( physdev ); physdev->funcs->pDeleteDC( physdev );
} }
free_gdi_handle( dc->hSelf ); free_gdi_handle( dc->hSelf );
@ -247,33 +246,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 * DC_DeleteObject
*/ */
@ -662,7 +634,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
WARN("creation aborted by device\n" ); WARN("creation aborted by device\n" );
goto error; goto error;
} }
push_dc_driver( dc, physdev, funcs ); push_dc_driver( &dc->physDev, physdev, funcs );
} }
dc->vis_rect.left = 0; dc->vis_rect.left = 0;
@ -786,7 +758,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
WARN("creation aborted by device\n"); WARN("creation aborted by device\n");
goto error; goto error;
} }
push_dc_driver( dc, physDev, funcs ); push_dc_driver( &dc->physDev, physDev, funcs );
} }
DC_InitDC( dc ); DC_InitDC( dc );
release_dc_ptr( dc ); release_dc_ptr( dc );

View File

@ -331,7 +331,7 @@ HDC WINAPI CreateEnhMetaFileW(
return 0; 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 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0]));
physDev->handles_size = HANDLE_LIST_INC; physDev->handles_size = HANDLE_LIST_INC;

View File

@ -330,8 +330,6 @@ extern void free_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
extern DC *get_dc_ptr( HDC hdc ) DECLSPEC_HIDDEN; extern DC *get_dc_ptr( HDC hdc ) DECLSPEC_HIDDEN;
extern void release_dc_ptr( DC *dc ) DECLSPEC_HIDDEN; extern void release_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
extern void update_dc( 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_InitDC( DC * dc ) DECLSPEC_HIDDEN;
extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN; extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN;

View File

@ -224,7 +224,7 @@ static DC *MFDRV_AllocMetaFile(void)
return NULL; 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 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0]));
physDev->handles_size = HANDLE_LIST_INC; physDev->handles_size = HANDLE_LIST_INC;

View File

@ -199,4 +199,19 @@ static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
#define GET_NEXT_PHYSDEV(dev,func) \ #define GET_NEXT_PHYSDEV(dev,func) \
get_physdev_entry_point( (dev)->next, FIELD_OFFSET(struct gdi_dc_funcs,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 */ #endif /* __WINE_WINE_GDI_DRIVER_H */