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
393ec970
Commit
393ec970
authored
May 07, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Added a helper to get screen dc.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9ee82b94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
cursoricon.c
dlls/user32/cursoricon.c
+21
-11
No files found.
dlls/user32/cursoricon.c
View file @
393ec970
...
...
@@ -48,10 +48,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(cursor);
WINE_DECLARE_DEBUG_CHANNEL
(
icon
);
WINE_DECLARE_DEBUG_CHANNEL
(
resource
);
static
HDC
screen_dc
;
static
const
WCHAR
DISPLAYW
[]
=
{
'D'
,
'I'
,
'S'
,
'P'
,
'L'
,
'A'
,
'Y'
,
0
};
static
struct
list
icon_cache
=
LIST_INIT
(
icon_cache
);
/**********************************************************************
...
...
@@ -96,6 +92,17 @@ struct animated_cursoricon_object
HICON
frames
[
1
];
/* list of animated cursor frames */
};
static
HDC
get_screen_dc
(
void
)
{
static
const
WCHAR
DISPLAYW
[]
=
{
'D'
,
'I'
,
'S'
,
'P'
,
'L'
,
'A'
,
'Y'
,
0
};
static
HDC
screen_dc
;
if
(
!
screen_dc
)
screen_dc
=
CreateDCW
(
DISPLAYW
,
NULL
,
NULL
,
NULL
);
return
screen_dc
;
}
static
HICON
alloc_icon_handle
(
BOOL
is_ani
,
UINT
num_steps
)
{
struct
cursoricon_object
*
obj
;
...
...
@@ -792,6 +799,7 @@ static HICON create_icon_from_bmi( const BITMAPINFO *bmi, DWORD maxsize, HMODULE
BOOL
ret
=
FALSE
;
BOOL
do_stretch
;
HICON
hObj
=
0
;
HDC
screen_dc
;
HDC
hdc
=
0
;
LONG
bmi_width
,
bmi_height
;
WORD
bpp
;
...
...
@@ -855,8 +863,7 @@ static HICON create_icon_from_bmi( const BITMAPINFO *bmi, DWORD maxsize, HMODULE
hotspot
.
y
=
(
hotspot
.
y
*
height
)
/
(
bmi_height
/
2
);
}
if
(
!
screen_dc
)
screen_dc
=
CreateDCW
(
DISPLAYW
,
NULL
,
NULL
,
NULL
);
if
(
!
screen_dc
)
return
0
;
if
(
!
(
screen_dc
=
get_screen_dc
()))
return
0
;
if
(
!
(
bmi_copy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
max
(
size
,
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
2
]
)))))
return
0
;
...
...
@@ -2149,7 +2156,7 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
height
=
bmpXor
.
bmHeight
;
if
(
bmpXor
.
bmPlanes
*
bmpXor
.
bmBitsPixel
!=
1
||
bmpAnd
.
bmPlanes
*
bmpAnd
.
bmBitsPixel
!=
1
)
{
color
=
CreateCompatibleBitmap
(
screen_dc
,
width
,
height
);
color
=
CreateCompatibleBitmap
(
get_screen_dc
()
,
width
,
height
);
mask
=
CreateBitmap
(
width
,
height
,
1
,
1
,
NULL
);
}
else
mask
=
CreateBitmap
(
width
,
height
*
2
,
1
,
1
,
NULL
);
...
...
@@ -2479,6 +2486,7 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name,
DWORD
compr_dummy
,
offbits
=
0
;
INT
bm_type
;
HDC
screen_mem_dc
=
NULL
;
HDC
screen_dc
;
if
(
!
(
loadflags
&
LR_LOADFROMFILE
))
{
...
...
@@ -2558,7 +2566,7 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name,
if
(
new_height
<
0
)
new_height
=
-
new_height
;
if
(
!
screen_dc
)
screen_dc
=
CreateDCW
(
DISPLAYW
,
NULL
,
NULL
,
NULL
);
screen_dc
=
get_screen_dc
(
);
if
(
!
(
screen_mem_dc
=
CreateCompatibleDC
(
screen_dc
)))
goto
end
;
bits
=
(
char
*
)
info
+
(
offbits
?
offbits
:
size
);
...
...
@@ -2654,8 +2662,10 @@ HANDLE WINAPI LoadImageW( HINSTANCE hinst, LPCWSTR name, UINT type,
depth
=
1
;
if
(
!
(
loadflags
&
LR_MONOCHROME
))
{
if
(
!
screen_dc
)
screen_dc
=
CreateDCW
(
DISPLAYW
,
NULL
,
NULL
,
NULL
);
if
(
screen_dc
)
depth
=
GetDeviceCaps
(
screen_dc
,
BITSPIXEL
);
HDC
screen_dc
;
if
((
screen_dc
=
get_screen_dc
()))
depth
=
GetDeviceCaps
(
screen_dc
,
BITSPIXEL
);
}
return
CURSORICON_Load
(
hinst
,
name
,
desiredx
,
desiredy
,
depth
,
(
type
==
IMAGE_CURSOR
),
loadflags
);
}
...
...
@@ -2879,7 +2889,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx,
{
struct
cursoricon_object
*
icon
;
HICON
res
=
0
;
int
depth
=
(
flags
&
LR_MONOCHROME
)
?
1
:
GetDeviceCaps
(
screen_dc
,
BITSPIXEL
);
int
depth
=
(
flags
&
LR_MONOCHROME
)
?
1
:
GetDeviceCaps
(
get_screen_dc
()
,
BITSPIXEL
);
if
(
flags
&
LR_DEFAULTSIZE
)
{
...
...
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