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
ccc34703
Commit
ccc34703
authored
Jul 23, 2015
by
Henri Verbeet
Committed by
Alexandre Julliard
Jul 28, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Also infer the alpha mode in d2d_d3d_render_target_CreateBitmapFromWicBitmap().
parent
e9e21ab4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
15 deletions
+33
-15
render_target.c
dlls/d2d1/render_target.c
+33
-15
No files found.
dlls/d2d1/render_target.c
View file @
ccc34703
...
...
@@ -300,14 +300,28 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateBitmap(ID2D1RenderT
static
HRESULT
STDMETHODCALLTYPE
d2d_d3d_render_target_CreateBitmapFromWicBitmap
(
ID2D1RenderTarget
*
iface
,
IWICBitmapSource
*
bitmap_source
,
const
D2D1_BITMAP_PROPERTIES
*
desc
,
ID2D1Bitmap
**
bitmap
)
{
const
D2D1_PIXEL_FORMAT
*
d2d_format
;
D2D1_BITMAP_PROPERTIES
bitmap_desc
;
WICPixelFormatGUID
wic_format
;
unsigned
int
bpp
,
data_size
;
D2D1_SIZE_U
size
;
unsigned
int
i
;
WICRect
rect
;
UINT32
pitch
;
HRESULT
hr
;
void
*
data
;
static
const
struct
{
const
WICPixelFormatGUID
*
wic
;
D2D1_PIXEL_FORMAT
d2d
;
}
format_lookup
[]
=
{
{
&
GUID_WICPixelFormat32bppPBGRA
,
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_PREMULTIPLIED
}},
{
&
GUID_WICPixelFormat32bppBGR
,
{
DXGI_FORMAT_B8G8R8A8_UNORM
,
D2D1_ALPHA_MODE_IGNORE
}},
};
TRACE
(
"iface %p, bitmap_source %p, desc %p, bitmap %p.
\n
"
,
iface
,
bitmap_source
,
desc
,
bitmap
);
...
...
@@ -329,28 +343,32 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateBitmapFromWicBitmap
bitmap_desc
=
*
desc
;
}
if
(
bitmap_desc
.
pixelFormat
.
format
==
DXGI_FORMAT_UNKNOWN
)
if
(
FAILED
(
hr
=
IWICBitmapSource_GetPixelFormat
(
bitmap_source
,
&
wic_format
))
)
{
WICPixelFormatGUID
wic_format
;
WARN
(
"Failed to get bitmap format, hr %#x.
\n
"
,
hr
);
return
hr
;
}
if
(
FAILED
(
hr
=
IWICBitmapSource_GetPixelFormat
(
bitmap_source
,
&
wic_format
)))
for
(
i
=
0
,
d2d_format
=
NULL
;
i
<
sizeof
(
format_lookup
)
/
sizeof
(
*
format_lookup
);
++
i
)
{
if
(
IsEqualGUID
(
&
wic_format
,
format_lookup
[
i
].
wic
))
{
WARN
(
"Failed to get bitmap format, hr %#x.
\n
"
,
hr
)
;
return
hr
;
d2d_format
=
&
format_lookup
[
i
].
d2d
;
break
;
}
}
if
(
IsEqualGUID
(
&
wic_format
,
&
GUID_WICPixelFormat32bppPBGRA
)
||
IsEqualGUID
(
&
wic_format
,
&
GUID_WICPixelFormat32bppBGR
))
{
bitmap_desc
.
pixelFormat
.
format
=
DXGI_FORMAT_B8G8R8A8_UNORM
;
}
else
{
WARN
(
"Unsupported WIC bitmap format %s.
\n
"
,
debugstr_guid
(
&
wic_format
));
return
D2DERR_UNSUPPORTED_PIXEL_FORMAT
;
}
if
(
!
d2d_format
)
{
WARN
(
"Unsupported WIC bitmap format %s.
\n
"
,
debugstr_guid
(
&
wic_format
));
return
D2DERR_UNSUPPORTED_PIXEL_FORMAT
;
}
if
(
bitmap_desc
.
pixelFormat
.
format
==
DXGI_FORMAT_UNKNOWN
)
bitmap_desc
.
pixelFormat
.
format
=
d2d_format
->
format
;
if
(
bitmap_desc
.
pixelFormat
.
alphaMode
==
D2D1_ALPHA_MODE_UNKNOWN
)
bitmap_desc
.
pixelFormat
.
alphaMode
=
d2d_format
->
alphaMode
;
switch
(
bitmap_desc
.
pixelFormat
.
format
)
{
case
DXGI_FORMAT_B8G8R8A8_UNORM
:
...
...
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