Alexandre Julliard : gdi32: Remove remaining references to gdi32 internals from gdi16.c.

Alexandre Julliard julliard at winehq.org
Wed Nov 18 09:40:39 CST 2009


Module: wine
Branch: master
Commit: 17349a06b1f5741c4ac439c4febd3656d5dc2a51
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=17349a06b1f5741c4ac439c4febd3656d5dc2a51

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Nov 17 22:30:08 2009 +0100

gdi32: Remove remaining references to gdi32 internals from gdi16.c.

---

 dlls/gdi32/gdi16.c       |   30 +++++++++---------------------
 dlls/gdi32/gdi_private.h |    1 -
 dlls/gdi32/palette.c     |    2 +-
 3 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/dlls/gdi32/gdi16.c b/dlls/gdi32/gdi16.c
index 4290d8f..e62b711 100644
--- a/dlls/gdi32/gdi16.c
+++ b/dlls/gdi32/gdi16.c
@@ -25,7 +25,6 @@
 #include "wingdi.h"
 #include "wownt32.h"
 #include "wine/wingdi16.h"
-#include "gdi_private.h"
 #include "wine/list.h"
 #include "wine/debug.h"
 
@@ -43,6 +42,8 @@ struct saved_visrgn
 
 static struct list saved_regions = LIST_INIT( saved_regions );
 
+static HPALETTE16 hPrimaryPalette;
+
 /*
  * ############################################################################
  */
@@ -2421,7 +2422,9 @@ HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
  */
 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
 {
-    return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
+    HPALETTE16 ret = HPALETTE_16( SelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
+    if (ret && !wBkg) hPrimaryPalette = hpalette;
+    return ret;
 }
 
 
@@ -2430,7 +2433,7 @@ HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg
  */
 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
 {
-    return GDIRealizePalette( HDC_32(hdc) );
+    return RealizePalette( HDC_32(hdc) );
 }
 
 
@@ -3539,16 +3542,8 @@ void WINAPI Copy16( LPVOID src, LPVOID dst, WORD size )
  */
 UINT16 WINAPI RealizeDefaultPalette16( HDC16 hdc )
 {
-    UINT16 ret = 0;
-    DC          *dc;
-
-    TRACE("%04x\n", hdc );
-
-    if (!(dc = get_dc_ptr( HDC_32(hdc) ))) return 0;
-
-    if (dc->funcs->pRealizeDefaultPalette) ret = dc->funcs->pRealizeDefaultPalette( dc->physDev );
-    release_dc_ptr( dc );
-    return ret;
+    FIXME( "%04x semi-stub\n", hdc );
+    return GDIRealizePalette16( hdc );
 }
 
 /***********************************************************************
@@ -3556,14 +3551,7 @@ UINT16 WINAPI RealizeDefaultPalette16( HDC16 hdc )
  */
 BOOL16 WINAPI IsDCCurrentPalette16(HDC16 hDC)
 {
-    DC *dc = get_dc_ptr( HDC_32(hDC) );
-    if (dc)
-    {
-      BOOL bRet = dc->hPalette == hPrimaryPalette;
-      release_dc_ptr( dc );
-      return bRet;
-    }
-    return FALSE;
+    return HPALETTE_16( GetCurrentObject( HDC_32(hDC), OBJ_PAL )) == hPrimaryPalette;
 }
 
 /*********************************************************************
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index bf0f37b..64717af 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -484,7 +484,6 @@ extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPE
 extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg);
 extern UINT WINAPI GDIRealizePalette( HDC hdc );
 extern HPALETTE PALETTE_Init(void) DECLSPEC_HIDDEN;
-extern HPALETTE hPrimaryPalette DECLSPEC_HIDDEN;
 
 /* region.c */
 extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y ) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c
index b4bbc95..e941b10 100644
--- a/dlls/gdi32/palette.c
+++ b/dlls/gdi32/palette.c
@@ -67,7 +67,7 @@ UINT (WINAPI *pfnRealizePalette)(HDC hdc) = GDIRealizePalette;
 
 static UINT SystemPaletteUse = SYSPAL_STATIC;  /* currently not considered */
 
-HPALETTE hPrimaryPalette = 0; /* used for WM_PALETTECHANGED */
+static HPALETTE hPrimaryPalette = 0; /* used for WM_PALETTECHANGED */
 static HPALETTE hLastRealizedPalette = 0; /* UnrealizeObject() needs it */
 
 #define NB_RESERVED_COLORS  20   /* number of fixed colors in system palette */




More information about the wine-cvs mailing list