https://git.reactos.org/?p=reactos.git;a=commitdiff;h=06bd04061437fc54095e93ec794856110b9e461a

commit 06bd04061437fc54095e93ec794856110b9e461a
Author:     winesync <[email protected]>
AuthorDate: Tue Jan 5 13:16:38 2021 +0100
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:07 2021 +0100

    [WINESYNC] d3dx9: Implement clipping of glyphs in ID3DXFont_DrawText.
    
    Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49546
    Signed-off-by: Sven Baars <[email protected]>
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 84cbf6a49dfe75b9fd497b2c3ef7e922857bb618 by Sven Baars 
<[email protected]>
---
 dll/directx/wine/d3dx9_36/font.c | 16 +++++++++++++++-
 sdk/tools/winesync/d3dx9.cfg     |  2 +-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c
index 56cef145461..14300d32e5e 100644
--- a/dll/directx/wine/d3dx9_36/font.c
+++ b/dll/directx/wine/d3dx9_36/font.c
@@ -587,7 +587,6 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, 
unsigned int *count,
         }
         else if (format & DT_SINGLELINE)
         {
-            *dest_len = num_fit;
             *count = 0;
         }
     }
@@ -772,6 +771,21 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont 
*iface, ID3DXSprite *sprite,
             pos.y = cell_inc.y + y;
             pos.z = 0;
 
+            if (!(format & DT_NOCLIP))
+            {
+                if (pos.x > rect->right)
+                {
+                    IDirect3DTexture9_Release(texture);
+                    continue;
+                }
+
+                if (pos.x + black_box.right - black_box.left > rect->right)
+                    black_box.right = black_box.left + rect->right - pos.x;
+
+                if (pos.y + black_box.bottom - black_box.top > rect->bottom)
+                    black_box.bottom = black_box.top + rect->bottom - pos.y;
+            }
+
             ID3DXSprite_Draw(target, texture, &black_box, NULL, &pos, color);
             IDirect3DTexture9_Release(texture);
         }
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 47c8d9b9134..9c4e5a95eb4 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -34,4 +34,4 @@ files:
   include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h
   include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h
 tags:
-  wine: 2481e617bbd529a297266ad53b1afe1d96e9af89
+  wine: 84cbf6a49dfe75b9fd497b2c3ef7e922857bb618

Reply via email to