mirror of
https://github.com/reactos/reactos.git
synced 2024-11-11 01:04:11 +00:00
[USER32]
- Use Screen capabilities to create icons bitmaps. svn path=/branches/reactos-yarotows/; revision=48673
This commit is contained in:
parent
00b7f54d2e
commit
7b457ade67
1 changed files with 10 additions and 4 deletions
|
@ -458,10 +458,16 @@ static BOOL create_icon_bitmaps( const BITMAPINFO *bmi, int width, int height,
|
|||
void *color_bits, *mask_bits;
|
||||
BOOL ret = FALSE;
|
||||
HDC hdc = 0;
|
||||
static HDC hScreenDC = 0;
|
||||
|
||||
if (!(info = HeapAlloc( GetProcessHeap(), 0, max( size, FIELD_OFFSET( BITMAPINFO, bmiColors[2] )))))
|
||||
return FALSE;
|
||||
if (!(hdc = CreateCompatibleDC( 0 ))) goto done;
|
||||
if(!hScreenDC)
|
||||
{
|
||||
hScreenDC = GetDC(0);
|
||||
if(!hScreenDC) goto done;
|
||||
}
|
||||
if (!(hdc = CreateCompatibleDC(hScreenDC))) goto done;
|
||||
|
||||
memcpy( info, bmi, size );
|
||||
info->bmiHeader.biHeight /= 2;
|
||||
|
@ -485,8 +491,8 @@ static BOOL create_icon_bitmaps( const BITMAPINFO *bmi, int width, int height,
|
|||
else
|
||||
{
|
||||
if (!(*mask = CreateBitmap( width, height, 1, 1, NULL ))) goto done;
|
||||
if (!(*color = CreateBitmap( width, height, bmi->bmiHeader.biPlanes,
|
||||
bmi->bmiHeader.biBitCount, NULL )))
|
||||
if (!(*color = CreateBitmap( width, height, GetDeviceCaps(hScreenDC, PLANES),
|
||||
GetDeviceCaps(hScreenDC, BITSPIXEL), NULL )))
|
||||
{
|
||||
DeleteObject( *mask );
|
||||
goto done;
|
||||
|
@ -523,7 +529,7 @@ static BOOL create_icon_bitmaps( const BITMAPINFO *bmi, int width, int height,
|
|||
ret = TRUE;
|
||||
|
||||
done:
|
||||
DeleteDC( hdc );
|
||||
if(hdc) DeleteDC( hdc );
|
||||
HeapFree( GetProcessHeap(), 0, info );
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue