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
4b99c987
Commit
4b99c987
authored
Aug 27, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Aug 28, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement conversion from 2bppGray to 32bppBGRA.
parent
b952c572
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
7 deletions
+26
-7
converter.c
dlls/windowscodecs/converter.c
+25
-7
regsvr.c
dlls/windowscodecs/regsvr.c
+1
-0
No files found.
dlls/windowscodecs/converter.c
View file @
4b99c987
...
...
@@ -41,6 +41,7 @@ enum pixelformat {
format_4bppIndexed
,
format_8bppIndexed
,
format_BlackWhite
,
format_2bppGray
,
format_8bppGray
,
format_16bppBGR555
,
format_16bppBGR565
,
...
...
@@ -68,6 +69,16 @@ typedef struct FormatConverter {
WICBitmapPaletteType
palette_type
;
}
FormatConverter
;
static
void
make_grayscale_palette
(
WICColor
*
colors
,
UINT
num_colors
)
{
int
i
,
v
;
for
(
i
=
0
;
i
<
num_colors
;
i
++
)
{
v
=
i
*
255
/
(
num_colors
-
1
);
colors
[
i
]
=
0xff000000
|
v
<<
16
|
v
<<
8
|
v
;
}
}
static
HRESULT
copypixels_to_32bppBGRA
(
struct
FormatConverter
*
This
,
const
WICRect
*
prc
,
UINT
cbStride
,
UINT
cbBufferSize
,
BYTE
*
pbBuffer
,
enum
pixelformat
source_format
)
{
...
...
@@ -146,6 +157,7 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe
}
return
S_OK
;
case
format_2bppIndexed
:
case
format_2bppGray
:
if
(
prc
)
{
HRESULT
res
;
...
...
@@ -160,16 +172,21 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe
IWICPalette
*
palette
;
UINT
actualcolors
;
res
=
PaletteImpl_Create
(
&
palette
);
if
(
FAILED
(
res
))
return
res
;
if
(
source_format
==
format_2bppIndexed
)
{
res
=
PaletteImpl_Create
(
&
palette
);
if
(
FAILED
(
res
))
return
res
;
res
=
IWICBitmapSource_CopyPalette
(
This
->
source
,
palette
);
if
(
SUCCEEDED
(
res
))
res
=
IWICPalette_GetColors
(
palette
,
4
,
colors
,
&
actualcolors
);
res
=
IWICBitmapSource_CopyPalette
(
This
->
source
,
palette
);
if
(
SUCCEEDED
(
res
))
res
=
IWICPalette_GetColors
(
palette
,
4
,
colors
,
&
actualcolors
);
IWICPalette_Release
(
palette
);
IWICPalette_Release
(
palette
);
if
(
FAILED
(
res
))
return
res
;
if
(
FAILED
(
res
))
return
res
;
}
else
make_grayscale_palette
(
colors
,
4
);
srcstride
=
(
prc
->
Width
+
3
)
/
4
;
srcdatasize
=
srcstride
*
prc
->
Height
;
...
...
@@ -540,6 +557,7 @@ static const struct pixelformatinfo supported_formats[] = {
{
format_4bppIndexed
,
&
GUID_WICPixelFormat4bppIndexed
,
NULL
},
{
format_8bppIndexed
,
&
GUID_WICPixelFormat8bppIndexed
,
NULL
},
{
format_BlackWhite
,
&
GUID_WICPixelFormatBlackWhite
,
NULL
},
{
format_2bppGray
,
&
GUID_WICPixelFormat2bppGray
,
NULL
},
{
format_8bppGray
,
&
GUID_WICPixelFormat8bppGray
,
NULL
},
{
format_16bppBGR555
,
&
GUID_WICPixelFormat16bppBGR555
,
NULL
},
{
format_16bppBGR565
,
&
GUID_WICPixelFormat16bppBGR565
,
NULL
},
...
...
dlls/windowscodecs/regsvr.c
View file @
4b99c987
...
...
@@ -922,6 +922,7 @@ static GUID const * const converter_formats[] = {
&
GUID_WICPixelFormat4bppIndexed
,
&
GUID_WICPixelFormat8bppIndexed
,
&
GUID_WICPixelFormatBlackWhite
,
&
GUID_WICPixelFormat2bppGray
,
&
GUID_WICPixelFormat8bppGray
,
&
GUID_WICPixelFormat16bppBGR555
,
&
GUID_WICPixelFormat16bppBGR565
,
...
...
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