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
June 2012
----- 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
3 participants
827 discussions
Start a n
N
ew thread
Dmitry Timoshkov : gdiplus: Add some tests for image properties.
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: 7f9230c5667c4038199d2b39c7aeb252abb6e793 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7f9230c5667c4038199d2b39c…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Mon Jun 25 20:30:57 2012 +0900 gdiplus: Add some tests for image properties. --- dlls/gdiplus/tests/image.c | 115 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 113 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 84baaa3..40673a0 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -27,8 +27,8 @@ #include "gdiplus.h" #include "wine/test.h" -#define expect(expected, got) ok((UINT)(got) == (UINT)(expected), "Expected %.8x, got %.8x\n", (UINT)(expected), (UINT)(got)) -#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got) +#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (expected), (got)) +#define expectf(expected, got) ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got)) static BOOL color_match(ARGB c1, ARGB c2, BYTE max_diff) { @@ -2656,6 +2656,116 @@ static void test_dispose(void) expect(ObjectBusy, stat); } +static GpImage *load_image(const BYTE *image_data, UINT image_size) +{ + IStream *stream; + HGLOBAL hmem; + BYTE *data; + HRESULT hr; + GpStatus status; + GpImage *image = NULL; + + hmem = GlobalAlloc(0, image_size); + data = GlobalLock(hmem); + memcpy(data, image_data, image_size); + GlobalUnlock(hmem); + + hr = CreateStreamOnHGlobal(hmem, TRUE, &stream); + ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr); + if (hr != S_OK) return NULL; + + status = GdipLoadImageFromStream(stream, &image); + ok(status == Ok, "GdipLoadImageFromStream error %d\n", status); + + IStream_Release(stream); + + return image; +} + +static void test_image_properties(void) +{ + static const struct test_data + { + const BYTE *image_data; + UINT image_size; + ImageType image_type; + UINT prop_count; + } + td[] = + { + { pngimage, sizeof(pngimage), ImageTypeBitmap, 4 }, + /* Win7 reports 4 properties, while everybody else just 1 + { gifimage, sizeof(gifimage), ImageTypeBitmap, 1 }, */ + { jpgimage, sizeof(jpgimage), ImageTypeBitmap, 2 }, + { tiffimage, sizeof(tiffimage), ImageTypeBitmap, 16 }, + { bmpimage, sizeof(bmpimage), ImageTypeBitmap, 0 }, + { wmfimage, sizeof(wmfimage), ImageTypeMetafile, 0 } + }; + GpStatus status; + GpImage *image; + UINT prop_count, i; + PROPID prop_id[16]; + ImageType image_type; + + for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + { + image = load_image(td[i].image_data, td[i].image_size); + ok(image != 0, "%u: failed to load image data\n", i); + if (!image) continue; + + status = GdipGetImageType(image, &image_type); + ok(status == Ok, "%u: GdipGetImageType error %d\n", i, status); + ok(td[i].image_type == image_type, "%u: expected image_type %d, got %d\n", + i, td[i].image_type, image_type); + + status = GdipGetPropertyCount(image, &prop_count); + ok(status == Ok, "%u: GdipGetPropertyCount error %d\n", i, status); + if (td[i].image_data == pngimage || td[i].image_data == gifimage || + td[i].image_data == jpgimage) + todo_wine + ok(td[i].prop_count == prop_count, " %u: expected property count %u, got %u\n", + i, td[i].prop_count, prop_count); + else + ok(td[i].prop_count == prop_count, " %u: expected property count %u, got %u\n", + i, td[i].prop_count, prop_count); + + if (td[i].prop_count != prop_count) + { + GdipDisposeImage(image); + continue; + } + + status = GdipGetPropertyIdList(NULL, prop_count, prop_id); + expect(InvalidParameter, status); + status = GdipGetPropertyIdList(image, prop_count, NULL); + expect(InvalidParameter, status); + status = GdipGetPropertyIdList(image, 0, prop_id); + if (image_type == ImageTypeMetafile) + expect(NotImplemented, status); + else if (prop_count == 0) + expect(Ok, status); + else + expect(InvalidParameter, status); + status = GdipGetPropertyIdList(image, prop_count - 1, prop_id); + if (image_type == ImageTypeMetafile) + expect(NotImplemented, status); + else + expect(InvalidParameter, status); + status = GdipGetPropertyIdList(image, prop_count + 1, prop_id); + if (image_type == ImageTypeMetafile) + expect(NotImplemented, status); + else + expect(InvalidParameter, status); + status = GdipGetPropertyIdList(image, prop_count, prop_id); + if (image_type == ImageTypeMetafile) + expect(NotImplemented, status); + else + expect(Ok, status); + + GdipDisposeImage(image); + } +} + START_TEST(image) { struct GdiplusStartupInput gdiplusStartupInput; @@ -2668,6 +2778,7 @@ START_TEST(image) GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + test_image_properties(); test_Scan0(); test_FromGdiDib(); test_GetImageDimension();
1
0
0
0
Dmitry Timoshkov : gdiplus: Implement GdipGetPropertyIdList.
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: fb6b27de77e5994f0f5105d38264670d447b6241 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fb6b27de77e5994f0f5105d38…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Mon Jun 25 20:30:50 2012 +0900 gdiplus: Implement GdipGetPropertyIdList. --- dlls/gdiplus/image.c | 53 +++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 48 insertions(+), 5 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 33c6ee6..db4518a 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -2420,16 +2420,59 @@ GpStatus WINGDIPAPI GdipGetPropertyCount(GpImage *image, UINT *num) return Ok; } -GpStatus WINGDIPAPI GdipGetPropertyIdList(GpImage *image, UINT num, PROPID* list) +GpStatus WINGDIPAPI GdipGetPropertyIdList(GpImage *image, UINT num, PROPID *list) { - static int calls; + HRESULT hr; + IWICMetadataReader *reader; + IWICEnumMetadataItem *enumerator; + UINT prop_count, i, items_returned; TRACE("(%p, %u, %p)\n", image, num, list); - if(!(calls++)) - FIXME("not implemented\n"); + if (!image || !list) return InvalidParameter; - return InvalidParameter; + if (image->type != ImageTypeBitmap) + { + FIXME("Not implemented for type %d\n", image->type); + return NotImplemented; + } + + reader = ((GpBitmap *)image)->metadata_reader; + if (!reader) + { + if (num != 0) return InvalidParameter; + return Ok; + } + + hr = IWICMetadataReader_GetCount(reader, &prop_count); + if (FAILED(hr)) return hresult_to_status(hr); + + if (num != prop_count) return InvalidParameter; + + hr = IWICMetadataReader_GetEnumerator(reader, &enumerator); + if (FAILED(hr)) return hresult_to_status(hr); + + IWICEnumMetadataItem_Reset(enumerator); + + for (i = 0; i < num; i++) + { + PROPVARIANT id; + + hr = IWICEnumMetadataItem_Next(enumerator, 1, NULL, &id, NULL, &items_returned); + if (hr != S_OK) break; + + if (id.vt != VT_UI2) + { + FIXME("not supported propvariant type for id: %u\n", id.vt); + list[i] = 0; + continue; + } + list[i] = id.u.uiVal; + } + + IWICEnumMetadataItem_Release(enumerator); + + return hr == S_OK ? Ok : hresult_to_status(hr); } GpStatus WINGDIPAPI GdipGetPropertyItem(GpImage *image, PROPID id, UINT size,
1
0
0
0
Dmitry Timoshkov : gdiplus: Implement GdipGetPropertyCount.
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: b9132b68153c509be1ece76bd760db5eb9a97731 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b9132b68153c509be1ece76bd…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Mon Jun 25 20:30:43 2012 +0900 gdiplus: Implement GdipGetPropertyCount. --- dlls/gdiplus/image.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index c8650c6..33c6ee6 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -2403,16 +2403,20 @@ GpStatus WINGDIPAPI GdipGetAllPropertyItems(GpImage *image, UINT size, return InvalidParameter; } -GpStatus WINGDIPAPI GdipGetPropertyCount(GpImage *image, UINT* num) +GpStatus WINGDIPAPI GdipGetPropertyCount(GpImage *image, UINT *num) { - static int calls; - TRACE("(%p, %p)\n", image, num); - if(!(calls++)) - FIXME("not implemented\n"); + if (!image || !num) return InvalidParameter; *num = 0; + + if (image->type == ImageTypeBitmap) + { + if (((GpBitmap *)image)->metadata_reader) + IWICMetadataReader_GetCount(((GpBitmap *)image)->metadata_reader, num); + } + return Ok; }
1
0
0
0
Dmitry Timoshkov : gdiplus: When loading a bitmap frame save its IWICMetadataReader interface.
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: b72d236ca8eb3994bcb1023eeb215513cb347721 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b72d236ca8eb3994bcb1023ee…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Mon Jun 25 20:30:34 2012 +0900 gdiplus: When loading a bitmap frame save its IWICMetadataReader interface. --- dlls/gdiplus/gdiplus_private.h | 2 ++ dlls/gdiplus/image.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 9ac9be2..1f50c91 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -29,6 +29,7 @@ #include "objbase.h" #include "ocidl.h" +#include "wincodecsdk.h" #include "wine/list.h" #include "gdiplus.h" @@ -309,6 +310,7 @@ struct GpBitmap{ INT stride; /* stride of bits if this is a DIB */ BYTE *own_bits; /* image bits that need to be freed with this object */ INT lockx, locky; /* X and Y coordinates of the rect when a bitmap is locked for writing. */ + IWICMetadataReader *metadata_reader; /* NULL if there is no metadata */ }; struct GpCachedBitmap{ diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 351160b..c8650c6 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -17,6 +17,7 @@ */ #include <stdarg.h> +#include <assert.h> #define NONAMELESSUNION @@ -1785,6 +1786,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, (*bitmap)->bits = bits; (*bitmap)->stride = stride; (*bitmap)->own_bits = own_bits; + (*bitmap)->metadata_reader = NULL; /* set format-related flags */ if (format & (PixelFormatAlpha|PixelFormatPAlpha|PixelFormatIndexed)) @@ -1967,6 +1969,11 @@ GpStatus WINGDIPAPI GdipEmfToWmfBits(HENHMETAFILE hemf, UINT cbData16, * and free src. */ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette) { + assert(src->image.type == ImageTypeBitmap); + assert(dst->image.type == ImageTypeBitmap); + assert(src->image.stream == NULL); + assert(dst->image.stream == NULL); + GdipFree(dst->bitmapbits); DeleteDC(dst->hdc); DeleteObject(dst->hbitmap); @@ -1991,7 +1998,11 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette) dst->bits = src->bits; dst->stride = src->stride; dst->own_bits = src->own_bits; + if (dst->metadata_reader) + IWICMetadataReader_Release(dst->metadata_reader); + dst->metadata_reader = src->metadata_reader; + src->image.type = ~0; GdipFree(src); } @@ -2006,6 +2017,8 @@ static GpStatus free_image_data(GpImage *image) GdipFree(((GpBitmap*)image)->own_bits); DeleteDC(((GpBitmap*)image)->hdc); DeleteObject(((GpBitmap*)image)->hbitmap); + if (((GpBitmap*)image)->metadata_reader) + IWICMetadataReader_Release(((GpBitmap*)image)->metadata_reader); } else if (image->type == ImageTypeMetafile) { @@ -2588,6 +2601,7 @@ static GpStatus decode_image_wic(IStream* stream, REFCLSID clsid, UINT active_fr IWICBitmapDecoder *decoder; IWICBitmapFrameDecode *frame; IWICBitmapSource *source=NULL; + IWICMetadataBlockReader *block_reader; WICPixelFormatGUID wic_format; PixelFormat gdip_format=0; int i; @@ -2685,6 +2699,15 @@ static GpStatus decode_image_wic(IStream* stream, REFCLSID clsid, UINT active_fr IWICBitmapSource_Release(source); } + bitmap->metadata_reader = NULL; + if (IWICBitmapFrameDecode_QueryInterface(frame, &IID_IWICMetadataBlockReader, (void **)&block_reader) == S_OK) + { + UINT block_count = 0; + if (IWICMetadataBlockReader_GetCount(block_reader, &block_count) == S_OK && block_count) + IWICMetadataBlockReader_GetReaderByIndex(block_reader, 0, &bitmap->metadata_reader); + IWICMetadataBlockReader_Release(block_reader); + } + IWICBitmapFrameDecode_Release(frame); }
1
0
0
0
Erich Hoover : hhctrl.ocx: Keep parsing failure from causing a segmentation fault.
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: b72ac222ea8b59eae17efbdff57cbfd82e3badd6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b72ac222ea8b59eae17efbdff…
Author: Erich Hoover <ehoover(a)mines.edu> Date: Mon Jun 25 08:54:47 2012 -0600 hhctrl.ocx: Keep parsing failure from causing a segmentation fault. --- dlls/hhctrl.ocx/index.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/hhctrl.ocx/index.c b/dlls/hhctrl.ocx/index.c index 3cf69de..2cc79a6 100644 --- a/dlls/hhctrl.ocx/index.c +++ b/dlls/hhctrl.ocx/index.c @@ -191,6 +191,8 @@ static IndexItem *parse_li(HHInfo *info, stream_t *stream) strbuf_zero(&node); } + if(!ret) + FIXME("Failed to parse <li> tag!\n"); strbuf_free(&node); strbuf_free(&node_name); @@ -227,9 +229,11 @@ static void parse_hhindex(HHInfo *info, IStream *str, IndexItem *item) if(!strcasecmp(node_name.buf, "li")) { item->next = parse_li(info, &stream); - item->next->merge = item->merge; - item = item->next; - item->indentLevel = indent_level; + if(item->next) { + item->next->merge = item->merge; + item = item->next; + item->indentLevel = indent_level; + } }else if(!strcasecmp(node_name.buf, "ul")) { indent_level++; }else if(!strcasecmp(node_name.buf, "/ul")) {
1
0
0
0
Vincent Povirk : windowscodecs: Implement IWICBitmapScaler::Initialize.
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: 07795754f43394d31fc9888237fc774fe31c4403 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=07795754f43394d31fc988823…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Tue Feb 28 16:20:03 2012 -0600 windowscodecs: Implement IWICBitmapScaler::Initialize. --- dlls/windowscodecs/scaler.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 files changed, 36 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/scaler.c b/dlls/windowscodecs/scaler.c index d3bd1b7..be21dcc 100644 --- a/dlls/windowscodecs/scaler.c +++ b/dlls/windowscodecs/scaler.c @@ -36,6 +36,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); typedef struct BitmapScaler { IWICBitmapScaler IWICBitmapScaler_iface; LONG ref; + IWICBitmapSource *source; + UINT width, height; + WICBitmapInterpolationMode mode; + CRITICAL_SECTION lock; /* must be held when initialized */ } BitmapScaler; static inline BitmapScaler *impl_from_IWICBitmapScaler(IWICBitmapScaler *iface) @@ -86,6 +90,9 @@ static ULONG WINAPI BitmapScaler_Release(IWICBitmapScaler *iface) if (ref == 0) { + This->lock.DebugInfo->Spare[0] = 0; + DeleteCriticalSection(&This->lock); + if (This->source) IWICBitmapSource_Release(This->source); HeapFree(GetProcessHeap(), 0, This); } @@ -136,9 +143,30 @@ static HRESULT WINAPI BitmapScaler_Initialize(IWICBitmapScaler *iface, IWICBitmapSource *pISource, UINT uiWidth, UINT uiHeight, WICBitmapInterpolationMode mode) { - FIXME("(%p,%p,%u,%u,%u): stub\n", iface, pISource, uiWidth, uiHeight, mode); + BitmapScaler *This = impl_from_IWICBitmapScaler(iface); + HRESULT hr=S_OK; - return E_NOTIMPL; + TRACE("(%p,%p,%u,%u,%u)\n", iface, pISource, uiWidth, uiHeight, mode); + + EnterCriticalSection(&This->lock); + + if (This->source) + { + hr = WINCODEC_ERR_WRONGSTATE; + goto end; + } + + IWICBitmapSource_AddRef(pISource); + This->source = pISource; + + This->width = uiWidth; + This->height = uiHeight; + This->mode = mode; + +end: + LeaveCriticalSection(&This->lock); + + return hr; } static const IWICBitmapScalerVtbl BitmapScaler_Vtbl = { @@ -162,6 +190,12 @@ HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl; This->ref = 1; + This->source = NULL; + This->width = 0; + This->height = 0; + This->mode = 0; + InitializeCriticalSection(&This->lock); + This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BitmapScaler.lock"); *scaler = &This->IWICBitmapScaler_iface;
1
0
0
0
Vincent Povirk : windowscodecs: Implement IWICImagingFactory::CreateEncoder .
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: 02aa7ec403e5faf3d89126e39481a4c7209d5540 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=02aa7ec403e5faf3d89126e39…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Tue Feb 28 16:10:08 2012 -0600 windowscodecs: Implement IWICImagingFactory::CreateEncoder. --- dlls/windowscodecs/imgfactory.c | 60 +++++++++++++++++++++++++++++++++++++- 1 files changed, 58 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index fa28c9a..d70c223 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -335,9 +335,65 @@ static HRESULT WINAPI ComponentFactory_CreateEncoder(IWICComponentFactory *iface REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapEncoder **ppIEncoder) { - FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidContainerFormat), + static int fixme=0; + IEnumUnknown *enumencoders; + IUnknown *unkencoderinfo; + IWICBitmapEncoderInfo *encoderinfo; + IWICBitmapEncoder *encoder=NULL; + HRESULT res=S_OK; + ULONG num_fetched; + GUID actual_containerformat; + + TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat), debugstr_guid(pguidVendor), ppIEncoder); - return E_NOTIMPL; + + if (pguidVendor && !fixme++) + FIXME("ignoring vendor GUID\n"); + + res = CreateComponentEnumerator(WICEncoder, WICComponentEnumerateDefault, &enumencoders); + if (FAILED(res)) return res; + + while (!encoder) + { + res = IEnumUnknown_Next(enumencoders, 1, &unkencoderinfo, &num_fetched); + + if (res == S_OK) + { + res = IUnknown_QueryInterface(unkencoderinfo, &IID_IWICBitmapEncoderInfo, (void**)&encoderinfo); + + if (SUCCEEDED(res)) + { + res = IWICBitmapEncoderInfo_GetContainerFormat(encoderinfo, &actual_containerformat); + + if (SUCCEEDED(res) && IsEqualGUID(guidContainerFormat, &actual_containerformat)) + { + res = IWICBitmapEncoderInfo_CreateInstance(encoderinfo, &encoder); + if (FAILED(res)) + encoder = NULL; + } + + IWICBitmapEncoderInfo_Release(encoderinfo); + } + + IUnknown_Release(unkencoderinfo); + } + else + break; + } + + IEnumUnknown_Release(enumencoders); + + if (encoder) + { + *ppIEncoder = encoder; + return S_OK; + } + else + { + WARN("failed to create encoder\n"); + *ppIEncoder = NULL; + return WINCODEC_ERR_COMPONENTNOTFOUND; + } } static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface,
1
0
0
0
Vincent Povirk : windowscodecs: Add stub IWICBitmapScaler implementation.
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: efab393295e3c9fe49891c778cd05b49f7426f4b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=efab393295e3c9fe49891c778…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Tue Feb 28 13:45:32 2012 -0600 windowscodecs: Add stub IWICBitmapScaler implementation. --- dlls/windowscodecs/Makefile.in | 1 + dlls/windowscodecs/imgfactory.c | 5 +- dlls/windowscodecs/scaler.c | 169 ++++++++++++++++++++++++++++++++ dlls/windowscodecs/wincodecs_private.h | 1 + 4 files changed, 174 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in index 28b5852..da851d5 100644 --- a/dlls/windowscodecs/Makefile.in +++ b/dlls/windowscodecs/Makefile.in @@ -24,6 +24,7 @@ C_SRCS = \ propertybag.c \ proxy.c \ regsvr.c \ + scaler.c \ stream.c \ tgaformat.c \ tiffformat.c \ diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index 9ef8bbb..fa28c9a 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -356,8 +356,9 @@ static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactor static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory *iface, IWICBitmapScaler **ppIBitmapScaler) { - FIXME("(%p,%p): stub\n", iface, ppIBitmapScaler); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIBitmapScaler); + + return BitmapScaler_Create(ppIBitmapScaler); } static HRESULT WINAPI ComponentFactory_CreateBitmapClipper(IWICComponentFactory *iface, diff --git a/dlls/windowscodecs/scaler.c b/dlls/windowscodecs/scaler.c new file mode 100644 index 0000000..d3bd1b7 --- /dev/null +++ b/dlls/windowscodecs/scaler.c @@ -0,0 +1,169 @@ +/* + * Copyright 2010 Vincent Povirk for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include <stdarg.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "wincodec.h" + +#include "wincodecs_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); + +typedef struct BitmapScaler { + IWICBitmapScaler IWICBitmapScaler_iface; + LONG ref; +} BitmapScaler; + +static inline BitmapScaler *impl_from_IWICBitmapScaler(IWICBitmapScaler *iface) +{ + return CONTAINING_RECORD(iface, BitmapScaler, IWICBitmapScaler_iface); +} + +static HRESULT WINAPI BitmapScaler_QueryInterface(IWICBitmapScaler *iface, REFIID iid, + void **ppv) +{ + BitmapScaler *This = impl_from_IWICBitmapScaler(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IWICBitmapSource, iid) || + IsEqualIID(&IID_IWICBitmapScaler, iid)) + { + *ppv = This; + } + else + { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI BitmapScaler_AddRef(IWICBitmapScaler *iface) +{ + BitmapScaler *This = impl_from_IWICBitmapScaler(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI BitmapScaler_Release(IWICBitmapScaler *iface) +{ + BitmapScaler *This = impl_from_IWICBitmapScaler(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI BitmapScaler_GetSize(IWICBitmapScaler *iface, + UINT *puiWidth, UINT *puiHeight) +{ + FIXME("(%p,%p,%p): stub\n", iface, puiWidth, puiHeight); + + return E_NOTIMPL; +} + +static HRESULT WINAPI BitmapScaler_GetPixelFormat(IWICBitmapScaler *iface, + WICPixelFormatGUID *pPixelFormat) +{ + FIXME("(%p,%p): stub\n", iface, pPixelFormat); + + return E_NOTIMPL; +} + +static HRESULT WINAPI BitmapScaler_GetResolution(IWICBitmapScaler *iface, + double *pDpiX, double *pDpiY) +{ + FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY); + + return E_NOTIMPL; +} + +static HRESULT WINAPI BitmapScaler_CopyPalette(IWICBitmapScaler *iface, + IWICPalette *pIPalette) +{ + FIXME("(%p,%p): stub\n", iface, pIPalette); + + return E_NOTIMPL; +} + +static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *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 BitmapScaler_Initialize(IWICBitmapScaler *iface, + IWICBitmapSource *pISource, UINT uiWidth, UINT uiHeight, + WICBitmapInterpolationMode mode) +{ + FIXME("(%p,%p,%u,%u,%u): stub\n", iface, pISource, uiWidth, uiHeight, mode); + + return E_NOTIMPL; +} + +static const IWICBitmapScalerVtbl BitmapScaler_Vtbl = { + BitmapScaler_QueryInterface, + BitmapScaler_AddRef, + BitmapScaler_Release, + BitmapScaler_GetSize, + BitmapScaler_GetPixelFormat, + BitmapScaler_GetResolution, + BitmapScaler_CopyPalette, + BitmapScaler_CopyPixels, + BitmapScaler_Initialize +}; + +HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) +{ + BitmapScaler *This; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapScaler)); + if (!This) return E_OUTOFMEMORY; + + This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl; + This->ref = 1; + + *scaler = &This->IWICBitmapScaler_iface; + + return S_OK; +} diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h index 92fa7ef..815ee3d 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -44,6 +44,7 @@ extern HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void* extern HRESULT TgaDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) DECLSPEC_HIDDEN; extern HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator) DECLSPEC_HIDDEN; extern HRESULT PaletteImpl_Create(IWICPalette **palette) DECLSPEC_HIDDEN; extern HRESULT StreamImpl_Create(IWICStream **stream) DECLSPEC_HIDDEN;
1
0
0
0
Vincent Povirk : windowscodecs: Add tests for IWICPixelFormatInfo.
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: 917c4e1f10f3d958082beee32e0ac93cfc13582a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=917c4e1f10f3d958082beee32…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Sat Mar 24 14:11:48 2012 -0500 windowscodecs: Add tests for IWICPixelFormatInfo. --- dlls/windowscodecs/tests/info.c | 88 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/tests/info.c b/dlls/windowscodecs/tests/info.c index e923999..1cd84c1 100644 --- a/dlls/windowscodecs/tests/info.c +++ b/dlls/windowscodecs/tests/info.c @@ -122,12 +122,18 @@ static void test_decoder_info(void) static void test_pixelformat_info(void) { IWICComponentInfo *info; + IWICPixelFormatInfo *pixelformat_info; + IWICPixelFormatInfo2 *pixelformat_info2; HRESULT hr; ULONG len, known_len; WCHAR value[256]; GUID guid; WICComponentType componenttype; + WICPixelFormatNumericRepresentation numericrepresentation; DWORD signing; + UINT uiresult; + BYTE abbuffer[256]; + BOOL supportstransparency; hr = get_component_info(&GUID_WICPixelFormat32bppBGRA, &info); ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr); @@ -217,6 +223,88 @@ static void test_pixelformat_info(void) ok(hr == S_OK, "GetVersion failed, hr=%x\n", hr); ok(len == 0, "invalid length 0x%x\n", len); /* version does not apply to pixel formats */ + hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo, (void**)&pixelformat_info); + ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr); + + if (SUCCEEDED(hr)) + { + hr = IWICPixelFormatInfo_GetBitsPerPixel(pixelformat_info, NULL); + ok(hr == E_INVALIDARG, "GetBitsPerPixel failed, hr=%x\n", hr); + + hr = IWICPixelFormatInfo_GetBitsPerPixel(pixelformat_info, &uiresult); + ok(hr == S_OK, "GetBitsPerPixel failed, hr=%x\n", hr); + ok(uiresult == 32, "unexpected bpp %i\n", uiresult); + + hr = IWICPixelFormatInfo_GetChannelCount(pixelformat_info, &uiresult); + ok(hr == S_OK, "GetChannelCount failed, hr=%x\n", hr); + ok(uiresult == 4, "unexpected channel count %i\n", uiresult); + + hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 0, NULL, NULL); + ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%x\n", hr); + + uiresult = 0xdeadbeef; + hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 0, NULL, &uiresult); + ok(hr == S_OK, "GetChannelMask failed, hr=%x\n", hr); + ok(uiresult == 4, "unexpected length %i\n", uiresult); + + memset(abbuffer, 0xaa, sizeof(abbuffer)); + hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, known_len, abbuffer, NULL); + ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%x\n", hr); + ok(abbuffer[0] == 0xaa, "buffer modified\n"); + + uiresult = 0xdeadbeef; + memset(abbuffer, 0xaa, sizeof(abbuffer)); + hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 3, abbuffer, &uiresult); + ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%x\n", hr); + ok(abbuffer[0] == 0xaa, "buffer modified\n"); + ok(uiresult == 4, "unexpected length %i\n", uiresult); + + memset(abbuffer, 0xaa, sizeof(abbuffer)); + hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 4, abbuffer, &uiresult); + ok(hr == S_OK, "GetChannelMask failed, hr=%x\n", hr); + ok(*((ULONG*)abbuffer) == 0xff, "unexpected mask 0x%x\n", *((ULONG*)abbuffer)); + ok(uiresult == 4, "unexpected length %i\n", uiresult); + + memset(abbuffer, 0xaa, sizeof(abbuffer)); + hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 5, abbuffer, &uiresult); + ok(hr == S_OK, "GetChannelMask failed, hr=%x\n", hr); + ok(*((ULONG*)abbuffer) == 0xff, "unexpected mask 0x%x\n", *((ULONG*)abbuffer)); + ok(abbuffer[4] == 0xaa, "buffer modified past actual length\n"); + ok(uiresult == 4, "unexpected length %i\n", uiresult); + + memset(&guid, 0xaa, sizeof(guid)); + hr = IWICPixelFormatInfo_GetFormatGUID(pixelformat_info, &guid); + ok(hr == S_OK, "GetFormatGUID failed, hr=%x\n", hr); + ok(IsEqualGUID(&guid, &GUID_WICPixelFormat32bppBGRA), "unexpected GUID %s\n", debugstr_guid(&guid)); + + IWICPixelFormatInfo_Release(pixelformat_info); + } + + hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo2, (void**)&pixelformat_info2); + + if (FAILED(hr)) + win_skip("IWICPixelFormatInfo2 not supported\n"); + else + { + hr = IWICPixelFormatInfo2_GetNumericRepresentation(pixelformat_info2, NULL); + ok(hr == E_INVALIDARG, "GetNumericRepresentation failed, hr=%x\n", hr); + + numericrepresentation = 0xdeadbeef; + hr = IWICPixelFormatInfo2_GetNumericRepresentation(pixelformat_info2, &numericrepresentation); + ok(hr == S_OK, "GetNumericRepresentation failed, hr=%x\n", hr); + ok(numericrepresentation == WICPixelFormatNumericRepresentationUnsignedInteger, "unexpected numeric representation %i\n", numericrepresentation); + + hr = IWICPixelFormatInfo2_SupportsTransparency(pixelformat_info2, NULL); + ok(hr == E_INVALIDARG, "SupportsTransparency failed, hr=%x\n", hr); + + supportstransparency = 0xdeadbeef; + hr = IWICPixelFormatInfo2_SupportsTransparency(pixelformat_info2, &supportstransparency); + ok(hr == S_OK, "SupportsTransparency failed, hr=%x\n", hr); + ok(supportstransparency == 1, "unexpected value %i\n", supportstransparency); + + IWICPixelFormatInfo2_Release(pixelformat_info2); + } + IWICComponentInfo_Release(info); }
1
0
0
0
Vincent Povirk : windowscodecs: Implement IWICPixelFormatInfo2:: SupportsTransparency.
by Alexandre Julliard
26 Jun '12
26 Jun '12
Module: wine Branch: master Commit: 12babdb7da25f22c8851303731a6fbbb5019a8ab URL:
http://source.winehq.org/git/wine.git/?a=commit;h=12babdb7da25f22c885130373…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Jun 13 10:24:42 2012 -0500 windowscodecs: Implement IWICPixelFormatInfo2::SupportsTransparency. --- dlls/windowscodecs/info.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index 980dfc4..b403310 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -50,6 +50,7 @@ static const WCHAR bitsperpixel_valuename[] = {'B','i','t','L','e','n','g','t',' static const WCHAR channelcount_valuename[] = {'C','h','a','n','n','e','l','C','o','u','n','t',0}; static const WCHAR channelmasks_keyname[] = {'C','h','a','n','n','e','l','M','a','s','k','s',0}; static const WCHAR numericrepresentation_valuename[] = {'N','u','m','e','r','i','c','R','e','p','r','e','s','e','n','t','a','t','i','o','n',0}; +static const WCHAR supportstransparency_valuename[] = {'S','u','p','p','o','r','t','s','T','r','a','n','s','p','a','r','e','n','c','y',0}; static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value, UINT buffer_size, WCHAR *buffer, UINT *actual_size) @@ -1324,8 +1325,11 @@ static HRESULT WINAPI PixelFormatInfo_GetChannelMask(IWICPixelFormatInfo2 *iface static HRESULT WINAPI PixelFormatInfo_SupportsTransparency(IWICPixelFormatInfo2 *iface, BOOL *pfSupportsTransparency) { - FIXME("(%p,%p): stub\n", iface, pfSupportsTransparency); - return E_NOTIMPL; + PixelFormatInfo *This = impl_from_IWICPixelFormatInfo2(iface); + + TRACE("(%p,%p)\n", iface, pfSupportsTransparency); + + return ComponentInfo_GetDWORDValue(This->classkey, supportstransparency_valuename, (DWORD*)pfSupportsTransparency); } static HRESULT WINAPI PixelFormatInfo_GetNumericRepresentation(IWICPixelFormatInfo2 *iface,
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
83
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
Results per page:
10
25
50
100
200