Jacek Caban : gdi32: Use NtGdiGetCharABCWidthsW for GetCharABCWidthsW.

Alexandre Julliard julliard at winehq.org
Fri Aug 27 15:03:34 CDT 2021


Module: wine
Branch: master
Commit: b656ff5d75a83e7db0401ed231247331ee03c260
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b656ff5d75a83e7db0401ed231247331ee03c260

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Aug 27 13:51:48 2021 +0100

gdi32: Use NtGdiGetCharABCWidthsW for GetCharABCWidthsW.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/font.c | 15 ++++++---------
 dlls/gdi32/text.c |  8 ++++++++
 include/ntgdi.h   |  6 +++++-
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index e80143066b5..261f2389285 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -5648,7 +5648,7 @@ BOOL WINAPI GetCharABCWidthsA(HDC hdc, UINT firstChar, UINT lastChar,
 
 
 /******************************************************************************
- * GetCharABCWidthsW [GDI32.@]
+ *           NtGdiGetCharABCWidthsW    (win32u.@)
  *
  * Retrieves widths of characters in range.
  *
@@ -5660,13 +5660,9 @@ BOOL WINAPI GetCharABCWidthsA(HDC hdc, UINT firstChar, UINT lastChar,
  *
  * NOTES
  *    Only works with TrueType fonts
- *
- * RETURNS
- *    Success: TRUE
- *    Failure: FALSE
  */
-BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
-                                   LPABC abc )
+BOOL WINAPI NtGdiGetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar, WCHAR *chars,
+                                    ULONG flags, void *buffer )
 {
     DC *dc = get_dc_ptr(hdc);
     PHYSDEV dev;
@@ -5676,7 +5672,7 @@ BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
 
     if (!dc) return FALSE;
 
-    if (!abc)
+    if (!buffer)
     {
         release_dc_ptr( dc );
         return FALSE;
@@ -5691,9 +5687,10 @@ BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
     }
 
     dev = GET_DC_PHYSDEV( dc, pGetCharABCWidths );
-    ret = dev->funcs->pGetCharABCWidths( dev, firstChar, lastChar, abc );
+    ret = dev->funcs->pGetCharABCWidths( dev, firstChar, lastChar, buffer );
     if (ret)
     {
+        ABC *abc = buffer;
         /* convert device units to logical */
         for( i = firstChar; i <= lastChar; i++, abc++ ) {
             abc->abcA = width_to_LP(dc, abc->abcA);
diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c
index c3d72938eba..5f1930cf4a5 100644
--- a/dlls/gdi32/text.c
+++ b/dlls/gdi32/text.c
@@ -1682,3 +1682,11 @@ BOOL WINAPI GetCharWidthI( HDC hdc, UINT first, UINT count, WORD *glyphs, INT *b
     return NtGdiGetCharWidthW( hdc, first, count, glyphs,
                                NTGDI_GETCHARWIDTH_INT | NTGDI_GETCHARWIDTH_INDICES, buffer );
 }
+
+/***********************************************************************
+ *           GetCharABCWidthsW    (GDI32.@)
+ */
+BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT first, UINT last, ABC *abc )
+{
+    return NtGdiGetCharABCWidthsW( hdc, first, last, NULL, NTGDI_GETCHARABCWIDTHS_INT, abc );
+}
diff --git a/include/ntgdi.h b/include/ntgdi.h
index 7d95c186c8f..39f478bd418 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -126,6 +126,9 @@ enum
 #define NTGDI_GETCHARWIDTH_INT      0x02
 #define NTGDI_GETCHARWIDTH_INDICES  0x08
 
+#define NTGDI_GETCHARABCWIDTHS_INT      0x01
+#define NTGDI_GETCHARABCWIDTHS_INDICES  0x02
+
 #define MWT_SET  4
 
 /* structs not compatible with native Windows */
@@ -229,7 +232,8 @@ BOOL     WINAPI NtGdiGetAndSetDCDword( HDC hdc, UINT method, DWORD value, DWORD
 INT      WINAPI NtGdiGetAppClipBox( HDC hdc, RECT *rect );
 BOOL     WINAPI NtGdiGetBitmapDimension( HBITMAP bitmap, SIZE *size );
 UINT     WINAPI NtGdiGetBoundsRect( HDC hdc, RECT *rect, UINT flags );
-BOOL     WINAPI NtGdiGetCharABCWidthsW( HDC hdc, UINT first_char, UINT last_char, ABC *abc );
+BOOL     WINAPI NtGdiGetCharABCWidthsW( HDC hdc, UINT first, UINT last, WCHAR *chars,
+                                        ULONG flags, void *buffer );
 BOOL     WINAPI NtGdiGetCharWidthW( HDC hdc, UINT first_char, UINT last_char, WCHAR *chars,
                                     ULONG flags, void *buffer );
 BOOL     WINAPI NtGdiGetDCDword( HDC hdc, UINT method, DWORD *result );




More information about the wine-cvs mailing list