user32: Propagate the LoadImage flags into the low-level loader functions.
This commit is contained in:
parent
6e077e0bc0
commit
ab4a5a327d
|
@ -413,7 +413,7 @@ typedef BOOL (*fnGetCIEntry)( LPCVOID dir, int n,
|
||||||
* Find the icon closest to the requested size and bit depth.
|
* Find the icon closest to the requested size and bit depth.
|
||||||
*/
|
*/
|
||||||
static int CURSORICON_FindBestIcon( LPCVOID dir, fnGetCIEntry get_entry,
|
static int CURSORICON_FindBestIcon( LPCVOID dir, fnGetCIEntry get_entry,
|
||||||
int width, int height, int depth )
|
int width, int height, int depth, UINT loadflags )
|
||||||
{
|
{
|
||||||
int i, cx, cy, bits, bestEntry = -1;
|
int i, cx, cy, bits, bestEntry = -1;
|
||||||
UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff;
|
UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff;
|
||||||
|
@ -475,7 +475,7 @@ static BOOL CURSORICON_GetResIconEntry( LPCVOID dir, int n,
|
||||||
* FIXME: parameter 'color' ignored.
|
* FIXME: parameter 'color' ignored.
|
||||||
*/
|
*/
|
||||||
static int CURSORICON_FindBestCursor( LPCVOID dir, fnGetCIEntry get_entry,
|
static int CURSORICON_FindBestCursor( LPCVOID dir, fnGetCIEntry get_entry,
|
||||||
int width, int height, int depth )
|
int width, int height, int depth, UINT loadflags )
|
||||||
{
|
{
|
||||||
int i, maxwidth, maxheight, cx, cy, bits, bestEntry = -1;
|
int i, maxwidth, maxheight, cx, cy, bits, bestEntry = -1;
|
||||||
|
|
||||||
|
@ -530,22 +530,24 @@ static BOOL CURSORICON_GetResCursorEntry( LPCVOID dir, int n,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const CURSORICONDIRENTRY *CURSORICON_FindBestIconRes( const CURSORICONDIR * dir,
|
static const CURSORICONDIRENTRY *CURSORICON_FindBestIconRes( const CURSORICONDIR * dir,
|
||||||
int width, int height, int depth )
|
int width, int height, int depth,
|
||||||
|
UINT loadflags )
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = CURSORICON_FindBestIcon( dir, CURSORICON_GetResIconEntry,
|
n = CURSORICON_FindBestIcon( dir, CURSORICON_GetResIconEntry,
|
||||||
width, height, depth );
|
width, height, depth, loadflags );
|
||||||
if ( n < 0 )
|
if ( n < 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
return &dir->idEntries[n];
|
return &dir->idEntries[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
static const CURSORICONDIRENTRY *CURSORICON_FindBestCursorRes( const CURSORICONDIR *dir,
|
static const CURSORICONDIRENTRY *CURSORICON_FindBestCursorRes( const CURSORICONDIR *dir,
|
||||||
int width, int height, int depth )
|
int width, int height, int depth,
|
||||||
|
UINT loadflags )
|
||||||
{
|
{
|
||||||
int n = CURSORICON_FindBestCursor( dir, CURSORICON_GetResCursorEntry,
|
int n = CURSORICON_FindBestCursor( dir, CURSORICON_GetResCursorEntry,
|
||||||
width, height, depth );
|
width, height, depth, loadflags );
|
||||||
if ( n < 0 )
|
if ( n < 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
return &dir->idEntries[n];
|
return &dir->idEntries[n];
|
||||||
|
@ -570,20 +572,22 @@ static BOOL CURSORICON_GetFileEntry( LPCVOID dir, int n,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const CURSORICONFILEDIRENTRY *CURSORICON_FindBestCursorFile( const CURSORICONFILEDIR *dir,
|
static const CURSORICONFILEDIRENTRY *CURSORICON_FindBestCursorFile( const CURSORICONFILEDIR *dir,
|
||||||
int width, int height, int depth )
|
int width, int height, int depth,
|
||||||
|
UINT loadflags )
|
||||||
{
|
{
|
||||||
int n = CURSORICON_FindBestCursor( (LPCVOID) dir, CURSORICON_GetFileEntry,
|
int n = CURSORICON_FindBestCursor( dir, CURSORICON_GetFileEntry,
|
||||||
width, height, depth );
|
width, height, depth, loadflags );
|
||||||
if ( n < 0 )
|
if ( n < 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
return &dir->idEntries[n];
|
return &dir->idEntries[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
static const CURSORICONFILEDIRENTRY *CURSORICON_FindBestIconFile( const CURSORICONFILEDIR *dir,
|
static const CURSORICONFILEDIRENTRY *CURSORICON_FindBestIconFile( const CURSORICONFILEDIR *dir,
|
||||||
int width, int height, int depth )
|
int width, int height, int depth,
|
||||||
|
UINT loadflags )
|
||||||
{
|
{
|
||||||
int n = CURSORICON_FindBestIcon((LPCVOID) dir, CURSORICON_GetFileEntry,
|
int n = CURSORICON_FindBestIcon( dir, CURSORICON_GetFileEntry,
|
||||||
width, height, depth );
|
width, height, depth, loadflags );
|
||||||
if ( n < 0 )
|
if ( n < 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
return &dir->idEntries[n];
|
return &dir->idEntries[n];
|
||||||
|
@ -945,7 +949,7 @@ static void riff_find_chunk( DWORD chunk_id, DWORD chunk_type, const riff_chunk_
|
||||||
* \- CHUNK:icon
|
* \- CHUNK:icon
|
||||||
*/
|
*/
|
||||||
static HCURSOR CURSORICON_CreateIconFromANI( const LPBYTE bits, DWORD bits_size,
|
static HCURSOR CURSORICON_CreateIconFromANI( const LPBYTE bits, DWORD bits_size,
|
||||||
INT width, INT height, INT depth )
|
INT width, INT height, INT depth, UINT loadflags )
|
||||||
{
|
{
|
||||||
struct cursoricon_object *info;
|
struct cursoricon_object *info;
|
||||||
ani_header header = {0};
|
ani_header header = {0};
|
||||||
|
@ -1003,7 +1007,7 @@ static HCURSOR CURSORICON_CreateIconFromANI( const LPBYTE bits, DWORD bits_size,
|
||||||
const BITMAPINFO *bmi;
|
const BITMAPINFO *bmi;
|
||||||
|
|
||||||
entry = CURSORICON_FindBestIconFile((const CURSORICONFILEDIR *) icon_data,
|
entry = CURSORICON_FindBestIconFile((const CURSORICONFILEDIR *) icon_data,
|
||||||
width, height, depth );
|
width, height, depth, loadflags );
|
||||||
|
|
||||||
bmi = (const BITMAPINFO *) (icon_data + entry->dwDIBOffset);
|
bmi = (const BITMAPINFO *) (icon_data + entry->dwDIBOffset);
|
||||||
info->hotspot.x = entry->xHotspot;
|
info->hotspot.x = entry->xHotspot;
|
||||||
|
@ -1131,8 +1135,7 @@ static HICON CURSORICON_LoadFromFile( LPCWSTR filename,
|
||||||
/* Check for .ani. */
|
/* Check for .ani. */
|
||||||
if (memcmp( bits, "RIFF", 4 ) == 0)
|
if (memcmp( bits, "RIFF", 4 ) == 0)
|
||||||
{
|
{
|
||||||
hIcon = CURSORICON_CreateIconFromANI( bits, filesize, width, height,
|
hIcon = CURSORICON_CreateIconFromANI( bits, filesize, width, height, depth, loadflags );
|
||||||
depth );
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1144,9 +1147,9 @@ static HICON CURSORICON_LoadFromFile( LPCWSTR filename,
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if ( fCursor )
|
if ( fCursor )
|
||||||
entry = CURSORICON_FindBestCursorFile( dir, width, height, depth );
|
entry = CURSORICON_FindBestCursorFile( dir, width, height, depth, loadflags );
|
||||||
else
|
else
|
||||||
entry = CURSORICON_FindBestIconFile( dir, width, height, depth );
|
entry = CURSORICON_FindBestIconFile( dir, width, height, depth, loadflags );
|
||||||
|
|
||||||
if ( !entry )
|
if ( !entry )
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -1207,9 +1210,9 @@ static HICON CURSORICON_Load(HINSTANCE hInstance, LPCWSTR name,
|
||||||
if (!(handle = LoadResource( hInstance, hRsrc ))) return 0;
|
if (!(handle = LoadResource( hInstance, hRsrc ))) return 0;
|
||||||
if (!(dir = LockResource( handle ))) return 0;
|
if (!(dir = LockResource( handle ))) return 0;
|
||||||
if (fCursor)
|
if (fCursor)
|
||||||
dirEntry = CURSORICON_FindBestCursorRes( dir, width, height, depth );
|
dirEntry = CURSORICON_FindBestCursorRes( dir, width, height, depth, loadflags );
|
||||||
else
|
else
|
||||||
dirEntry = CURSORICON_FindBestIconRes( dir, width, height, depth );
|
dirEntry = CURSORICON_FindBestIconRes( dir, width, height, depth, loadflags );
|
||||||
if (!dirEntry) return 0;
|
if (!dirEntry) return 0;
|
||||||
wResId = dirEntry->wResId;
|
wResId = dirEntry->wResId;
|
||||||
FreeResource( handle );
|
FreeResource( handle );
|
||||||
|
@ -1548,9 +1551,9 @@ INT WINAPI LookupIconIdFromDirectoryEx( LPBYTE xdir, BOOL bIcon,
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(0, hdc);
|
||||||
|
|
||||||
if( bIcon )
|
if( bIcon )
|
||||||
entry = CURSORICON_FindBestIconRes( dir, width, height, depth );
|
entry = CURSORICON_FindBestIconRes( dir, width, height, depth, LR_DEFAULTSIZE );
|
||||||
else
|
else
|
||||||
entry = CURSORICON_FindBestCursorRes( dir, width, height, depth );
|
entry = CURSORICON_FindBestCursorRes( dir, width, height, depth, LR_DEFAULTSIZE );
|
||||||
|
|
||||||
if( entry ) retVal = entry->wResId;
|
if( entry ) retVal = entry->wResId;
|
||||||
}
|
}
|
||||||
|
@ -1563,9 +1566,7 @@ INT WINAPI LookupIconIdFromDirectoryEx( LPBYTE xdir, BOOL bIcon,
|
||||||
*/
|
*/
|
||||||
INT WINAPI LookupIconIdFromDirectory( LPBYTE dir, BOOL bIcon )
|
INT WINAPI LookupIconIdFromDirectory( LPBYTE dir, BOOL bIcon )
|
||||||
{
|
{
|
||||||
return LookupIconIdFromDirectoryEx( dir, bIcon,
|
return LookupIconIdFromDirectoryEx( dir, bIcon, 0, 0, bIcon ? 0 : LR_MONOCHROME );
|
||||||
bIcon ? GetSystemMetrics(SM_CXICON) : GetSystemMetrics(SM_CXCURSOR),
|
|
||||||
bIcon ? GetSystemMetrics(SM_CYICON) : GetSystemMetrics(SM_CYCURSOR), bIcon ? 0 : LR_MONOCHROME );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
Loading…
Reference in New Issue