Convert HPALETTE to a void*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

this is a reworked patch which applies to the current cvs.

License: LGPL, X11
Changelog:
    Michael Stefaniuc <mstefani@redhat.com>
    - Convert HPALETTE to a void*

bye
	michael
-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani@redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
Index: dlls/msvideo/msvideo_main.c
===================================================================
RCS file: /home/wine/wine/dlls/msvideo/msvideo_main.c,v
retrieving revision 1.36
diff -u -r1.36 msvideo_main.c
--- dlls/msvideo/msvideo_main.c	26 Aug 2002 21:44:48 -0000	1.36
+++ dlls/msvideo/msvideo_main.c	28 Aug 2002 21:33:08 -0000
@@ -672,7 +672,7 @@
 			ret = icdb16;
 
 			COPY(icdb,dwFlags);
-			COPY(icdb,hpal);
+			icdb->hpal = HPALETTE_32(icdb16->hpal);
 			COPY(icdb,hwnd);
 			COPY(icdb,hdc);
 			COPY(icdb,xDst);
Index: dlls/msvideo/vfw16.h
===================================================================
RCS file: /home/wine/wine/dlls/msvideo/vfw16.h,v
retrieving revision 1.3
diff -u -r1.3 vfw16.h
--- dlls/msvideo/vfw16.h	9 Mar 2002 23:39:09 -0000	1.3
+++ dlls/msvideo/vfw16.h	28 Aug 2002 21:33:08 -0000
@@ -117,6 +117,10 @@
 HIC16   VFWAPI  ICOpenFunction16(DWORD,DWORD,UINT16,FARPROC16);
 LRESULT VFWAPI  ICSendMessage16(HIC16,UINT16,DWORD,DWORD);
 
+/* handle <-> handle16 conversions */
+#define HPALETTE_32(h16)	((HPALETTE)(ULONG_PTR)(h16))
+#define HPALETTE_16(h32)	(LOWORD(h32))
+
 #ifdef __cplusplus
 }
 #endif  /* __cplusplus */
Index: graphics/x11drv/palette.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/palette.c,v
retrieving revision 1.34
diff -u -r1.34 palette.c
--- graphics/x11drv/palette.c	2 Jun 2002 21:40:24 -0000	1.34
+++ graphics/x11drv/palette.c	28 Aug 2002 21:33:11 -0000
@@ -829,7 +829,7 @@
 {
     DC *dc = physDev ? physDev->dc : NULL;
     WORD 		 index = 0;
-    HPALETTE16		 hPal = (dc)? dc->hPalette: GetStockObject(DEFAULT_PALETTE);
+    HPALETTE		 hPal = (dc)? dc->hPalette: GetStockObject(DEFAULT_PALETTE);
     unsigned char	 spec_type = color >> 24;
     PALETTEOBJ* 	 palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC );
 
Index: objects/dc.c
===================================================================
RCS file: /home/wine/wine/objects/dc.c,v
retrieving revision 1.80
diff -u -r1.80 dc.c
--- objects/dc.c	16 Aug 2002 00:42:07 -0000	1.80
+++ objects/dc.c	28 Aug 2002 21:33:12 -0000
@@ -33,6 +33,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(dc);
 
+#define HPALETTE_16(h32)	(LOWORD(h32))
+
 /* ### start build ### */
 extern WORD CALLBACK GDI_CallTo16_word_wwll(FARPROC16,WORD,WORD,LONG,LONG);
 /* ### stop build ### */
@@ -433,7 +435,7 @@
     SelectObject( hdc, dcs->hPen );
     SetBkColor( hdc, dcs->backgroundColor);
     SetTextColor( hdc, dcs->textColor);
-    GDISelectPalette16( hdc, dcs->hPalette, FALSE );
+    GDISelectPalette16( hdc, HPALETTE_16(dcs->hPalette), FALSE );
     GDI_ReleaseObj( hdcs );
     GDI_ReleaseObj( hdc );
 }
