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
76fb69bf
Commit
76fb69bf
authored
Jan 28, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Fix LoadImage behavior with zero size and no LR_DEFAULTSIZE.
Based on a patch by Marcus Meissner.
parent
ab4a5a32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
12 deletions
+36
-12
cursoricon.c
dlls/user32/cursoricon.c
+36
-12
No files found.
dlls/user32/cursoricon.c
View file @
76fb69bf
...
...
@@ -422,7 +422,20 @@ static int CURSORICON_FindBestIcon( LPCVOID dir, fnGetCIEntry get_entry,
/* Find Best Fit */
iTotalDiff
=
0xFFFFFFFF
;
iColorDiff
=
0xFFFFFFFF
;
for
(
i
=
0
;
get_entry
(
dir
,
i
,
&
cx
,
&
cy
,
&
bits
);
i
++
)
if
(
loadflags
&
LR_DEFAULTSIZE
)
{
if
(
!
width
)
width
=
GetSystemMetrics
(
SM_CXICON
);
if
(
!
height
)
height
=
GetSystemMetrics
(
SM_CYICON
);
}
else
if
(
!
width
&&
!
height
)
{
/* use the size of the first entry */
if
(
!
get_entry
(
dir
,
0
,
&
width
,
&
height
,
&
bits
))
return
-
1
;
iTotalDiff
=
0
;
}
for
(
i
=
0
;
iTotalDiff
&&
get_entry
(
dir
,
i
,
&
cx
,
&
cy
,
&
bits
);
i
++
)
{
iTempXDiff
=
abs
(
width
-
cx
);
iTempYDiff
=
abs
(
height
-
cy
);
...
...
@@ -479,6 +492,18 @@ static int CURSORICON_FindBestCursor( LPCVOID dir, fnGetCIEntry get_entry,
{
int
i
,
maxwidth
,
maxheight
,
cx
,
cy
,
bits
,
bestEntry
=
-
1
;
if
(
loadflags
&
LR_DEFAULTSIZE
)
{
if
(
!
width
)
width
=
GetSystemMetrics
(
SM_CXCURSOR
);
if
(
!
height
)
height
=
GetSystemMetrics
(
SM_CYCURSOR
);
}
else
if
(
!
width
&&
!
height
)
{
/* use the first entry */
if
(
!
get_entry
(
dir
,
0
,
&
width
,
&
height
,
&
bits
))
return
-
1
;
return
0
;
}
/* Double height to account for AND and XOR masks */
height
*=
2
;
...
...
@@ -782,8 +807,16 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi, HMODULE module, LPCW
return
0
;
}
if
(
!
width
)
width
=
bmi
->
bmiHeader
.
biWidth
;
if
(
!
height
)
height
=
bmi
->
bmiHeader
.
biHeight
/
2
;
if
(
cFlag
&
LR_DEFAULTSIZE
)
{
if
(
!
width
)
width
=
GetSystemMetrics
(
bIcon
?
SM_CXICON
:
SM_CXCURSOR
);
if
(
!
height
)
height
=
GetSystemMetrics
(
bIcon
?
SM_CYICON
:
SM_CYCURSOR
);
}
else
{
if
(
!
width
)
width
=
bmi
->
bmiHeader
.
biWidth
;
if
(
!
height
)
height
=
bmi
->
bmiHeader
.
biHeight
/
2
;
}
do_stretch
=
(
bmi
->
bmiHeader
.
biHeight
/
2
!=
height
)
||
(
bmi
->
bmiHeader
.
biWidth
!=
width
);
...
...
@@ -2274,15 +2307,6 @@ HANDLE WINAPI LoadImageW( HINSTANCE hinst, LPCWSTR name, UINT type,
TRACE_
(
resource
)(
"(%p,%s,%d,%d,%d,0x%08x)
\n
"
,
hinst
,
debugstr_w
(
name
),
type
,
desiredx
,
desiredy
,
loadflags
);
if
(
loadflags
&
LR_DEFAULTSIZE
)
{
if
(
type
==
IMAGE_ICON
)
{
if
(
!
desiredx
)
desiredx
=
GetSystemMetrics
(
SM_CXICON
);
if
(
!
desiredy
)
desiredy
=
GetSystemMetrics
(
SM_CYICON
);
}
else
if
(
type
==
IMAGE_CURSOR
)
{
if
(
!
desiredx
)
desiredx
=
GetSystemMetrics
(
SM_CXCURSOR
);
if
(
!
desiredy
)
desiredy
=
GetSystemMetrics
(
SM_CYCURSOR
);
}
}
if
(
loadflags
&
LR_LOADFROMFILE
)
loadflags
&=
~
LR_SHARED
;
switch
(
type
)
{
case
IMAGE_BITMAP
:
...
...
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