gdi32: Don't store the default color table in dib_info objects.

This commit is contained in:
Alexandre Julliard 2012-05-23 11:56:38 +02:00
parent 9968f3083a
commit 664442ab84
5 changed files with 25 additions and 36 deletions

View File

@ -831,7 +831,7 @@ DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
if (!bmp) return ERROR_INVALID_HANDLE;
if (!init_dib_info_from_bitmapobj( &stand_alone, bmp, 0 ))
if (!init_dib_info_from_bitmapobj( &stand_alone, bmp ))
{
ret = ERROR_OUTOFMEMORY;
goto done;
@ -934,7 +934,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
if (!bmp) return ERROR_INVALID_HANDLE;
if (!init_dib_info_from_bitmapobj( &stand_alone, bmp, 0 ))
if (!init_dib_info_from_bitmapobj( &stand_alone, bmp ))
{
ret = ERROR_OUTOFMEMORY;
goto done;
@ -962,7 +962,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
goto done;
}
init_dib_info_from_bitmapinfo( &src_dib, info, bits->ptr, 0 );
init_dib_info_from_bitmapinfo( &src_dib, info, bits->ptr );
src_dib.bits.is_copy = bits->is_copy;
if (!hbitmap)
@ -1029,7 +1029,7 @@ DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_b
if (!bits) return ERROR_SUCCESS;
if ((src->width != dst->width) || (src->height != dst->height)) return ERROR_TRANSFORM_NOT_SUPPORTED;
init_dib_info_from_bitmapinfo( &src_dib, info, bits->ptr, 0 );
init_dib_info_from_bitmapinfo( &src_dib, info, bits->ptr );
src_dib.bits.is_copy = bits->is_copy;
add_clipped_bounds( pdev, &dst->visrect, pdev->clip );
return blend_rect( &pdev->dib, &dst->visrect, &src_dib, &src->visrect, pdev->clip, blend );
@ -1171,8 +1171,8 @@ DWORD stretch_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
dst->x, dst->y, dst->width, dst->height, wine_dbgstr_rect(&dst->visrect),
src->x, src->y, src->width, src->height, wine_dbgstr_rect(&src->visrect));
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits, 0 );
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, 0 );
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits );
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits );
/* v */
ret = calc_1d_stretch_params( dst->y, dst->height, dst->visrect.top, dst->visrect.bottom,
@ -1273,8 +1273,8 @@ DWORD blend_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitbl
{
dib_info src_dib, dst_dib;
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits, 0 );
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, default_color_table );
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits );
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits );
return blend_rect( &dst_dib, &dst->visrect, &src_dib, &src->visrect, NULL, blend );
}
@ -1291,7 +1291,7 @@ DWORD gradient_bitmapinfo( const BITMAPINFO *info, void *bits, TRIVERTEX *vert_a
RECT rc;
DWORD ret = ERROR_SUCCESS;
init_dib_info_from_bitmapinfo( &dib, info, bits, default_color_table );
init_dib_info_from_bitmapinfo( &dib, info, bits );
switch (mode)
{
@ -1344,7 +1344,7 @@ COLORREF get_pixel_bitmapinfo( const BITMAPINFO *info, void *bits, struct bitblt
dib_info dib;
DWORD pixel;
init_dib_info_from_bitmapinfo( &dib, info, bits, default_color_table );
init_dib_info_from_bitmapinfo( &dib, info, bits );
pixel = dib.funcs->get_pixel( &dib, src->x, src->y );
return dib.funcs->pixel_to_colorref( &dib, pixel );
}

View File

@ -68,7 +68,7 @@ static void init_bit_fields(dib_info *dib, const DWORD *bit_fields)
}
static void init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD *bit_fields,
const RGBQUAD *color_table, void *bits, enum dib_info_flags flags)
const RGBQUAD *color_table, void *bits)
{
dib->bit_count = bi->biBitCount;
dib->width = bi->biWidth;
@ -145,11 +145,6 @@ static void init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
dib->color_table = color_table;
dib->color_table_size = bi->biClrUsed;
}
else if (flags & default_color_table)
{
dib->color_table = get_default_color_table( dib->bit_count );
dib->color_table_size = dib->color_table ? (1 << dib->bit_count) : 0;
}
else
{
dib->color_table = NULL;
@ -157,12 +152,12 @@ static void init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
}
}
void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits, enum dib_info_flags flags)
void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits)
{
init_dib_info( dib, &info->bmiHeader, (const DWORD *)info->bmiColors, info->bmiColors, bits, flags );
init_dib_info( dib, &info->bmiHeader, (const DWORD *)info->bmiColors, info->bmiColors, bits );
}
BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags)
BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp)
{
if (!is_bitmapobj_dib( bmp ))
{
@ -176,16 +171,15 @@ BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_f
bmp->dib.dsBm.bmHeight * width_bytes );
if (!bmp->dib.dsBm.bmBits) return FALSE;
}
init_dib_info_from_bitmapinfo( dib, &info, bmp->dib.dsBm.bmBits, flags );
init_dib_info_from_bitmapinfo( dib, &info, bmp->dib.dsBm.bmBits );
}
else init_dib_info( dib, &bmp->dib.dsBmih, bmp->dib.dsBitfields,
bmp->color_table, bmp->dib.dsBm.bmBits, flags );
bmp->color_table, bmp->dib.dsBm.bmBits );
return TRUE;
}
static void clear_dib_info(dib_info *dib)
{
dib->color_table = NULL;
dib->bits.ptr = NULL;
dib->bits.free = NULL;
dib->bits.param = NULL;
@ -225,8 +219,8 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
dib_info src_dib, dst_dib;
DWORD ret;
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits, default_color_table );
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, default_color_table );
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits );
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits );
__TRY
{
@ -380,7 +374,7 @@ static HBITMAP dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
if (!bmp) return 0;
if(!init_dib_info_from_bitmapobj(&dib, bmp, default_color_table))
if (!init_dib_info_from_bitmapobj(&dib, bmp))
{
GDI_ReleaseObj( bitmap );
return 0;

View File

@ -18,11 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
enum dib_info_flags
{
default_color_table = 1
};
typedef struct
{
int bit_count, width, height;
@ -237,8 +232,8 @@ struct clipped_rects
extern void get_rop_codes(INT rop, struct rop_codes *codes) DECLSPEC_HIDDEN;
extern void reset_dash_origin(dibdrv_physdev *pdev) DECLSPEC_HIDDEN;
extern void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits, enum dib_info_flags flags) DECLSPEC_HIDDEN;
extern BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags) DECLSPEC_HIDDEN;
extern void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits) DECLSPEC_HIDDEN;
extern BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp) DECLSPEC_HIDDEN;
extern void free_dib_info(dib_info *dib) DECLSPEC_HIDDEN;
extern void free_pattern_brush(dib_brush *brush) DECLSPEC_HIDDEN;
extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;

