[WIN32K]
[reactos.git] / reactos / subsystems / win32 / win32k / objects / coord.c
index 7310dcb..12cb42a 100644 (file)
@@ -886,41 +886,18 @@ IntMirrorWindowOrg(PDC dc)
     return;
 }
 
-// NtGdiSetLayout
-//
-// The default is left to right. This function changes it to right to left, which
-// is the standard in Arabic and Hebrew cultures.
-//
-/*
- * @implemented
- */
-DWORD
-APIENTRY
-NtGdiSetLayout(
-    IN HDC hdc,
+VOID
+NTAPI
+DC_vSetLayout(
+    IN PDC pdc,
     IN LONG wox,
     IN DWORD dwLayout)
 {
-    PDC dc;
-    PDC_ATTR pdcattr;
-    DWORD oLayout;
-
-    dc = DC_LockDc(hdc);
-    if (!dc)
-    {
-        SetLastWin32Error(ERROR_INVALID_HANDLE);
-        return GDI_ERROR;
-    }
-    pdcattr = dc->pdcattr;
+    PDC_ATTR pdcattr = pdc->pdcattr;
 
     pdcattr->dwLayout = dwLayout;
-    oLayout = pdcattr->dwLayout;
 
-    if (!(dwLayout & LAYOUT_ORIENTATIONMASK))
-    {
-        DC_UnlockDc(dc);
-        return oLayout;
-    }
+    if (!(dwLayout & LAYOUT_ORIENTATIONMASK)) return;
 
     if (dwLayout & LAYOUT_RTL)
     {
@@ -931,23 +908,55 @@ NtGdiSetLayout(
     pdcattr->ptlWindowOrg.x  = -pdcattr->ptlWindowOrg.x;
 
     if (wox == -1)
-        IntMirrorWindowOrg(dc);
+        IntMirrorWindowOrg(pdc);
     else
         pdcattr->ptlWindowOrg.x = wox - pdcattr->ptlWindowOrg.x;
 
     if (!(pdcattr->flTextAlign & TA_CENTER)) pdcattr->flTextAlign |= TA_RIGHT;
 
-    if (dc->dclevel.flPath & DCPATH_CLOCKWISE)
-        dc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
+    if (pdc->dclevel.flPath & DCPATH_CLOCKWISE)
+        pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
     else
-        dc->dclevel.flPath |= DCPATH_CLOCKWISE;
+        pdc->dclevel.flPath |= DCPATH_CLOCKWISE;
 
     pdcattr->flXform |= (PAGE_EXTENTS_CHANGED |
                          INVALIDATE_ATTRIBUTES |
                          DEVICE_TO_WORLD_INVALID);
 
-//  DC_UpdateXforms(dc);
-    DC_UnlockDc(dc);
+//  DC_UpdateXforms(pdc);
+}
+
+// NtGdiSetLayout
+//
+// The default is left to right. This function changes it to right to left, which
+// is the standard in Arabic and Hebrew cultures.
+//
+/*
+ * @implemented
+ */
+DWORD
+APIENTRY
+NtGdiSetLayout(
+    IN HDC hdc,
+    IN LONG wox,
+    IN DWORD dwLayout)
+{
+    PDC pdc;
+    PDC_ATTR pdcattr;
+    DWORD oLayout;
+
+    pdc = DC_LockDc(hdc);
+    if (!pdc)
+    {
+        SetLastWin32Error(ERROR_INVALID_HANDLE);
+        return GDI_ERROR;
+    }
+    pdcattr = pdc->pdcattr;
+
+    oLayout = pdcattr->dwLayout;
+    DC_vSetLayout(pdc, wox, dwLayout);
+
+    DC_UnlockDc(pdc);
     return oLayout;
 }