user32: Move the bitmap header check as far up as possible.

Based on a patchset by Henri Verbeet.
This commit is contained in:
Andrew Riedi 2008-03-17 00:56:29 -07:00 committed by Alexandre Julliard
parent f629dc4eb6
commit 927875390d
1 changed files with 7 additions and 6 deletions

View File

@ -701,12 +701,6 @@ HICON WINAPI CreateIconFromResourceEx( LPBYTE bits, UINT cbSize,
hotspot = *pt; hotspot = *pt;
bmi = (BITMAPINFO *)(pt + 1); bmi = (BITMAPINFO *)(pt + 1);
} }
size = bitmap_info_size( bmi, DIB_RGB_COLORS );
if (!width) width = bmi->bmiHeader.biWidth;
if (!height) height = bmi->bmiHeader.biHeight/2;
DoStretch = (bmi->bmiHeader.biHeight/2 != height) ||
(bmi->bmiHeader.biWidth != width);
/* Check bitmap header */ /* Check bitmap header */
@ -718,6 +712,13 @@ HICON WINAPI CreateIconFromResourceEx( LPBYTE bits, UINT cbSize,
return 0; return 0;
} }
size = bitmap_info_size( bmi, DIB_RGB_COLORS );
if (!width) width = bmi->bmiHeader.biWidth;
if (!height) height = bmi->bmiHeader.biHeight/2;
DoStretch = (bmi->bmiHeader.biHeight/2 != height) ||
(bmi->bmiHeader.biWidth != width);
if (!screen_dc) screen_dc = CreateDCW( DISPLAYW, NULL, NULL, NULL ); if (!screen_dc) screen_dc = CreateDCW( DISPLAYW, NULL, NULL, NULL );
if (screen_dc) if (screen_dc)
{ {