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
July 2011
----- 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
838 discussions
Start a n
N
ew thread
Mariusz Pluciński : shell32: Add support of KF_REDIRECT_COPY_CONTENTS flag to redirection.
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: 104bf57c118120580075891ae40e2739eee982c8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=104bf57c118120580075891ae…
Author: Mariusz Pluciński <vshader(a)gmail.com> Date: Tue Jul 5 11:07:23 2011 +0200 shell32: Add support of KF_REDIRECT_COPY_CONTENTS flag to redirection. --- dlls/shell32/shellpath.c | 68 ++++++++++++++++++++++++++++++++++----- dlls/shell32/tests/shellpath.c | 4 -- 2 files changed, 59 insertions(+), 13 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index c468cb8..b5209a6 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -3173,6 +3173,8 @@ static HRESULT get_known_folder_redirection_place( return hr; } +static HRESULT get_known_folder_path_by_id(REFKNOWNFOLDERID folderId, LPWSTR lpRegistryPath, DWORD dwFlags, LPWSTR *ppszPath); + static HRESULT redirect_known_folder( REFKNOWNFOLDERID rfid, HWND hwnd, @@ -3185,10 +3187,19 @@ static HRESULT redirect_known_folder( HRESULT hr; HKEY rootKey = HKEY_LOCAL_MACHINE, hKey; WCHAR sGuid[39]; + LPWSTR lpRegistryPath = NULL, lpSrcPath = NULL; TRACE("(%s, %p, 0x%08x, %s, %d, %p, %p)\n", debugstr_guid(rfid), hwnd, flags, debugstr_w(pszTargetPath), cFolders, pExclusion, ppszError); + hr = get_known_folder_registry_path(rfid, NULL, &lpRegistryPath); + + if(SUCCEEDED(hr)) + hr = get_known_folder_path_by_id(rfid, lpRegistryPath, 0, &lpSrcPath); + + HeapFree(GetProcessHeap(), 0, lpRegistryPath); + /* get path to redirection storage */ - hr = get_known_folder_redirection_place(rfid, &rootKey); + if(SUCCEEDED(hr)) + hr = get_known_folder_redirection_place(rfid, &rootKey); /* write redirection information */ if(SUCCEEDED(hr)) @@ -3203,6 +3214,34 @@ static HRESULT redirect_known_folder( RegCloseKey(hKey); } + /* make sure destination path exists */ + SHCreateDirectory(NULL, pszTargetPath); + + /* copy content if required */ + if(SUCCEEDED(hr) && (flags & KF_REDIRECT_COPY_CONTENTS) ) + { + static const WCHAR sWildcard[] = {'\\','*',0}; + WCHAR srcPath[MAX_PATH+1], dstPath[MAX_PATH+1]; + SHFILEOPSTRUCTW fileOp; + + ZeroMemory(srcPath, sizeof(srcPath)); + lstrcpyW(srcPath, lpSrcPath); + lstrcatW(srcPath, sWildcard); + + ZeroMemory(dstPath, sizeof(dstPath)); + lstrcpyW(dstPath, pszTargetPath); + + ZeroMemory(&fileOp, sizeof(fileOp)); + fileOp.wFunc = FO_COPY; + fileOp.pFrom = srcPath; + fileOp.pTo = dstPath; + fileOp.fFlags = FOF_NO_UI; + + hr = (SHFileOperationW(&fileOp)==0 ? S_OK : E_FAIL); + } + + CoTaskMemFree(lpSrcPath); + return hr; } @@ -3427,28 +3466,28 @@ static HRESULT get_known_folder_path( return hr; } -static HRESULT WINAPI knownfolder_GetPath( - IKnownFolder *iface, +static HRESULT get_known_folder_path_by_id( + REFKNOWNFOLDERID folderId, + LPWSTR lpRegistryPath, DWORD dwFlags, LPWSTR *ppszPath) { - struct knownfolder *knownfolder = impl_from_IKnownFolder( iface ); HRESULT hr; WCHAR sGuid[39]; DWORD dwAttributes; - TRACE("(%p, 0x%08x, %p)\n", knownfolder, dwFlags, ppszPath); + TRACE("(%s, %s, 0x%08x, %p)\n", debugstr_guid(folderId), debugstr_w(lpRegistryPath), dwFlags, ppszPath); /* if this is registry-registered known folder, get path from registry */ - if(knownfolder->registryPath) + if(lpRegistryPath) { - StringFromGUID2(&knownfolder->id, sGuid, sizeof(sGuid)/sizeof(sGuid[0])); + StringFromGUID2(folderId, sGuid, sizeof(sGuid)/sizeof(sGuid[0])); - hr = get_known_folder_path(sGuid, knownfolder->registryPath, ppszPath); + hr = get_known_folder_path(sGuid, lpRegistryPath, ppszPath); } /* in other case, use older way */ else - hr = SHGetKnownFolderPath( &knownfolder->id, dwFlags, NULL, ppszPath ); + hr = SHGetKnownFolderPath( folderId, dwFlags, NULL, ppszPath ); /* check if known folder really exists */ dwAttributes = GetFileAttributesW(*ppszPath); @@ -3463,6 +3502,17 @@ static HRESULT WINAPI knownfolder_GetPath( return hr; } +static HRESULT WINAPI knownfolder_GetPath( + IKnownFolder *iface, + DWORD dwFlags, + LPWSTR *ppszPath) +{ + struct knownfolder *knownfolder = impl_from_IKnownFolder( iface ); + TRACE("(%p, 0x%08x, %p)\n", knownfolder, dwFlags, ppszPath); + + return get_known_folder_path_by_id(&knownfolder->id, knownfolder->registryPath, dwFlags, ppszPath); +} + static HRESULT WINAPI knownfolder_SetPath( IKnownFolder *iface, DWORD dwFlags, diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 8cdae30..0be43f4 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -1354,9 +1354,7 @@ static void test_knownFolders(void) /* verify sub folder */ hr = IKnownFolder_GetPath(subFolder, 0, &folderPath); - todo_wine ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr); - todo_wine ok(lstrcmpiW(folderPath, sSubFolder2Path)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sSubFolder2Path)); CoTaskMemFree(folderPath); @@ -1393,9 +1391,7 @@ static void test_knownFolders(void) /* verify sub folder */ hr = IKnownFolder_GetPath(subFolder, 0, &folderPath); - todo_wine ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr); - todo_wine ok(lstrcmpiW(folderPath, sSubFolder2Path)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sSubFolder2Path)); CoTaskMemFree(folderPath);
1
0
0
0
Mariusz Pluciński : include: Add FOF_NO_UI flag.
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: c56f952da2c519cfb4898f60dbeeeb0ed7efc7bc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c56f952da2c519cfb4898f60d…
Author: Mariusz Pluciński <vshader(a)gmail.com> Date: Tue Jul 5 11:07:09 2011 +0200 include: Add FOF_NO_UI flag. --- include/shellapi.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/include/shellapi.h b/include/shellapi.h index 9866b5e..23457f2 100644 --- a/include/shellapi.h +++ b/include/shellapi.h @@ -186,6 +186,7 @@ HRESULT WINAPI SHGetImageList(INT, REFIID, void **); #define FOF_WANTNUKEWARNING 0x4000 /* during delete operation, warn if delete instead of recycling (even if FOF_NOCONFIRMATION) */ #define FOF_NORECURSEREPARSE 0x8000 /* don't do recursion into reparse points */ +#define FOF_NO_UI (FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR) typedef WORD FILEOP_FLAGS;
1
0
0
0
Michael Stefaniuc : d3d8: COM cleanup for the IDirect3DIndexBuffer8 iface.
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: 638cf80c4ffa15e747b27e9179e326294af8796e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=638cf80c4ffa15e747b27e917…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Tue Jul 5 00:46:30 2011 +0200 d3d8: COM cleanup for the IDirect3DIndexBuffer8 iface. --- dlls/d3d8/buffer.c | 42 ++++++++++++++++++++++++++---------------- dlls/d3d8/d3d8_private.h | 6 ++---- dlls/d3d8/device.c | 2 +- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c index cd68f6c..f10ec68 100644 --- a/dlls/d3d8/buffer.c +++ b/dlls/d3d8/buffer.c @@ -300,7 +300,7 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im static inline IDirect3DIndexBuffer8Impl *impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface) { - return CONTAINING_RECORD(iface, IDirect3DIndexBuffer8Impl, lpVtbl); + return CONTAINING_RECORD(iface, IDirect3DIndexBuffer8Impl, IDirect3DIndexBuffer8_iface); } static HRESULT WINAPI d3d8_indexbuffer_QueryInterface(IDirect3DIndexBuffer8 *iface, REFIID riid, void **object) @@ -324,7 +324,7 @@ static HRESULT WINAPI d3d8_indexbuffer_QueryInterface(IDirect3DIndexBuffer8 *ifa static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface) { - IDirect3DIndexBuffer8Impl *buffer = (IDirect3DIndexBuffer8Impl *)iface; + IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface); ULONG refcount = InterlockedIncrement(&buffer->ref); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -342,7 +342,7 @@ static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface) static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface) { - IDirect3DIndexBuffer8Impl *buffer = (IDirect3DIndexBuffer8Impl *)iface; + IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface); ULONG refcount = InterlockedDecrement(&buffer->ref); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -362,11 +362,14 @@ static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface) return refcount; } -static HRESULT WINAPI d3d8_indexbuffer_GetDevice(IDirect3DIndexBuffer8 *iface, IDirect3DDevice8 **device) +static HRESULT WINAPI d3d8_indexbuffer_GetDevice(IDirect3DIndexBuffer8 *iface, + IDirect3DDevice8 **device) { + IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface); + TRACE("iface %p, device %p.\n", iface, device); - *device = (IDirect3DDevice8 *)((IDirect3DIndexBuffer8Impl *)iface)->parentDevice; + *device = buffer->parentDevice; IDirect3DDevice8_AddRef(*device); TRACE("Returning device %p.\n", *device); @@ -428,12 +431,13 @@ static HRESULT WINAPI d3d8_indexbuffer_FreePrivateData(IDirect3DIndexBuffer8 *if static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, DWORD priority) { + IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface); DWORD previous; TRACE("iface %p, priority %u.\n", iface, priority); wined3d_mutex_lock(); - previous = wined3d_buffer_set_priority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, priority); + previous = wined3d_buffer_set_priority(buffer->wineD3DIndexBuffer, priority); wined3d_mutex_unlock(); return previous; @@ -441,12 +445,13 @@ static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, D static DWORD WINAPI d3d8_indexbuffer_GetPriority(IDirect3DIndexBuffer8 *iface) { + IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface); DWORD priority; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - priority = wined3d_buffer_get_priority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer); + priority = wined3d_buffer_get_priority(buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); return priority; @@ -454,10 +459,12 @@ static DWORD WINAPI d3d8_indexbuffer_GetPriority(IDirect3DIndexBuffer8 *iface) static void WINAPI d3d8_indexbuffer_PreLoad(IDirect3DIndexBuffer8 *iface) { + IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface); + TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - wined3d_buffer_preload(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer); + wined3d_buffer_preload(buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); } @@ -468,17 +475,17 @@ static D3DRESOURCETYPE WINAPI d3d8_indexbuffer_GetType(IDirect3DIndexBuffer8 *if return D3DRTYPE_INDEXBUFFER; } -static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, - UINT offset, UINT size, BYTE **data, DWORD flags) +static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, UINT offset, UINT size, + BYTE **data, DWORD flags) { + IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface); HRESULT hr; TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n", iface, offset, size, data, flags); wined3d_mutex_lock(); - hr = wined3d_buffer_map(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, - offset, size, data, flags); + hr = wined3d_buffer_map(buffer->wineD3DIndexBuffer, offset, size, data, flags); wined3d_mutex_unlock(); return hr; @@ -486,18 +493,21 @@ static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, static HRESULT WINAPI d3d8_indexbuffer_Unlock(IDirect3DIndexBuffer8 *iface) { + IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface); + TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - wined3d_buffer_unmap(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer); + wined3d_buffer_unmap(buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); return D3D_OK; } -static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface, D3DINDEXBUFFER_DESC *desc) +static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface, + D3DINDEXBUFFER_DESC *desc) { - IDirect3DIndexBuffer8Impl *buffer = (IDirect3DIndexBuffer8Impl *)iface; + IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface); struct wined3d_resource_desc wined3d_desc; struct wined3d_resource *wined3d_resource; @@ -553,7 +563,7 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl { HRESULT hr; - buffer->lpVtbl = &d3d8_indexbuffer_vtbl; + buffer->IDirect3DIndexBuffer8_iface.lpVtbl = &d3d8_indexbuffer_vtbl; buffer->ref = 1; buffer->format = wined3dformat_from_d3dformat(format); diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index e84b60a..6ec6712 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -287,10 +287,8 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im */ struct IDirect3DIndexBuffer8Impl { - /* IUnknown fields */ - const IDirect3DIndexBuffer8Vtbl *lpVtbl; - LONG ref; - + IDirect3DIndexBuffer8 IDirect3DIndexBuffer8_iface; + LONG ref; struct wined3d_buffer *wineD3DIndexBuffer; IDirect3DDevice8 *parentDevice; enum wined3d_format_id format; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index adae05e..3537cb7 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -870,7 +870,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(IDirect3DDevice8 *i } TRACE("Created index buffer %p.\n", object); - *buffer = (IDirect3DIndexBuffer8 *)object; + *buffer = &object->IDirect3DIndexBuffer8_iface; return D3D_OK; }
1
0
0
0
Michael Stefaniuc : d3d8: Use unsafe_impl_from_IDirect3DIndexBuffer8 for an app provided iface.
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: c1eeeec2d2ee27b042eda7c9e29498127abae3bb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c1eeeec2d2ee27b042eda7c9e…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Tue Jul 5 00:43:50 2011 +0200 d3d8: Use unsafe_impl_from_IDirect3DIndexBuffer8 for an app provided iface. --- dlls/d3d8/buffer.c | 10 ++++++++++ dlls/d3d8/d3d8_private.h | 1 + dlls/d3d8/device.c | 2 +- 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c index 6ca8829..cd68f6c 100644 --- a/dlls/d3d8/buffer.c +++ b/dlls/d3d8/buffer.c @@ -17,6 +17,7 @@ */ #include "config.h" +#include <assert.h> #include "d3d8_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); @@ -571,3 +572,12 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl return D3D_OK; } + +IDirect3DIndexBuffer8Impl *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface) +{ + if (!iface) + return NULL; + assert(iface->lpVtbl == &d3d8_indexbuffer_vtbl); + + return impl_from_IDirect3DIndexBuffer8(iface); +} diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 0c0f2b1..e84b60a 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -298,6 +298,7 @@ struct IDirect3DIndexBuffer8Impl HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl *device, UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN; +IDirect3DIndexBuffer8Impl *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface) DECLSPEC_HIDDEN; /* --------------------- */ /* IDirect3DBaseTexture8 */ diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index dd45f1f..adae05e 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2367,8 +2367,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(IDirect3DDevice8 *iface, IDirect3DIndexBuffer8 *pIndexData, UINT baseVertexIndex) { IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + IDirect3DIndexBuffer8Impl *ib = unsafe_impl_from_IDirect3DIndexBuffer8(pIndexData); HRESULT hr; - IDirect3DIndexBuffer8Impl *ib = (IDirect3DIndexBuffer8Impl *)pIndexData; TRACE("iface %p, buffer %p, base_vertex_idx %u.\n", iface, pIndexData, baseVertexIndex);
1
0
0
0
Michael Stefaniuc : d3d8: COM cleanup for the IDirect3DSurface8 iface.
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: d615be8eeab3487f5d6d1a78f5982c5d8533fa4b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d615be8eeab3487f5d6d1a78f…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Tue Jul 5 00:41:12 2011 +0200 d3d8: COM cleanup for the IDirect3DSurface8 iface. --- dlls/d3d8/d3d8_private.h | 5 ++--- dlls/d3d8/device.c | 8 ++++---- dlls/d3d8/surface.c | 44 +++++++++++++++++++++++++++----------------- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 3043478..0c0f2b1 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -240,9 +240,8 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl */ struct IDirect3DSurface8Impl { - /* IUnknown fields */ - const IDirect3DSurface8Vtbl *lpVtbl; - LONG ref; + IDirect3DSurface8 IDirect3DSurface8_iface; + LONG ref; struct wined3d_surface *wined3d_surface; IDirect3DDevice8 *parentDevice; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 7771990..dd45f1f 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -905,7 +905,7 @@ static HRESULT IDirect3DDevice8Impl_CreateSurface(IDirect3DDevice8Impl *device, } TRACE("Created surface %p.\n", object); - *ppSurface = (IDirect3DSurface8 *)object; + *ppSurface = &object->IDirect3DSurface8_iface; return D3D_OK; } @@ -2874,7 +2874,7 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent * IUnknown_Release(d3d_surface->parentDevice); d3d_surface->parentDevice = NULL; - IDirect3DSurface8_Release((IDirect3DSurface8 *)d3d_surface); + IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface); d3d_surface->forwardReference = container_parent; return hr; @@ -2907,7 +2907,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par d3d_surface->container = (IUnknown *)&device->IDirect3DDevice8_iface; /* Implicit surfaces are created with an refcount of 0 */ - IUnknown_Release((IUnknown *)d3d_surface); + IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface); return hr; } @@ -2937,7 +2937,7 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa d3d_surface->container = (IUnknown *)&device->IDirect3DDevice8_iface; /* Implicit surfaces are created with an refcount of 0 */ - IUnknown_Release((IUnknown *)d3d_surface); + IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface); return hr; } diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index 846a7db..3424dcb 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -26,12 +26,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); static inline IDirect3DSurface8Impl *impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) { - return CONTAINING_RECORD(iface, IDirect3DSurface8Impl, lpVtbl); + return CONTAINING_RECORD(iface, IDirect3DSurface8Impl, IDirect3DSurface8_iface); } /* IDirect3DSurface8 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(LPDIRECT3DSURFACE8 iface, REFIID riid, LPVOID *ppobj) { - IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; +static HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(IDirect3DSurface8 *iface, REFIID riid, + void **ppobj) +{ + IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -48,8 +50,9 @@ static HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(LPDIRECT3DSURFACE8 if return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DSurface8Impl_AddRef(LPDIRECT3DSURFACE8 iface) { - IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; +static ULONG WINAPI IDirect3DSurface8Impl_AddRef(IDirect3DSurface8 *iface) +{ + IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface); TRACE("iface %p.\n", iface); @@ -75,8 +78,9 @@ static ULONG WINAPI IDirect3DSurface8Impl_AddRef(LPDIRECT3DSURFACE8 iface) { } } -static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) { - IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; +static ULONG WINAPI IDirect3DSurface8Impl_Release(IDirect3DSurface8 *iface) +{ + IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface); TRACE("iface %p.\n", iface); @@ -106,9 +110,10 @@ static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) { } /* IDirect3DSurface8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface, IDirect3DDevice8 **device) +static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface, + IDirect3DDevice8 **device) { - IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; + IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface); TRACE("iface %p, device %p.\n", iface, device); @@ -190,8 +195,10 @@ static HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(IDirect3DSurface8 *i } /* IDirect3DSurface8 Interface follow: */ -static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 iface, REFIID riid, void **ppContainer) { - IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; +static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(IDirect3DSurface8 *iface, REFIID riid, + void **ppContainer) +{ + IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface); HRESULT res; TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), ppContainer); @@ -206,7 +213,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 ifac static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_DESC *desc) { - IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; + IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface); struct wined3d_resource_desc wined3d_desc; struct wined3d_resource *wined3d_resource; @@ -229,8 +236,10 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(IDirect3DSurface8 *iface, D3 return D3D_OK; } -static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) { - IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; +static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(IDirect3DSurface8 *iface, + D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags) +{ + IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface); HRESULT hr; TRACE("iface %p, locked_rect %p, rect %p, flags %#x.\n", iface, pLockedRect, pRect, Flags); @@ -259,8 +268,9 @@ static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D return hr; } -static HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface) { - IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; +static HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(IDirect3DSurface8 *iface) +{ + IDirect3DSurface8Impl *This = impl_from_IDirect3DSurface8(iface); HRESULT hr; TRACE("iface %p.\n", iface); @@ -310,7 +320,7 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic { HRESULT hr; - surface->lpVtbl = &Direct3DSurface8_Vtbl; + surface->IDirect3DSurface8_iface.lpVtbl = &Direct3DSurface8_Vtbl; surface->ref = 1; /* FIXME: Check MAX bounds of MultisampleQuality. */
1
0
0
0
Michael Stefaniuc : d3d8: Use unsafe_impl_from_IDirect3DSurface8 for app provided ifaces.
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: cce8294f399b0b0c33a46105174cd7ab272804ab URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cce8294f399b0b0c33a461051…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Tue Jul 5 00:34:58 2011 +0200 d3d8: Use unsafe_impl_from_IDirect3DSurface8 for app provided ifaces. --- dlls/d3d8/d3d8_private.h | 1 + dlls/d3d8/device.c | 12 ++++++------ dlls/d3d8/surface.c | 10 ++++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index f98b334..3043478 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -256,6 +256,7 @@ struct IDirect3DSurface8Impl HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *device, UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN; +IDirect3DSurface8Impl *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN; /* ---------------------- */ /* IDirect3DVertexBuffer8 */ diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 03638ab..7771990 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -451,7 +451,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetCursorProperties(IDirect3DDevice8 UINT XHotSpot, UINT YHotSpot, IDirect3DSurface8 *pCursorBitmap) { IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); - IDirect3DSurface8Impl *pSurface = (IDirect3DSurface8Impl*)pCursorBitmap; + IDirect3DSurface8Impl *pSurface = unsafe_impl_from_IDirect3DSurface8(pCursorBitmap); HRESULT hr; TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n", @@ -965,8 +965,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(IDirect3DDevice8 *iface, IDirect3DSurface8 *pSourceSurface, const RECT *pSourceRects, UINT cRects, IDirect3DSurface8 *pDestinationSurface, const POINT *pDestPoints) { - IDirect3DSurface8Impl *Source = (IDirect3DSurface8Impl *) pSourceSurface; - IDirect3DSurface8Impl *Dest = (IDirect3DSurface8Impl *) pDestinationSurface; + IDirect3DSurface8Impl *Source = unsafe_impl_from_IDirect3DSurface8(pSourceSurface); + IDirect3DSurface8Impl *Dest = unsafe_impl_from_IDirect3DSurface8(pDestinationSurface); enum wined3d_format_id srcFormat, destFormat; struct wined3d_resource_desc wined3d_desc; struct wined3d_resource *wined3d_resource; @@ -1053,7 +1053,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetFrontBuffer(IDirect3DDevice8 *ifac IDirect3DSurface8 *pDestSurface) { IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); - IDirect3DSurface8Impl *destSurface = (IDirect3DSurface8Impl *)pDestSurface; + IDirect3DSurface8Impl *destSurface = unsafe_impl_from_IDirect3DSurface8(pDestSurface); HRESULT hr; TRACE("iface %p, dst_surface %p.\n", iface, pDestSurface); @@ -1074,8 +1074,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa IDirect3DSurface8 *pRenderTarget, IDirect3DSurface8 *pNewZStencil) { IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); - IDirect3DSurface8Impl *pSurface = (IDirect3DSurface8Impl *)pRenderTarget; - IDirect3DSurface8Impl *pZSurface = (IDirect3DSurface8Impl *)pNewZStencil; + IDirect3DSurface8Impl *pSurface = unsafe_impl_from_IDirect3DSurface8(pRenderTarget); + IDirect3DSurface8Impl *pZSurface = unsafe_impl_from_IDirect3DSurface8(pNewZStencil); struct wined3d_surface *original_ds = NULL; HRESULT hr; diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index dfda50f..846a7db 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -19,6 +19,7 @@ */ #include "config.h" +#include <assert.h> #include "d3d8_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); @@ -335,3 +336,12 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic return D3D_OK; } + +IDirect3DSurface8Impl *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) +{ + if (!iface) + return NULL; + assert(iface->lpVtbl == &Direct3DSurface8_Vtbl); + + return impl_from_IDirect3DSurface8(iface); +}
1
0
0
0
Michael Stefaniuc : d3d8: Avoid an unsafe IDirect3DSurface8 to object cast.
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: bdd8459a537b55c4316a247407abf04cec2337ac URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bdd8459a537b55c4316a24740…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Tue Jul 5 00:31:23 2011 +0200 d3d8: Avoid an unsafe IDirect3DSurface8 to object cast. --- dlls/d3d8/device.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index c4d4ea9..03638ab 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1087,25 +1087,26 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *ifa { struct wined3d_resource_desc ds_desc, rt_desc; struct wined3d_resource *wined3d_resource; - IDirect3DSurface8 *orig_rt = NULL; + struct wined3d_surface *original_rt = NULL; /* If no render target is passed in check the size against the current RT */ if (!pRenderTarget) { - hr = IDirect3DDevice8_GetRenderTarget(iface, &orig_rt); - if (FAILED(hr)) + hr = wined3d_device_get_render_target(This->wined3d_device, 0, &original_rt); + if (FAILED(hr) || !original_rt) { wined3d_mutex_unlock(); return hr; } - pSurface = (IDirect3DSurface8Impl *)orig_rt; + wined3d_resource = wined3d_surface_get_resource(original_rt); + wined3d_surface_decref(original_rt); } + else + wined3d_resource = wined3d_surface_get_resource(pSurface->wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &rt_desc); wined3d_resource = wined3d_surface_get_resource(pZSurface->wined3d_surface); wined3d_resource_get_desc(wined3d_resource, &ds_desc); - wined3d_resource = wined3d_surface_get_resource(pSurface->wined3d_surface); - wined3d_resource_get_desc(wined3d_resource, &rt_desc); - if (orig_rt) IDirect3DSurface8_Release(orig_rt); if (ds_desc.width < rt_desc.width || ds_desc.height < rt_desc.height) {
1
0
0
0
Henri Verbeet : wined3d: Print an ERR for unknown / invalid surface locations in surface_load_location().
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: 4e8c7f00f2963658ac9d9a6a2e249b05090f6639 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4e8c7f00f2963658ac9d9a6a2…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Mon Jul 4 21:39:39 2011 +0200 wined3d: Print an ERR for unknown / invalid surface locations in surface_load_location(). --- dlls/wined3d/surface.c | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 1cd8da6..8fbad09 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -6213,17 +6213,26 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const return WINED3DERR_DEVICELOST; } - if (flag == SFLAG_INSYSMEM) - surface_load_sysmem(surface, gl_info, rect); - else if (flag == SFLAG_INDRAWABLE) + switch (flag) { - if (FAILED(hr = surface_load_drawable(surface, gl_info, rect))) - return hr; - } - else /* if(flag & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) */ - { - if (FAILED(hr = surface_load_texture(surface, gl_info, rect, flag == SFLAG_INSRGBTEX))) - return hr; + case SFLAG_INSYSMEM: + surface_load_sysmem(surface, gl_info, rect); + break; + + case SFLAG_INDRAWABLE: + if (FAILED(hr = surface_load_drawable(surface, gl_info, rect))) + return hr; + break; + + case SFLAG_INTEXTURE: + case SFLAG_INSRGBTEX: + if (FAILED(hr = surface_load_texture(surface, gl_info, rect, flag == SFLAG_INSRGBTEX))) + return hr; + break; + + default: + ERR("Don't know how to handle location %#x.\n", flag); + break; } if (!rect)
1
0
0
0
Henri Verbeet : wined3d: Introduce a separate function for loading the SFLAG_INTEXTURE and SFLAG_INSRGBTEX surface locations .
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: 1c3b691f10f20da2504d987411c98c8b73733917 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1c3b691f10f20da2504d98741…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Mon Jul 4 21:39:38 2011 +0200 wined3d: Introduce a separate function for loading the SFLAG_INTEXTURE and SFLAG_INSRGBTEX surface locations. --- dlls/wined3d/surface.c | 286 +++++++++++++++++++++++++---------------------- 1 files changed, 152 insertions(+), 134 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=1c3b691f10f20da2504d9…
1
0
0
0
Henri Verbeet : wined3d: Introduce a separate function for loading the SFLAG_INDRAWABLE surface location .
by Alexandre Julliard
05 Jul '11
05 Jul '11
Module: wine Branch: master Commit: cabcb362c124a4e17baaa41b557875bdbacf84e0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cabcb362c124a4e17baaa41b5…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Mon Jul 4 21:39:37 2011 +0200 wined3d: Introduce a separate function for loading the SFLAG_INDRAWABLE surface location. --- dlls/wined3d/surface.c | 167 +++++++++++++++++++++++++++--------------------- 1 files changed, 93 insertions(+), 74 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index af97694..113c3de 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -5906,6 +5906,96 @@ static void surface_load_sysmem(struct wined3d_surface *surface, wined3d_surface_get_pitch(surface)); } +static HRESULT surface_load_drawable(struct wined3d_surface *surface, + const struct wined3d_gl_info *gl_info, const RECT *rect) +{ + struct wined3d_device *device = surface->resource.device; + struct wined3d_format format; + CONVERT_TYPES convert; + UINT byte_count; + BYTE *mem; + + if (wined3d_settings.rendertargetlock_mode == RTL_READTEX) + surface_load_location(surface, SFLAG_INTEXTURE, NULL); + + if (surface->flags & SFLAG_INTEXTURE) + { + RECT r; + + surface_get_rect(surface, rect, &r); + surface_blt_to_drawable(device, WINED3DTEXF_POINT, FALSE, surface, &r, surface, &r); + + return WINED3D_OK; + } + + if ((surface->flags & SFLAG_LOCATIONS) == SFLAG_INSRGBTEX) + { + /* This needs colorspace conversion from sRGB to RGB. We take the slow + * path through sysmem. */ + surface_load_location(surface, SFLAG_INSYSMEM, rect); + } + + d3dfmt_get_conv(surface, FALSE, FALSE, &format, &convert); + + /* Don't use PBOs for converted surfaces. During PBO conversion we look at + * SFLAG_CONVERTED but it isn't set (yet) in all cases where it is getting + * called. */ + if ((convert != NO_CONVERSION) && (surface->flags & SFLAG_PBO)) + { + struct wined3d_context *context = NULL; + + TRACE("Removing the pbo attached to surface %p.\n", surface); + + if (!device->isInDraw) + context = context_acquire(device, NULL); + + surface_remove_pbo(surface, gl_info); + + if (context) + context_release(context); + } + + if ((convert != NO_CONVERSION) && surface->resource.allocatedMemory) + { + UINT height = surface->resource.height; + UINT width = surface->resource.width; + UINT src_pitch, dst_pitch; + + byte_count = format.conv_byte_count; + src_pitch = wined3d_surface_get_pitch(surface); + + /* Stick to the alignment for the converted surface too, makes it + * easier to load the surface. */ + dst_pitch = width * byte_count; + dst_pitch = (dst_pitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1); + + if (!(mem = HeapAlloc(GetProcessHeap(), 0, dst_pitch * height))) + { + ERR("Out of memory (%u).\n", dst_pitch * height); + return E_OUTOFMEMORY; + } + + d3dfmt_convert_surface(surface->resource.allocatedMemory, mem, + src_pitch, width, height, dst_pitch, convert, surface); + + surface->flags |= SFLAG_CONVERTED; + } + else + { + surface->flags &= ~SFLAG_CONVERTED; + mem = surface->resource.allocatedMemory; + byte_count = format.byte_count; + } + + flush_to_framebuffer_drawpixels(surface, rect, format.glFormat, format.glType, byte_count, mem); + + /* Don't delete PBO memory. */ + if ((mem != surface->resource.allocatedMemory) && !(surface->flags & SFLAG_PBO)) + HeapFree(GetProcessHeap(), 0, mem); + + return WINED3D_OK; +} + HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const RECT *rect) { struct wined3d_device *device = surface->resource.device; @@ -5916,6 +6006,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const int width, pitch, outpitch; BYTE *mem; BOOL in_fbo = FALSE; + HRESULT hr; TRACE("surface %p, location %s, rect %s.\n", surface, debug_surflocation(flag), wine_dbgstr_rect(rect)); @@ -5981,80 +6072,8 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const surface_load_sysmem(surface, gl_info, rect); else if (flag == SFLAG_INDRAWABLE) { - if (wined3d_settings.rendertargetlock_mode == RTL_READTEX) - surface_load_location(surface, SFLAG_INTEXTURE, NULL); - - if (surface->flags & SFLAG_INTEXTURE) - { - RECT r; - - surface_get_rect(surface, rect, &r); - surface_blt_to_drawable(device, WINED3DTEXF_POINT, FALSE, surface, &r, surface, &r); - } - else - { - int byte_count; - if ((surface->flags & SFLAG_LOCATIONS) == SFLAG_INSRGBTEX) - { - /* This needs a shader to convert the srgb data sampled from the GL texture into RGB - * values, otherwise we get incorrect values in the target. For now go the slow way - * via a system memory copy - */ - surface_load_location(surface, SFLAG_INSYSMEM, rect); - } - - d3dfmt_get_conv(surface, FALSE /* We need color keying */, - FALSE /* We won't use textures */, &format, &convert); - - /* The width is in 'length' not in bytes */ - width = surface->resource.width; - pitch = wined3d_surface_get_pitch(surface); - - /* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED - * but it isn't set (yet) in all cases it is getting called. */ - if ((convert != NO_CONVERSION) && (surface->flags & SFLAG_PBO)) - { - struct wined3d_context *context = NULL; - - TRACE("Removing the pbo attached to surface %p.\n", surface); - - if (!device->isInDraw) context = context_acquire(device, NULL); - surface_remove_pbo(surface, gl_info); - if (context) context_release(context); - } - - if ((convert != NO_CONVERSION) && surface->resource.allocatedMemory) - { - int height = surface->resource.height; - byte_count = format.conv_byte_count; - - /* Stick to the alignment for the converted surface too, makes it easier to load the surface */ - outpitch = width * byte_count; - outpitch = (outpitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1); - - mem = HeapAlloc(GetProcessHeap(), 0, outpitch * height); - if(!mem) { - ERR("Out of memory %d, %d!\n", outpitch, height); - return WINED3DERR_OUTOFVIDEOMEMORY; - } - d3dfmt_convert_surface(surface->resource.allocatedMemory, mem, pitch, - width, height, outpitch, convert, surface); - - surface->flags |= SFLAG_CONVERTED; - } - else - { - surface->flags &= ~SFLAG_CONVERTED; - mem = surface->resource.allocatedMemory; - byte_count = format.byte_count; - } - - flush_to_framebuffer_drawpixels(surface, rect, format.glFormat, format.glType, byte_count, mem); - - /* Don't delete PBO memory */ - if ((mem != surface->resource.allocatedMemory) && !(surface->flags & SFLAG_PBO)) - HeapFree(GetProcessHeap(), 0, mem); - } + if (FAILED(hr = surface_load_drawable(surface, gl_info, rect))) + return hr; } else /* if(flag & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) */ {
1
0
0
0
← Newer
1
...
72
73
74
75
76
77
78
...
84
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
Results per page:
10
25
50
100
200