fixed GDIOBJ locking issue with DC_SET_MODE macro

svn path=/trunk/; revision=5610
This commit is contained in:
Royce Mitchell III 2003-08-17 03:32:59 +00:00
parent 96a1097b2d
commit 85f2a50511

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: dc.c,v 1.68 2003/08/04 19:10:52 royce Exp $ /* $Id: dc.c,v 1.69 2003/08/17 03:32:59 royce Exp $
* *
* DC.C - Device context functions * DC.C - Device context functions
* *
@ -79,9 +79,7 @@ BOOL STDCALL func_name( HDC hdc, LP##type pt ) \
{ \ { \
PDC dc = DC_HandleToPtr ( hdc ); \ PDC dc = DC_HandleToPtr ( hdc ); \
if (!dc) \ if (!dc) \
{ \
return FALSE; \ return FALSE; \
} \
((LPPOINT)pt)->x = dc->ret_x; \ ((LPPOINT)pt)->x = dc->ret_x; \
((LPPOINT)pt)->y = dc->ret_y; \ ((LPPOINT)pt)->y = dc->ret_y; \
DC_ReleasePtr ( hdc ); \ DC_ReleasePtr ( hdc ); \
@ -92,15 +90,12 @@ BOOL STDCALL func_name( HDC hdc, LP##type pt ) \
INT STDCALL func_name( HDC hdc, INT mode ) \ INT STDCALL func_name( HDC hdc, INT mode ) \
{ \ { \
INT prevMode; \ INT prevMode; \
PDC dc = DC_HandleToPtr( hdc ); \ PDC dc; \
if(!dc) \
{ \
return 0; \
} \
if ((mode < min_val) || (mode > max_val)) \ if ((mode < min_val) || (mode > max_val)) \
{ \
return 0; \ return 0; \
} \ dc = DC_HandleToPtr ( hdc ); \
if ( !dc ) \
return 0; \
prevMode = dc->dc_field; \ prevMode = dc->dc_field; \
dc->dc_field = mode; \ dc->dc_field = mode; \
DC_ReleasePtr ( hdc ); \ DC_ReleasePtr ( hdc ); \
@ -136,7 +131,8 @@ W32kCreateCompatableDC(HDC hDC)
if( hNewDC ) if( hNewDC )
NewDC = DC_HandleToPtr( hNewDC ); NewDC = DC_HandleToPtr( hNewDC );
} }
else { else
{
/* Allocate a new DC based on the original DC's device */ /* Allocate a new DC based on the original DC's device */
hNewDC = DC_AllocDC(OrigDC->DriverName); hNewDC = DC_AllocDC(OrigDC->DriverName);
if( hNewDC ) if( hNewDC )
@ -152,8 +148,11 @@ W32kCreateCompatableDC(HDC hDC)
NewDC->hSelf = NewDC; NewDC->hSelf = NewDC;
/* FIXME: Should this DC request its own PDEV? */ /* FIXME: Should this DC request its own PDEV? */
if(OrigDC == NULL) { if(OrigDC == NULL)
} else { {
}
else
{
NewDC->PDev = OrigDC->PDev; NewDC->PDev = OrigDC->PDev;
NewDC->DMW = OrigDC->DMW; NewDC->DMW = OrigDC->DMW;
memcpy(NewDC->FillPatternSurfaces, memcpy(NewDC->FillPatternSurfaces,
@ -164,9 +163,12 @@ W32kCreateCompatableDC(HDC hDC)
} }
/* DriverName is copied in the AllocDC routine */ /* DriverName is copied in the AllocDC routine */
if(OrigDC == NULL) { if(OrigDC == NULL)
{
NewDC->DeviceDriver = DRIVER_FindMPDriver(NewDC->DriverName); NewDC->DeviceDriver = DRIVER_FindMPDriver(NewDC->DriverName);
} else { }
else
{
NewDC->DeviceDriver = OrigDC->DeviceDriver; NewDC->DeviceDriver = OrigDC->DeviceDriver;
NewDC->wndOrgX = OrigDC->wndOrgX; NewDC->wndOrgX = OrigDC->wndOrgX;
NewDC->wndOrgY = OrigDC->wndOrgY; NewDC->wndOrgY = OrigDC->wndOrgY;