Jacek Caban : gdi32: Avoid calling gdi32 functions from ntgdi functions.

Alexandre Julliard julliard at winehq.org
Fri Sep 17 16:03:09 CDT 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Sep 17 13:44:30 2021 +0200

gdi32: Avoid calling gdi32 functions from ntgdi functions.

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/clipping.c |  8 ++++----
 dlls/gdi32/dib.c      |  4 ++--
 dlls/gdi32/driver.c   |  2 +-
 dlls/gdi32/palette.c  |  2 +-
 dlls/gdi32/path.c     | 10 +++++-----
 dlls/gdi32/region.c   |  2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c
index 598f738cad1..4fefa834b58 100644
--- a/dlls/gdi32/clipping.c
+++ b/dlls/gdi32/clipping.c
@@ -133,7 +133,7 @@ static inline void create_default_clip_region( DC * dc )
         rect.right = NtGdiGetDeviceCaps( dc->hSelf, DESKTOPHORZRES );
         rect.bottom = NtGdiGetDeviceCaps( dc->hSelf, DESKTOPVERTRES );
     }
-    dc->hClipRgn = CreateRectRgnIndirect( &rect );
+    dc->hClipRgn = NtGdiCreateRectRgn( rect.left, rect.top, rect.right, rect.bottom );
 }
 
 
@@ -265,7 +265,7 @@ INT WINAPI NtGdiExcludeClipRect( HDC hdc, INT left, INT top, INT right, INT bott
 
     rect = get_clip_rect( dc, left, top, right, bottom );
 
-    if ((rgn = CreateRectRgnIndirect( &rect )))
+    if ((rgn = NtGdiCreateRectRgn( rect.left, rect.top, rect.right, rect.bottom )))
     {
         if (!dc->hClipRgn) create_default_clip_region( dc );
         ret = NtGdiCombineRgn( dc->hClipRgn, dc->hClipRgn, rgn, RGN_DIFF );
@@ -293,10 +293,10 @@ INT WINAPI NtGdiIntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bo
     rect = get_clip_rect( dc, left, top, right, bottom );
     if (!dc->hClipRgn)
     {
-        if ((dc->hClipRgn = CreateRectRgnIndirect( &rect )))
+        if ((dc->hClipRgn = NtGdiCreateRectRgn( rect.left, rect.top, rect.right, rect.bottom )))
             ret = SIMPLEREGION;
     }
-    else if ((rgn = CreateRectRgnIndirect( &rect )))
+    else if ((rgn = NtGdiCreateRectRgn( rect.left, rect.top, rect.right, rect.bottom )))
     {
         ret = NtGdiCombineRgn( dc->hClipRgn, dc->hClipRgn, rgn, RGN_AND );
         NtGdiDeleteObjectApp( rgn );
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 9f10f479c2f..db517b89745 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -936,8 +936,8 @@ UINT set_dib_dc_color_table( HDC hdc, UINT startpos, UINT entries, const RGBQUAD
 
         if (result)  /* update colors of selected objects */
         {
-            SetTextColor( hdc, dc->attr->text_color );
-            SetBkColor( hdc, dc->attr->background_color );
+            NtGdiGetAndSetDCDword( hdc, NtGdiSetTextColor, dc->attr->text_color, NULL );
+            NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, dc->attr->background_color, NULL );
             NtGdiSelectPen( hdc, dc->hPen );
             NtGdiSelectBrush( hdc, dc->hBrush );
         }
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 75f82fbabe7..ac1a64016a1 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -608,7 +608,7 @@ static INT CDECL nulldrv_GetTextFace( PHYSDEV dev, INT size, LPWSTR name )
     LOGFONTW font;
     DC *dc = get_nulldrv_dc( dev );
 
-    if (GetObjectW( dc->hFont, sizeof(font), &font ))
+    if (NtGdiExtGetObjectW( dc->hFont, sizeof(font), &font ))
     {
         ret = lstrlenW( font.lfFaceName ) + 1;
         if (name)
diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c
index 09959c6d398..2f3fc7dd215 100644
--- a/dlls/gdi32/palette.c
+++ b/dlls/gdi32/palette.c
@@ -158,7 +158,7 @@ HPALETTE WINAPI NtGdiCreateHalftonePalette( HDC hdc )
         pal->palPalEntry[i].peBlue  = entries[i].rgbBlue;
         pal->palPalEntry[i].peFlags = 0;
     }
-    return CreatePalette( pal );
+    return NtGdiCreatePaletteInternal( pal, pal->palNumEntries );
 }
 
 
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index cc6c6c714c2..9eb0c40665e 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -348,7 +348,7 @@ static HRGN path_to_region( const struct gdi_path *path, int mode )
     if (i > pos + 1) counts[polygons++] = i - pos;
 
     assert( polygons <= path->count / 2 );
-    hrgn = CreatePolyPolygonRgn( path->points, counts, polygons, mode );
+    hrgn = create_polypolygon_region( path->points, counts, polygons, mode, NULL );
     HeapFree( GetProcessHeap(), 0, counts );
     return hrgn;
 }
@@ -1535,7 +1535,7 @@ static BOOL CDECL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, con
         DWORD dwSize;
         void *outline;
 
-        dwSize = GetGlyphOutlineW(dev->hdc, str[idx], ggo_flags, &gm, 0, NULL, &identity);
+        dwSize = NtGdiGetGlyphOutline( dev->hdc, str[idx], ggo_flags, &gm, 0, NULL, &identity, FALSE );
         if (dwSize == GDI_ERROR) continue;
 
         /* add outline only if char is printable */
@@ -1544,7 +1544,7 @@ static BOOL CDECL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, con
             outline = HeapAlloc(GetProcessHeap(), 0, dwSize);
             if (!outline) return FALSE;
 
-            GetGlyphOutlineW(dev->hdc, str[idx], ggo_flags, &gm, dwSize, outline, &identity);
+            NtGdiGetGlyphOutline( dev->hdc, str[idx], ggo_flags, &gm, dwSize, outline, &identity, FALSE );
             PATH_add_outline(physdev, x + offset.x, y + offset.y, outline, dwSize);
 
             HeapFree(GetProcessHeap(), 0, outline);
@@ -1618,14 +1618,14 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
     BYTE *type;
     DWORD obj_type, joint, endcap, penType;
 
-    size = GetObjectW( dc->hPen, 0, NULL );
+    size = NtGdiExtGetObjectW( dc->hPen, 0, NULL );
     if (!size) {
         SetLastError(ERROR_CAN_NOT_COMPLETE);
         return NULL;
     }
 
     elp = HeapAlloc( GetProcessHeap(), 0, size );
-    GetObjectW( dc->hPen, size, elp );
+    NtGdiExtGetObjectW( dc->hPen, size, elp );
 
     obj_type = get_gdi_object_type(dc->hPen);
     switch (obj_type)
diff --git a/dlls/gdi32/region.c b/dlls/gdi32/region.c
index 757efc0ac1a..44ac1744793 100644
--- a/dlls/gdi32/region.c
+++ b/dlls/gdi32/region.c
@@ -927,7 +927,7 @@ HRGN WINAPI NtGdiExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA
             pt[3].y = pCurRect->bottom;
 
             translate( pt, 4, xform );
-            poly_hrgn = CreatePolyPolygonRgn( pt, &count, 1, WINDING );
+            poly_hrgn = create_polypolygon_region( pt, &count, 1, WINDING, NULL );
             NtGdiCombineRgn( hrgn, hrgn, poly_hrgn, RGN_OR );
             NtGdiDeleteObjectApp( poly_hrgn );
         }




More information about the wine-cvs mailing list