Jacek Caban : gdi32: Use NtGdiDoPalette for GetDIBColorTable and SetDIBColorTable.

Alexandre Julliard julliard at winehq.org
Mon Aug 16 18:07:24 CDT 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Aug 16 10:28:12 2021 +0200

gdi32: Use NtGdiDoPalette for GetDIBColorTable and SetDIBColorTable.

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/dib.c           | 10 ++--------
 dlls/gdi32/ntgdi_private.h |  4 ++++
 dlls/gdi32/objects.c       | 16 ++++++++++++++++
 dlls/gdi32/palette.c       |  4 ++++
 4 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 738151aa14d..7da248079b2 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -910,10 +910,7 @@ INT WINAPI NtGdiSetDIBitsToDeviceInternal( HDC hdc, INT xDest, INT yDest, DWORD
     return ret;
 }
 
-/***********************************************************************
- *           SetDIBColorTable    (GDI32.@)
- */
-UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUAD *colors )
+UINT set_dib_dc_color_table( HDC hdc, UINT startpos, UINT entries, const RGBQUAD *colors )
 {
     DC * dc;
     UINT i, result = 0;
@@ -949,10 +946,7 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUA
 }
 
 
-/***********************************************************************
- *           GetDIBColorTable    (GDI32.@)
- */
-UINT WINAPI GetDIBColorTable( HDC hdc, UINT startpos, UINT entries, RGBQUAD *colors )
+UINT get_dib_dc_color_table( HDC hdc, UINT startpos, UINT entries, RGBQUAD *colors )
 {
     DC * dc;
     BITMAPOBJ *bitmap;
diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h
index d9b016c213f..6b3efea3ddb 100644
--- a/dlls/gdi32/ntgdi_private.h
+++ b/dlls/gdi32/ntgdi_private.h
@@ -241,6 +241,10 @@ extern DWORD get_image_from_bitmap( BITMAPOBJ *bmp, BITMAPINFO *info,
 extern DWORD put_image_into_bitmap( BITMAPOBJ *bmp, HRGN clip, BITMAPINFO *info,
                                     const struct gdi_image_bits *bits, struct bitblt_coords *src,
                                     struct bitblt_coords *dst ) DECLSPEC_HIDDEN;
+extern UINT get_dib_dc_color_table( HDC hdc, UINT startpos, UINT entries,
+                                    RGBQUAD *colors ) DECLSPEC_HIDDEN;
+extern UINT set_dib_dc_color_table( HDC hdc, UINT startpos, UINT entries,
+                                    const RGBQUAD *colors ) DECLSPEC_HIDDEN;
 extern void dibdrv_set_window_surface( DC *dc, struct window_surface *surface ) DECLSPEC_HIDDEN;
 
 extern NTSTATUS init_opengl_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out ) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c
index 38a26afe774..028b9fd06ad 100644
--- a/dlls/gdi32/objects.c
+++ b/dlls/gdi32/objects.c
@@ -594,3 +594,19 @@ UINT WINAPI GetSystemPaletteEntries( HDC hdc, UINT start, UINT count, PALETTEENT
 
     return 0;
 }
+
+/***********************************************************************
+ *           GetDIBColorTable    (GDI32.@)
+ */
+UINT WINAPI GetDIBColorTable( HDC hdc, UINT start, UINT count, RGBQUAD *colors )
+{
+    return NtGdiDoPalette( hdc, start, count, colors, NtGdiGetDIBColorTable, TRUE );
+}
+
+/***********************************************************************
+ *           SetDIBColorTable    (GDI32.@)
+ */
+UINT WINAPI SetDIBColorTable( HDC hdc, UINT start, UINT count, const RGBQUAD *colors )
+{
+    return NtGdiDoPalette( hdc, start, count, (void *)colors, NtGdiSetDIBColorTable, FALSE );
+}
diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c
index 36335083c48..3d2e27c1fc6 100644
--- a/dlls/gdi32/palette.c
+++ b/dlls/gdi32/palette.c
@@ -635,6 +635,10 @@ LONG WINAPI NtGdiDoPalette( HGDIOBJ handle, WORD start, WORD count, void *entrie
         return get_palette_entries( handle, start, count, entries );
     case NtGdiGetSystemPaletteEntries:
         return get_system_palette_entries( handle, start, count, entries );
+    case NtGdiSetDIBColorTable:
+        return set_dib_dc_color_table( handle, start, count, entries );
+    case NtGdiGetDIBColorTable:
+        return get_dib_dc_color_table( handle, start, count, entries );
     default:
         WARN( "invalid func %u\n", func );
         return 0;




More information about the wine-cvs mailing list