Commit 79ef408c authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Add a helper function to initialize DIB info from a bitmap object.

parent a13df5ce
......@@ -621,10 +621,7 @@ DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
if (!bmp) return ERROR_INVALID_HANDLE;
assert(bmp->dib);
if (!init_dib_info( &stand_alone, &bmp->dib->dsBmih, bmp->dib->dsBitfields,
bmp->color_table, bmp->nb_colors, bmp->dib->dsBm.bmBits, 0 ))
if (!init_dib_info_from_bitmapobj( &stand_alone, bmp, 0 ))
{
ret = ERROR_BAD_FORMAT;
goto done;
......@@ -722,10 +719,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;
assert(bmp->dib);
if (!init_dib_info( &stand_alone, &bmp->dib->dsBmih, bmp->dib->dsBitfields,
bmp->color_table, bmp->nb_colors, bmp->dib->dsBm.bmBits, 0 ))
if (!init_dib_info_from_bitmapobj( &stand_alone, bmp, 0 ))
{
ret = ERROR_BAD_FORMAT;
goto done;
......
......@@ -211,6 +211,13 @@ BOOL init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *
return init_dib_info( dib, &info->bmiHeader, bitfields, colors ? colorptr : NULL, colors, bits, flags );
}
BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags)
{
assert(bmp->dib);
return init_dib_info( dib, &bmp->dib->dsBmih, bmp->dib->dsBitfields,
bmp->color_table, bmp->nb_colors, bmp->dib->dsBm.bmBits, flags );
}
static void clear_dib_info(dib_info *dib)
{
dib->color_table = NULL;
......@@ -368,8 +375,7 @@ static HBITMAP dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
clear_dib_info(&pdev->brush_dib);
pdev->brush_and_bits = pdev->brush_xor_bits = NULL;
if(!init_dib_info(&pdev->dib, &bmp->dib->dsBmih, bmp->dib->dsBitfields,
bmp->color_table, bmp->nb_colors, bmp->dib->dsBm.bmBits, private_color_table))
if(!init_dib_info_from_bitmapobj(&pdev->dib, bmp, private_color_table))
pdev->defer |= DEFER_FORMAT;
GDI_ReleaseObj( bitmap );
......
......@@ -80,6 +80,7 @@ extern BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
extern BOOL init_dib_info_from_packed(dib_info *dib, const BITMAPINFOHEADER *bi, WORD usage, HPALETTE pal) DECLSPEC_HIDDEN;
extern BOOL 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 free_dib_info(dib_info *dib) DECLSPEC_HIDDEN;
extern void free_pattern_brush(dibdrv_physdev *pdev) DECLSPEC_HIDDEN;
extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;
......
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