Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a50dbd6c
Commit
a50dbd6c
authored
Nov 17, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Derive shared bitmap format from the source bitmap.
parent
f6f89bf6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
2 deletions
+72
-2
bitmap.c
dlls/d2d1/bitmap.c
+10
-2
d2d1.c
dlls/d2d1/tests/d2d1.c
+62
-0
No files found.
dlls/d2d1/bitmap.c
View file @
a50dbd6c
...
...
@@ -544,15 +544,23 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid,
goto
failed
;
}
if
(
!
desc
)
if
(
desc
)
{
d
=
*
desc
;
if
(
d
.
pixelFormat
.
format
==
DXGI_FORMAT_UNKNOWN
)
d
.
pixelFormat
.
format
=
src_impl
->
format
.
format
;
if
(
d
.
pixelFormat
.
alphaMode
==
D2D1_ALPHA_MODE_UNKNOWN
)
d
.
pixelFormat
.
alphaMode
=
src_impl
->
format
.
alphaMode
;
}
else
{
d
.
pixelFormat
=
src_impl
->
format
;
d
.
dpiX
=
src_impl
->
dpi_x
;
d
.
dpiY
=
src_impl
->
dpi_y
;
d
.
bitmapOptions
=
src_impl
->
options
;
d
.
colorContext
=
NULL
;
desc
=
&
d
;
}
desc
=
&
d
;
if
(
!
format_supported
(
&
desc
->
pixelFormat
))
{
...
...
dlls/d2d1/tests/d2d1.c
View file @
a50dbd6c
...
...
@@ -5254,6 +5254,68 @@ static void test_shared_bitmap(BOOL d3d11)
}
}
ID2D1Bitmap_Release
(
bitmap1
);
/* Create from another bitmap, with a different description. */
set_size_u
(
&
size
,
4
,
4
);
bitmap_desc
.
pixelFormat
.
format
=
DXGI_FORMAT_B8G8R8A8_UNORM
;
bitmap_desc
.
pixelFormat
.
alphaMode
=
D2D1_ALPHA_MODE_PREMULTIPLIED
;
bitmap_desc
.
dpiX
=
96
.
0
f
;
bitmap_desc
.
dpiY
=
96
.
0
f
;
hr
=
ID2D1RenderTarget_CreateBitmap
(
rt2
,
size
,
NULL
,
0
,
&
bitmap_desc
,
&
bitmap1
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
static
const
struct
bitmap_format_test
{
D2D1_PIXEL_FORMAT
original
;
D2D1_PIXEL_FORMAT
result
;
HRESULT
hr
;
}
bitmap_format_tests
[]
=
{
{
{
DXGI_FORMAT_UNKNOWN
,
D2D1_ALPHA_MODE_PREMULTIPLIED
},
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_PREMULTIPLIED
}
},
{
{
DXGI_FORMAT_UNKNOWN
,
D2D1_ALPHA_MODE_IGNORE
},
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_IGNORE
}
},
{
{
DXGI_FORMAT_UNKNOWN
,
D2D1_ALPHA_MODE_UNKNOWN
},
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_PREMULTIPLIED
}
},
{
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_UNKNOWN
},
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_PREMULTIPLIED
}
},
{
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_IGNORE
},
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_IGNORE
}
},
{
{
DXGI_FORMAT_UNKNOWN
,
D2D1_ALPHA_MODE_STRAIGHT
},
{
0
},
D2DERR_UNSUPPORTED_PIXEL_FORMAT
},
{
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_STRAIGHT
},
{
0
},
D2DERR_UNSUPPORTED_PIXEL_FORMAT
},
};
unsigned
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
bitmap_format_tests
);
++
i
)
{
bitmap_desc
.
pixelFormat
=
bitmap_format_tests
[
i
].
original
;
hr
=
ID2D1RenderTarget_CreateSharedBitmap
(
rt2
,
&
IID_ID2D1Bitmap
,
bitmap1
,
&
bitmap_desc
,
&
bitmap2
);
ok
(
hr
==
bitmap_format_tests
[
i
].
hr
,
"%u: Got unexpected hr %#lx.
\n
"
,
i
,
hr
);
if
(
SUCCEEDED
(
hr
)
&&
hr
==
bitmap_format_tests
[
i
].
hr
)
{
pixel_format
=
ID2D1Bitmap_GetPixelFormat
(
bitmap2
);
ok
(
pixel_format
.
format
==
bitmap_format_tests
[
i
].
result
.
format
,
"%u: unexpected pixel format %#x.
\n
"
,
i
,
pixel_format
.
format
);
ok
(
pixel_format
.
alphaMode
==
bitmap_format_tests
[
i
].
result
.
alphaMode
,
"%u: unexpected alpha mode %d.
\n
"
,
i
,
pixel_format
.
alphaMode
);
}
if
(
SUCCEEDED
(
hr
))
ID2D1Bitmap_Release
(
bitmap2
);
}
}
ID2D1RenderTarget_Release
(
rt2
);
ID2D1Bitmap_Release
(
bitmap1
);
...
...
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