[NtGDI] Adding Support for Viewport TextOut
authorjimtabor <james.tabor@reactos.org>
Thu, 2 May 2019 15:11:11 +0000 (10:11 -0500)
committerjimtabor <james.tabor@reactos.org>
Thu, 2 May 2019 15:11:11 +0000 (10:11 -0500)
Add Viewport changes to Text Out Batch.

win32ss/gdi/ntgdi/gdibatch.c

index 13d6ad9..d292e2e 100644 (file)
@@ -246,12 +246,13 @@ GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
         PGDIBSTEXTOUT pgO;
         COLORREF crColor = -1, crBkColor;
         ULONG ulForegroundClr, ulBackgroundClr;
-        DWORD flags = 0, saveflags;
+        DWORD flags = 0, flXform = 0, saveflags, saveflXform = 0;
         FLONG flTextAlign = -1;
         HANDLE hlfntNew;
         PRECTL lprc;
         USHORT jBkMode;
         LONG lBkMode;
+        POINTL ptlViewportOrg;
         if (!dc) break;
         pgO = (PGDIBSTEXTOUT) pHdr;
 
@@ -288,6 +289,15 @@ GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
             flags |= DIRTY_CHARSET;
         }
 
+        if ( dc->pdcattr->ptlViewportOrg.x != pgO->ptlViewportOrg.x ||
+             dc->pdcattr->ptlViewportOrg.y != pgO->ptlViewportOrg.y )
+        {
+            saveflXform = dc->pdcattr->flXform & (PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
+            ptlViewportOrg = dc->pdcattr->ptlViewportOrg;
+            dc->pdcattr->ptlViewportOrg = pgO->ptlViewportOrg;
+            flXform = (PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
+        }
+
         dc->pdcattr->ulDirty_ |= flags;
 
         jBkMode = dc->pdcattr->jBkMode;
@@ -312,6 +322,12 @@ GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
         dc->pdcattr->jBkMode = jBkMode;
         dc->pdcattr->lBkMode = lBkMode;
 
+        if (saveflXform)
+        {
+            dc->pdcattr->ptlViewportOrg = ptlViewportOrg;
+            dc->pdcattr->flXform |= saveflXform|flXform;
+        }
+
         if (flags & DIRTY_TEXT && crColor != -1)
         {
             dc->pdcattr->crForegroundClr = crColor;
@@ -341,7 +357,8 @@ GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
         PGDIBSEXTTEXTOUT pgO;
         COLORREF crBkColor;
         ULONG ulBackgroundClr;
-        DWORD flags = 0, saveflags;
+        POINTL ptlViewportOrg;
+        DWORD flags = 0, flXform = 0, saveflags, saveflXform = 0;
         if (!dc) break;
         pgO = (PGDIBSEXTTEXTOUT) pHdr;
 
@@ -356,6 +373,15 @@ GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
             flags |= (DIRTY_BACKGROUND|DIRTY_LINE|DIRTY_FILL);
         }
 
+        if ( dc->pdcattr->ptlViewportOrg.x != pgO->ptlViewportOrg.x ||
+             dc->pdcattr->ptlViewportOrg.y != pgO->ptlViewportOrg.y )
+        {
+            saveflXform = dc->pdcattr->flXform & (PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
+            ptlViewportOrg = dc->pdcattr->ptlViewportOrg;
+            dc->pdcattr->ptlViewportOrg = pgO->ptlViewportOrg;
+            flXform = (PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
+        }
+
         dc->pdcattr->ulDirty_ |= flags;
 
         IntExtTextOutW( dc,
@@ -368,6 +394,12 @@ GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
                         NULL,
                         0 );
 
+        if (saveflXform)
+        {
+            dc->pdcattr->ptlViewportOrg = ptlViewportOrg;
+            dc->pdcattr->flXform |= saveflXform|flXform;
+        }
+
         if (flags & DIRTY_BACKGROUND)
         {
             dc->pdcattr->crBackgroundClr = crBkColor;