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 2010
----- 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
2 participants
884 discussions
Start a n
N
ew thread
Stefan Dösinger : wined3d: The clipplane mask and texcoords are unsigned.
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: 1d710bb4cab2ffcef26ffe2e52d028f7b5b37c9a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1d710bb4cab2ffcef26ffe2e5…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Wed Jul 28 15:47:22 2010 +0200 wined3d: The clipplane mask and texcoords are unsigned. --- dlls/wined3d/arb_program_shader.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 03443b4..db1f953 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -248,8 +248,8 @@ struct arb_vs_compile_args struct { WORD bools; - char clip_texcoord; - char clipplane_mask; + unsigned char clip_texcoord; + unsigned char clipplane_mask; } boolclip; DWORD boolclip_compare; } clip; @@ -4482,7 +4482,7 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW { if(stateblock->renderState[WINED3DRS_CLIPPING]) { - args->clip.boolclip.clipplane_mask = stateblock->renderState[WINED3DRS_CLIPPLANEENABLE]; + args->clip.boolclip.clipplane_mask = (unsigned char) stateblock->renderState[WINED3DRS_CLIPPLANEENABLE]; } /* clipplane_mask was set to 0 by setting boolclip_compare to 0 */ }
1
0
0
0
Nikolay Sivov : oleaut32/olepicture: No need to check interface pointer in vtable methods.
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: b5a8c331821544a136fd23fe57ebbf54c7eb6a55 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b5a8c331821544a136fd23fe5…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 23 11:54:07 2010 +0400 oleaut32/olepicture: No need to check interface pointer in vtable methods. --- dlls/oleaut32/olepicture.c | 27 ++++++--------------------- 1 files changed, 6 insertions(+), 21 deletions(-) diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c index d6d55d9..4dd25fb 100644 --- a/dlls/oleaut32/olepicture.c +++ b/dlls/oleaut32/olepicture.c @@ -438,22 +438,14 @@ static HRESULT WINAPI OLEPictureImpl_QueryInterface( void** ppvObject) { OLEPictureImpl *This = (OLEPictureImpl *)iface; + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject); - /* - * Perform a sanity check on the parameters. - */ - if ( (This==0) || (ppvObject==0) ) + if (!ppvObject) return E_INVALIDARG; - /* - * Initialize the return parameter. - */ *ppvObject = 0; - /* - * Compare the riid with the interface IDs implemented by this object. - */ if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IPicture, riid)) *ppvObject = This; else if (IsEqualIID(&IID_IDispatch, riid)) @@ -465,20 +457,13 @@ static HRESULT WINAPI OLEPictureImpl_QueryInterface( else if (IsEqualIID(&IID_IConnectionPointContainer, riid)) *ppvObject = &This->lpvtblIConnectionPointContainer; - /* - * Check that we obtained an interface. - */ - if ((*ppvObject)==0) + if (!*ppvObject) { FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid)); return E_NOINTERFACE; } - /* - * Query Interface always increases the reference count by one when it is - * successful - */ - OLEPictureImpl_AddRef((IPicture*)This); + IPicture_AddRef(iface); return S_OK; } @@ -1335,9 +1320,9 @@ static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This, * * Currently implemented: BITMAP, ICON, JPEG, GIF, WMF, EMF */ -static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { +static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm) { HRESULT hr; - BOOL headerisdata = FALSE; + BOOL headerisdata; BOOL statfailed = FALSE; ULONG xread, toread; ULONG headerread;
1
0
0
0
Nikolay Sivov : oleaut32/olepicture: Fix assumptions about S_OK value.
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: 32c2ef6c9761bf953ec97dc64d7196d9bb274521 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=32c2ef6c9761bf953ec97dc64…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 23 11:17:35 2010 +0400 oleaut32/olepicture: Fix assumptions about S_OK value. --- dlls/oleaut32/olepicture.c | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c index df7826b..d6d55d9 100644 --- a/dlls/oleaut32/olepicture.c +++ b/dlls/oleaut32/olepicture.c @@ -494,7 +494,7 @@ static void OLEPicture_SendNotify(OLEPictureImpl* this, DISPID dispID) IEnumConnections *pEnum; CONNECTDATA CD; - if (IConnectionPoint_EnumConnections(this->pCP, &pEnum)) + if (IConnectionPoint_EnumConnections(this->pCP, &pEnum) != S_OK) return; while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) { IPropertyNotifySink *sink; @@ -1336,7 +1336,7 @@ static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This, * Currently implemented: BITMAP, ICON, JPEG, GIF, WMF, EMF */ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { - HRESULT hr = E_FAIL; + HRESULT hr; BOOL headerisdata = FALSE; BOOL statfailed = FALSE; ULONG xread, toread; @@ -1365,8 +1365,8 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { * Also handle streams where we do not have a working "Stat" method by * reading all data until the end of the stream. */ - hr=IStream_Stat(pStm,&statstg,STATFLAG_NONAME); - if (hr) { + hr = IStream_Stat(pStm,&statstg,STATFLAG_NONAME); + if (hr != S_OK) { TRACE("stat failed with hres %x, proceeding to read all data.\n",hr); statfailed = TRUE; /* we will read at least 8 byte ... just right below */ @@ -1377,8 +1377,8 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { headerread = 0; headerisdata = FALSE; do { - hr=IStream_Read(pStm,header,8,&xread); - if (hr || xread!=8) { + hr = IStream_Read(pStm, header, 8, &xread); + if (hr != S_OK || xread!=8) { ERR("Failure while reading picture header (hr is %x, nread is %d).\n",hr,xread); return (hr?hr:E_FAIL); } @@ -1423,11 +1423,11 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { while (1) { while (xread < origsize) { hr = IStream_Read(pStm,xbuf+xread,origsize-xread,&nread); - xread+=nread; - if (hr || !nread) + xread += nread; + if (hr != S_OK || !nread) break; } - if (!nread || hr) /* done, or error */ + if (!nread || hr != S_OK) /* done, or error */ break; if (xread == origsize) { origsize += sizeinc; @@ -1435,7 +1435,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { xbuf = HeapReAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, xbuf, origsize); } } - if (hr) + if (hr != S_OK) TRACE("hr in no-stat loader case is %08x\n", hr); TRACE("loaded %d bytes.\n", xread); This->datalen = xread; @@ -1452,8 +1452,8 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { while (xread < This->datalen) { ULONG nread; hr = IStream_Read(pStm,xbuf+xread,This->datalen-xread,&nread); - xread+=nread; - if (hr || !nread) + xread += nread; + if (hr != S_OK || !nread) break; } if (xread != This->datalen) @@ -2159,8 +2159,8 @@ static const IConnectionPointContainerVtbl OLEPictureImpl_IConnectionPointContai HRESULT WINAPI OleCreatePictureIndirect(LPPICTDESC lpPictDesc, REFIID riid, BOOL fOwn, LPVOID *ppvObj ) { - OLEPictureImpl* newPict = NULL; - HRESULT hr = S_OK; + OLEPictureImpl* newPict; + HRESULT hr; TRACE("(%p,%s,%d,%p)\n", lpPictDesc, debugstr_guid(riid), fOwn, ppvObj); @@ -2209,10 +2209,10 @@ HRESULT WINAPI OleLoadPicture( LPSTREAM lpstream, LONG lSize, BOOL fRunmode, lpstream, lSize, fRunmode, debugstr_guid(riid), ppvObj); hr = OleCreatePictureIndirect(NULL,riid,!fRunmode,(LPVOID*)&newpic); - if (hr) + if (hr != S_OK) return hr; hr = IPicture_QueryInterface(newpic,&IID_IPersistStream, (LPVOID*)&ps); - if (hr) { + if (hr != S_OK) { ERR("Could not get IPersistStream iface from Ole Picture?\n"); IPicture_Release(newpic); *ppvObj = NULL; @@ -2228,7 +2228,7 @@ HRESULT WINAPI OleLoadPicture( LPSTREAM lpstream, LONG lSize, BOOL fRunmode, return hr; } hr = IPicture_QueryInterface(newpic,riid,ppvObj); - if (hr) + if (hr != S_OK) ERR("Failed to get interface %s from IPicture.\n",debugstr_guid(riid)); IPicture_Release(newpic); return hr; @@ -2248,10 +2248,10 @@ HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode, lpstream, lSize, fRunmode, debugstr_guid(riid), xsiz, ysiz, flags, ppvObj); hr = OleCreatePictureIndirect(NULL,riid,!fRunmode,(LPVOID*)&newpic); - if (hr) + if (hr != S_OK) return hr; hr = IPicture_QueryInterface(newpic,&IID_IPersistStream, (LPVOID*)&ps); - if (hr) { + if (hr != S_OK) { ERR("Could not get IPersistStream iface from Ole Picture?\n"); IPicture_Release(newpic); *ppvObj = NULL; @@ -2267,7 +2267,7 @@ HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode, return hr; } hr = IPicture_QueryInterface(newpic,riid,ppvObj); - if (hr) + if (hr != S_OK) ERR("Failed to get interface %s from IPicture.\n",debugstr_guid(riid)); IPicture_Release(newpic); return hr;
1
0
0
0
Nikolay Sivov : oleaut32/olepicture: Properly round while performing pixels->himetric units conversion.
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: 99863b02ba73f68c06cfa46425f06d12fc44bf9b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=99863b02ba73f68c06cfa4642…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 23 10:59:06 2010 +0400 oleaut32/olepicture: Properly round while performing pixels->himetric units conversion. --- dlls/oleaut32/olepicture.c | 35 ++++++++++++---- dlls/oleaut32/tests/olepicture.c | 79 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 9 deletions(-) diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c index b8e949d..df7826b 100644 --- a/dlls/oleaut32/olepicture.c +++ b/dlls/oleaut32/olepicture.c @@ -181,28 +181,43 @@ static const IDispatchVtbl OLEPictureImpl_IDispatch_VTable; static const IPersistStreamVtbl OLEPictureImpl_IPersistStream_VTable; static const IConnectionPointContainerVtbl OLEPictureImpl_IConnectionPointContainer_VTable; +/* pixels to HIMETRIC units conversion */ +static inline OLE_XSIZE_HIMETRIC xpixels_to_himetric(INT pixels, HDC hdc) +{ + return MulDiv(pixels, 2540, GetDeviceCaps(hdc, LOGPIXELSX)); +} + +static inline OLE_YSIZE_HIMETRIC ypixels_to_himetric(INT pixels, HDC hdc) +{ + return MulDiv(pixels, 2540, GetDeviceCaps(hdc, LOGPIXELSY)); +} + /*********************************************************************** * Implementation of the OLEPictureImpl class. */ -static void OLEPictureImpl_SetBitmap(OLEPictureImpl*This) { +static void OLEPictureImpl_SetBitmap(OLEPictureImpl *This) +{ BITMAP bm; HDC hdcRef; TRACE("bitmap handle %p\n", This->desc.u.bmp.hbitmap); - if(GetObjectA(This->desc.u.bmp.hbitmap, sizeof(bm), &bm) != sizeof(bm)) { + if(GetObjectW(This->desc.u.bmp.hbitmap, sizeof(bm), &bm) != sizeof(bm)) { ERR("GetObject fails\n"); return; } This->origWidth = bm.bmWidth; This->origHeight = bm.bmHeight; + /* The width and height are stored in HIMETRIC units (0.01 mm), so we take our pixel width divide by pixels per inch and multiply by 25.4 * 100 */ /* Should we use GetBitmapDimension if available? */ hdcRef = CreateCompatibleDC(0); - This->himetricWidth =(bm.bmWidth *2540)/GetDeviceCaps(hdcRef, LOGPIXELSX); - This->himetricHeight=(bm.bmHeight*2540)/GetDeviceCaps(hdcRef, LOGPIXELSY); + + This->himetricWidth = xpixels_to_himetric(bm.bmWidth, hdcRef); + This->himetricHeight = xpixels_to_himetric(bm.bmHeight, hdcRef); + DeleteDC(hdcRef); } @@ -216,7 +231,7 @@ static void OLEPictureImpl_SetIcon(OLEPictureImpl * This) BITMAP bm; TRACE("bitmap handle for icon is %p\n", infoIcon.hbmColor); - if(GetObjectA(infoIcon.hbmColor ? infoIcon.hbmColor : infoIcon.hbmMask, sizeof(bm), &bm) != sizeof(bm)) { + if(GetObjectW(infoIcon.hbmColor ? infoIcon.hbmColor : infoIcon.hbmMask, sizeof(bm), &bm) != sizeof(bm)) { ERR("GetObject fails on icon bitmap\n"); return; } @@ -225,8 +240,10 @@ static void OLEPictureImpl_SetIcon(OLEPictureImpl * This) This->origHeight = infoIcon.hbmColor ? bm.bmHeight : bm.bmHeight / 2; /* see comment on HIMETRIC on OLEPictureImpl_SetBitmap() */ hdcRef = GetDC(0); - This->himetricWidth = (This->origWidth *2540)/GetDeviceCaps(hdcRef, LOGPIXELSX); - This->himetricHeight= (This->origHeight *2540)/GetDeviceCaps(hdcRef, LOGPIXELSY); + + This->himetricWidth = xpixels_to_himetric(This->origWidth, hdcRef); + This->himetricHeight = ypixels_to_himetric(This->origHeight, hdcRef); + ReleaseDC(0, hdcRef); DeleteObject(infoIcon.hbmMask); @@ -1241,8 +1258,8 @@ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG x This->origWidth = cifd->idEntries[i].bWidth; This->origHeight = cifd->idEntries[i].bHeight; hdcRef = CreateCompatibleDC(0); - This->himetricWidth =(cifd->idEntries[i].bWidth *2540)/GetDeviceCaps(hdcRef, LOGPIXELSX); - This->himetricHeight=(cifd->idEntries[i].bHeight*2540)/GetDeviceCaps(hdcRef, LOGPIXELSY); + This->himetricWidth = xpixels_to_himetric(cifd->idEntries[i].bWidth, hdcRef); + This->himetricHeight= ypixels_to_himetric(cifd->idEntries[i].bHeight, hdcRef); DeleteDC(hdcRef); return S_OK; } diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c index f00055e..9ab2515 100644 --- a/dlls/oleaut32/tests/olepicture.c +++ b/dlls/oleaut32/tests/olepicture.c @@ -880,6 +880,84 @@ static void test_OleLoadPicturePath(void) "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres); } +static void test_himetric(void) +{ + static const BYTE bmp_bits[1024]; + OLE_XSIZE_HIMETRIC cx; + OLE_YSIZE_HIMETRIC cy; + IPicture *pic; + PICTDESC desc; + HBITMAP bmp; + HRESULT hr; + HICON icon; + HDC hdc; + INT d; + + if (!pOleCreatePictureIndirect) + { + win_skip("OleCreatePictureIndirect not available\n"); + return; + } + + desc.cbSizeofstruct = sizeof(desc); + desc.picType = PICTYPE_BITMAP; + desc.u.bmp.hpal = NULL; + + hdc = CreateCompatibleDC(0); + + bmp = CreateBitmap(1.9 * GetDeviceCaps(hdc, LOGPIXELSX), + 1.9 * GetDeviceCaps(hdc, LOGPIXELSY), 1, 1, NULL); + + desc.u.bmp.hbitmap = bmp; + + /* size in himetric units reported rounded up to next integer value */ + hr = pOleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); + ok(hr == S_OK, "got 0x%08x\n", hr); + + cx = 0; + d = MulDiv((INT)(1.9 * GetDeviceCaps(hdc, LOGPIXELSX)), 2540, GetDeviceCaps(hdc, LOGPIXELSX)); + hr = IPicture_get_Width(pic, &cx); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(cx == d, "got %d, expected %d\n", cx, d); + + cy = 0; + d = MulDiv((INT)(1.9 * GetDeviceCaps(hdc, LOGPIXELSY)), 2540, GetDeviceCaps(hdc, LOGPIXELSY)); + hr = IPicture_get_Height(pic, &cy); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(cy == d, "got %d, expected %d\n", cy, d); + + DeleteObject(bmp); + IPicture_Release(pic); + + /* same thing with icon */ + icon = CreateIcon(NULL, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), + 1, 1, bmp_bits, bmp_bits); + ok(icon != NULL, "failed to create icon\n"); + + desc.picType = PICTYPE_ICON; + desc.u.icon.hicon = icon; + + hr = pOleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic); + ok(hr == S_OK, "got 0x%08x\n", hr); + + cx = 0; + d = MulDiv(GetSystemMetrics(SM_CXICON), 2540, GetDeviceCaps(hdc, LOGPIXELSX)); + hr = IPicture_get_Width(pic, &cx); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(cx == d, "got %d, expected %d\n", cx, d); + + cy = 0; + d = MulDiv(GetSystemMetrics(SM_CYICON), 2540, GetDeviceCaps(hdc, LOGPIXELSY)); + hr = IPicture_get_Height(pic, &cy); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(cy == d, "got %d, expected %d\n", cy, d); + + IPicture_Release(pic); + DestroyIcon(icon); + + DeleteDC(hdc); +} + START_TEST(olepicture) { hOleaut32 = GetModuleHandleA("oleaut32.dll"); @@ -911,6 +989,7 @@ START_TEST(olepicture) test_get_Handle(); test_get_Type(); test_OleLoadPicturePath(); + test_himetric(); }
1
0
0
0
Nikolay Sivov : comctl32/imagelist: Fix return value for IImageList_GetIconSize().
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: acbd632039a96a02feebc911a88de3114094512b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=acbd632039a96a02feebc911a…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sat Aug 21 19:31:29 2010 +0400 comctl32/imagelist: Fix return value for IImageList_GetIconSize(). --- dlls/comctl32/imagelist.c | 5 +--- dlls/comctl32/tests/imagelist.c | 48 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 89333bf..9396b95 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3431,7 +3431,7 @@ static HRESULT WINAPI ImageListImpl_GetIconSize(IImageList *iface, int *cx, { HIMAGELIST This = (HIMAGELIST) iface; - return ImageList_GetIconSize(This, cx, cy) ? S_OK : E_FAIL; + return ImageList_GetIconSize(This, cx, cy) ? S_OK : E_INVALIDARG; } static HRESULT WINAPI ImageListImpl_SetIconSize(IImageList *iface, int cx, @@ -3442,9 +3442,6 @@ static HRESULT WINAPI ImageListImpl_SetIconSize(IImageList *iface, int cx, static HRESULT WINAPI ImageListImpl_GetImageCount(IImageList *iface, int *pi) { - if (!pi) - return E_FAIL; - *pi = ImageList_GetImageCount((HIMAGELIST) iface); return S_OK; } diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index ff3ada4..c5ea95f 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1863,6 +1863,52 @@ if (0) IImageList_Release(imgl); } +static void test_IImageList_GetImageCount(void) +{ + IImageList *imgl; + HIMAGELIST himl; + int count; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + +if (0) +{ + /* crashes on native */ + hr = IImageList_GetImageCount(imgl, NULL); +} + + count = -1; + hr = IImageList_GetImageCount(imgl, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count == 0, "got %d\n", count); + + IImageList_Release(imgl); +} + +static void test_IImageList_GetIconSize(void) +{ + IImageList *imgl; + HIMAGELIST himl; + int cx, cy; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + + hr = IImageList_GetIconSize(imgl, NULL, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IImageList_GetIconSize(imgl, &cx, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IImageList_GetIconSize(imgl, NULL, &cy); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + IImageList_Release(imgl); +} + START_TEST(imagelist) { ULONG_PTR ctx_cookie; @@ -1918,6 +1964,8 @@ START_TEST(imagelist) test_IImageList_Clone(); test_IImageList_GetBkColor(); test_IImageList_SetBkColor(); + test_IImageList_GetImageCount(); + test_IImageList_GetIconSize(); CoUninitialize();
1
0
0
0
Nikolay Sivov : comctl32/imagelist: Fix return value from IImageList_SetBkColor().
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: 9b77425f6a2bdd968f2135142ef54ee7837fcac9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9b77425f6a2bdd968f2135142…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sat Aug 21 19:22:34 2010 +0400 comctl32/imagelist: Fix return value from IImageList_SetBkColor(). --- dlls/comctl32/imagelist.c | 5 +---- dlls/comctl32/tests/imagelist.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index f110787..89333bf 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3458,11 +3458,8 @@ static HRESULT WINAPI ImageListImpl_SetImageCount(IImageList *iface, static HRESULT WINAPI ImageListImpl_SetBkColor(IImageList *iface, COLORREF clrBk, COLORREF *pclr) { - if (!pclr) - return E_FAIL; - *pclr = ImageList_SetBkColor((HIMAGELIST) iface, clrBk); - return *pclr == CLR_NONE ? E_FAIL : S_OK; + return S_OK; } static HRESULT WINAPI ImageListImpl_GetBkColor(IImageList *iface, COLORREF *pclr) diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index dc1c0c8..ff3ada4 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1833,6 +1833,36 @@ if (0) IImageList_Release(imgl); } +static void test_IImageList_SetBkColor(void) +{ + IImageList *imgl; + HIMAGELIST himl; + COLORREF color; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + +if (0) +{ + /* crashes on native */ + hr = IImageList_SetBkColor(imgl, RGB(0, 0, 0), NULL); +} + + hr = IImageList_SetBkColor(imgl, CLR_NONE, &color); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IImageList_SetBkColor(imgl, CLR_NONE, &color); + ok(hr == S_OK, "got 0x%08x\n", hr); + + color = 0xdeadbeef; + hr = IImageList_GetBkColor(imgl, &color); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(color == CLR_NONE, "got %x\n", color); + + IImageList_Release(imgl); +} + START_TEST(imagelist) { ULONG_PTR ctx_cookie; @@ -1887,6 +1917,7 @@ START_TEST(imagelist) test_IImageList_Merge(); test_IImageList_Clone(); test_IImageList_GetBkColor(); + test_IImageList_SetBkColor(); CoUninitialize();
1
0
0
0
Nikolay Sivov : comctl32/imagelist: Remove parameter check from IImageList_GetBkColor().
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: 1c82b3491a93ac6f1473260533d435968145504a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1c82b3491a93ac6f147326053…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sat Aug 21 19:20:11 2010 +0400 comctl32/imagelist: Remove parameter check from IImageList_GetBkColor(). --- dlls/comctl32/imagelist.c | 7 +------ dlls/comctl32/tests/imagelist.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 7133d2f..f110787 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3467,9 +3467,6 @@ static HRESULT WINAPI ImageListImpl_SetBkColor(IImageList *iface, COLORREF clrBk static HRESULT WINAPI ImageListImpl_GetBkColor(IImageList *iface, COLORREF *pclr) { - if (!pclr) - return E_FAIL; - *pclr = ImageList_GetBkColor((HIMAGELIST) iface); return S_OK; } @@ -3649,11 +3646,9 @@ static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID ii if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(struct _IMAGELIST)); + This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct _IMAGELIST)); if (!This) return E_OUTOFMEMORY; - ZeroMemory(This, sizeof(struct _IMAGELIST)); - This->lpVtbl = &ImageListImpl_Vtbl; This->ref = 1; diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index 210f9ec..dc1c0c8 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1811,6 +1811,28 @@ if (0) IImageList_Release(imgl); } +static void test_IImageList_GetBkColor(void) +{ + IImageList *imgl; + HIMAGELIST himl; + COLORREF color; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + +if (0) +{ + /* crashes on native */ + hr = IImageList_GetBkColor(imgl, NULL); +} + + hr = IImageList_GetBkColor(imgl, &color); + ok(hr == S_OK, "got 0x%08x\n", hr); + + IImageList_Release(imgl); +} + START_TEST(imagelist) { ULONG_PTR ctx_cookie; @@ -1864,6 +1886,7 @@ START_TEST(imagelist) test_IImageList_Draw(); test_IImageList_Merge(); test_IImageList_Clone(); + test_IImageList_GetBkColor(); CoUninitialize();
1
0
0
0
Nikolay Sivov : comctl32/imagelist: Fix reference leak in IImageList_Clone( ).
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: 6db1d3c5b99b99ad10f3604ca2b87266b4aaa064 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6db1d3c5b99b99ad10f3604ca…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sat Aug 21 19:17:34 2010 +0400 comctl32/imagelist: Fix reference leak in IImageList_Clone(). --- dlls/comctl32/imagelist.c | 13 +++++++++---- dlls/comctl32/tests/imagelist.c | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 34cf7d3..7133d2f 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3392,16 +3392,21 @@ static HRESULT WINAPI ImageListImpl_Merge(IImageList *iface, int i1, static HRESULT WINAPI ImageListImpl_Clone(IImageList *iface, REFIID riid, void **ppv) { HIMAGELIST This = (HIMAGELIST) iface; - HIMAGELIST hNew; + HIMAGELIST clone; HRESULT ret = E_FAIL; TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv); - hNew = ImageList_Duplicate(This); + clone = ImageList_Duplicate(This); /* Get the interface for the new image list */ - if (hNew) - ret = HIMAGELIST_QueryInterface(hNew, riid, ppv); + if (clone) + { + IImageList *iclone = (IImageList*)clone; + + ret = HIMAGELIST_QueryInterface(clone, riid, ppv); + IImageList_Release(iclone); + } return ret; } diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index a4dae03..210f9ec 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1332,7 +1332,7 @@ cleanup: static void test_iimagelist(void) { - IImageList *imgl; + IImageList *imgl, *imgl2; HIMAGELIST himl; HRESULT hr; ULONG ret; @@ -1364,6 +1364,15 @@ static void test_iimagelist(void) ret = ImageList_Destroy((HIMAGELIST)imgl); ok(ret == FALSE, "Expected FALSE, got %d\n", ret); + /* ref counting, HIMAGELIST_QueryInterface adds a reference */ + imgl = (IImageList*)createImageList(32, 32); + hr = pHIMAGELIST_QueryInterface((HIMAGELIST)imgl, &IID_IImageList, (void**)&imgl2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(imgl2 == imgl, "got different pointer\n"); + ret = IImageList_Release(imgl); + ok(ret == 1, "got %u\n", ret); + IImageList_Release(imgl); + if (!pImageList_CoCreateInstance) { win_skip("Vista imagelist functions not available\n"); @@ -1783,6 +1792,7 @@ static void test_IImageList_Clone(void) IImageList *imgl, *imgl2; HIMAGELIST himl; HRESULT hr; + ULONG ref; himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); imgl = (IImageList*)himl; @@ -1795,7 +1805,8 @@ if (0) hr = IImageList_Clone(imgl, &IID_IImageList, (void**)&imgl2); ok(hr == S_OK, "got 0x%08x\n", hr); - IImageList_Release(imgl2); + ref = IImageList_Release(imgl2); + ok(ref == 0, "got %u\n", ref); IImageList_Release(imgl); }
1
0
0
0
Nikolay Sivov : comctl32/imagelist: Make IImageList_Merge() crash like it does on native.
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: eb2aae669ca16affd019c02bcbc0dda1d19b34b3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eb2aae669ca16affd019c02bc…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sat Aug 21 19:08:54 2010 +0400 comctl32/imagelist: Make IImageList_Merge() crash like it does on native. --- dlls/comctl32/imagelist.c | 5 ++--- dlls/comctl32/tests/imagelist.c | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 2218d99..162d0d3 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3365,15 +3365,14 @@ static HRESULT WINAPI ImageListImpl_Copy(IImageList *iface, int iDst, } static HRESULT WINAPI ImageListImpl_Merge(IImageList *iface, int i1, - IUnknown *punk2, int i2, int dx, int dy, REFIID riid, PVOID *ppv) + IUnknown *punk2, int i2, int dx, int dy, REFIID riid, void **ppv) { HIMAGELIST This = (HIMAGELIST) iface; IImageList *iml2 = NULL; HIMAGELIST hNew; HRESULT ret = E_FAIL; - if (!punk2 || !ppv) - return E_FAIL; + TRACE("(%p)->(%d %p %d %d %d %s %p)\n", iface, i1, punk2, i2, dx, dy, debugstr_guid(riid), ppv); /* TODO: Add test for IID_ImageList2 too */ if (FAILED(IImageList_QueryInterface(punk2, &IID_IImageList, diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index 26c7e12..3530932 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1674,6 +1674,13 @@ static void test_IImageList_Merge(void) ret = -1; ok( IImageList_ReplaceIcon(imgl2, -1, hicon1, &ret) == S_OK && (ret == 0),"add icon1 to himl2 failed\n"); +if (0) +{ + /* null cases that crash on native */ + hr = IImageList_Merge(imgl1, -1, NULL, 0, 0, 0, &IID_IImageList, (void**)&merge); + hr = IImageList_Merge(imgl1, -1, (IUnknown*) imgl2, 0, 0, 0, &IID_IImageList, NULL); +} + /* If himl1 has no images, merge still succeeds */ hr = IImageList_Merge(imgl1, -1, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge); ok(hr == S_OK, "merge himl1,-1 failed\n");
1
0
0
0
Nikolay Sivov : comctl32/imagelist: Remove parameter check from IImageList_Clone().
by Alexandre Julliard
23 Aug '10
23 Aug '10
Module: wine Branch: master Commit: 87847aa13cadc158a6cb2c49ec2c0b90e3cb16ac URL:
http://source.winehq.org/git/wine.git/?a=commit;h=87847aa13cadc158a6cb2c49e…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sat Aug 21 19:14:23 2010 +0400 comctl32/imagelist: Remove parameter check from IImageList_Clone(). --- dlls/comctl32/imagelist.c | 6 ++---- dlls/comctl32/tests/imagelist.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 162d0d3..34cf7d3 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3389,15 +3389,13 @@ static HRESULT WINAPI ImageListImpl_Merge(IImageList *iface, int i1, return ret; } -static HRESULT WINAPI ImageListImpl_Clone(IImageList *iface, REFIID riid, - PVOID *ppv) +static HRESULT WINAPI ImageListImpl_Clone(IImageList *iface, REFIID riid, void **ppv) { HIMAGELIST This = (HIMAGELIST) iface; HIMAGELIST hNew; HRESULT ret = E_FAIL; - if (!ppv) - return E_FAIL; + TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv); hNew = ImageList_Duplicate(This); diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index 3530932..a4dae03 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1778,6 +1778,28 @@ static void test_create(void) ok(himl == NULL, "got %p\n", himl); } +static void test_IImageList_Clone(void) +{ + IImageList *imgl, *imgl2; + HIMAGELIST himl; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + +if (0) +{ + /* crashes on native */ + hr = IImageList_Clone(imgl, &IID_IImageList, NULL); +} + + hr = IImageList_Clone(imgl, &IID_IImageList, (void**)&imgl2); + ok(hr == S_OK, "got 0x%08x\n", hr); + IImageList_Release(imgl2); + + IImageList_Release(imgl); +} + START_TEST(imagelist) { ULONG_PTR ctx_cookie; @@ -1830,6 +1852,7 @@ START_TEST(imagelist) test_IImageList_Get_SetImageCount(); test_IImageList_Draw(); test_IImageList_Merge(); + test_IImageList_Clone(); CoUninitialize();
1
0
0
0
← Newer
1
...
31
32
33
34
35
36
37
...
89
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
Results per page:
10
25
50
100
200