gdi32: Use NtGdiDoPalette for GetPaletteEntries.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4d55d75455
commit
ad00037c27
|
@ -236,8 +236,8 @@ static RGBQUAD get_dc_rgb_color( DC *dc, int color_table_size, COLORREF color )
|
|||
{
|
||||
PALETTEENTRY pal;
|
||||
|
||||
if (!GetPaletteEntries( dc->hPalette, LOWORD(color), 1, &pal ))
|
||||
GetPaletteEntries( dc->hPalette, 0, 1, &pal );
|
||||
if (!get_palette_entries( dc->hPalette, LOWORD(color), 1, &pal ))
|
||||
get_palette_entries( dc->hPalette, 0, 1, &pal );
|
||||
ret.rgbRed = pal.peRed;
|
||||
ret.rgbGreen = pal.peGreen;
|
||||
ret.rgbBlue = pal.peBlue;
|
||||
|
|
|
@ -261,7 +261,7 @@ static int fill_color_table_from_palette( BITMAPINFO *info, HDC hdc )
|
|||
if (!palette) return 0;
|
||||
|
||||
memset( palEntry, 0, sizeof(palEntry) );
|
||||
if (!GetPaletteEntries( palette, 0, colors, palEntry ))
|
||||
if (!get_palette_entries( palette, 0, colors, palEntry ))
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < colors; i++)
|
||||
|
@ -285,7 +285,7 @@ BOOL fill_color_table_from_pal_colors( BITMAPINFO *info, HDC hdc )
|
|||
|
||||
if (!colors) return TRUE;
|
||||
if (!(palette = GetCurrentObject( hdc, OBJ_PAL ))) return FALSE;
|
||||
if (!(count = GetPaletteEntries( palette, 0, colors, entries ))) return FALSE;
|
||||
if (!(count = get_palette_entries( palette, 0, colors, entries ))) return FALSE;
|
||||
|
||||
for (i = 0; i < colors; i++, index++)
|
||||
{
|
||||
|
|
|
@ -145,8 +145,8 @@ static COLORREF make_rgb_colorref( DC *dc, const dib_info *dib, COLORREF color,
|
|||
{
|
||||
PALETTEENTRY pal_ent;
|
||||
|
||||
if (!GetPaletteEntries( dc->hPalette, LOWORD(color), 1, &pal_ent ))
|
||||
GetPaletteEntries( dc->hPalette, 0, 1, &pal_ent );
|
||||
if (!get_palette_entries( dc->hPalette, LOWORD(color), 1, &pal_ent ))
|
||||
get_palette_entries( dc->hPalette, 0, 1, &pal_ent );
|
||||
return RGB( pal_ent.peRed, pal_ent.peGreen, pal_ent.peBlue );
|
||||
}
|
||||
|
||||
|
|
|
@ -482,6 +482,8 @@ extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPE
|
|||
/* palette.c */
|
||||
extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg) DECLSPEC_HIDDEN;
|
||||
extern HPALETTE PALETTE_Init(void) DECLSPEC_HIDDEN;
|
||||
extern UINT get_palette_entries( HPALETTE hpalette, UINT start, UINT count,
|
||||
PALETTEENTRY *entries ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* region.c */
|
||||
extern BOOL add_rect_to_region( HRGN rgn, const RECT *rect ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -525,3 +525,11 @@ HPALETTE WINAPI CreatePalette( const LOGPALETTE *palette )
|
|||
if (!palette) return 0;
|
||||
return NtGdiCreatePaletteInternal( palette, palette->palNumEntries );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetPaletteEntries (GDI32.@)
|
||||
*/
|
||||
UINT WINAPI GetPaletteEntries( HPALETTE palette, UINT start, UINT count, PALETTEENTRY *entries )
|
||||
{
|
||||
return NtGdiDoPalette( palette, start, count, entries, NtGdiGetPaletteEntries, TRUE );
|
||||
}
|
||||
|
|
|
@ -162,20 +162,7 @@ HPALETTE WINAPI NtGdiCreateHalftonePalette( HDC hdc )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetPaletteEntries [GDI32.@]
|
||||
*
|
||||
* Retrieves palette entries.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: Number of entries from logical palette
|
||||
* Failure: 0
|
||||
*/
|
||||
UINT WINAPI GetPaletteEntries(
|
||||
HPALETTE hpalette, /* [in] Handle of logical palette */
|
||||
UINT start, /* [in] First entry to receive */
|
||||
UINT count, /* [in] Number of entries to receive */
|
||||
LPPALETTEENTRY entries) /* [out] Address of array receiving entries */
|
||||
UINT get_palette_entries( HPALETTE hpalette, UINT start, UINT count, PALETTEENTRY *entries )
|
||||
{
|
||||
PALETTEOBJ * palPtr;
|
||||
UINT numEntries;
|
||||
|
@ -495,10 +482,10 @@ COLORREF CDECL nulldrv_GetNearestColor( PHYSDEV dev, COLORREF color )
|
|||
else /* PALETTEINDEX */
|
||||
index = LOWORD(color);
|
||||
|
||||
if (!GetPaletteEntries( hpal, index, 1, &entry ))
|
||||
if (!get_palette_entries( hpal, index, 1, &entry ))
|
||||
{
|
||||
WARN("RGB(%x) : idx %d is out of bounds, assuming NULL\n", color, index );
|
||||
if (!GetPaletteEntries( hpal, 0, 1, &entry )) return CLR_INVALID;
|
||||
if (!get_palette_entries( hpal, 0, 1, &entry )) return CLR_INVALID;
|
||||
}
|
||||
color = RGB( entry.peRed, entry.peGreen, entry.peBlue );
|
||||
}
|
||||
|
@ -695,3 +682,19 @@ BOOL WINAPI NtGdiSetMagicColors( HDC hdc, DWORD magic, ULONG index )
|
|||
FIXME( "(%p 0x%08x 0x%08x): stub\n", hdc, magic, index );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* NtGdiDoPalette (win32u.@)
|
||||
*/
|
||||
LONG WINAPI NtGdiDoPalette( HGDIOBJ handle, WORD start, WORD count, void *entries,
|
||||
DWORD func, BOOL inbound )
|
||||
{
|
||||
switch (func)
|
||||
{
|
||||
case NtGdiGetPaletteEntries:
|
||||
return get_palette_entries( handle, start, count, entries );
|
||||
default:
|
||||
WARN( "invalid func %u\n", func );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,6 +105,16 @@ enum
|
|||
NtGdiSetMapMode = 8,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
NtGdiAnimatePalette,
|
||||
NtGdiSetPaletteEntries,
|
||||
NtGdiGetPaletteEntries,
|
||||
NtGdiGetSystemPaletteEntries,
|
||||
NtGdiGetDIBColorTable,
|
||||
NtGdiSetDIBColorTable,
|
||||
};
|
||||
|
||||
#define MWT_SET 4
|
||||
|
||||
/* structs not compatible with native Windows */
|
||||
|
|
Loading…
Reference in New Issue