From 5e9d1bc6289d099b2bda12568cf4ed90a0551603 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sun, 14 May 2017 01:00:27 +0000 Subject: [PATCH] [NtGDI] - Implement internal functions for setting and retrieving DC origin. Related to CORE-13110. - Code fix ups. svn path=/trunk/; revision=74543 --- reactos/win32ss/gdi/ntgdi/coord.c | 50 ++++++++++++++++++++++++++++++ reactos/win32ss/gdi/ntgdi/coord.h | 2 ++ reactos/win32ss/gdi/ntgdi/dcutil.c | 4 +-- 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/coord.c b/reactos/win32ss/gdi/ntgdi/coord.c index 2200aaea5bc..8d7be4e26c0 100644 --- a/reactos/win32ss/gdi/ntgdi/coord.c +++ b/reactos/win32ss/gdi/ntgdi/coord.c @@ -1335,6 +1335,56 @@ GreGetDCPoint( return Ret; } +BOOL +WINAPI +GreSetDCOrg( + _In_ HDC hdc, + _In_ LONG x, + _In_ LONG y, + _In_opt_ PRECTL Rect) +{ + PDC dc; + + dc = DC_LockDc(hdc); + if (!dc) return FALSE; + + /* Set DC Origin */ + dc->ptlDCOrig.x = x; + dc->ptlDCOrig.y = y; + + /* Recalculate Fill Origin */ + dc->ptlFillOrigin.x = dc->dclevel.ptlBrushOrigin.x + x; + dc->ptlFillOrigin.y = dc->dclevel.ptlBrushOrigin.y + y; + + /* Set DC Window Rectangle */ + if (Rect) + dc->erclWindow = *Rect; + + DC_UnlockDc(dc); + return TRUE; +} + +BOOL +WINAPI +GreGetDCOrgEx( + _In_ HDC hdc, + _Out_ PPOINTL Point, + _Out_ PRECTL Rect) +{ + PDC dc; + + dc = DC_LockDc(hdc); + if (!dc) return FALSE; + + /* Retrieve DC Window Rectangle without a check */ + *Rect = dc->erclWindow; + + DC_UnlockDc(dc); + + /* Use default call for DC Origin and parameter checking */ + return GreGetDCPoint( hdc, GdiGetDCOrg, Point); +} + BOOL WINAPI GreGetWindowExtEx( diff --git a/reactos/win32ss/gdi/ntgdi/coord.h b/reactos/win32ss/gdi/ntgdi/coord.h index 2a2861ba6e3..9993ef527ae 100644 --- a/reactos/win32ss/gdi/ntgdi/coord.h +++ b/reactos/win32ss/gdi/ntgdi/coord.h @@ -166,3 +166,5 @@ BOOL APIENTRY GreGetDCPoint(HDC,UINT,PPOINTL); BOOL WINAPI GreGetWindowExtEx( _In_ HDC hdc, _Out_ LPSIZE lpSize); BOOL WINAPI GreGetViewportExtEx( _In_ HDC hdc, _Out_ LPSIZE lpSize); BOOL FASTCALL GreSetViewportOrgEx(HDC,int,int,LPPOINT); +BOOL WINAPI GreGetDCOrgEx(_In_ HDC, _Out_ PPOINTL, _Out_ PRECTL); +BOOL WINAPI GreSetDCOrg(_In_ HDC, _In_ LONG, _In_ LONG, _In_opt_ PRECTL); diff --git a/reactos/win32ss/gdi/ntgdi/dcutil.c b/reactos/win32ss/gdi/ntgdi/dcutil.c index 26016882437..818eae7a10d 100644 --- a/reactos/win32ss/gdi/ntgdi/dcutil.c +++ b/reactos/win32ss/gdi/ntgdi/dcutil.c @@ -396,8 +396,8 @@ IntSetDefaultRegion(PDC pdc) pdc->erclWindow = rclWnd; pdc->erclClip = rclClip; /* Might be an InitDC or DCE... */ - pdc->ptlFillOrigin.x = pdc->dcattr.VisRectRegion.Rect.right; - pdc->ptlFillOrigin.y = pdc->dcattr.VisRectRegion.Rect.bottom; + pdc->ptlFillOrigin.x = pdc->dcattr.ptlBrushOrigin.x; + pdc->ptlFillOrigin.y = pdc->dcattr.ptlBrushOrigin.y; return TRUE; } -- 2.17.1