winex11: Copy icon color table in 256-color mode (Valgrind).

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alex Henrie 2019-10-15 19:00:59 -06:00 committed by Alexandre Julliard
parent 293dae8fdc
commit 7dd3abe69f
1 changed files with 2 additions and 1 deletions

View File

@ -924,13 +924,14 @@ static void free_ximage_bits( struct gdi_image_bits *bits )
XFree( bits->ptr ); XFree( bits->ptr );
} }
/* only for use on sanitized BITMAPINFO structures */
static inline int get_dib_info_size( const BITMAPINFO *info, UINT coloruse ) static inline int get_dib_info_size( const BITMAPINFO *info, UINT coloruse )
{ {
if (info->bmiHeader.biCompression == BI_BITFIELDS) if (info->bmiHeader.biCompression == BI_BITFIELDS)
return sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD); return sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD);
if (coloruse == DIB_PAL_COLORS) if (coloruse == DIB_PAL_COLORS)
return sizeof(BITMAPINFOHEADER) + info->bmiHeader.biClrUsed * sizeof(WORD); return sizeof(BITMAPINFOHEADER) + info->bmiHeader.biClrUsed * sizeof(WORD);
if (!info->bmiHeader.biClrUsed && info->bmiHeader.biBitCount <= 8)
return FIELD_OFFSET( BITMAPINFO, bmiColors[1 << info->bmiHeader.biBitCount] );
return FIELD_OFFSET( BITMAPINFO, bmiColors[info->bmiHeader.biClrUsed] ); return FIELD_OFFSET( BITMAPINFO, bmiColors[info->bmiHeader.biClrUsed] );
} }