[NtGDI]
authorJames Tabor <james.tabor@reactos.org>
Sun, 14 May 2017 01:00:27 +0000 (01:00 +0000)
committerJames Tabor <james.tabor@reactos.org>
Sun, 14 May 2017 01:00:27 +0000 (01:00 +0000)
- 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
reactos/win32ss/gdi/ntgdi/coord.h
reactos/win32ss/gdi/ntgdi/dcutil.c

index 2200aae..8d7be4e 100644 (file)
@@ -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(
index 2a2861b..9993ef5 100644 (file)
@@ -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);
index 2601688..818eae7 100644 (file)
@@ -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;
     }