winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
August 2009
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
4 participants
1042 discussions
Start a n
N
ew thread
Vincent Povirk : windowscodecs: Implement conversion from 4bppGray to 32bppBGRA.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: 25022fe7d5be482790b215bec6978b6e619641fd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=25022fe7d5be482790b215bec…
Author: Vincent Povirk <vincent(a)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,
1
0
0
0
Vincent Povirk : windowscodecs: Implement conversion from 2bppGray to 32bppBGRA.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: 4b99c98720f39443d1cb25d2038af8935529ce94 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4b99c98720f39443d1cb25d20…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 27 13:23:18 2009 -0500 windowscodecs: Implement conversion from 2bppGray to 32bppBGRA. --- dlls/windowscodecs/converter.c | 32 +++++++++++++++++++++++++------- dlls/windowscodecs/regsvr.c | 1 + 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c index 3ea0b2e..8ec1114 100644 --- a/dlls/windowscodecs/converter.c +++ b/dlls/windowscodecs/converter.c @@ -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}, diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c index 4a38849..0e857f5 100644 --- a/dlls/windowscodecs/regsvr.c +++ b/dlls/windowscodecs/regsvr.c @@ -922,6 +922,7 @@ static GUID const * const converter_formats[] = { &GUID_WICPixelFormat4bppIndexed, &GUID_WICPixelFormat8bppIndexed, &GUID_WICPixelFormatBlackWhite, + &GUID_WICPixelFormat2bppGray, &GUID_WICPixelFormat8bppGray, &GUID_WICPixelFormat16bppBGR555, &GUID_WICPixelFormat16bppBGR565,
1
0
0
0
Vincent Povirk : windowscodecs: Implement conversion from 2bppIndexed to 32bppBGRA.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: b952c5726d6865880446347ce3e703bada8b1e2d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b952c5726d6865880446347ce…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 27 13:17:15 2009 -0500 windowscodecs: Implement conversion from 2bppIndexed to 32bppBGRA. --- dlls/windowscodecs/converter.c | 61 ++++++++++++++++++++++++++++++++++++++++ dlls/windowscodecs/regsvr.c | 1 + 2 files changed, 62 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c index af6827c..3ea0b2e 100644 --- a/dlls/windowscodecs/converter.c +++ b/dlls/windowscodecs/converter.c @@ -37,6 +37,7 @@ struct FormatConverter; enum pixelformat { format_1bppIndexed, + format_2bppIndexed, format_4bppIndexed, format_8bppIndexed, format_BlackWhite, @@ -144,6 +145,65 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe return res; } return S_OK; + case format_2bppIndexed: + if (prc) + { + HRESULT res; + UINT x, y; + BYTE *srcdata; + UINT srcstride, srcdatasize; + const BYTE *srcrow; + const BYTE *srcbyte; + BYTE *dstrow; + DWORD *dstpixel; + WICColor colors[4]; + IWICPalette *palette; + UINT actualcolors; + + 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); + + IWICPalette_Release(palette); + + if (FAILED(res)) return res; + + srcstride = (prc->Width+3)/4; + 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++) { + srcbyte=(const BYTE*)srcrow; + dstpixel=(DWORD*)dstrow; + for (x=0; x<prc->Width; x+=4) { + BYTE srcval; + srcval=*srcbyte++; + *dstpixel++ = colors[srcval>>6]; + if (x+1 < prc->Width) *dstpixel++ = colors[srcval>>4&0x3]; + if (x+2 < prc->Width) *dstpixel++ = colors[srcval>>2&0x3]; + if (x+1 < prc->Width) *dstpixel++ = colors[srcval&0x3]; + } + srcrow += srcstride; + dstrow += cbStride; + } + } + + HeapFree(GetProcessHeap(), 0, srcdata); + + return res; + } + return S_OK; case format_4bppIndexed: if (prc) { @@ -476,6 +536,7 @@ static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRec static const struct pixelformatinfo supported_formats[] = { {format_1bppIndexed, &GUID_WICPixelFormat1bppIndexed, NULL}, + {format_2bppIndexed, &GUID_WICPixelFormat2bppIndexed, NULL}, {format_4bppIndexed, &GUID_WICPixelFormat4bppIndexed, NULL}, {format_8bppIndexed, &GUID_WICPixelFormat8bppIndexed, NULL}, {format_BlackWhite, &GUID_WICPixelFormatBlackWhite, NULL}, diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c index 7218c07..4a38849 100644 --- a/dlls/windowscodecs/regsvr.c +++ b/dlls/windowscodecs/regsvr.c @@ -918,6 +918,7 @@ static struct regsvr_decoder const decoder_list[] = { static GUID const * const converter_formats[] = { &GUID_WICPixelFormat1bppIndexed, + &GUID_WICPixelFormat2bppIndexed, &GUID_WICPixelFormat4bppIndexed, &GUID_WICPixelFormat8bppIndexed, &GUID_WICPixelFormatBlackWhite,
1
0
0
0
Vincent Povirk : windowscodecs: Implement conversion from BlackWhite to 32bppBGRA.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: 3b1fde1668afe5607bbe3f4885a99cce910cc1ca URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3b1fde1668afe5607bbe3f488…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 27 12:46:13 2009 -0500 windowscodecs: Implement conversion from BlackWhite to 32bppBGRA. --- dlls/windowscodecs/converter.c | 25 ++++++++++++++++++------- dlls/windowscodecs/regsvr.c | 1 + 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c index f8efd45..af6827c 100644 --- a/dlls/windowscodecs/converter.c +++ b/dlls/windowscodecs/converter.c @@ -39,6 +39,7 @@ enum pixelformat { format_1bppIndexed, format_4bppIndexed, format_8bppIndexed, + format_BlackWhite, format_8bppGray, format_16bppBGR555, format_16bppBGR565, @@ -72,6 +73,7 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe switch (source_format) { case format_1bppIndexed: + case format_BlackWhite: if (prc) { HRESULT res; @@ -86,16 +88,24 @@ 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_1bppIndexed) + { + res = PaletteImpl_Create(&palette); + if (FAILED(res)) return res; - res = IWICBitmapSource_CopyPalette(This->source, palette); - if (SUCCEEDED(res)) - res = IWICPalette_GetColors(palette, 2, colors, &actualcolors); + res = IWICBitmapSource_CopyPalette(This->source, palette); + if (SUCCEEDED(res)) + res = IWICPalette_GetColors(palette, 2, colors, &actualcolors); - IWICPalette_Release(palette); + IWICPalette_Release(palette); - if (FAILED(res)) return res; + if (FAILED(res)) return res; + } + else + { + colors[0] = 0xff000000; + colors[1] = 0xffffffff; + } srcstride = (prc->Width+7)/8; srcdatasize = srcstride * prc->Height; @@ -468,6 +478,7 @@ static const struct pixelformatinfo supported_formats[] = { {format_1bppIndexed, &GUID_WICPixelFormat1bppIndexed, NULL}, {format_4bppIndexed, &GUID_WICPixelFormat4bppIndexed, NULL}, {format_8bppIndexed, &GUID_WICPixelFormat8bppIndexed, NULL}, + {format_BlackWhite, &GUID_WICPixelFormatBlackWhite, 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 81218b9..7218c07 100644 --- a/dlls/windowscodecs/regsvr.c +++ b/dlls/windowscodecs/regsvr.c @@ -920,6 +920,7 @@ static GUID const * const converter_formats[] = { &GUID_WICPixelFormat1bppIndexed, &GUID_WICPixelFormat4bppIndexed, &GUID_WICPixelFormat8bppIndexed, + &GUID_WICPixelFormatBlackWhite, &GUID_WICPixelFormat8bppGray, &GUID_WICPixelFormat16bppBGR555, &GUID_WICPixelFormat16bppBGR565,
1
0
0
0
Vincent Povirk : windowscodecs: Support color-keyed transparency in PNG images.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: 80adebf76cbb5847ce710226a5beff8cc80b9559 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=80adebf76cbb5847ce710226a…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 27 14:07:35 2009 -0500 windowscodecs: Support color-keyed transparency in PNG images. --- dlls/windowscodecs/pngformat.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index cfc5d2d..be0bd6e 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -55,8 +55,11 @@ MAKE_FUNCPTR(png_get_io_ptr); MAKE_FUNCPTR(png_get_PLTE); MAKE_FUNCPTR(png_get_tRNS); MAKE_FUNCPTR(png_set_bgr); +MAKE_FUNCPTR(png_set_gray_1_2_4_to_8); MAKE_FUNCPTR(png_set_gray_to_rgb); MAKE_FUNCPTR(png_set_read_fn); +MAKE_FUNCPTR(png_set_strip_16); +MAKE_FUNCPTR(png_set_tRNS_to_alpha); MAKE_FUNCPTR(png_read_end); MAKE_FUNCPTR(png_read_image); MAKE_FUNCPTR(png_read_info); @@ -83,8 +86,11 @@ static void *load_libpng(void) LOAD_FUNCPTR(png_get_PLTE); LOAD_FUNCPTR(png_get_tRNS); LOAD_FUNCPTR(png_set_bgr); + LOAD_FUNCPTR(png_set_gray_1_2_4_to_8); LOAD_FUNCPTR(png_set_gray_to_rgb); LOAD_FUNCPTR(png_set_read_fn); + LOAD_FUNCPTR(png_set_strip_16); + LOAD_FUNCPTR(png_set_tRNS_to_alpha); LOAD_FUNCPTR(png_read_end); LOAD_FUNCPTR(png_read_image); LOAD_FUNCPTR(png_read_info); @@ -196,6 +202,10 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p UINT image_size; UINT i; int color_type, bit_depth; + png_bytep trans; + int num_trans; + png_uint_32 transparency; + png_color_16p trans_values; TRACE("(%p,%p,%x)\n", iface, pIStream, cacheOptions); /* initialize libpng */ @@ -242,6 +252,25 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p color_type = ppng_get_color_type(This->png_ptr, This->info_ptr); bit_depth = ppng_get_bit_depth(This->png_ptr, This->info_ptr); + /* check for color-keyed alpha */ + transparency = ppng_get_tRNS(This->png_ptr, This->info_ptr, &trans, &num_trans, &trans_values); + + if (transparency && color_type != PNG_COLOR_TYPE_PALETTE) + { + /* expand to RGBA */ + if (color_type == PNG_COLOR_TYPE_GRAY) + { + if (bit_depth < 8) + { + ppng_set_gray_1_2_4_to_8(This->png_ptr); + bit_depth = 8; + } + ppng_set_gray_to_rgb(This->png_ptr); + } + ppng_set_tRNS_to_alpha(This->png_ptr); + color_type = PNG_COLOR_TYPE_RGB_ALPHA; + } + switch (color_type) { case PNG_COLOR_TYPE_GRAY:
1
0
0
0
Vincent Povirk : windowscodecs: Implement CopyPalette for the PNG decoder.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: 4657938235e638b5e43a9d8b93fcad65ec1f34bc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4657938235e638b5e43a9d8b9…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 27 13:17:06 2009 -0500 windowscodecs: Implement CopyPalette for the PNG decoder. --- dlls/windowscodecs/pngformat.c | 45 ++++++++++++++++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 5c73f40..cfc5d2d 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -52,6 +52,8 @@ MAKE_FUNCPTR(png_get_color_type); MAKE_FUNCPTR(png_get_image_height); MAKE_FUNCPTR(png_get_image_width); MAKE_FUNCPTR(png_get_io_ptr); +MAKE_FUNCPTR(png_get_PLTE); +MAKE_FUNCPTR(png_get_tRNS); MAKE_FUNCPTR(png_set_bgr); MAKE_FUNCPTR(png_set_gray_to_rgb); MAKE_FUNCPTR(png_set_read_fn); @@ -78,6 +80,8 @@ static void *load_libpng(void) LOAD_FUNCPTR(png_get_image_height); LOAD_FUNCPTR(png_get_image_width); LOAD_FUNCPTR(png_get_io_ptr); + LOAD_FUNCPTR(png_get_PLTE); + LOAD_FUNCPTR(png_get_tRNS); LOAD_FUNCPTR(png_set_bgr); LOAD_FUNCPTR(png_set_gray_to_rgb); LOAD_FUNCPTR(png_set_read_fn); @@ -484,8 +488,45 @@ static HRESULT WINAPI PngDecoder_Frame_GetResolution(IWICBitmapFrameDecode *ifac static HRESULT WINAPI PngDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface, IWICPalette *pIPalette) { - FIXME("(%p,%p): stub\n", iface, pIPalette); - return E_NOTIMPL; + PngDecoder *This = impl_from_frame(iface); + png_uint_32 ret; + png_colorp png_palette; + int num_palette; + WICColor palette[256]; + png_bytep trans; + int num_trans; + png_color_16p trans_values; + int i; + + TRACE("(%p,%p)\n", iface, pIPalette); + + ret = ppng_get_PLTE(This->png_ptr, This->info_ptr, &png_palette, &num_palette); + if (!ret) return WINCODEC_ERR_PALETTEUNAVAILABLE; + + if (num_palette > 256) + { + ERR("palette has %i colors?!\n", num_palette); + return E_FAIL; + } + + for (i=0; i<num_palette; i++) + { + palette[i] = (0xff000000| + png_palette[i].red << 16| + png_palette[i].green << 8| + png_palette[i].blue); + } + + ret = ppng_get_tRNS(This->png_ptr, This->info_ptr, &trans, &num_trans, &trans_values); + if (ret) + { + for (i=0; i<num_trans; i++) + { + palette[trans[i]] = 0x00000000; + } + } + + return IWICPalette_InitializeCustom(pIPalette, palette, num_palette); } static HRESULT WINAPI PngDecoder_Frame_CopyPixels(IWICBitmapFrameDecode *iface,
1
0
0
0
Vincent Povirk : windowscodecs: Implement CopyPixels for the PNG decoder.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: bcd8dc2d5305d810703f1e25a534f6972a1cc044 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bcd8dc2d5305d810703f1e25a…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 27 12:41:03 2009 -0500 windowscodecs: Implement CopyPixels for the PNG decoder. --- dlls/windowscodecs/pngformat.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 2373f99..5c73f40 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -491,8 +491,12 @@ static HRESULT WINAPI PngDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface, static HRESULT WINAPI PngDecoder_Frame_CopyPixels(IWICBitmapFrameDecode *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer) { - FIXME("(%p,%p,%u,%u,%p): stub\n", iface, prc, cbStride, cbBufferSize, pbBuffer); - return E_NOTIMPL; + PngDecoder *This = impl_from_frame(iface); + TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer); + + return copy_pixels(This->bpp, This->image_bits, + This->width, This->height, This->stride, + prc, cbStride, cbBufferSize, pbBuffer); } static HRESULT WINAPI PngDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDecode *iface,
1
0
0
0
Vincent Povirk : windowscodecs: Implement GetSize for the PNG decoder.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: c7125783dec641086433062d9e24195378a6ddd9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c7125783dec641086433062d9…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Thu Aug 27 12:39:16 2009 -0500 windowscodecs: Implement GetSize for the PNG decoder. --- dlls/windowscodecs/pngformat.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 5ab9c9f..2373f99 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -456,8 +456,11 @@ static ULONG WINAPI PngDecoder_Frame_Release(IWICBitmapFrameDecode *iface) static HRESULT WINAPI PngDecoder_Frame_GetSize(IWICBitmapFrameDecode *iface, UINT *puiWidth, UINT *puiHeight) { - FIXME("(%p,%p,%p): stub\n", iface, puiWidth, puiHeight); - return E_NOTIMPL; + PngDecoder *This = impl_from_frame(iface); + *puiWidth = This->width; + *puiHeight = This->height; + TRACE("(%p)->(%u,%u)\n", iface, *puiWidth, *puiHeight); + return S_OK; } static HRESULT WINAPI PngDecoder_Frame_GetPixelFormat(IWICBitmapFrameDecode *iface,
1
0
0
0
Vincent Povirk : windowscodecs: Implement GetPixelFormat for the PNG decoder.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: 50b07b795d3b9c7f2353d18f87f887a6c5b61038 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=50b07b795d3b9c7f2353d18f8…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Tue Aug 18 17:54:15 2009 -0500 windowscodecs: Implement GetPixelFormat for the PNG decoder. --- dlls/windowscodecs/pngformat.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 4c6c50c..5ab9c9f 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -463,8 +463,12 @@ static HRESULT WINAPI PngDecoder_Frame_GetSize(IWICBitmapFrameDecode *iface, static HRESULT WINAPI PngDecoder_Frame_GetPixelFormat(IWICBitmapFrameDecode *iface, WICPixelFormatGUID *pPixelFormat) { - FIXME("(%p,%p): stub\n", iface, pPixelFormat); - return E_NOTIMPL; + PngDecoder *This = impl_from_frame(iface); + TRACE("(%p,%p)\n", iface, pPixelFormat); + + memcpy(pPixelFormat, This->format, sizeof(GUID)); + + return S_OK; } static HRESULT WINAPI PngDecoder_Frame_GetResolution(IWICBitmapFrameDecode *iface,
1
0
0
0
Vincent Povirk : windowscodecs: Implement GetFrame for the PNG decoder.
by Alexandre Julliard
28 Aug '09
28 Aug '09
Module: wine Branch: master Commit: b077f0653c86c0aa21d4b30a5ba75a7e99208a4b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b077f0653c86c0aa21d4b30a5…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Tue Aug 18 17:09:03 2009 -0500 windowscodecs: Implement GetFrame for the PNG decoder. --- dlls/windowscodecs/pngformat.c | 126 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 124 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index bd0482b..4c6c50c 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -92,6 +92,7 @@ static void *load_libpng(void) typedef struct { const IWICBitmapDecoderVtbl *lpVtbl; + const IWICBitmapFrameDecodeVtbl *lpFrameVtbl; LONG ref; png_structp png_ptr; png_infop info_ptr; @@ -104,6 +105,13 @@ typedef struct { BYTE *image_bits; } PngDecoder; +static inline PngDecoder *impl_from_frame(IWICBitmapFrameDecode *iface) +{ + return CONTAINING_RECORD(iface, PngDecoder, lpFrameVtbl); +} + +static const IWICBitmapFrameDecodeVtbl PngDecoder_FrameVtbl; + static HRESULT WINAPI PngDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid, void **ppv) { @@ -381,8 +389,18 @@ static HRESULT WINAPI PngDecoder_GetFrameCount(IWICBitmapDecoder *iface, static HRESULT WINAPI PngDecoder_GetFrame(IWICBitmapDecoder *iface, UINT index, IWICBitmapFrameDecode **ppIBitmapFrame) { - FIXME("(%p,%u,%p): stub\n", iface, index, ppIBitmapFrame); - return E_NOTIMPL; + PngDecoder *This = (PngDecoder*)iface; + TRACE("(%p,%u,%p)\n", iface, index, ppIBitmapFrame); + + if (!This->initialized) return WINCODEC_ERR_NOTINITIALIZED; + + if (index != 0) return E_INVALIDARG; + + IWICBitmapDecoder_AddRef(iface); + + *ppIBitmapFrame = (void*)(&This->lpFrameVtbl); + + return S_OK; } static const IWICBitmapDecoderVtbl PngDecoder_Vtbl = { @@ -402,6 +420,109 @@ static const IWICBitmapDecoderVtbl PngDecoder_Vtbl = { PngDecoder_GetFrame }; +static HRESULT WINAPI PngDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid, + void **ppv) +{ + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IWICBitmapSource, iid) || + IsEqualIID(&IID_IWICBitmapFrameDecode, iid)) + { + *ppv = iface; + } + else + { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI PngDecoder_Frame_AddRef(IWICBitmapFrameDecode *iface) +{ + PngDecoder *This = impl_from_frame(iface); + return IUnknown_AddRef((IUnknown*)This); +} + +static ULONG WINAPI PngDecoder_Frame_Release(IWICBitmapFrameDecode *iface) +{ + PngDecoder *This = impl_from_frame(iface); + return IUnknown_Release((IUnknown*)This); +} + +static HRESULT WINAPI PngDecoder_Frame_GetSize(IWICBitmapFrameDecode *iface, + UINT *puiWidth, UINT *puiHeight) +{ + FIXME("(%p,%p,%p): stub\n", iface, puiWidth, puiHeight); + return E_NOTIMPL; +} + +static HRESULT WINAPI PngDecoder_Frame_GetPixelFormat(IWICBitmapFrameDecode *iface, + WICPixelFormatGUID *pPixelFormat) +{ + FIXME("(%p,%p): stub\n", iface, pPixelFormat); + return E_NOTIMPL; +} + +static HRESULT WINAPI PngDecoder_Frame_GetResolution(IWICBitmapFrameDecode *iface, + double *pDpiX, double *pDpiY) +{ + FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY); + return E_NOTIMPL; +} + +static HRESULT WINAPI PngDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface, + IWICPalette *pIPalette) +{ + FIXME("(%p,%p): stub\n", iface, pIPalette); + return E_NOTIMPL; +} + +static HRESULT WINAPI PngDecoder_Frame_CopyPixels(IWICBitmapFrameDecode *iface, + const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer) +{ + FIXME("(%p,%p,%u,%u,%p): stub\n", iface, prc, cbStride, cbBufferSize, pbBuffer); + return E_NOTIMPL; +} + +static HRESULT WINAPI PngDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, + IWICMetadataQueryReader **ppIMetadataQueryReader) +{ + FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); + return E_NOTIMPL; +} + +static HRESULT WINAPI PngDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface, + UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount); + return E_NOTIMPL; +} + +static HRESULT WINAPI PngDecoder_Frame_GetThumbnail(IWICBitmapFrameDecode *iface, + IWICBitmapSource **ppIThumbnail) +{ + FIXME("(%p,%p): stub\n", iface, ppIThumbnail); + return E_NOTIMPL; +} + +static const IWICBitmapFrameDecodeVtbl PngDecoder_FrameVtbl = { + PngDecoder_Frame_QueryInterface, + PngDecoder_Frame_AddRef, + PngDecoder_Frame_Release, + PngDecoder_Frame_GetSize, + PngDecoder_Frame_GetPixelFormat, + PngDecoder_Frame_GetResolution, + PngDecoder_Frame_CopyPalette, + PngDecoder_Frame_CopyPixels, + PngDecoder_Frame_GetMetadataQueryReader, + PngDecoder_Frame_GetColorContexts, + PngDecoder_Frame_GetThumbnail +}; + HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) { PngDecoder *This; @@ -423,6 +544,7 @@ HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) if (!This) return E_OUTOFMEMORY; This->lpVtbl = &PngDecoder_Vtbl; + This->lpFrameVtbl = &PngDecoder_FrameVtbl; This->ref = 1; This->png_ptr = NULL; This->info_ptr = NULL;
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
105
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Results per page:
10
25
50
100
200