Vincent Povirk : windowscodecs: Implement conversion from 64bppRGBA to 32bppBGRA.
Alexandre Julliard
julliard at winehq.org
Fri Aug 28 10:18:21 CDT 2009
Module: wine
Branch: master
Commit: 0a495723c029a68e5a2daa9be0dae81cc9888249
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0a495723c029a68e5a2daa9be0dae81cc9888249
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Thu Aug 27 13:40:23 2009 -0500
windowscodecs: Implement conversion from 64bppRGBA to 32bppBGRA.
---
dlls/windowscodecs/converter.c | 47 ++++++++++++++++++++++++++++++++++++++++
dlls/windowscodecs/regsvr.c | 1 +
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
index 61619dd..15c7b0f 100644
--- a/dlls/windowscodecs/converter.c
+++ b/dlls/windowscodecs/converter.c
@@ -51,6 +51,7 @@ enum pixelformat {
format_32bppBGR,
format_32bppBGRA,
format_48bppRGB,
+ format_64bppRGBA,
};
typedef HRESULT (*copyfunc)(struct FormatConverter *This, const WICRect *prc,
@@ -626,6 +627,51 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe
return res;
}
return S_OK;
+ case format_64bppRGBA:
+ if (prc)
+ {
+ HRESULT res;
+ UINT x, y;
+ BYTE *srcdata;
+ UINT srcstride, srcdatasize;
+ const BYTE *srcrow;
+ const BYTE *srcpixel;
+ BYTE *dstrow;
+ DWORD *dstpixel;
+
+ srcstride = 8 * 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=srcrow;
+ dstpixel=(DWORD*)dstrow;
+ for (x=0; x<prc->Width; x++) {
+ BYTE red, green, blue, alpha;
+ red = *srcpixel++; srcpixel++;
+ green = *srcpixel++; srcpixel++;
+ blue = *srcpixel++; srcpixel++;
+ alpha = *srcpixel++; srcpixel++;
+ *dstpixel++=alpha<<24|red<<16|green<<8|blue;
+ }
+ srcrow += srcstride;
+ dstrow += cbStride;
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, srcdata);
+
+ return res;
+ }
+ return S_OK;
default:
return WINCODEC_ERR_UNSUPPORTEDOPERATION;
}
@@ -662,6 +708,7 @@ static const struct pixelformatinfo supported_formats[] = {
{format_32bppBGR, &GUID_WICPixelFormat32bppBGR, copypixels_to_32bppBGR},
{format_32bppBGRA, &GUID_WICPixelFormat32bppBGRA, copypixels_to_32bppBGRA},
{format_48bppRGB, &GUID_WICPixelFormat48bppRGB, NULL},
+ {format_64bppRGBA, &GUID_WICPixelFormat64bppRGBA, NULL},
{0}
};
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index 865c7b7..6544372 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -932,6 +932,7 @@ static GUID const * const converter_formats[] = {
&GUID_WICPixelFormat32bppBGR,
&GUID_WICPixelFormat32bppBGRA,
&GUID_WICPixelFormat48bppRGB,
+ &GUID_WICPixelFormat64bppRGBA,
NULL
};
More information about the wine-cvs
mailing list