Commit 664442ab authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 9968f308
...@@ -831,7 +831,7 @@ DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, ...@@ -831,7 +831,7 @@ DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ); BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
if (!bmp) return ERROR_INVALID_HANDLE; 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; ret = ERROR_OUTOFMEMORY;
goto done; goto done;
...@@ -934,7 +934,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info ...@@ -934,7 +934,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ); BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
if (!bmp) return ERROR_INVALID_HANDLE; 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; ret = ERROR_OUTOFMEMORY;
goto done; goto done;
...@@ -962,7 +962,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info ...@@ -962,7 +962,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
goto done; 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; src_dib.bits.is_copy = bits->is_copy;
if (!hbitmap) if (!hbitmap)
...@@ -1029,7 +1029,7 @@ DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_b ...@@ -1029,7 +1029,7 @@ DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_b
if (!bits) return ERROR_SUCCESS; if (!bits) return ERROR_SUCCESS;
if ((src->width != dst->width) || (src->height != dst->height)) return ERROR_TRANSFORM_NOT_SUPPORTED; 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; src_dib.bits.is_copy = bits->is_copy;
add_clipped_bounds( pdev, &dst->visrect, pdev->clip ); add_clipped_bounds( pdev, &dst->visrect, pdev->clip );
return blend_rect( &pdev->dib, &dst->visrect, &src_dib, &src->visrect, pdev->clip, blend ); 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 ...@@ -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), 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)); 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( &src_dib, src_info, src_bits );
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, 0 ); init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits );
/* v */ /* v */
ret = calc_1d_stretch_params( dst->y, dst->height, dst->visrect.top, dst->visrect.bottom, 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 ...@@ -1273,8 +1273,8 @@ DWORD blend_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitbl
{ {
dib_info src_dib, dst_dib; dib_info src_dib, dst_dib;
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits, 0 ); init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits );
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, default_color_table ); init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits );
return blend_rect( &dst_dib, &dst->visrect, &src_dib, &src->visrect, NULL, blend ); 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 ...@@ -1291,7 +1291,7 @@ DWORD gradient_bitmapinfo( const BITMAPINFO *info, void *bits, TRIVERTEX *vert_a
RECT rc; RECT rc;
DWORD ret = ERROR_SUCCESS; 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) switch (mode)
{ {
...@@ -1344,7 +1344,7 @@ COLORREF get_pixel_bitmapinfo( const BITMAPINFO *info, void *bits, struct bitblt ...@@ -1344,7 +1344,7 @@ COLORREF get_pixel_bitmapinfo( const BITMAPINFO *info, void *bits, struct bitblt
dib_info dib; dib_info dib;
DWORD pixel; 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 ); pixel = dib.funcs->get_pixel( &dib, src->x, src->y );
return dib.funcs->pixel_to_colorref( &dib, pixel ); return dib.funcs->pixel_to_colorref( &dib, pixel );
} }
......
...@@ -68,7 +68,7 @@ static void init_bit_fields(dib_info *dib, const DWORD *bit_fields) ...@@ -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, 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->bit_count = bi->biBitCount;
dib->width = bi->biWidth; dib->width = bi->biWidth;
...@@ -145,11 +145,6 @@ static void init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD ...@@ -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 = color_table;
dib->color_table_size = bi->biClrUsed; 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 else
{ {
dib->color_table = NULL; dib->color_table = NULL;
...@@ -157,12 +152,12 @@ static void init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD ...@@ -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 )) if (!is_bitmapobj_dib( bmp ))
{ {
...@@ -176,16 +171,15 @@ BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_f ...@@ -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 ); bmp->dib.dsBm.bmHeight * width_bytes );
if (!bmp->dib.dsBm.bmBits) return FALSE; 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, 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; return TRUE;
} }
static void clear_dib_info(dib_info *dib) static void clear_dib_info(dib_info *dib)
{ {
dib->color_table = NULL;
dib->bits.ptr = NULL; dib->bits.ptr = NULL;
dib->bits.free = NULL; dib->bits.free = NULL;
dib->bits.param = NULL; dib->bits.param = NULL;
...@@ -225,8 +219,8 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit ...@@ -225,8 +219,8 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
dib_info src_dib, dst_dib; dib_info src_dib, dst_dib;
DWORD ret; DWORD ret;
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_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, default_color_table ); init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits );
__TRY __TRY
{ {
...@@ -380,7 +374,7 @@ static HBITMAP dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap ) ...@@ -380,7 +374,7 @@ static HBITMAP dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
if (!bmp) return 0; 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 ); GDI_ReleaseObj( bitmap );
return 0; return 0;
......
...@@ -18,11 +18,6 @@ ...@@ -18,11 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
enum dib_info_flags
{
default_color_table = 1
};
typedef struct typedef struct
{ {
int bit_count, width, height; int bit_count, width, height;
...@@ -237,8 +232,8 @@ struct clipped_rects ...@@ -237,8 +232,8 @@ struct clipped_rects
extern void get_rop_codes(INT rop, struct rop_codes *codes) DECLSPEC_HIDDEN; 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 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 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, enum dib_info_flags flags) 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_dib_info(dib_info *dib) DECLSPEC_HIDDEN;
extern void free_pattern_brush(dib_brush *brush) 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; extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;
......
...@@ -558,7 +558,7 @@ BOOL render_aa_text_bitmapinfo( HDC hdc, BITMAPINFO *info, struct gdi_image_bits ...@@ -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 */ 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); fg = make_rgb_colorref( hdc, &dib, GetTextColor( hdc ), &got_pixel, &fg_pixel);
if (!got_pixel) fg_pixel = dib.funcs->colorref_to_pixel( &dib, fg ); if (!got_pixel) fg_pixel = dib.funcs->colorref_to_pixel( &dib, fg );
......
...@@ -1855,7 +1855,7 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL * ...@@ -1855,7 +1855,7 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *
BOOL ret; BOOL ret;
if (!bmp) return FALSE; 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 ); GDI_ReleaseObj( brush->pattern.bitmap );
if (!ret) return FALSE; if (!ret) return FALSE;
} }
...@@ -1863,12 +1863,12 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL * ...@@ -1863,12 +1863,12 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *
{ {
copy_bitmapinfo( info, brush->pattern.info ); copy_bitmapinfo( info, brush->pattern.info );
fill_color_table_from_pal_colors( info, pdev->dev.hdc ); 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; *needs_reselect = TRUE;
} }
else 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) if (pattern.bit_count == 1 && !pattern.color_table)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment