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
7bbe7312
Commit
7bbe7312
authored
Aug 13, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Aug 14, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement conversion from 16bppBGR565 to 32bppBGRA.
parent
e38fd32e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
converter.c
dlls/windowscodecs/converter.c
+50
-0
regsvr.c
dlls/windowscodecs/regsvr.c
+1
-0
No files found.
dlls/windowscodecs/converter.c
View file @
7bbe7312
...
...
@@ -37,6 +37,7 @@ struct FormatConverter;
enum
pixelformat
{
format_16bppBGR555
,
format_16bppBGR565
,
format_32bppBGR
,
format_32bppBGRA
};
...
...
@@ -113,6 +114,54 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe
return
res
;
}
return
S_OK
;
case
format_16bppBGR565
:
if
(
prc
)
{
HRESULT
res
;
UINT
x
,
y
;
BYTE
*
srcdata
;
UINT
srcstride
,
srcdatasize
;
const
BYTE
*
srcrow
;
const
WORD
*
srcpixel
;
BYTE
*
dstrow
;
DWORD
*
dstpixel
;
srcstride
=
2
*
prc
->
Width
;
srcdatasize
=
srcstride
*
prc
->
Height
;
srcdata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
srcdatasize
);
if
(
!
srcdata
)
return
E_OUTOFMEMORY
;
res
=
IWICBitmapSource_CopyPixels
(
This
->
source
,
prc
,
srcstride
,
srcdatasize
,
srcdata
);
if
(
SUCCEEDED
(
res
))
{
srcrow
=
srcdata
;
dstrow
=
pbBuffer
;
for
(
y
=
0
;
y
<
prc
->
Height
;
y
++
)
{
srcpixel
=
(
const
WORD
*
)
srcrow
;
dstpixel
=
(
DWORD
*
)
dstrow
;
for
(
x
=
0
;
x
<
prc
->
Width
;
x
++
)
{
WORD
srcval
;
srcval
=*
srcpixel
++
;
*
dstpixel
++=
0xff000000
|
/* constant 255 alpha */
((
srcval
<<
8
)
&
0xf80000
)
|
/* r */
((
srcval
<<
3
)
&
0x070000
)
|
/* r - 3 bits */
((
srcval
<<
5
)
&
0x00fc00
)
|
/* g */
((
srcval
>>
1
)
&
0x000300
)
|
/* g - 2 bits */
((
srcval
<<
3
)
&
0x0000f8
)
|
/* b */
((
srcval
>>
2
)
&
0x000007
);
/* b - 3 bits */
}
srcrow
+=
srcstride
;
dstrow
+=
cbStride
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
srcdata
);
return
res
;
}
return
S_OK
;
case
format_32bppBGR
:
if
(
prc
)
{
...
...
@@ -154,6 +203,7 @@ static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRec
static
const
struct
pixelformatinfo
supported_formats
[]
=
{
{
format_16bppBGR555
,
&
GUID_WICPixelFormat16bppBGR555
,
NULL
},
{
format_16bppBGR565
,
&
GUID_WICPixelFormat16bppBGR565
,
NULL
},
{
format_32bppBGR
,
&
GUID_WICPixelFormat32bppBGR
,
copypixels_to_32bppBGR
},
{
format_32bppBGRA
,
&
GUID_WICPixelFormat32bppBGRA
,
copypixels_to_32bppBGRA
},
{
0
}
...
...
dlls/windowscodecs/regsvr.c
View file @
7bbe7312
...
...
@@ -790,6 +790,7 @@ static struct regsvr_decoder const decoder_list[] = {
static
GUID
const
*
const
converter_formats
[]
=
{
&
GUID_WICPixelFormat16bppBGR555
,
&
GUID_WICPixelFormat16bppBGR565
,
&
GUID_WICPixelFormat32bppBGR
,
&
GUID_WICPixelFormat32bppBGRA
,
NULL
...
...
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