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
b62f3c88
Commit
b62f3c88
authored
May 26, 2023
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Improve resource properties check when creating a bitmap.
parent
a5426f6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
31 deletions
+53
-31
device.c
dlls/d2d1/device.c
+2
-2
d2d1.c
dlls/d2d1/tests/d2d1.c
+51
-29
No files found.
dlls/d2d1/device.c
View file @
b62f3c88
...
@@ -2097,10 +2097,10 @@ static BOOL d2d_bitmap_check_options_with_surface(unsigned int options, unsigned
...
@@ -2097,10 +2097,10 @@ static BOOL d2d_bitmap_check_options_with_surface(unsigned int options, unsigned
if
(
options
&&
(
options
&
D2D1_BITMAP_OPTIONS_TARGET
)
!=
(
surface_options
&
D2D1_BITMAP_OPTIONS_TARGET
))
if
(
options
&&
(
options
&
D2D1_BITMAP_OPTIONS_TARGET
)
!=
(
surface_options
&
D2D1_BITMAP_OPTIONS_TARGET
))
return
FALSE
;
return
FALSE
;
if
(
!
(
options
&
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
)
&&
(
surface_options
&
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
))
return
FALSE
;
if
(
options
&
D2D1_BITMAP_OPTIONS_TARGET
)
if
(
options
&
D2D1_BITMAP_OPTIONS_TARGET
)
{
{
if
(
!
(
options
&
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
)
&&
(
surface_options
&
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
))
return
FALSE
;
if
(
options
&
D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE
&&
!
(
surface_options
&
D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE
))
if
(
options
&
D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE
&&
!
(
surface_options
&
D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE
))
return
FALSE
;
return
FALSE
;
return
TRUE
;
return
TRUE
;
...
...
dlls/d2d1/tests/d2d1.c
View file @
b62f3c88
...
@@ -13249,6 +13249,24 @@ static void test_bitmap_map(BOOL d3d11)
...
@@ -13249,6 +13249,24 @@ static void test_bitmap_map(BOOL d3d11)
{
{
{
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
|
D2D1_BITMAP_OPTIONS_CPU_READ
},
{
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
|
D2D1_BITMAP_OPTIONS_CPU_READ
},
};
};
static
const
struct
{
unsigned
int
bind_flags
;
unsigned
int
options
;
HRESULT
hr
;
}
options_tests
[]
=
{
{
D3D11_BIND_RENDER_TARGET
|
D3D11_BIND_SHADER_RESOURCE
,
D2D1_BITMAP_OPTIONS_TARGET
|
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
},
{
D3D11_BIND_RENDER_TARGET
,
D2D1_BITMAP_OPTIONS_TARGET
|
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
},
{
D3D11_BIND_RENDER_TARGET
|
D3D11_BIND_SHADER_RESOURCE
,
D2D1_BITMAP_OPTIONS_NONE
},
{
0
,
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
},
{
0
,
D2D1_BITMAP_OPTIONS_TARGET
,
E_INVALIDARG
},
{
0
,
D2D1_BITMAP_OPTIONS_NONE
,
E_INVALIDARG
},
{
D3D11_BIND_RENDER_TARGET
,
D2D1_BITMAP_OPTIONS_TARGET
,
E_INVALIDARG
},
{
D3D11_BIND_RENDER_TARGET
,
D2D1_BITMAP_OPTIONS_NONE
,
E_INVALIDARG
},
};
D2D1_BITMAP_PROPERTIES1
bitmap_desc
;
D2D1_BITMAP_PROPERTIES1
bitmap_desc
;
D3D11_TEXTURE2D_DESC
texture_desc
;
D3D11_TEXTURE2D_DESC
texture_desc
;
ID2D1Bitmap
*
bitmap2
,
*
bitmap3
;
ID2D1Bitmap
*
bitmap2
,
*
bitmap3
;
...
@@ -13436,9 +13454,8 @@ static void test_bitmap_map(BOOL d3d11)
...
@@ -13436,9 +13454,8 @@ static void test_bitmap_map(BOOL d3d11)
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
bitmap_desc
.
bitmapOptions
=
D2D1_BITMAP_OPTIONS_NONE
;
bitmap_desc
.
bitmapOptions
=
D2D1_BITMAP_OPTIONS_NONE
;
hr
=
ID2D1DeviceContext_CreateBitmapFromDxgiSurface
(
ctx
.
context
,
surface
,
&
bitmap_desc
,
&
bitmap
);
hr
=
ID2D1DeviceContext_CreateBitmapFromDxgiSurface
(
ctx
.
context
,
surface
,
&
bitmap_desc
,
&
bitmap
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID2D1Bitmap1_Release
(
bitmap
);
bitmap_desc
.
bitmapOptions
=
D2D1_BITMAP_OPTIONS_TARGET
|
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
;
bitmap_desc
.
bitmapOptions
=
D2D1_BITMAP_OPTIONS_TARGET
|
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
;
hr
=
ID2D1DeviceContext_CreateBitmapFromDxgiSurface
(
ctx
.
context
,
surface
,
&
bitmap_desc
,
&
bitmap
);
hr
=
ID2D1DeviceContext_CreateBitmapFromDxgiSurface
(
ctx
.
context
,
surface
,
&
bitmap_desc
,
&
bitmap
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
@@ -13454,37 +13471,42 @@ static void test_bitmap_map(BOOL d3d11)
...
@@ -13454,37 +13471,42 @@ static void test_bitmap_map(BOOL d3d11)
ID3D11Texture2D_Release
(
texture
);
ID3D11Texture2D_Release
(
texture
);
IDXGISurface_Release
(
surface
);
IDXGISurface_Release
(
surface
);
/* Surface D2D1_BITMAP_OPTIONS_TARGET */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
options_tests
);
++
i
)
texture_desc
.
Width
=
4
;
{
texture_desc
.
Height
=
4
;
winetest_push_context
(
"Test %u"
,
i
);
texture_desc
.
MipLevels
=
1
;
texture_desc
.
ArraySize
=
1
;
texture_desc
.
Format
=
DXGI_FORMAT_B8G8R8A8_UNORM
;
texture_desc
.
SampleDesc
.
Count
=
1
;
texture_desc
.
SampleDesc
.
Quality
=
0
;
texture_desc
.
Usage
=
D3D11_USAGE_DEFAULT
;
texture_desc
.
BindFlags
=
D3D11_BIND_RENDER_TARGET
|
D3D11_BIND_SHADER_RESOURCE
;
texture_desc
.
CPUAccessFlags
=
0
;
texture_desc
.
MiscFlags
=
0
;
hr
=
ID3D11Device_CreateTexture2D
(
d3d_device
,
&
texture_desc
,
NULL
,
&
texture
);
texture_desc
.
Width
=
4
;
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
texture_desc
.
Height
=
4
;
hr
=
ID3D11Texture2D_QueryInterface
(
texture
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
texture_desc
.
MipLevels
=
1
;
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
texture_desc
.
ArraySize
=
1
;
texture_desc
.
Format
=
DXGI_FORMAT_B8G8R8A8_UNORM
;
texture_desc
.
SampleDesc
.
Count
=
1
;
texture_desc
.
SampleDesc
.
Quality
=
0
;
texture_desc
.
Usage
=
D3D11_USAGE_DEFAULT
;
texture_desc
.
BindFlags
=
options_tests
[
i
].
bind_flags
;
texture_desc
.
CPUAccessFlags
=
0
;
texture_desc
.
MiscFlags
=
0
;
hr
=
ID3D11Device_CreateTexture2D
(
d3d_device
,
&
texture_desc
,
NULL
,
&
texture
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID3D11Texture2D_QueryInterface
(
texture
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
bitmap_desc
.
bitmapOptions
=
D2D1_BITMAP_OPTIONS_CANNOT_DRAW
|
D2D1_BITMAP_OPTIONS_TARGET
;
bitmap
=
NULL
;
hr
=
ID2D1DeviceContext_CreateBitmapFromDxgiSurface
(
ctx
.
context
,
surface
,
&
bitmap_desc
,
&
bitmap
);
bitmap_desc
.
bitmapOptions
=
options_tests
[
i
].
options
;
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
ID2D1DeviceContext_CreateBitmapFromDxgiSurface
(
ctx
.
context
,
surface
,
&
bitmap_desc
,
&
bitmap
);
ID2D1Bitmap1_Release
(
bitmap
);
ok
(
hr
==
options_tests
[
i
].
hr
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
check_bitmap_options
((
ID2D1Bitmap
*
)
bitmap
,
options_tests
[
i
].
options
);
ID2D1Bitmap1_Release
(
bitmap
);
}
bitmap_desc
.
bitmapOptions
=
0
;
ID3D11Texture2D_Release
(
texture
);
hr
=
ID2D1DeviceContext_CreateBitmapFromDxgiSurface
(
ctx
.
context
,
surface
,
&
bitmap_desc
,
&
bitmap
);
IDXGISurface_Release
(
surface
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
check_bitmap_options
((
ID2D1Bitmap
*
)
bitmap
,
0
);
ID2D1Bitmap1_Release
(
bitmap
);
ID3D11Texture2D_Release
(
texture
);
winetest_pop_context
(
);
IDXGISurface_Release
(
surface
);
}
ID3D11Device_Release
(
d3d_device
);
ID3D11Device_Release
(
d3d_device
);
...
...
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