gdi32: Replace remaining instance of DC_GetDCUpdate by get_dc_ptr+update_dc.
This commit is contained in:
parent
baa8d22543
commit
99a258311c
|
@ -177,32 +177,6 @@ DC *DC_GetDCPtr( HDC hdc )
|
|||
return dc;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DC_GetDCUpdate
|
||||
*
|
||||
* Retrieve a DC ptr while making sure the visRgn is updated.
|
||||
* This function may call up to USER so the GDI lock should _not_
|
||||
* be held when calling it.
|
||||
*/
|
||||
DC *DC_GetDCUpdate( HDC hdc )
|
||||
{
|
||||
DC *dc = DC_GetDCPtr( hdc );
|
||||
if (!dc) return NULL;
|
||||
while (InterlockedExchange( &dc->dirty, 0 ))
|
||||
{
|
||||
DCHOOKPROC proc = dc->hookThunk;
|
||||
if (proc)
|
||||
{
|
||||
DWORD_PTR data = dc->dwHookData;
|
||||
DC_ReleaseDCPtr( dc );
|
||||
proc( hdc, DCHC_INVALIDVISRGN, data, 0 );
|
||||
if (!(dc = DC_GetDCPtr( hdc ))) break;
|
||||
/* otherwise restart the loop in case it became dirty again in the meantime */
|
||||
}
|
||||
}
|
||||
return dc;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DC_ReleaseDCPtr
|
||||
|
@ -488,20 +462,21 @@ void WINAPI SetDCState( HDC hdc, HDC hdcs )
|
|||
{
|
||||
DC *dc, *dcs;
|
||||
|
||||
if (!(dc = DC_GetDCUpdate( hdc ))) return;
|
||||
if (!(dcs = DC_GetDCPtr( hdcs )))
|
||||
if (!(dc = get_dc_ptr( hdc ))) return;
|
||||
if (!(dcs = get_dc_ptr( hdcs )))
|
||||
{
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
return;
|
||||
}
|
||||
if (!dcs->flags & DC_SAVED)
|
||||
{
|
||||
DC_ReleaseDCPtr( dc );
|
||||
DC_ReleaseDCPtr( dcs );
|
||||
release_dc_ptr( dc );
|
||||
release_dc_ptr( dcs );
|
||||
return;
|
||||
}
|
||||
TRACE("%p %p\n", hdc, hdcs );
|
||||
|
||||
update_dc( dc );
|
||||
dc->flags = dcs->flags & ~DC_SAVED;
|
||||
dc->layout = dcs->layout;
|
||||
dc->hDevice = dcs->hDevice;
|
||||
|
@ -569,8 +544,8 @@ void WINAPI SetDCState( HDC hdc, HDC hdcs )
|
|||
SetBkColor( hdc, dcs->backgroundColor);
|
||||
SetTextColor( hdc, dcs->textColor);
|
||||
GDISelectPalette( hdc, dcs->hPalette, FALSE );
|
||||
DC_ReleaseDCPtr( dcs );
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
release_dc_ptr( dcs );
|
||||
}
|
||||
|
||||
|
||||
|
@ -653,22 +628,23 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level )
|
|||
BOOL success;
|
||||
|
||||
TRACE("%p %d\n", hdc, level );
|
||||
dc = DC_GetDCUpdate( hdc );
|
||||
if(!dc) return FALSE;
|
||||
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
|
||||
|
||||
if(abs(level) > dc->saveLevel || level == 0)
|
||||
{
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
update_dc( dc );
|
||||
|
||||
if(dc->funcs->pRestoreDC)
|
||||
{
|
||||
success = dc->funcs->pRestoreDC( dc->physDev, level );
|
||||
if(level < 0) level = dc->saveLevel + level + 1;
|
||||
if(success)
|
||||
dc->saveLevel = level - 1;
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -677,10 +653,10 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level )
|
|||
while (dc->saveLevel >= level)
|
||||
{
|
||||
HDC hdcs = dc->saved_dc;
|
||||
if (!(dcs = DC_GetDCPtr( hdcs )))
|
||||
if (!(dcs = get_dc_ptr( hdcs )))
|
||||
{
|
||||
DC_ReleaseDCPtr( dc );
|
||||
return FALSE;
|
||||
success = FALSE;
|
||||
break;
|
||||
}
|
||||
dc->saved_dc = dcs->saved_dc;
|
||||
dcs->saved_dc = 0;
|
||||
|
@ -692,12 +668,10 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level )
|
|||
* returning FALSE but still destroying the saved DC state */
|
||||
success=FALSE;
|
||||
}
|
||||
DC_ReleaseDCPtr( dcs );
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dcs );
|
||||
DeleteDC( hdcs );
|
||||
if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
|
||||
}
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
@ -1879,7 +1879,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
|
|||
BOOL done_extents = FALSE;
|
||||
INT width = 0, xwidth = 0, ywidth = 0;
|
||||
DWORD type;
|
||||
DC * dc = DC_GetDCUpdate( hdc );
|
||||
DC * dc = get_dc_ptr( hdc );
|
||||
INT breakRem;
|
||||
|
||||
if (!dc) return FALSE;
|
||||
|
@ -1891,15 +1891,16 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
|
|||
|
||||
if (!dc->funcs->pExtTextOut && !PATH_IsPathOpen(dc->path))
|
||||
{
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
return ret;
|
||||
}
|
||||
|
||||
update_dc( dc );
|
||||
type = GetObjectType(hdc);
|
||||
if(type == OBJ_METADC || type == OBJ_ENHMETADC)
|
||||
{
|
||||
ret = dc->funcs->pExtTextOut(dc->physDev, x, y, flags, lprect, str, count, lpDx);
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2198,7 +2199,7 @@ done:
|
|||
if(reordered_str != str)
|
||||
HeapFree(GetProcessHeap(), 0, reordered_str);
|
||||
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
|
||||
if (ret && (lf.lfUnderline || lf.lfStrikeOut))
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ static DC* OPENGL_GetDefaultDC(void)
|
|||
if(!default_hdc)
|
||||
default_hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
|
||||
|
||||
return DC_GetDCPtr(default_hdc);
|
||||
return get_dc_ptr(default_hdc);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -169,16 +169,17 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
|
|||
if(hglrc == NULL)
|
||||
dc = OPENGL_GetDefaultDC();
|
||||
else
|
||||
dc = DC_GetDCUpdate( hdc );
|
||||
dc = get_dc_ptr( hdc );
|
||||
|
||||
TRACE("hdc: (%p), hglrc: (%p)\n", hdc, hglrc);
|
||||
|
||||
if (!dc) return FALSE;
|
||||
|
||||
update_dc( dc );
|
||||
if (!dc->funcs->pwglMakeCurrent) FIXME(" :stub\n");
|
||||
else ret = dc->funcs->pwglMakeCurrent(dc->physDev,hglrc);
|
||||
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -294,7 +295,7 @@ PROC WINAPI wglGetProcAddress(LPCSTR func)
|
|||
if (!dc->funcs->pwglGetProcAddress) FIXME(" :stub\n");
|
||||
else ret = dc->funcs->pwglGetProcAddress(func);
|
||||
|
||||
DC_ReleaseDCPtr( dc );
|
||||
release_dc_ptr( dc );
|
||||
|
||||
/* At the moment we implement one WGL extension which requires a HDC. When we
|
||||
* are looking up this call and when the Extension is available (that is the case
|
||||
|
|
Loading…
Reference in New Issue