gdi32: Check that the bitmap depth matches the DC when selecting it.

oldstable
Alexandre Julliard 2012-05-25 11:19:36 +02:00
parent fdc4682e31
commit 294faf5ef3
1 changed files with 9 additions and 0 deletions

View File

@ -507,6 +507,15 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
goto done;
}
if (bitmap->dib.dsBm.bmBitsPixel != 1 &&
bitmap->dib.dsBm.bmBitsPixel != GetDeviceCaps( hdc, BITSPIXEL ))
{
WARN( "Wrong format bitmap %u bpp\n", bitmap->dib.dsBm.bmBitsPixel );
GDI_ReleaseObj( handle );
ret = 0;
goto done;
}
if (dc->dibdrv) old_physdev = pop_dc_driver( dc, dc->dibdrv );
physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );