From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- 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 6e7bb8e781..b2c4cee260 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) { @@ -1236,8 +1307,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 d0c2c690ca..3e3cdb5435 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -2483,6 +2483,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 9a580c67c5..c8338f1bea 100644 --- a/dlls/windowscodecs/regsvr.c +++ b/dlls/windowscodecs/regsvr.c @@ -1463,8 +1463,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, @@ -1928,6 +1931,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", @@ -1939,6 +1953,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", @@ -1950,6 +1975,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",
Nikolay Sivov nsivov@codeweavers.com wrote:
From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Please don't send my patches from wine-staging for inclusion to winehq, I prefer to take care of that on my own when time permits. I already asked about that more than once.
Dmitry Timoshkov dmitry@baikal.ru wrote:
Nikolay Sivov nsivov@codeweavers.com wrote:
From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Please don't send my patches from wine-staging for inclusion to winehq, I prefer to take care of that on my own when time permits. I already asked about that more than once.
Besides, this version of the patch is broken, I have a fixed one.
On Tue, Jan 29, 2019 at 6:49 PM Dmitry Timoshkov dmitry@baikal.ru wrote:
Dmitry Timoshkov dmitry@baikal.ru wrote:
Nikolay Sivov nsivov@codeweavers.com wrote:
From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Please don't send my patches from wine-staging for inclusion to winehq, I prefer to take care of that on my own when time permits. I already asked about that more than once.
Besides, this version of the patch is broken, I have a fixed one.
Great. I probably only need RGBA part of it right now. If you're going to send it any time soon that would be ideal.
-- Dmitry.
Hello!
Am Di., 29. Jan. 2019 um 16:48 Uhr schrieb Dmitry Timoshkov dmitry@baikal.ru:
Nikolay Sivov nsivov@codeweavers.com wrote:
From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Please don't send my patches from wine-staging for inclusion to winehq, I prefer to take care of that on my own when time permits. I already asked about that more than once.
This probably results from the offer sent with every news item that says: Please steal the staging patches and submit them.
What could be done about that? Maybe update the staging patches with some line "Do not steal this patch, the author takes care of it"?
Regards, Kai
Kai Krakow kai@kaishome.de wrote:
Please don't send my patches from wine-staging for inclusion to winehq, I prefer to take care of that on my own when time permits. I already asked about that more than once.
This probably results from the offer sent with every news item that says: Please steal the staging patches and submit them.
That's not an offer, that's a game of some sort. People are usually taught in their childhood that stealing is bad, and often rightfully get punished for that. That particilar line from the wine-staging news should be removed, it just creates an unpleasant picture of the project.
On Tue, Jan 29, 2019, 18:55 Dmitry Timoshkov <dmitry@baikal.ru wrote:
Kai Krakow kai@kaishome.de wrote:
Please don't send my patches from wine-staging for inclusion to winehq, I prefer to take care of that on my own when time permits. I already asked about that more than once.
This probably results from the offer sent with every news item that says: Please steal the staging patches and submit them.
That's not an offer, that's a game of some sort. People are usually taught in their childhood that stealing is bad, and often rightfully get punished for that. That particilar line from the wine-staging news should be removed, it just creates an unpleasant picture of the project.
-- Dmitry.
It's open source code, I don't think the LGPL lets you limit its use in this way, but I'm welcome to be proven wrong.
Hello Austin!
Generally I agree with you but the staging patches play a somewhat different role here: Some are currently actively handled by their authors, others are old or maybe even abandoned by their original author. And "steal" is maybe not the best wording. Maybe the wording should be different, and maybe it should ask to contact the original author first.
Actually, I'm having a problem with "stealing" something. The way it's worded leaves a negative feeling about adopting a patch and working on it. I'd better not pick patches to actively work on them and submit them, because the news item considered it stealing... at least regarding IP. Actually, it's quite common work-flow of forking, adding IP to a project and giving back. But this feels different. What do you think?
Regards, Kai
Am Mi., 30. Jan. 2019 um 02:47 Uhr schrieb Austin English austinenglish@gmail.com:
On Tue, Jan 29, 2019, 18:55 Dmitry Timoshkov <dmitry@baikal.ru wrote:
Kai Krakow kai@kaishome.de wrote:
Please don't send my patches from wine-staging for inclusion to winehq, I prefer to take care of that on my own when time permits. I already asked about that more than once.
This probably results from the offer sent with every news item that says: Please steal the staging patches and submit them.
That's not an offer, that's a game of some sort. People are usually taught in their childhood that stealing is bad, and often rightfully get punished for that. That particilar line from the wine-staging news should be removed, it just creates an unpleasant picture of the project.
-- Dmitry.
It's open source code, I don't think the LGPL lets you limit its use in this way, but I'm welcome to be proven wrong.