Vincent Povirk : windowscodecs: Implement conversion from 4bppGray to 32bppBGRA.
Alexandre Julliard
julliard at winehq.org
Fri Aug 28 10:18:18 CDT 2009
Module: wine
Branch: master
Commit: 25022fe7d5be482790b215bec6978b6e619641fd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=25022fe7d5be482790b215bec6978b6e619641fd
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Thu Aug 27 13:26:23 2009 -0500
windowscodecs: Implement conversion from 4bppGray to 32bppBGRA.
---
dlls/windowscodecs/converter.c | 22 +++++++++++++++-------
dlls/windowscodecs/regsvr.c | 1 +
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
index 8ec1114..50dcab4 100644
--- a/dlls/windowscodecs/converter.c
+++ b/dlls/windowscodecs/converter.c
@@ -42,6 +42,7 @@ enum pixelformat {
format_8bppIndexed,
format_BlackWhite,
format_2bppGray,
+ format_4bppGray,
format_8bppGray,
format_16bppBGR555,
format_16bppBGR565,
@@ -222,6 +223,7 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe
}
return S_OK;
case format_4bppIndexed:
+ case format_4bppGray:
if (prc)
{
HRESULT res;
@@ -236,16 +238,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_4bppIndexed)
+ {
+ res = PaletteImpl_Create(&palette);
+ if (FAILED(res)) return res;
- res = IWICBitmapSource_CopyPalette(This->source, palette);
- if (SUCCEEDED(res))
- res = IWICPalette_GetColors(palette, 16, colors, &actualcolors);
+ res = IWICBitmapSource_CopyPalette(This->source, palette);
+ if (SUCCEEDED(res))
+ res = IWICPalette_GetColors(palette, 16, colors, &actualcolors);
- IWICPalette_Release(palette);
+ IWICPalette_Release(palette);
- if (FAILED(res)) return res;
+ if (FAILED(res)) return res;
+ }
+ else
+ make_grayscale_palette(colors, 16);
srcstride = (prc->Width+1)/2;
srcdatasize = srcstride * prc->Height;
@@ -558,6 +565,7 @@ static const struct pixelformatinfo supported_formats[] = {
{format_8bppIndexed, &GUID_WICPixelFormat8bppIndexed, NULL},
{format_BlackWhite, &GUID_WICPixelFormatBlackWhite, NULL},
{format_2bppGray, &GUID_WICPixelFormat2bppGray, NULL},
+ {format_4bppGray, &GUID_WICPixelFormat4bppGray, NULL},
{format_8bppGray, &GUID_WICPixelFormat8bppGray, NULL},
{format_16bppBGR555, &GUID_WICPixelFormat16bppBGR555, NULL},
{format_16bppBGR565, &GUID_WICPixelFormat16bppBGR565, NULL},
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index 0e857f5..03253b8 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -923,6 +923,7 @@ static GUID const * const converter_formats[] = {
&GUID_WICPixelFormat8bppIndexed,
&GUID_WICPixelFormatBlackWhite,
&GUID_WICPixelFormat2bppGray,
+ &GUID_WICPixelFormat4bppGray,
&GUID_WICPixelFormat8bppGray,
&GUID_WICPixelFormat16bppBGR555,
&GUID_WICPixelFormat16bppBGR565,
More information about the wine-cvs
mailing list