Index: objects/palette.c
===================================================================
RCS file: /home/wine/wine/objects/palette.c,v
retrieving revision 1.48
diff -u -r1.48 palette.c
--- objects/palette.c	16 Aug 2002 00:42:07 -0000	1.48
+++ objects/palette.c	28 Aug 2002 21:33:12 -0000
@@ -37,6 +37,10 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(palette);
 
+/* handle <-> handle16 conversions */
+#define HPALETTE_32(h16)	((HPALETTE)(ULONG_PTR)(h16))
+#define HPALETTE_16(h32)	(LOWORD(h32))
+
 static INT PALETTE_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
 static BOOL PALETTE_UnrealizeObject( HGDIOBJ handle, void *obj );
 static BOOL PALETTE_DeleteObject( HGDIOBJ handle, void *obj );
@@ -659,20 +663,21 @@
 /***********************************************************************
  *           GDISelectPalette    (GDI.361)
  */
-HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpal, WORD wBkg)
+HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpal16, WORD wBkg)
 {
+    HPALETTE hpal = HPALETTE_32(hpal16);
     HPALETTE16 prev;
     DC *dc;
 
-    TRACE("%04x %04x\n", hdc, hpal );
+    TRACE("%04x %04x\n", hdc, hpal16 );
 
     if (GetObjectType(hpal) != OBJ_PAL)
     {
-      WARN("invalid selected palette %04x\n",hpal);
+      WARN("invalid selected palette %08x\n",hpal);
       return 0;
     }
     if (!(dc = DC_GetDCPtr( hdc ))) return 0;
-    prev = dc->hPalette;
+    prev = HPALETTE_16(dc->hPalette);
     dc->hPalette = hpal;
     GDI_ReleaseObj( hdc );
     if (!wBkg) hPrimaryPalette = hpal;
@@ -759,7 +764,7 @@
     HPALETTE hPal,         /* [in] Handle of logical color palette */
     BOOL bForceBackground) /* [in] Foreground/background mode */
 {
-    return pfnSelectPalette( hDC, hPal, bForceBackground );
+    return (HPALETTE) pfnSelectPalette( hDC, hPal, bForceBackground );
 }
 
 
Index: include/windef.h
===================================================================
RCS file: /home/wine/wine/include/windef.h,v
retrieving revision 1.70
diff -u -r1.70 windef.h
--- include/windef.h	28 Aug 2002 00:39:39 -0000	1.70
+++ include/windef.h	28 Aug 2002 21:38:22 -0000
@@ -87,7 +87,7 @@
 DECLARE_OLD_HANDLE(HMENU);
 DECLARE_HANDLE(HMETAFILE);
 DECLARE_HANDLE(HMONITOR);
-DECLARE_OLD_HANDLE(HPALETTE);
+DECLARE_HANDLE(HPALETTE);
 DECLARE_OLD_HANDLE(HPEN);
 DECLARE_OLD_HANDLE(HRGN);
 DECLARE_OLD_HANDLE(HRSRC);
Index: dlls/msvideo/msvideo16.c
===================================================================
RCS file: /home/wine/wine/dlls/msvideo/msvideo16.c,v
retrieving revision 1.1
diff -u -r1.1 msvideo16.c
--- dlls/msvideo/msvideo16.c	26 Aug 2002 21:44:48 -0000	1.1
+++ dlls/msvideo/msvideo16.c	28 Aug 2002 21:48:03 -0000
@@ -32,13 +32,11 @@
 #define HDC_32(h16)		((HDC)(ULONG_PTR)(h16))
 #define HDRAWDIB_32(h16)	((HDRAWDIB)(ULONG_PTR)(h16))
 #define HIC_32(h16)		((HIC)(ULONG_PTR)(h16))
-#define HPALETTE_32(h16)	((HPALETTE)(ULONG_PTR)(h16))
 
 /* handle --> handle16 conversions */
 #define HDC_16(h32)		(LOWORD(h32))
 #define HDRAWDIB_16(h32)	(LOWORD(h32))
 #define HIC_16(h32)		(LOWORD(h32))
-#define HPALETTE_16(h32)	(LOWORD(h32))
 
 
 /***********************************************************************

Attachment: pgp00038.pgp
Description: PGP signature


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux