https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b751c31c74507699e1e3d…
commit b751c31c74507699e1e3d8d4788d09ed11457783
Author: James Tabor <james.tabor(a)reactos.org>
AuthorDate: Wed May 1 20:33:09 2019 -0500
Commit: James Tabor <james.tabor(a)reactos.org>
CommitDate: Wed May 1 20:33:09 2019 -0500
[GDI32] Update signal flags for batch.
Add removed flags for batch signaling. This will allow syncing of
changed Xfroms after batched drawing. Disable calls to kernel mode since
the code is closely identical. Kernel calls are for init time when
PDCATTR is normally zero. ReactOS seems to work better keeping this from
NULL.
While making code changes add Xform state flags from:
https://www.reactos.org/archives/public/ros-diffs/2019-May/070693.html
Test BOT results:
https://reactos.org/testman/compare.php?ids=67251,67254
https://reactos.org/testman/compare.php?ids=67253,67255
---
win32ss/gdi/gdi32/objects/coord.c | 62 +++++++++++++++++-------------------
win32ss/gdi/gdi32/objects/dc.c | 4 +--
win32ss/gdi/gdi32/objects/font.c | 25 ++++-----------
win32ss/gdi/gdi32/objects/painting.c | 2 ++
win32ss/gdi/gdi32/objects/text.c | 1 +
5 files changed, 40 insertions(+), 54 deletions(-)
diff --git a/win32ss/gdi/gdi32/objects/coord.c b/win32ss/gdi/gdi32/objects/coord.c
index a42fa1236b..f405490d84 100644
--- a/win32ss/gdi/gdi32/objects/coord.c
+++ b/win32ss/gdi/gdi32/objects/coord.c
@@ -279,7 +279,6 @@ GetWorldTransform(
_In_ HDC hdc,
_Out_ LPXFORM pxform)
{
-#if 0
PDC_ATTR pdcattr;
pdcattr = GdiGetDcAttr(hdc);
@@ -288,7 +287,7 @@ GetWorldTransform(
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
-
+#if 0
if (pdcattr->flXform & ANY_XFORM_INVALID)
{
GdiFixupTransforms(pdcattr);
@@ -503,10 +502,10 @@ SetViewportExtEx(
{
if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
{
- if (pdcattr->ulDirty_ & DC_FONTTEXT_DIRTY)
+ if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
{
NtGdiFlush(); // Sync up pdcattr from Kernel space.
- pdcattr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY);
+ pdcattr->ulDirty_ &= ~DC_MODE_DIRTY;
}
}
@@ -519,8 +518,7 @@ SetViewportExtEx(
NtGdiMirrorWindowOrg(hdc);
/* Update xform flags */
- pdcattr->flXform |= (PAGE_EXTENTS_CHANGED | INVALIDATE_ATTRIBUTES |
- DEVICE_TO_WORLD_INVALID);
+ pdcattr->flXform |=
(PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID);
}
return TRUE;
@@ -548,7 +546,7 @@ SetWindowOrgEx(
/* Do not set LastError here! */
return FALSE;
}
-#if 0
+
if (lpPoint)
{
lpPoint->x = pdcattr->ptlWindowOrg.x;
@@ -558,23 +556,24 @@ SetWindowOrgEx(
if ((pdcattr->ptlWindowOrg.x == X) && (pdcattr->ptlWindowOrg.y == Y))
return TRUE;
- if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc)
+ if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
{
- if (pdcattr->ulDirty_ & DC_FONTTEXT_DIRTY)
+ if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
{
NtGdiFlush(); // Sync up pdcattr from Kernel space.
- pdcattr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY);
+ pdcattr->ulDirty_ &= ~DC_MODE_DIRTY;
}
}
pdcattr->ptlWindowOrg.x = X;
- pdcattr->lWindowOrgx = X;
pdcattr->ptlWindowOrg.y = Y;
+
+ pdcattr->lWindowOrgx = X;
if (pdcattr->dwLayout & LAYOUT_RTL) NtGdiMirrorWindowOrg(hdc);
- pdcattr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID);
+ pdcattr->flXform |=
(PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
return TRUE;
-#endif
- return NtGdiSetWindowOrgEx(hdc, X, Y, lpPoint);
+
+// return NtGdiSetWindowOrgEx(hdc, X, Y, lpPoint);
}
/*
@@ -630,10 +629,10 @@ SetWindowExtEx(
if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
{
- if (pdcattr->ulDirty_ & DC_FONTTEXT_DIRTY)
+ if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
{
NtGdiFlush(); // Sync up Dc_Attr from Kernel space.
- pdcattr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY);
+ pdcattr->ulDirty_ &= ~DC_MODE_DIRTY;
}
}
@@ -671,20 +670,19 @@ SetViewportOrgEx(
return FALSE;
}
-#if 0
if (lpPoint)
{
lpPoint->x = pdcattr->ptlViewportOrg.x;
lpPoint->y = pdcattr->ptlViewportOrg.y;
if (pdcattr->dwLayout & LAYOUT_RTL) lpPoint->x = -lpPoint->x;
}
- pdcattr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID);
+ pdcattr->flXform |=
(PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
if (pdcattr->dwLayout & LAYOUT_RTL) X = -X;
pdcattr->ptlViewportOrg.x = X;
pdcattr->ptlViewportOrg.y = Y;
return TRUE;
-#endif
- return NtGdiSetViewportOrgEx(hdc,X,Y,lpPoint);
+
+// return NtGdiSetViewportOrgEx(hdc,X,Y,lpPoint);
}
/*
@@ -854,10 +852,9 @@ OffsetViewportOrgEx(
_In_ int nYOffset,
_Out_opt_ LPPOINT lpPoint)
{
- //PDC_ATTR pdcattr;
+ PDC_ATTR pdcattr;
HANDLE_METADC(BOOL, OffsetViewportOrgEx, FALSE, hdc, nXOffset, nYOffset, lpPoint);
-#if 0
/* Get the DC attribute */
pdcattr = GdiGetDcAttr(hdc);
@@ -875,7 +872,7 @@ OffsetViewportOrgEx(
if ( nXOffset || nYOffset != nXOffset )
{
- if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc)
+ if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
{
if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
{
@@ -884,14 +881,14 @@ OffsetViewportOrgEx(
}
}
- pdcattr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID);
+ pdcattr->flXform |=
(PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
if (pdcattr->dwLayout & LAYOUT_RTL) nXOffset = -nXOffset;
pdcattr->ptlViewportOrg.x += nXOffset;
pdcattr->ptlViewportOrg.y += nYOffset;
}
return TRUE;
-#endif
- return NtGdiOffsetViewportOrgEx(hdc, nXOffset, nYOffset, lpPoint);
+
+// return NtGdiOffsetViewportOrgEx(hdc, nXOffset, nYOffset, lpPoint);
}
/*
@@ -906,11 +903,10 @@ OffsetWindowOrgEx(
_In_ int nYOffset,
_Out_opt_ LPPOINT lpPoint)
{
- //PDC_ATTR pdcattr;
+ PDC_ATTR pdcattr;
HANDLE_METADC(BOOL, OffsetWindowOrgEx, FALSE, hdc, nXOffset, nYOffset, lpPoint);
-#if 0
/* Get the DC attribute */
pdcattr = GdiGetDcAttr(hdc);
if (!pdcattr)
@@ -922,12 +918,12 @@ OffsetWindowOrgEx(
if ( lpPoint )
{
*lpPoint = (POINT)pdcattr->ptlWindowOrg;
- lpPoint->x = pdcattr->lWindowOrgx;
+ //lpPoint->x = pdcattr->lWindowOrgx;
}
if ( nXOffset || nYOffset != nXOffset )
{
- if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc)
+ if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
{
if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
{
@@ -936,13 +932,13 @@ OffsetWindowOrgEx(
}
}
- pdcattr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID);
+ pdcattr->flXform |=
(PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
pdcattr->ptlWindowOrg.x += nXOffset;
pdcattr->ptlWindowOrg.y += nYOffset;
pdcattr->lWindowOrgx += nXOffset;
}
return TRUE;
-#endif
- return NtGdiOffsetWindowOrgEx(hdc, nXOffset, nYOffset, lpPoint);
+
+// return NtGdiOffsetWindowOrgEx(hdc, nXOffset, nYOffset, lpPoint);
}
diff --git a/win32ss/gdi/gdi32/objects/dc.c b/win32ss/gdi/gdi32/objects/dc.c
index 7ea146ab20..716e42ee51 100644
--- a/win32ss/gdi/gdi32/objects/dc.c
+++ b/win32ss/gdi/gdi32/objects/dc.c
@@ -1162,7 +1162,7 @@ SetPolyFillMode(
if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
{
NtGdiFlush(); // Sync up pdcattr from Kernel space.
- pdcattr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY);
+ pdcattr->ulDirty_ &= ~DC_MODE_DIRTY;
}
}
@@ -1230,7 +1230,7 @@ SetGraphicsMode(
if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
{
NtGdiFlush(); // Sync up pdcattr from Kernel space.
- pdcattr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY);
+ pdcattr->ulDirty_ &= ~DC_MODE_DIRTY;
}
}
diff --git a/win32ss/gdi/gdi32/objects/font.c b/win32ss/gdi/gdi32/objects/font.c
index 8789223183..0d88defc57 100644
--- a/win32ss/gdi/gdi32/objects/font.c
+++ b/win32ss/gdi/gdi32/objects/font.c
@@ -2239,27 +2239,14 @@ SetMapperFlags(
{
DWORD Ret = GDI_ERROR;
PDC_ATTR Dc_Attr;
-#if 0
- if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
+
+ /* Get the DC attribute */
+ Dc_Attr = GdiGetDcAttr(hDC);
+ if (Dc_Attr == NULL)
{
- if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
- return MFDRV_SetMapperFlags( hDC, flags);
- else
- {
- PLDC pLDC = Dc_Attr->pvLDC;
- if ( !pLDC )
- {
- SetLastError(ERROR_INVALID_HANDLE);
- return GDI_ERROR;
- }
- if (pLDC->iType == LDC_EMFLDC)
- {
- return EMFDRV_SetMapperFlags( hDC, flags);
- }
- }
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return GDI_ERROR;
}
-#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return GDI_ERROR;
if (NtCurrentTeb()->GdiTebBatch.HDC == hDC)
{
diff --git a/win32ss/gdi/gdi32/objects/painting.c b/win32ss/gdi/gdi32/objects/painting.c
index 8fc0d645c3..f41e7a78ab 100644
--- a/win32ss/gdi/gdi32/objects/painting.c
+++ b/win32ss/gdi/gdi32/objects/painting.c
@@ -469,6 +469,7 @@ PatBlt(
pgO = GdiAllocBatchCommand(hdc, GdiBCPatBlt);
if (pgO)
{
+ pdcattr->ulDirty_ |= DC_MODE_DIRTY;
pgO->nXLeft = nXLeft;
pgO->nYLeft = nYLeft;
pgO->nWidth = nWidth;
@@ -553,6 +554,7 @@ PolyPatBlt(
if ((pTeb->GdiTebBatch.Offset + cjSize) <= GDIBATCHBUFSIZE)
{
+ pdcattr->ulDirty_ |= DC_MODE_DIRTY;
pgO->Count = nCount;
pgO->Mode = dwMode;
pgO->rop4 = dwRop;
diff --git a/win32ss/gdi/gdi32/objects/text.c b/win32ss/gdi/gdi32/objects/text.c
index e35c7c99e8..ab86a51f11 100644
--- a/win32ss/gdi/gdi32/objects/text.c
+++ b/win32ss/gdi/gdi32/objects/text.c
@@ -526,6 +526,7 @@ ExtTextOutW(
pgO = GdiAllocBatchCommand(hdc, GdiBCExtTextOut);
if (pgO)
{
+ pdcattr->ulDirty_ |= DC_MODE_DIRTY;
pgO->Count = cwc;
pgO->Rect = *lprc;
pgO->Options = fuOptions;