gdi32: Use NtGdiCreatePaletteInternal for CreatePalette.

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:
Jacek Caban 2021-08-16 10:26:58 +02:00 committed by Alexandre Julliard
parent 76821849fe
commit 3787b43428
3 changed files with 14 additions and 9 deletions

View File

@ -516,3 +516,12 @@ HCOLORSPACE WINAPI SetColorSpace( HDC hdc, HCOLORSPACE cs )
FIXME( "stub\n" );
return cs;
}
/***********************************************************************
* CreatePalette (GDI32.@)
*/
HPALETTE WINAPI CreatePalette( const LOGPALETTE *palette )
{
if (!palette) return 0;
return NtGdiCreatePaletteInternal( palette, palette->palNumEntries );
}

View File

@ -94,28 +94,23 @@ HPALETTE PALETTE_Init(void)
/***********************************************************************
* CreatePalette [GDI32.@]
* NtGdiCreatePaletteInternal (win32u.@)
*
* Creates a logical color palette.
*
* RETURNS
* Success: Handle to logical palette
* Failure: NULL
*/
HPALETTE WINAPI CreatePalette(
const LOGPALETTE* palette) /* [in] Pointer to logical color palette */
HPALETTE WINAPI NtGdiCreatePaletteInternal( const LOGPALETTE *palette, UINT count )
{
PALETTEOBJ * palettePtr;
HPALETTE hpalette;
int size;
if (!palette) return 0;
TRACE("entries=%i\n", palette->palNumEntries);
TRACE( "entries=%u\n", count );
if (!(palettePtr = HeapAlloc( GetProcessHeap(), 0, sizeof(*palettePtr) ))) return 0;
palettePtr->unrealize = NULL;
palettePtr->version = palette->palVersion;
palettePtr->count = palette->palNumEntries;
palettePtr->count = count;
size = palettePtr->count * sizeof(*palettePtr->entries);
if (!(palettePtr->entries = HeapAlloc( GetProcessHeap(), 0, size )))
{

View File

@ -164,6 +164,7 @@ BOOL WINAPI NtGdiComputeXformCoefficients( HDC hdc );
HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes,
UINT bpp, const void *bits );
HBRUSH WINAPI NtGdiCreateHatchBrushInternal( INT style, COLORREF color, BOOL pen );
HPALETTE WINAPI NtGdiCreatePaletteInternal( const LOGPALETTE *palette, UINT count );
BOOL WINAPI NtGdiEllipse( HDC hdc, INT left, INT top, INT right, INT bottom );
INT WINAPI NtGdiEndDoc(HDC hdc);
BOOL WINAPI NtGdiEndPath( HDC hdc );