Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ab4a5a32
Commit
ab4a5a32
authored
Jan 28, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Propagate the LoadImage flags into the low-level loader functions.
parent
6e077e0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
25 deletions
+26
-25
cursoricon.c
dlls/user32/cursoricon.c
+26
-25
No files found.
dlls/user32/cursoricon.c
View file @
ab4a5a32
...
...
@@ -413,7 +413,7 @@ typedef BOOL (*fnGetCIEntry)( LPCVOID dir, int n,
* Find the icon closest to the requested size and bit depth.
*/
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
;
UINT
iTotalDiff
,
iXDiff
=
0
,
iYDiff
=
0
,
iColorDiff
;
...
...
@@ -475,7 +475,7 @@ static BOOL CURSORICON_GetResIconEntry( LPCVOID dir, int n,
* FIXME: parameter 'color' ignored.
*/
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
;
...
...
@@ -530,22 +530,24 @@ static BOOL CURSORICON_GetResCursorEntry( LPCVOID dir, int n,
}
static
const
CURSORICONDIRENTRY
*
CURSORICON_FindBestIconRes
(
const
CURSORICONDIR
*
dir
,
int
width
,
int
height
,
int
depth
)
int
width
,
int
height
,
int
depth
,
UINT
loadflags
)
{
int
n
;
n
=
CURSORICON_FindBestIcon
(
dir
,
CURSORICON_GetResIconEntry
,
width
,
height
,
depth
);
width
,
height
,
depth
,
loadflags
);
if
(
n
<
0
)
return
NULL
;
return
&
dir
->
idEntries
[
n
];
}
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
,
width
,
height
,
depth
);
width
,
height
,
depth
,
loadflags
);
if
(
n
<
0
)
return
NULL
;
return
&
dir
->
idEntries
[
n
];
...
...
@@ -570,20 +572,22 @@ static BOOL CURSORICON_GetFileEntry( LPCVOID dir, int n,
}
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
,
width
,
height
,
depth
);
int
n
=
CURSORICON_FindBestCursor
(
dir
,
CURSORICON_GetFileEntry
,
width
,
height
,
depth
,
loadflags
);
if
(
n
<
0
)
return
NULL
;
return
&
dir
->
idEntries
[
n
];
}
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
,
width
,
height
,
depth
);
int
n
=
CURSORICON_FindBestIcon
(
dir
,
CURSORICON_GetFileEntry
,
width
,
height
,
depth
,
loadflags
);
if
(
n
<
0
)
return
NULL
;
return
&
dir
->
idEntries
[
n
];
...
...
@@ -945,7 +949,7 @@ static void riff_find_chunk( DWORD chunk_id, DWORD chunk_type, const riff_chunk_
* \- CHUNK:icon
*/
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
;
ani_header
header
=
{
0
};
...
...
@@ -1003,7 +1007,7 @@ static HCURSOR CURSORICON_CreateIconFromANI( const LPBYTE bits, DWORD bits_size,
const
BITMAPINFO
*
bmi
;
entry
=
CURSORICON_FindBestIconFile
((
const
CURSORICONFILEDIR
*
)
icon_data
,
width
,
height
,
depth
);
width
,
height
,
depth
,
loadflags
);
bmi
=
(
const
BITMAPINFO
*
)
(
icon_data
+
entry
->
dwDIBOffset
);
info
->
hotspot
.
x
=
entry
->
xHotspot
;
...
...
@@ -1131,8 +1135,7 @@ static HICON CURSORICON_LoadFromFile( LPCWSTR filename,
/* Check for .ani. */
if
(
memcmp
(
bits
,
"RIFF"
,
4
)
==
0
)
{
hIcon
=
CURSORICON_CreateIconFromANI
(
bits
,
filesize
,
width
,
height
,
depth
);
hIcon
=
CURSORICON_CreateIconFromANI
(
bits
,
filesize
,
width
,
height
,
depth
,
loadflags
);
goto
end
;
}
...
...
@@ -1144,9 +1147,9 @@ static HICON CURSORICON_LoadFromFile( LPCWSTR filename,
goto
end
;
if
(
fCursor
)
entry
=
CURSORICON_FindBestCursorFile
(
dir
,
width
,
height
,
depth
);
entry
=
CURSORICON_FindBestCursorFile
(
dir
,
width
,
height
,
depth
,
loadflags
);
else
entry
=
CURSORICON_FindBestIconFile
(
dir
,
width
,
height
,
depth
);
entry
=
CURSORICON_FindBestIconFile
(
dir
,
width
,
height
,
depth
,
loadflags
);
if
(
!
entry
)
goto
end
;
...
...
@@ -1207,9 +1210,9 @@ static HICON CURSORICON_Load(HINSTANCE hInstance, LPCWSTR name,
if
(
!
(
handle
=
LoadResource
(
hInstance
,
hRsrc
)))
return
0
;
if
(
!
(
dir
=
LockResource
(
handle
)))
return
0
;
if
(
fCursor
)
dirEntry
=
CURSORICON_FindBestCursorRes
(
dir
,
width
,
height
,
depth
);
dirEntry
=
CURSORICON_FindBestCursorRes
(
dir
,
width
,
height
,
depth
,
loadflags
);
else
dirEntry
=
CURSORICON_FindBestIconRes
(
dir
,
width
,
height
,
depth
);
dirEntry
=
CURSORICON_FindBestIconRes
(
dir
,
width
,
height
,
depth
,
loadflags
);
if
(
!
dirEntry
)
return
0
;
wResId
=
dirEntry
->
wResId
;
FreeResource
(
handle
);
...
...
@@ -1548,9 +1551,9 @@ INT WINAPI LookupIconIdFromDirectoryEx( LPBYTE xdir, BOOL bIcon,
ReleaseDC
(
0
,
hdc
);
if
(
bIcon
)
entry
=
CURSORICON_FindBestIconRes
(
dir
,
width
,
height
,
depth
);
entry
=
CURSORICON_FindBestIconRes
(
dir
,
width
,
height
,
depth
,
LR_DEFAULTSIZE
);
else
entry
=
CURSORICON_FindBestCursorRes
(
dir
,
width
,
height
,
depth
);
entry
=
CURSORICON_FindBestCursorRes
(
dir
,
width
,
height
,
depth
,
LR_DEFAULTSIZE
);
if
(
entry
)
retVal
=
entry
->
wResId
;
}
...
...
@@ -1563,9 +1566,7 @@ INT WINAPI LookupIconIdFromDirectoryEx( LPBYTE xdir, BOOL bIcon,
*/
INT
WINAPI
LookupIconIdFromDirectory
(
LPBYTE
dir
,
BOOL
bIcon
)
{
return
LookupIconIdFromDirectoryEx
(
dir
,
bIcon
,
bIcon
?
GetSystemMetrics
(
SM_CXICON
)
:
GetSystemMetrics
(
SM_CXCURSOR
),
bIcon
?
GetSystemMetrics
(
SM_CYICON
)
:
GetSystemMetrics
(
SM_CYCURSOR
),
bIcon
?
0
:
LR_MONOCHROME
);
return
LookupIconIdFromDirectoryEx
(
dir
,
bIcon
,
0
,
0
,
bIcon
?
0
:
LR_MONOCHROME
);
}
/***********************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment