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
c9b68daf
Commit
c9b68daf
authored
May 17, 2023
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Implement IsSupported() for HWND target.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
4150d728
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
+30
-7
d2d1_private.h
dlls/d2d1/d2d1_private.h
+2
-0
hwnd_render_target.c
dlls/d2d1/hwnd_render_target.c
+28
-1
d2d1.c
dlls/d2d1/tests/d2d1.c
+0
-6
No files found.
dlls/d2d1/d2d1_private.h
View file @
c9b68daf
...
@@ -264,6 +264,8 @@ struct d2d_hwnd_render_target
...
@@ -264,6 +264,8 @@ struct d2d_hwnd_render_target
IDXGISwapChain
*
swapchain
;
IDXGISwapChain
*
swapchain
;
UINT
sync_interval
;
UINT
sync_interval
;
HWND
hwnd
;
HWND
hwnd
;
D2D1_RENDER_TARGET_PROPERTIES
desc
;
};
};
HRESULT
d2d_hwnd_render_target_init
(
struct
d2d_hwnd_render_target
*
render_target
,
ID2D1Factory1
*
factory
,
HRESULT
d2d_hwnd_render_target_init
(
struct
d2d_hwnd_render_target
*
render_target
,
ID2D1Factory1
*
factory
,
...
...
dlls/d2d1/hwnd_render_target.c
View file @
c9b68daf
...
@@ -652,10 +652,32 @@ static BOOL STDMETHODCALLTYPE d2d_hwnd_render_target_IsSupported(ID2D1HwndRender
...
@@ -652,10 +652,32 @@ static BOOL STDMETHODCALLTYPE d2d_hwnd_render_target_IsSupported(ID2D1HwndRender
const
D2D1_RENDER_TARGET_PROPERTIES
*
desc
)
const
D2D1_RENDER_TARGET_PROPERTIES
*
desc
)
{
{
struct
d2d_hwnd_render_target
*
render_target
=
impl_from_ID2D1HwndRenderTarget
(
iface
);
struct
d2d_hwnd_render_target
*
render_target
=
impl_from_ID2D1HwndRenderTarget
(
iface
);
const
D2D1_RENDER_TARGET_PROPERTIES
*
target_desc
=
&
render_target
->
desc
;
D2D1_PIXEL_FORMAT
pixel_format
;
TRACE
(
"iface %p, desc %p.
\n
"
,
iface
,
desc
);
TRACE
(
"iface %p, desc %p.
\n
"
,
iface
,
desc
);
return
ID2D1RenderTarget_IsSupported
(
render_target
->
dxgi_target
,
desc
);
if
(
desc
->
type
!=
D2D1_RENDER_TARGET_TYPE_DEFAULT
&&
target_desc
->
type
!=
desc
->
type
)
{
return
FALSE
;
}
pixel_format
=
ID2D1RenderTarget_GetPixelFormat
(
render_target
->
dxgi_target
);
if
(
desc
->
pixelFormat
.
format
!=
DXGI_FORMAT_UNKNOWN
&&
pixel_format
.
format
!=
desc
->
pixelFormat
.
format
)
{
return
FALSE
;
}
if
(
desc
->
pixelFormat
.
alphaMode
!=
D2D1_ALPHA_MODE_UNKNOWN
&&
pixel_format
.
alphaMode
!=
desc
->
pixelFormat
.
alphaMode
)
{
return
FALSE
;
}
return
(
target_desc
->
usage
&
desc
->
usage
)
==
desc
->
usage
;
}
}
static
D2D1_WINDOW_STATE
STDMETHODCALLTYPE
d2d_hwnd_render_target_CheckWindowState
(
ID2D1HwndRenderTarget
*
iface
)
static
D2D1_WINDOW_STATE
STDMETHODCALLTYPE
d2d_hwnd_render_target_CheckWindowState
(
ID2D1HwndRenderTarget
*
iface
)
...
@@ -840,6 +862,11 @@ HRESULT d2d_hwnd_render_target_init(struct d2d_hwnd_render_target *render_target
...
@@ -840,6 +862,11 @@ HRESULT d2d_hwnd_render_target_init(struct d2d_hwnd_render_target *render_target
if
(
dxgi_rt_desc
.
pixelFormat
.
alphaMode
==
D2D1_ALPHA_MODE_UNKNOWN
)
if
(
dxgi_rt_desc
.
pixelFormat
.
alphaMode
==
D2D1_ALPHA_MODE_UNKNOWN
)
dxgi_rt_desc
.
pixelFormat
.
alphaMode
=
D2D1_ALPHA_MODE_IGNORE
;
dxgi_rt_desc
.
pixelFormat
.
alphaMode
=
D2D1_ALPHA_MODE_IGNORE
;
render_target
->
desc
=
dxgi_rt_desc
;
/* FIXME: should be resolved to either HW or SW type. */
if
(
render_target
->
desc
.
type
==
D2D1_RENDER_TARGET_TYPE_DEFAULT
)
render_target
->
desc
.
type
=
D2D1_RENDER_TARGET_TYPE_HARDWARE
;
swapchain_desc
.
BufferDesc
.
Width
=
hwnd_rt_desc
->
pixelSize
.
width
;
swapchain_desc
.
BufferDesc
.
Width
=
hwnd_rt_desc
->
pixelSize
.
width
;
swapchain_desc
.
BufferDesc
.
Height
=
hwnd_rt_desc
->
pixelSize
.
height
;
swapchain_desc
.
BufferDesc
.
Height
=
hwnd_rt_desc
->
pixelSize
.
height
;
swapchain_desc
.
BufferDesc
.
RefreshRate
.
Numerator
=
60
;
swapchain_desc
.
BufferDesc
.
RefreshRate
.
Numerator
=
60
;
...
...
dlls/d2d1/tests/d2d1.c
View file @
c9b68daf
...
@@ -13429,7 +13429,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
...
@@ -13429,7 +13429,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
hr
=
ID2D1Factory_CreateHwndRenderTarget
(
ctx
.
factory
,
&
template_desc
,
&
hwnd_rt_desc
,
&
rt
);
hr
=
ID2D1Factory_CreateHwndRenderTarget
(
ctx
.
factory
,
&
template_desc
,
&
hwnd_rt_desc
,
&
rt
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
template_desc
);
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
template_desc
);
todo_wine
ok
(
supported
,
"Expected supported.
\n
"
);
ok
(
supported
,
"Expected supported.
\n
"
);
ID2D1HwndRenderTarget_Release
(
rt
);
ID2D1HwndRenderTarget_Release
(
rt
);
...
@@ -13476,7 +13475,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
...
@@ -13476,7 +13475,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
ok
(
pixel_format
.
format
==
DXGI_FORMAT_R8G8B8A8_UNORM
,
"Got unexpected format %#x.
\n
"
,
pixel_format
.
format
);
ok
(
pixel_format
.
format
==
DXGI_FORMAT_R8G8B8A8_UNORM
,
"Got unexpected format %#x.
\n
"
,
pixel_format
.
format
);
ok
(
pixel_format
.
alphaMode
==
D2D1_ALPHA_MODE_PREMULTIPLIED
,
"Got unexpected alpha %u.
\n
"
,
pixel_format
.
alphaMode
);
ok
(
pixel_format
.
alphaMode
==
D2D1_ALPHA_MODE_PREMULTIPLIED
,
"Got unexpected alpha %u.
\n
"
,
pixel_format
.
alphaMode
);
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
test_desc
);
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
test_desc
);
todo_wine
ok
(
supported
,
"Expected supported.
\n
"
);
ok
(
supported
,
"Expected supported.
\n
"
);
ID2D1Bitmap1_Release
(
bitmap
);
ID2D1Bitmap1_Release
(
bitmap
);
...
@@ -13497,7 +13495,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
...
@@ -13497,7 +13495,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
test_desc
=
template_desc
;
test_desc
=
template_desc
;
test_desc
.
type
=
D2D1_RENDER_TARGET_TYPE_DEFAULT
;
test_desc
.
type
=
D2D1_RENDER_TARGET_TYPE_DEFAULT
;
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
test_desc
);
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
test_desc
);
todo_wine
ok
(
supported
,
"Unexpected return value %d.
\n
"
,
supported
);
ok
(
supported
,
"Unexpected return value %d.
\n
"
,
supported
);
}
}
else
else
...
@@ -13514,7 +13511,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
...
@@ -13514,7 +13511,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
test_desc
);
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
test_desc
);
expected
=
target_types
[
j
]
==
D2D1_RENDER_TARGET_TYPE_DEFAULT
expected
=
target_types
[
j
]
==
D2D1_RENDER_TARGET_TYPE_DEFAULT
||
target_types
[
i
]
==
target_types
[
j
];
||
target_types
[
i
]
==
target_types
[
j
];
todo_wine_if
(
expected
)
ok
(
supported
==
expected
,
"Unexpected return value %d.
\n
"
,
supported
);
ok
(
supported
==
expected
,
"Unexpected return value %d.
\n
"
,
supported
);
winetest_pop_context
();
winetest_pop_context
();
...
@@ -13556,7 +13552,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
...
@@ -13556,7 +13552,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
alpha_mode_supported
=
pixel_formats
[
j
].
alphaMode
==
D2D1_ALPHA_MODE_UNKNOWN
alpha_mode_supported
=
pixel_formats
[
j
].
alphaMode
==
D2D1_ALPHA_MODE_UNKNOWN
||
pixel_formats
[
j
].
alphaMode
==
desc
.
pixelFormat
.
alphaMode
;
||
pixel_formats
[
j
].
alphaMode
==
desc
.
pixelFormat
.
alphaMode
;
expected
=
format_supported
&&
alpha_mode_supported
;
expected
=
format_supported
&&
alpha_mode_supported
;
todo_wine_if
(
expected
)
ok
(
supported
==
expected
,
"Unexpected return value.
\n
"
);
ok
(
supported
==
expected
,
"Unexpected return value.
\n
"
);
winetest_pop_context
();
winetest_pop_context
();
...
@@ -13589,7 +13584,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
...
@@ -13589,7 +13584,6 @@ static void test_hwnd_target_is_supported(BOOL d3d11)
desc
.
usage
=
usages
[
j
];
desc
.
usage
=
usages
[
j
];
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
desc
);
supported
=
ID2D1HwndRenderTarget_IsSupported
(
rt
,
&
desc
);
expected
=
(
usages
[
i
]
&
usages
[
j
])
==
usages
[
j
];
expected
=
(
usages
[
i
]
&
usages
[
j
])
==
usages
[
j
];
todo_wine_if
(
expected
)
ok
(
supported
==
expected
,
"Unexpected result %d.
\n
"
,
supported
);
ok
(
supported
==
expected
,
"Unexpected result %d.
\n
"
,
supported
);
winetest_pop_context
();
winetest_pop_context
();
...
...
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