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
6526de5c
Commit
6526de5c
authored
May 22, 2023
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Improve GetDC()/ReleaseDC() handling on render targets.
parent
981db831
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
13 deletions
+33
-13
d2d1_private.h
dlls/d2d1/d2d1_private.h
+1
-0
device.c
dlls/d2d1/device.c
+19
-4
d2d1.c
dlls/d2d1/tests/d2d1.c
+13
-9
No files found.
dlls/d2d1/d2d1_private.h
View file @
6526de5c
...
...
@@ -183,6 +183,7 @@ struct d2d_device_context
struct
d2d_bitmap
*
bitmap
;
struct
d2d_command_list
*
command_list
;
};
HDC
hdc
;
}
target
;
struct
d2d_shape_resources
shape_resources
[
D2D_SHAPE_TYPE_COUNT
];
ID3D11Buffer
*
vs_cb
;
...
...
dlls/d2d1/device.c
View file @
6526de5c
...
...
@@ -3097,7 +3097,7 @@ static ULONG STDMETHODCALLTYPE d2d_gdi_interop_render_target_Release(ID2D1GdiInt
return
IUnknown_Release
(
render_target
->
outer_unknown
);
}
static
HRESULT
d2d_
device_context
_get_surface
(
struct
d2d_device_context
*
context
,
IDXGISurface1
**
surface
)
static
HRESULT
d2d_
gdi_interop
_get_surface
(
struct
d2d_device_context
*
context
,
IDXGISurface1
**
surface
)
{
ID3D11Resource
*
resource
;
HRESULT
hr
;
...
...
@@ -3108,6 +3108,9 @@ static HRESULT d2d_device_context_get_surface(struct d2d_device_context *context
return
E_NOTIMPL
;
}
if
(
!
(
context
->
target
.
bitmap
->
options
&
D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE
))
return
D2DERR_TARGET_NOT_GDI_COMPATIBLE
;
ID3D11RenderTargetView_GetResource
(
context
->
target
.
bitmap
->
rtv
,
&
resource
);
hr
=
ID3D11Resource_QueryInterface
(
resource
,
&
IID_IDXGISurface1
,
(
void
**
)
surface
);
ID3D11Resource_Release
(
resource
);
...
...
@@ -3130,12 +3133,20 @@ static HRESULT STDMETHODCALLTYPE d2d_gdi_interop_render_target_GetDC(ID2D1GdiInt
TRACE
(
"iface %p, mode %d, dc %p.
\n
"
,
iface
,
mode
,
dc
);
if
(
FAILED
(
hr
=
d2d_device_context_get_surface
(
render_target
,
&
surface
)))
*
dc
=
NULL
;
if
(
render_target
->
target
.
hdc
)
return
D2DERR_WRONG_STATE
;
if
(
FAILED
(
hr
=
d2d_gdi_interop_get_surface
(
render_target
,
&
surface
)))
return
hr
;
hr
=
IDXGISurface1_GetDC
(
surface
,
mode
!=
D2D1_DC_INITIALIZE_MODE_COPY
,
dc
);
hr
=
IDXGISurface1_GetDC
(
surface
,
mode
!=
D2D1_DC_INITIALIZE_MODE_COPY
,
&
render_target
->
target
.
h
dc
);
IDXGISurface1_Release
(
surface
);
if
(
SUCCEEDED
(
hr
))
*
dc
=
render_target
->
target
.
hdc
;
return
hr
;
}
...
...
@@ -3149,9 +3160,13 @@ static HRESULT STDMETHODCALLTYPE d2d_gdi_interop_render_target_ReleaseDC(ID2D1Gd
TRACE
(
"iface %p, update rect %s.
\n
"
,
iface
,
wine_dbgstr_rect
(
update
));
if
(
FAILED
(
hr
=
d2d_device_context_get_surface
(
render_target
,
&
surface
)))
if
(
!
render_target
->
target
.
hdc
)
return
D2DERR_WRONG_STATE
;
if
(
FAILED
(
hr
=
d2d_gdi_interop_get_surface
(
render_target
,
&
surface
)))
return
hr
;
render_target
->
target
.
hdc
=
NULL
;
if
(
update
)
update_rect
=
*
update
;
hr
=
IDXGISurface1_ReleaseDC
(
surface
,
update
?
&
update_rect
:
NULL
);
...
...
dlls/d2d1/tests/d2d1.c
View file @
6526de5c
...
...
@@ -6166,7 +6166,7 @@ static void test_dc_target_gdi_interop(BOOL d3d11)
hr
=
ID2D1GdiInteropRenderTarget_GetDC
(
interop
,
D2D1_DC_INITIALIZE_MODE_COPY
,
&
hdc
);
todo_wine
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
!
hdc
,
"Got unexpected DC %p.
\n
"
,
hdc
);
ok
(
!
hdc
,
"Got unexpected DC %p.
\n
"
,
hdc
);
hr
=
ID2D1DCRenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -6335,9 +6335,8 @@ static void test_hwnd_target_gdi_interop(BOOL d3d11)
ID2D1HwndRenderTarget_BeginDraw
(
rt
);
dc
=
(
void
*
)
0xdeadbeef
;
hr
=
ID2D1GdiInteropRenderTarget_GetDC
(
interop
,
D2D1_DC_INITIALIZE_MODE_COPY
,
&
dc
);
todo_wine
ok
(
hr
==
D2DERR_TARGET_NOT_GDI_COMPATIBLE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
ok
(
!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
hr
=
ID2D1HwndRenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ID2D1GdiInteropRenderTarget_Release
(
interop
);
...
...
@@ -6441,9 +6440,10 @@ static void test_dxgi_surface_target_gdi_interop(BOOL d3d11)
ID2D1RenderTarget_BeginDraw
(
rt
);
dc
=
(
void
*
)
0xdeadbeef
;
hr
=
ID2D1GdiInteropRenderTarget_GetDC
(
interop
,
D2D1_DC_INITIALIZE_MODE_COPY
,
&
dc
);
todo_wine
ok
(
hr
==
D2DERR_TARGET_NOT_GDI_COMPATIBLE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
ok
(
!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
hr
=
ID2D1GdiInteropRenderTarget_ReleaseDC
(
interop
,
NULL
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1RenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ID2D1GdiInteropRenderTarget_Release
(
interop
);
...
...
@@ -6481,6 +6481,9 @@ static void test_dxgi_surface_target_gdi_interop(BOOL d3d11)
hr
=
ID2D1GdiInteropRenderTarget_GetDC
(
interop
,
D2D1_DC_INITIALIZE_MODE_COPY
,
&
dc
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
hr
=
ID2D1GdiInteropRenderTarget_GetDC
(
interop
,
D2D1_DC_INITIALIZE_MODE_COPY
,
&
dc
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
hr
=
ID2D1GdiInteropRenderTarget_ReleaseDC
(
interop
,
NULL
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1RenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
...
...
@@ -6499,8 +6502,10 @@ static void test_dxgi_surface_target_gdi_interop(BOOL d3d11)
ID2D1RenderTarget_BeginDraw
(
rt
);
dc
=
(
void
*
)
0xdeadbeef
;
hr
=
ID2D1GdiInteropRenderTarget_GetDC
(
interop
,
D2D1_DC_INITIALIZE_MODE_COPY
,
&
dc
);
todo_wine
ok
(
hr
==
D2DERR_TARGET_NOT_GDI_COMPATIBLE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
ok
(
hr
==
D2DERR_TARGET_NOT_GDI_COMPATIBLE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
hr
=
ID2D1GdiInteropRenderTarget_ReleaseDC
(
interop
,
NULL
);
ok
(
hr
==
D2DERR_WRONG_STATE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1RenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ID2D1GdiInteropRenderTarget_Release
(
interop
);
...
...
@@ -8781,9 +8786,8 @@ static void test_wic_gdi_interop(BOOL d3d11)
ID2D1RenderTarget_BeginDraw
(
rt
);
dc
=
(
void
*
)
0xdeadbeef
;
hr
=
ID2D1GdiInteropRenderTarget_GetDC
(
interop
,
D2D1_DC_INITIALIZE_MODE_COPY
,
&
dc
);
todo_wine
ok
(
hr
==
D2DERR_TARGET_NOT_GDI_COMPATIBLE
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
ok
(
!
dc
,
"Got unexpected DC %p.
\n
"
,
dc
);
ID2D1GdiInteropRenderTarget_Release
(
interop
);
hr
=
ID2D1RenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
...
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