View File

@ -558,7 +558,7 @@ BOOL render_aa_text_bitmapinfo( HDC hdc, BITMAPINFO *info, struct gdi_image_bits
assert( info->bmiHeader.biBitCount > 8 ); /* mono and indexed formats don't support anti-aliasing */
init_dib_info_from_bitmapinfo( &dib, info, bits->ptr, 0 );
init_dib_info_from_bitmapinfo( &dib, info, bits->ptr );
fg = make_rgb_colorref( hdc, &dib, GetTextColor( hdc ), &got_pixel, &fg_pixel);
if (!got_pixel) fg_pixel = dib.funcs->colorref_to_pixel( &dib, fg );

View File

@ -1855,7 +1855,7 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *
BOOL ret;
if (!bmp) return FALSE;
ret = init_dib_info_from_bitmapobj( &pattern, bmp, 0 );
ret = init_dib_info_from_bitmapobj( &pattern, bmp );
GDI_ReleaseObj( brush->pattern.bitmap );
if (!ret) return FALSE;
}
@ -1863,12 +1863,12 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *
{
copy_bitmapinfo( info, brush->pattern.info );
fill_color_table_from_pal_colors( info, pdev->dev.hdc );
init_dib_info_from_bitmapinfo( &pattern, info, brush->pattern.bits.ptr, 0 );
init_dib_info_from_bitmapinfo( &pattern, info, brush->pattern.bits.ptr );
*needs_reselect = TRUE;
}
else
{
init_dib_info_from_bitmapinfo( &pattern, brush->pattern.info, brush->pattern.bits.ptr, 0 );
init_dib_info_from_bitmapinfo( &pattern, brush->pattern.info, brush->pattern.bits.ptr );
}
if (pattern.bit_count == 1 && !pattern.color_table)