Implement NtGdiGetBoundsRect and NtGdiSetBoundsRect. Patch by Samuel Serapion with modifications by me.

svn path=/trunk/; revision=50280
This commit is contained in:
Timo Kreuzer 2011-01-04 12:36:19 +00:00
parent 391de4dea7
commit c855b45934
2 changed files with 90 additions and 25 deletions

View file

@ -1057,7 +1057,7 @@ NtGdiSetVirtualResolution(
cxVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, HORZSIZE);
cyVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, VERTSIZE);
}
else if (cxVirtualDevicePixel == 0 || cyVirtualDevicePixel == 0 ||
else if (cxVirtualDevicePixel == 0 || cyVirtualDevicePixel == 0 ||
cxVirtualDeviceMm == 0 || cyVirtualDeviceMm == 0)
{
return FALSE;
@ -1322,28 +1322,4 @@ NtGdiGetDCPoint(
return Ret;
}
DWORD
APIENTRY
NtGdiGetBoundsRect(
IN HDC hdc,
OUT LPRECT prc,
IN DWORD f)
{
DPRINT1("stub\n");
return DCB_RESET; /* bounding rectangle always empty */
}
DWORD
APIENTRY
NtGdiSetBoundsRect(
IN HDC hdc,
IN LPRECT prc,
IN DWORD f)
{
DPRINT1("stub\n");
return DCB_DISABLE; /* bounding rectangle always empty */
}
/* EOF */

View file

@ -464,3 +464,92 @@ NtGdiGetAndSetDCDword(
DC_UnlockDc(pdc);
return Ret;
}
DWORD
APIENTRY
NtGdiGetBoundsRect(
IN HDC hdc,
OUT LPRECT prc,
IN DWORD flags)
{
DWORD ret;
PDC pdc;
/* Lock the DC */
if (!(pdc = DC_LockDc(hdc))) return 0;
/* Get the return value */
ret = pdc->fs & DC_ACCUM_APP ? DCB_ENABLE : DCB_DISABLE;
ret |= RECTL_bIsEmptyRect(&pdc->erclBoundsApp) ? DCB_RESET : DCB_SET;
/* Copy the rect to the caller */
_SEH2_TRY
{
ProbeForWrite(prc, sizeof(RECT), 1);
*prc = pdc->erclBoundsApp;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ret = 0;
}
_SEH2_END;
if (flags & DCB_RESET)
{
RECTL_vSetEmptyRect(&pdc->erclBoundsApp);
}
DC_UnlockDc(pdc);
return ret;
}
DWORD
APIENTRY
NtGdiSetBoundsRect(
IN HDC hdc,
IN LPRECT prc,
IN DWORD flags)
{
DWORD ret;
PDC pdc;
RECTL rcl;
/* Verify arguments */
if ((flags & DCB_ENABLE) && (flags & DCB_DISABLE)) return 0;
/* Lock the DC */
if (!(pdc = DC_LockDc(hdc))) return 0;
/* Get the return value */
ret = pdc->fs & DC_ACCUM_APP ? DCB_ENABLE : DCB_DISABLE;
ret |= RECTL_bIsEmptyRect(&pdc->erclBoundsApp) ? DCB_RESET : DCB_SET;
if (flags & DCB_RESET)
{
RECTL_vSetEmptyRect(&pdc->erclBoundsApp);
}
if (flags & DCB_ACCUMULATE)
{
/* Capture the rect */
_SEH2_TRY
{
ProbeForRead(prc, sizeof(RECT), 1);
rcl = *prc;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
_SEH2_YIELD(return 0;)
}
_SEH2_END;
RECTL_vMakeWellOrdered(&rcl);
RECTL_bUnionRect(&pdc->erclBoundsApp, &pdc->erclBoundsApp, &rcl);
}
if (flags & DCB_ENABLE) pdc->fs |= DC_ACCUM_APP;
if (flags & DCB_DISABLE) pdc->fs &= ~DC_ACCUM_APP;
DC_UnlockDc( pdc );
return ret;
}