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
e6069c25
Commit
e6069c25
authored
Oct 25, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Test device context type in BindDC().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
ffbe1e62
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
4 deletions
+45
-4
dc_render_target.c
dlls/d2d1/dc_render_target.c
+3
-1
d2d1.c
dlls/d2d1/tests/d2d1.c
+42
-3
No files found.
dlls/d2d1/dc_render_target.c
View file @
e6069c25
...
...
@@ -689,11 +689,13 @@ static HRESULT STDMETHODCALLTYPE d2d_dc_render_target_BindDC(ID2D1DCRenderTarget
ID2D1DeviceContext
*
context
;
D2D1_SIZE_U
bitmap_size
;
ID2D1Bitmap
*
bitmap
;
DWORD
obj_type
;
HRESULT
hr
;
TRACE
(
"iface %p, hdc %p, rect %s.
\n
"
,
iface
,
hdc
,
wine_dbgstr_rect
(
rect
));
if
(
!
hdc
)
obj_type
=
GetObjectType
(
hdc
);
if
(
obj_type
!=
OBJ_DC
&&
obj_type
!=
OBJ_ENHMETADC
&&
obj_type
!=
OBJ_MEMDC
)
return
E_INVALIDARG
;
/* Switch dxgi target to new surface. */
...
...
dlls/d2d1/tests/d2d1.c
View file @
e6069c25
...
...
@@ -5825,15 +5825,18 @@ static void test_dc_target(BOOL d3d11)
ID2D1Factory
*
factory
;
FLOAT
dpi_x
,
dpi_y
;
D2D1_COLOR_F
color
;
HENHMETAFILE
hemf
;
D2D1_SIZE_U
sizeu
;
D2D1_SIZE_F
size
;
D2D1_TAG
t1
,
t2
;
unsigned
int
i
;
HDC
hdc
,
hdc2
;
HMETAFILE
hmf
;
D2D_RECT_F
r
;
COLORREF
clr
;
HRESULT
hr
;
RECT
rect
;
HWND
hwnd
;
if
(
!
init_test_context
(
&
ctx
,
d3d11
))
return
;
...
...
@@ -5997,7 +6000,7 @@ static void test_dc_target(BOOL d3d11)
/* Invalid DC. */
hr
=
ID2D1DCRenderTarget_BindDC
(
rt
,
(
HDC
)
0xdeadbeef
,
&
rect
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ID2D1DCRenderTarget_BeginDraw
(
rt
);
...
...
@@ -6008,7 +6011,7 @@ static void test_dc_target(BOOL d3d11)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
clr
=
GetPixel
(
hdc2
,
0
,
0
);
todo_wine
ok
(
clr
==
RGB
(
255
,
0
,
0
),
"Got unexpected colour 0x%08lx.
\n
"
,
clr
);
ok
(
clr
==
RGB
(
255
,
0
,
0
),
"Got unexpected colour 0x%08lx.
\n
"
,
clr
);
hr
=
ID2D1DCRenderTarget_BindDC
(
rt
,
NULL
,
&
rect
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -6022,10 +6025,46 @@ static void test_dc_target(BOOL d3d11)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
clr
=
GetPixel
(
hdc2
,
0
,
0
);
todo_wine
ok
(
clr
==
RGB
(
0
,
0
,
255
),
"Got unexpected colour 0x%08lx.
\n
"
,
clr
);
ok
(
clr
==
RGB
(
0
,
0
,
255
),
"Got unexpected colour 0x%08lx.
\n
"
,
clr
);
DeleteDC
(
hdc
);
DeleteDC
(
hdc2
);
/* Metafile context. */
hdc
=
CreateMetaFileA
(
NULL
);
ok
(
!!
hdc
,
"Failed to create a device context.
\n
"
);
hr
=
ID2D1DCRenderTarget_BindDC
(
rt
,
hdc
,
&
rect
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hmf
=
CloseMetaFile
(
hdc
);
ok
(
!!
hmf
,
"Failed to close a metafile, error %ld.
\n
"
,
GetLastError
());
DeleteMetaFile
(
hmf
);
/* Enhanced metafile context. */
hdc
=
CreateEnhMetaFileA
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!!
hdc
,
"Failed to create a device context.
\n
"
);
hr
=
ID2D1DCRenderTarget_BindDC
(
rt
,
hdc
,
&
rect
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hemf
=
CloseEnhMetaFile
(
hdc
);
ok
(
!!
hemf
,
"Failed to close a metafile, error %ld.
\n
"
,
GetLastError
());
DeleteEnhMetaFile
(
hemf
);
/* Window context. */
hwnd
=
CreateWindowExA
(
0
,
"static"
,
NULL
,
WS_POPUP
|
WS_VISIBLE
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
NULL
);
ok
(
!!
hwnd
,
"Failed to create a test window.
\n
"
);
hdc
=
GetDC
(
hwnd
);
ok
(
!!
hdc
,
"Failed to get a context.
\n
"
);
hr
=
ID2D1DCRenderTarget_BindDC
(
rt
,
hdc
,
&
rect
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ReleaseDC
(
hwnd
,
hdc
);
DestroyWindow
(
hwnd
);
ID2D1DCRenderTarget_Release
(
rt
);
ID2D1Factory_Release
(
factory
);
}
...
...
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