Added patch to implement support for 32bppRGB, 32bppRGBA and 32bppPRGBA in format converter.

This commit is contained in:
Sebastian Lackner 2017-01-24 04:44:02 +01:00
parent cb587975ef
commit f93bdfd5fb
3 changed files with 261 additions and 17 deletions

View File

@ -382,6 +382,7 @@ patch_enable_all ()
enable_wbemprox_fill_processor="$1"
enable_widl_SLTG_Typelib_Support="$1"
enable_windowscodecs_32bppGrayFloat="$1"
enable_windowscodecs_32bppPRGBA="$1"
enable_windowscodecs_GIF_Encoder="$1"
enable_windowscodecs_IMILBitmapSource="$1"
enable_windowscodecs_IWICPalette_InitializeFromBitmap="$1"
@ -1361,6 +1362,9 @@ patch_enable ()
windowscodecs-32bppGrayFloat)
enable_windowscodecs_32bppGrayFloat="$2"
;;
windowscodecs-32bppPRGBA)
enable_windowscodecs_32bppPRGBA="$2"
;;
windowscodecs-GIF_Encoder)
enable_windowscodecs_GIF_Encoder="$2"
;;
@ -2031,6 +2035,13 @@ if test "$enable_wineboot_ProxySettings" -eq 1; then
enable_wineboot_drivers_etc_Stubs=1
fi
if test "$enable_windowscodecs_32bppPRGBA" -eq 1; then
if test "$enable_windowscodecs_TIFF_Support" -gt 1; then
abort "Patchset windowscodecs-TIFF_Support disabled, but windowscodecs-32bppPRGBA depends on that."
fi
enable_windowscodecs_TIFF_Support=1
fi
if test "$enable_windowscodecs_TIFF_Support" -eq 1; then
if test "$enable_windowscodecs_GIF_Encoder" -gt 1; then
abort "Patchset windowscodecs-GIF_Encoder disabled, but windowscodecs-TIFF_Support depends on that."
@ -7968,23 +7979,6 @@ if test "$enable_windowscodecs_GIF_Encoder" -eq 1; then
) >> "$patchlist"
fi
# Patchset windowscodecs-IMILBitmapSource
# |
# | This patchset fixes the following Wine bugs:
# | * [#34764] Improve compatibility of IMILBitmapSource interface
# |
# | Modified files:
# | * dlls/windowscodecs/bitmap.c, dlls/windowscodecs/scaler.c, dlls/windowscodecs/wincodecs_private.h
# |
if test "$enable_windowscodecs_IMILBitmapSource" -eq 1; then
patch_apply windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch
patch_apply windowscodecs-IMILBitmapSource/0002-windowscodecs-Add-support-for-IMILBitmapScaler-inter.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Improve compatibility of IMILBitmapSource interface.", 3 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for IMILBitmapScaler interface.", 2 },';
) >> "$patchlist"
fi
# Patchset windowscodecs-IWICPalette_InitializeFromBitmap
# |
# | This patchset has the following (direct or indirect) dependencies:
@ -8059,6 +8053,39 @@ if test "$enable_windowscodecs_TIFF_Support" -eq 1; then
) >> "$patchlist"
fi
# Patchset windowscodecs-32bppPRGBA
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * gdiplus-Grayscale_PNG, windowscodecs-32bppGrayFloat, windowscodecs-Palette_Images, windowscodecs-GIF_Encoder,
# | windowscodecs-IWICPalette_InitializeFromBitmap, windowscodecs-TIFF_Support
# |
# | Modified files:
# | * dlls/windowscodecs/converter.c, dlls/windowscodecs/info.c, dlls/windowscodecs/regsvr.c
# |
if test "$enable_windowscodecs_32bppPRGBA" -eq 1; then
patch_apply windowscodecs-32bppPRGBA/0001-windowscodecs-Add-support-for-32bppRGB-32bppRGBA-and.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for 32bppRGB, 32bppRGBA and 32bppPRGBA to format converter.", 1 },';
) >> "$patchlist"
fi
# Patchset windowscodecs-IMILBitmapSource
# |
# | This patchset fixes the following Wine bugs:
# | * [#34764] Improve compatibility of IMILBitmapSource interface
# |
# | Modified files:
# | * dlls/windowscodecs/bitmap.c, dlls/windowscodecs/scaler.c, dlls/windowscodecs/wincodecs_private.h
# |
if test "$enable_windowscodecs_IMILBitmapSource" -eq 1; then
patch_apply windowscodecs-IMILBitmapSource/0001-windowscodecs-Improve-compatibility-of-IMILBitmapSou.patch
patch_apply windowscodecs-IMILBitmapSource/0002-windowscodecs-Add-support-for-IMILBitmapScaler-inter.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Improve compatibility of IMILBitmapSource interface.", 3 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for IMILBitmapScaler interface.", 2 },';
) >> "$patchlist"
fi
# Patchset windowscodecs-WICCreateBitmapFromSection
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,215 @@
From 19602d837ac30e24f629eeae62238eb9fbe4adcc Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Mon, 23 Jan 2017 18:24:46 +0800
Subject: windowscodecs: Add support for 32bppRGB, 32bppRGBA and 32bppPRGBA to
format converter.
---
dlls/windowscodecs/converter.c | 74 ++++++++++++++++++++++++++++++++++++++++++
dlls/windowscodecs/info.c | 2 ++
dlls/windowscodecs/regsvr.c | 36 ++++++++++++++++++++
3 files changed, 112 insertions(+)
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
index 5561d423dce..519860d9065 100644
--- a/dlls/windowscodecs/converter.c
+++ b/dlls/windowscodecs/converter.c
@@ -53,8 +53,11 @@ enum pixelformat {
format_24bppRGB,
format_32bppGrayFloat,
format_32bppBGR,
+ format_32bppRGB,
format_32bppBGRA,
+ format_32bppRGBA,
format_32bppPBGRA,
+ format_32bppPRGBA,
format_48bppRGB,
format_64bppRGBA,
format_32bppCMYK,
@@ -858,6 +861,25 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe
}
}
+static HRESULT copypixels_to_32bppRGBA(struct FormatConverter *This, const WICRect *prc,
+ UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
+{
+ HRESULT hr;
+
+ switch (source_format)
+ {
+ case format_32bppRGBA:
+ if (prc)
+ return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer);
+ return S_OK;
+ default:
+ hr = copypixels_to_32bppBGRA(This, prc, cbStride, cbBufferSize, pbBuffer, source_format);
+ if (SUCCEEDED(hr) && prc)
+ reverse_bgr8(4, pbBuffer, prc->Width, prc->Height, cbStride);
+ return hr;
+ }
+}
+
static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRect *prc,
UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
{
@@ -874,6 +896,22 @@ static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRec
}
}
+static HRESULT copypixels_to_32bppRGB(struct FormatConverter *This, const WICRect *prc,
+ UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
+{
+ switch (source_format)
+ {
+ case format_32bppRGB:
+ case format_32bppRGBA:
+ case format_32bppPRGBA:
+ if (prc)
+ return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer);
+ return S_OK;
+ default:
+ return copypixels_to_32bppRGBA(This, prc, cbStride, cbBufferSize, pbBuffer, source_format);
+ }
+}
+
static HRESULT copypixels_to_32bppPBGRA(struct FormatConverter *This, const WICRect *prc,
UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
{
@@ -907,6 +945,39 @@ static HRESULT copypixels_to_32bppPBGRA(struct FormatConverter *This, const WICR
}
}
+static HRESULT copypixels_to_32bppPRGBA(struct FormatConverter *This, const WICRect *prc,
+ UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
+{
+ HRESULT hr;
+
+ switch (source_format)
+ {
+ case format_32bppPRGBA:
+ if (prc)
+ return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer);
+ return S_OK;
+ default:
+ hr = copypixels_to_32bppRGBA(This, prc, cbStride, cbBufferSize, pbBuffer, source_format);
+ if (SUCCEEDED(hr) && prc)
+ {
+ INT x, y;
+
+ for (y=0; y<prc->Height; y++)
+ for (x=0; x<prc->Width; x++)
+ {
+ BYTE alpha = pbBuffer[cbStride*y+4*x+3];
+ if (alpha != 255)
+ {
+ pbBuffer[cbStride*y+4*x] = pbBuffer[cbStride*y+4*x] * alpha / 255;
+ pbBuffer[cbStride*y+4*x+1] = pbBuffer[cbStride*y+4*x+1] * alpha / 255;
+ pbBuffer[cbStride*y+4*x+2] = pbBuffer[cbStride*y+4*x+2] * alpha / 255;
+ }
+ }
+ }
+ return hr;
+ }
+}
+
static HRESULT copypixels_to_24bppBGR(struct FormatConverter *This, const WICRect *prc,
UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
{
@@ -1288,8 +1359,11 @@ static const struct pixelformatinfo supported_formats[] = {
{format_24bppRGB, &GUID_WICPixelFormat24bppRGB, copypixels_to_24bppRGB},
{format_32bppGrayFloat, &GUID_WICPixelFormat32bppGrayFloat, copypixels_to_32bppGrayFloat},
{format_32bppBGR, &GUID_WICPixelFormat32bppBGR, copypixels_to_32bppBGR},
+ {format_32bppRGB, &GUID_WICPixelFormat32bppRGB, copypixels_to_32bppRGB},
{format_32bppBGRA, &GUID_WICPixelFormat32bppBGRA, copypixels_to_32bppBGRA},
+ {format_32bppRGBA, &GUID_WICPixelFormat32bppRGBA, copypixels_to_32bppRGBA},
{format_32bppPBGRA, &GUID_WICPixelFormat32bppPBGRA, copypixels_to_32bppPBGRA},
+ {format_32bppPRGBA, &GUID_WICPixelFormat32bppPRGBA, copypixels_to_32bppPRGBA},
{format_48bppRGB, &GUID_WICPixelFormat48bppRGB, NULL},
{format_64bppRGBA, &GUID_WICPixelFormat64bppRGBA, NULL},
{format_32bppCMYK, &GUID_WICPixelFormat32bppCMYK, NULL},
diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c
index 5e6244b9ccd..cc0123d60c6 100644
--- a/dlls/windowscodecs/info.c
+++ b/dlls/windowscodecs/info.c
@@ -2302,6 +2302,8 @@ HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitma
BOOL canconvert;
ULONG num_fetched;
+ TRACE("%s,%p,%p\n", debugstr_guid(dstFormat), pISrc, ppIDst);
+
res = IWICBitmapSource_GetPixelFormat(pISrc, &srcFormat);
if (FAILED(res)) return res;
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index b5bbff3b38f..308326cbdbc 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -1480,8 +1480,11 @@ static GUID const * const converter_formats[] = {
&GUID_WICPixelFormat24bppBGR,
&GUID_WICPixelFormat24bppRGB,
&GUID_WICPixelFormat32bppBGR,
+ &GUID_WICPixelFormat32bppRGB,
&GUID_WICPixelFormat32bppBGRA,
+ &GUID_WICPixelFormat32bppRGBA,
&GUID_WICPixelFormat32bppPBGRA,
+ &GUID_WICPixelFormat32bppPRGBA,
&GUID_WICPixelFormat32bppGrayFloat,
&GUID_WICPixelFormat48bppRGB,
&GUID_WICPixelFormat64bppRGBA,
@@ -1945,6 +1948,17 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
WICPixelFormatNumericRepresentationUnsignedInteger,
0
},
+ { &GUID_WICPixelFormat32bppRGB,
+ "The Wine Project",
+ "32bpp RGB",
+ NULL, /* no version */
+ &GUID_VendorMicrosoft,
+ 32, /* bitsperpixel */
+ 3, /* channel count */
+ channel_masks_8bit,
+ WICPixelFormatNumericRepresentationUnsignedInteger,
+ 0
+ },
{ &GUID_WICPixelFormat32bppBGRA,
"The Wine Project",
"32bpp BGRA",
@@ -1956,6 +1970,17 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
WICPixelFormatNumericRepresentationUnsignedInteger,
1
},
+ { &GUID_WICPixelFormat32bppRGBA,
+ "The Wine Project",
+ "32bpp RGBA",
+ NULL, /* no version */
+ &GUID_VendorMicrosoft,
+ 32, /* bitsperpixel */
+ 4, /* channel count */
+ channel_masks_8bit,
+ WICPixelFormatNumericRepresentationUnsignedInteger,
+ 1
+ },
{ &GUID_WICPixelFormat32bppPBGRA,
"The Wine Project",
"32bpp PBGRA",
@@ -1967,6 +1992,17 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
WICPixelFormatNumericRepresentationUnsignedInteger,
1
},
+ { &GUID_WICPixelFormat32bppPRGBA,
+ "The Wine Project",
+ "32bpp PRGBA",
+ NULL, /* no version */
+ &GUID_VendorMicrosoft,
+ 32, /* bitsperpixel */
+ 4, /* channel count */
+ channel_masks_8bit,
+ WICPixelFormatNumericRepresentationUnsignedInteger,
+ 1
+ },
{ &GUID_WICPixelFormat32bppGrayFloat,
"The Wine Project",
"32bpp GrayFloat",
--
2.11.0

View File

@ -0,0 +1,2 @@
Fixes: Implement support for 32bppRGB, 32bppRGBA and 32bppPRGBA in format converter
Depends: windowscodecs-TIFF_Support