From f1f5f334687a90842acff555bdb987c901d59f6d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 31 Oct 2011 20:21:15 +0100 Subject: [PATCH] gdi32: Emulate DDB support using the DIB driver when the graphics driver doesn't support bitmaps. --- dlls/gdi32/bitmap.c | 11 +++-------- dlls/gdi32/dibdrv/dc.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index fe9deb78a6f..8aea89c5cb3 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -609,11 +609,7 @@ BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev ) set_initial_bitmap_bits( hbitmap, bitmap ); } } - else - { - WARN( "Trying to select bitmap %p in DC that doesn't support it\n", hbitmap ); - ret = FALSE; - } + else bitmap->funcs = &dib_driver; /* use the DIB driver to emulate DDB support */ } else { @@ -666,7 +662,8 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc ) if(old_physdev == dc->dibdrv) old_physdev = pop_dc_driver( &dc->physDev ); - if(bitmap->dib) + physdev = GET_DC_PHYSDEV( dc, pSelectBitmap ); + if (bitmap->dib || physdev->funcs == &null_driver) { physdev = dc->dibdrv; if (physdev) push_dc_driver( &dc->physDev, physdev, physdev->funcs ); @@ -676,8 +673,6 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc ) dc->dibdrv = physdev = dc->physDev; } } - else - physdev = GET_DC_PHYSDEV( dc, pSelectBitmap ); if (!BITMAP_SetOwnerDC( handle, physdev )) { diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index 0b67974e1e3..b312faba421 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -403,6 +403,14 @@ static BOOL dibdrv_DeleteDC( PHYSDEV dev ) return TRUE; } +/*********************************************************************** + * dibdrv_DeleteBitmap + */ +static BOOL dibdrv_DeleteBitmap( HBITMAP bitmap ) +{ + return TRUE; +} + /*********************************************************************** * dibdrv_SelectBitmap */ @@ -414,7 +422,6 @@ static HBITMAP dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap ) TRACE("(%p, %p)\n", dev, bitmap); if (!bmp) return 0; - assert(bmp->dib); free_dib_info(&pdev->dib); pdev->defer = 0; @@ -533,7 +540,7 @@ const struct gdi_dc_funcs dib_driver = NULL, /* pCreateCompatibleDC */ dibdrv_CreateDC, /* pCreateDC */ NULL, /* pCreateDIBSection */ - NULL, /* pDeleteBitmap */ + dibdrv_DeleteBitmap, /* pDeleteBitmap */ dibdrv_DeleteDC, /* pDeleteDC */ NULL, /* pDeleteObject */ NULL, /* pDescribePixelFormat */