Added internal 32-bit versions of GDISelectPalette and

GDIRealizePalette.
This commit is contained in:
Alexandre Julliard 2002-08-29 01:55:16 +00:00
parent 0e79a4128c
commit a0b32d7c1b
4 changed files with 36 additions and 14 deletions

View File

@ -21,6 +21,7 @@
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "wine/wingdi16.h" #include "wine/wingdi16.h"
#include "gdi.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(gdi); WINE_DEFAULT_DEBUG_CHANNEL(gdi);
@ -1593,6 +1594,24 @@ HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
} }
/***********************************************************************
* GDISelectPalette (GDI.361)
*/
HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
{
return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
}
/***********************************************************************
* GDIRealizePalette (GDI.362)
*/
UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
{
return GDIRealizePalette( HDC_32(hdc) );
}
/*********************************************************************** /***********************************************************************
* GetPaletteEntries (GDI.363) * GetPaletteEntries (GDI.363)
*/ */

View File

@ -455,6 +455,10 @@ extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCSTR filename);
/* region.c */ /* region.c */
extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y ); extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y );
/* palette.c */
extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg);
extern UINT WINAPI GDIRealizePalette( HDC hdc );
#define WINE_GGO_GRAY16_BITMAP 0x7f #define WINE_GGO_GRAY16_BITMAP 0x7f
#endif /* __WINE_GDI_H */ #endif /* __WINE_GDI_H */

View File

@ -433,7 +433,7 @@ void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
SelectObject( hdc, dcs->hPen ); SelectObject( hdc, dcs->hPen );
SetBkColor( hdc, dcs->backgroundColor); SetBkColor( hdc, dcs->backgroundColor);
SetTextColor( hdc, dcs->textColor); SetTextColor( hdc, dcs->textColor);
GDISelectPalette16( hdc, dcs->hPalette, FALSE ); GDISelectPalette( hdc, dcs->hPalette, FALSE );
GDI_ReleaseObj( hdcs ); GDI_ReleaseObj( hdcs );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }

View File

@ -53,8 +53,8 @@ static const struct gdi_obj_funcs palette_funcs =
/* Pointers to USER implementation of SelectPalette/RealizePalette */ /* Pointers to USER implementation of SelectPalette/RealizePalette */
/* they will be patched by USER on startup */ /* they will be patched by USER on startup */
FARPROC pfnSelectPalette = NULL; HPALETTE (WINAPI *pfnSelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd ) = NULL;
FARPROC pfnRealizePalette = NULL; UINT (WINAPI *pfnRealizePalette)(HDC hdc) = NULL;
static UINT SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */ static UINT SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */
@ -657,11 +657,11 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle, void *obj )
/*********************************************************************** /***********************************************************************
* GDISelectPalette (GDI.361) * GDISelectPalette (Not a Windows API)
*/ */
HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpal, WORD wBkg) HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg)
{ {
HPALETTE16 prev; HPALETTE prev;
DC *dc; DC *dc;
TRACE("%04x %04x\n", hdc, hpal ); TRACE("%04x %04x\n", hdc, hpal );
@ -681,9 +681,9 @@ HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpal, WORD wBkg)
/*********************************************************************** /***********************************************************************
* GDIRealizePalette (GDI.362) * GDIRealizePalette (Not a Windows API)
*/ */
UINT16 WINAPI GDIRealizePalette16( HDC16 hdc ) UINT WINAPI GDIRealizePalette( HDC hdc )
{ {
UINT realized = 0; UINT realized = 0;
DC* dc = DC_GetDCPtr( hdc ); DC* dc = DC_GetDCPtr( hdc );
@ -694,11 +694,10 @@ UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
if( dc->hPalette == GetStockObject( DEFAULT_PALETTE )) if( dc->hPalette == GetStockObject( DEFAULT_PALETTE ))
{ {
GDI_ReleaseObj( hdc ); if (dc->funcs->pRealizeDefaultPalette)
return RealizeDefaultPalette16( hdc ); realized = dc->funcs->pRealizeDefaultPalette( dc->physDev );
} }
else if(dc->hPalette != hLastRealizedPalette )
if(dc->hPalette != hLastRealizedPalette )
{ {
if (dc->funcs->pRealizePalette) if (dc->funcs->pRealizePalette)
realized = dc->funcs->pRealizePalette( dc->physDev, dc->hPalette, realized = dc->funcs->pRealizePalette( dc->physDev, dc->hPalette,
@ -707,10 +706,10 @@ UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
pLastRealizedDC = dc->funcs; pLastRealizedDC = dc->funcs;
} }
else TRACE(" skipping (hLastRealizedPalette = %04x)\n", hLastRealizedPalette); else TRACE(" skipping (hLastRealizedPalette = %04x)\n", hLastRealizedPalette);
GDI_ReleaseObj( hdc );
GDI_ReleaseObj( hdc );
TRACE(" realized %i colors.\n", realized ); TRACE(" realized %i colors.\n", realized );
return (UINT16)realized; return realized;
} }