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
* *
@ -76,34 +76,29 @@ func_type STDCALL func_name( HDC hdc ) \
*/ */
#define DC_GET_VAL_EX( func_name, ret_x, ret_y, type ) \ #define DC_GET_VAL_EX( func_name, ret_x, ret_y, type ) \
BOOL STDCALL func_name( HDC hdc, LP##type pt ) \ 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)->y = dc->ret_y; \
((LPPOINT)pt)->x = dc->ret_x; \ DC_ReleasePtr ( hdc ); \
((LPPOINT)pt)->y = dc->ret_y; \ return TRUE; \
DC_ReleasePtr( hdc ); \
return TRUE; \
} }
#define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \ #define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \
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 ); \
return prevMode; \ return prevMode; \
} }
@ -133,14 +128,15 @@ W32kCreateCompatableDC(HDC hDC)
if (OrigDC == NULL) if (OrigDC == NULL)
{ {
hNewDC = DC_AllocDC(L"DISPLAY"); hNewDC = DC_AllocDC(L"DISPLAY");
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 )
NewDC = DC_HandleToPtr( hNewDC ); NewDC = DC_HandleToPtr( hNewDC );
} }
if (NewDC == NULL) if (NewDC == NULL)
@ -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;