gdi32: Remove support for private color maps.

This commit is contained in:
Alexandre Julliard 2011-12-12 15:58:05 +01:00
parent 30467685ba
commit d357392b8b
3 changed files with 8 additions and 34 deletions

View File

@ -68,7 +68,7 @@ static void init_bit_fields(dib_info *dib, const DWORD *bit_fields)
}
static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD *bit_fields,
RGBQUAD *color_table, void *bits, enum dib_info_flags flags)
const RGBQUAD *color_table, void *bits, enum dib_info_flags flags)
{
dib->bit_count = bi->biBitCount;
dib->width = bi->biWidth;
@ -79,7 +79,6 @@ static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
dib->bits.is_copy = FALSE;
dib->bits.free = NULL;
dib->bits.param = NULL;
dib->flags = flags;
if(dib->height < 0) /* top-down */
{
@ -143,19 +142,12 @@ static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
if (color_table && bi->biClrUsed)
{
if (flags & private_color_table)
{
dib->color_table = HeapAlloc(GetProcessHeap(), 0, bi->biClrUsed * sizeof(dib->color_table[0]));
if(!dib->color_table) return FALSE;
memcpy(dib->color_table, color_table, bi->biClrUsed * sizeof(color_table[0]));
}
else
dib->color_table = color_table;
dib->color_table = color_table;
dib->color_table_size = bi->biClrUsed;
}
else if (flags & default_color_table)
{
dib->color_table = (RGBQUAD *)get_default_color_table( dib->bit_count );
dib->color_table = get_default_color_table( dib->bit_count );
dib->color_table_size = dib->color_table ? (1 << dib->bit_count) : 0;
}
else
@ -170,7 +162,7 @@ static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
BOOL init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits, enum dib_info_flags flags)
{
return init_dib_info( dib, &info->bmiHeader, (const DWORD *)info->bmiColors,
(RGBQUAD *)info->bmiColors, bits, flags );
info->bmiColors, bits, flags );
}
BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags)
@ -208,9 +200,6 @@ static void clear_dib_info(dib_info *dib)
*/
void free_dib_info(dib_info *dib)
{
if (dib->flags & private_color_table)
HeapFree(GetProcessHeap(), 0, dib->color_table);
if (dib->bits.free) dib->bits.free( &dib->bits );
clear_dib_info( dib );
}
@ -229,19 +218,7 @@ void copy_dib_color_info(dib_info *dst, const dib_info *src)
dst->blue_shift = src->blue_shift;
dst->funcs = src->funcs;
dst->color_table_size = src->color_table_size;
dst->color_table = NULL;
dst->flags = src->flags;
if(dst->color_table_size)
{
int size = dst->color_table_size * sizeof(dst->color_table[0]);
if (dst->flags & private_color_table)
{
dst->color_table = HeapAlloc(GetProcessHeap(), 0, size);
memcpy(dst->color_table, src->color_table, size);
}
else
dst->color_table = src->color_table;
}
dst->color_table = src->color_table;
}
DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,

View File

@ -20,8 +20,7 @@
enum dib_info_flags
{
private_color_table = 1,
default_color_table = 2
default_color_table = 1
};
typedef struct
@ -35,11 +34,9 @@ typedef struct
int red_shift, green_shift, blue_shift;
int red_len, green_len, blue_len;
RGBQUAD *color_table;
const RGBQUAD *color_table;
DWORD color_table_size;
enum dib_info_flags flags;
const struct primitive_funcs *funcs;
} dib_info;

View File

@ -1391,7 +1391,7 @@ static DWORD rgb_to_pixel_colortable(const dib_info *dib, BYTE r, BYTE g, BYTE b
for(i = 0; i < dib->color_table_size; i++)
{
RGBQUAD *cur = dib->color_table + i;
const RGBQUAD *cur = dib->color_table + i;
diff = (r - cur->rgbRed) * (r - cur->rgbRed)
+ (g - cur->rgbGreen) * (g - cur->rgbGreen)
+ (b - cur->rgbBlue) * (b - cur->rgbBlue);