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
February 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
783 discussions
Start a n
N
ew thread
Stefan Dösinger : d3d9: Move the vertex buffer alignment test into buffer.c.
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: 8912b372ed97dfa4ce1cb56ce77eca1f92a311e5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8912b372ed97dfa4ce1cb56ce…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Sat Jan 30 12:15:40 2010 +0100 d3d9: Move the vertex buffer alignment test into buffer.c. --- dlls/d3d9/tests/buffer.c | 51 +++++++++++++++++++++++++++++++ dlls/d3d9/tests/device.c | 76 ---------------------------------------------- 2 files changed, 51 insertions(+), 76 deletions(-) diff --git a/dlls/d3d9/tests/buffer.c b/dlls/d3d9/tests/buffer.c index c2e22c2..a10cefd 100644 --- a/dlls/d3d9/tests/buffer.c +++ b/dlls/d3d9/tests/buffer.c @@ -111,6 +111,56 @@ static void lock_flag_test(IDirect3DDevice9 *device) IDirect3DVertexBuffer9_Release(buffer); } +static inline const char *debug_d3dpool(D3DPOOL pool) +{ + switch(pool) + { + case D3DPOOL_DEFAULT: return "D3DPOOL_DEFAULT"; + case D3DPOOL_SYSTEMMEM: return "D3DPOOL_SYSTEMMEM"; + case D3DPOOL_SCRATCH: return "D3DPOOL_SCRATCH"; + case D3DPOOL_MANAGED: return "D3DPOOL_MANAGED"; + default: + return "unknown pool"; + } +} + +static void test_vertex_buffer_alignment(IDirect3DDevice9 *device) +{ + IDirect3DVertexBuffer9 *buffer = NULL; + HRESULT hr; + D3DPOOL pools[] = {D3DPOOL_DEFAULT, D3DPOOL_SYSTEMMEM, D3DPOOL_SCRATCH, D3DPOOL_MANAGED}; + DWORD sizes[] = {1, 4, 16, 17, 32, 33, 64, 65, 1024, 1025, 1048576, 1048577}; + unsigned int i, j; + void *data; + + for(i = 0; i < (sizeof(sizes) / sizeof(sizes[0])); i++) + { + for(j = 0; j < (sizeof(pools) / sizeof(pools[0])); j++) + { + hr = IDirect3DDevice9_CreateVertexBuffer(device, sizes[i], 0, 0, pools[j], &buffer, NULL); + if(pools[j] == D3DPOOL_SCRATCH) + { + ok(hr == D3DERR_INVALIDCALL, "Creating a D3DPOOL_SCRATCH buffer returned (0x%08x)\n", hr); + } + else + { + ok(SUCCEEDED(hr), "IDirect3DDevice9_CreateVertexBuffer failed (0x%08x). Pool = %s, size %d\n", hr, + debug_d3dpool(pools[j]), sizes[i]); + } + if(FAILED(hr)) continue; + + hr = IDirect3DVertexBuffer9_Lock(buffer, 0, 0, &data, 0); + ok(SUCCEEDED(hr), "IDirect3DVertexBuffer9_Lock failed (0x%08x)\n", hr); + ok(((DWORD_PTR) data & 31) == 0, "Vertex buffer start address is not 32 byte aligned(size: %d, pool: %s, data: %p)\n", + sizes[i], debug_d3dpool(pools[j]), data); + hr = IDirect3DVertexBuffer9_Unlock(buffer); + ok(SUCCEEDED(hr), "IDirect3DVertexBuffer9_Unlock failed (0x%08x)\n", hr); + + if(buffer) IDirect3DVertexBuffer9_Release(buffer); + } + } +} + START_TEST(buffer) { IDirect3DDevice9 *device_ptr; @@ -127,6 +177,7 @@ START_TEST(buffer) if (!device_ptr) return; lock_flag_test(device_ptr); + test_vertex_buffer_alignment(device_ptr); refcount = IDirect3DDevice9_Release(device_ptr); ok(!refcount, "Device has %u references left\n", refcount); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 1e58008..de46082 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -1902,81 +1902,6 @@ cleanup: if(d3d9) IDirect3D9_Release(d3d9); } -static inline const char *debug_d3dpool(D3DPOOL pool) { - switch(pool) { - case D3DPOOL_DEFAULT: return "D3DPOOL_DEFAULT"; - case D3DPOOL_SYSTEMMEM: return "D3DPOOL_SYSTEMMEM"; - case D3DPOOL_SCRATCH: return "D3DPOOL_SCRATCH"; - case D3DPOOL_MANAGED: return "D3DPOOL_MANAGED"; - default: - return "unknown pool"; - } -} - -static void test_vertex_buffer_alignment(void) -{ - IDirect3DVertexBuffer9 *buffer = NULL; - D3DPRESENT_PARAMETERS present_parameters; - IDirect3DDevice9 *device = NULL; - IDirect3D9 *d3d9; - HWND hwnd; - HRESULT hr; - D3DPOOL pools[] = {D3DPOOL_DEFAULT, D3DPOOL_SYSTEMMEM, D3DPOOL_SCRATCH, D3DPOOL_MANAGED}; - DWORD sizes[] = {1, 4, 16, 17, 32, 33, 64, 65, 1024, 1025, 1048576, 1048577}; - unsigned int i, j; - void *data; - - d3d9 = pDirect3DCreate9( D3D_SDK_VERSION ); - ok(d3d9 != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindow( "static", "d3d9_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL ); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d9 || !hwnd) goto cleanup; - - ZeroMemory(&present_parameters, sizeof(present_parameters)); - present_parameters.Windowed = TRUE; - present_parameters.hDeviceWindow = hwnd; - present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - - hr = IDirect3D9_CreateDevice( d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %08x\n", hr); - if(!device) - { - skip("Failed to create a d3d device\n"); - goto cleanup; - } - - for(i = 0; i < (sizeof(sizes) / sizeof(sizes[0])); i++) { - for(j = 0; j < (sizeof(pools) / sizeof(pools[0])); j++) { - hr = IDirect3DDevice9_CreateVertexBuffer(device, sizes[i], 0, 0, pools[j], &buffer, NULL); - if(pools[j] == D3DPOOL_SCRATCH) { - ok(hr == D3DERR_INVALIDCALL, "Creating a D3DPOOL_SCRATCH buffer returned (0x%08x)\n", hr); - } else { - ok(SUCCEEDED(hr), "IDirect3DDevice9_CreateVertexBuffer failed (0x%08x). Pool = %s, size %d\n", hr, - debug_d3dpool(pools[j]), sizes[i]); - } - if(FAILED(hr)) continue; - - hr = IDirect3DVertexBuffer9_Lock(buffer, 0, 0, &data, 0); - ok(SUCCEEDED(hr), "IDirect3DVertexBuffer9_Lock failed (0x%08x)\n", hr); - ok(((DWORD_PTR) data & 31) == 0, "Vertex buffer start address is not 32 byte aligned(size: %d, pool: %s, data: %p)\n", - sizes[i], debug_d3dpool(pools[j]), data); - hr = IDirect3DVertexBuffer9_Unlock(buffer); - ok(SUCCEEDED(hr), "IDirect3DVertexBuffer9_Unlock failed (0x%08x)\n", hr); - - if(buffer) IDirect3DVertexBuffer9_Release(buffer); - } - } - -cleanup: - if (device) - { - UINT refcount = IDirect3DDevice9_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (d3d9) IDirect3D9_Release(d3d9); -} - static void test_lights(void) { D3DPRESENT_PARAMETERS present_parameters; @@ -2660,7 +2585,6 @@ START_TEST(device) test_depthstenciltest(); test_draw_indexed(); test_null_stream(); - test_vertex_buffer_alignment(); test_lights(); test_set_stream_source(); test_scissor_size();
1
0
0
0
Stefan Dösinger : d3d9: Test buffer lock flags.
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: 1d486a5abe28a7dcccb8a4305e9c2dd6a35af069 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1d486a5abe28a7dcccb8a4305…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Sat Jan 30 12:13:12 2010 +0100 d3d9: Test buffer lock flags. --- dlls/d3d9/tests/Makefile.in | 1 + dlls/d3d9/tests/buffer.c | 133 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+), 0 deletions(-) diff --git a/dlls/d3d9/tests/Makefile.in b/dlls/d3d9/tests/Makefile.in index 7fa911d..0ed62c4 100644 --- a/dlls/d3d9/tests/Makefile.in +++ b/dlls/d3d9/tests/Makefile.in @@ -7,6 +7,7 @@ IMPORTS = user32 kernel32 CTESTS = \ d3d9ex.c \ + buffer.c \ device.c \ query.c \ shader.c \ diff --git a/dlls/d3d9/tests/buffer.c b/dlls/d3d9/tests/buffer.c new file mode 100644 index 0000000..c2e22c2 --- /dev/null +++ b/dlls/d3d9/tests/buffer.c @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2010 Stefan Dösinger(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 + */ + +#define COBJMACROS +#include <d3d9.h> +#include "wine/test.h" + +static HMODULE d3d9_handle = 0; + +static HWND create_window(void) +{ + WNDCLASS wc = {0}; + wc.lpfnWndProc = DefWindowProc; + wc.lpszClassName = "d3d9_test_wc"; + RegisterClass(&wc); + + return CreateWindow("d3d9_test_wc", "d3d9_test", + 0, 0, 0, 0, 0, 0, 0, 0, 0); +} + +static IDirect3DDevice9 *init_d3d9(void) +{ + IDirect3D9 * (__stdcall * d3d9_create)(UINT SDKVersion) = 0; + IDirect3D9 *d3d9_ptr = 0; + IDirect3DDevice9 *device_ptr = 0; + D3DPRESENT_PARAMETERS present_parameters; + HRESULT hr; + + d3d9_create = (void *)GetProcAddress(d3d9_handle, "Direct3DCreate9"); + ok(d3d9_create != NULL, "Failed to get address of Direct3DCreate9\n"); + if (!d3d9_create) return NULL; + + d3d9_ptr = d3d9_create(D3D_SDK_VERSION); + if (!d3d9_ptr) + { + skip("could not create D3D9\n"); + return NULL; + } + + ZeroMemory(&present_parameters, sizeof(present_parameters)); + present_parameters.Windowed = TRUE; + present_parameters.hDeviceWindow = create_window(); + present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; + + hr = IDirect3D9_CreateDevice(d3d9_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device_ptr); + + if(FAILED(hr)) + { + skip("could not create device, IDirect3D9_CreateDevice returned 0x%08x\n", hr); + return NULL; + } + + return device_ptr; +} + +static void lock_flag_test(IDirect3DDevice9 *device) +{ + HRESULT hr; + IDirect3DVertexBuffer9 *buffer; + unsigned int i; + void *data; + const struct + { + DWORD flags; + const char *debug_string; + HRESULT result; + } + test_data[] = + { + {D3DLOCK_READONLY, "D3DLOCK_READONLY", D3D_OK }, + {D3DLOCK_DISCARD, "D3DLOCK_DISCARD", D3D_OK }, + {D3DLOCK_NOOVERWRITE, "D3DLOCK_NOOVERWRITE", D3D_OK }, + {D3DLOCK_NOOVERWRITE | D3DLOCK_DISCARD, "D3DLOCK_NOOVERWRITE | D3DLOCK_DISCARD", D3D_OK }, + {D3DLOCK_NOOVERWRITE | D3DLOCK_READONLY, "D3DLOCK_NOOVERWRITE | D3DLOCK_READONLY", D3D_OK }, + {D3DLOCK_READONLY | D3DLOCK_DISCARD, "D3DLOCK_READONLY | D3DLOCK_DISCARD", D3D_OK }, + /* Completely bogous flags aren't an error */ + {0xdeadbeef, "0xdeadbeef", D3D_OK }, + }; + + hr = IDirect3DDevice9_CreateVertexBuffer(device, 1024, D3DUSAGE_DYNAMIC, 0, D3DPOOL_DEFAULT, &buffer, NULL); + ok(hr == D3D_OK, "IDirect3DDevice9_CreateBuffer failed, 0x%08x\n", hr); + + for(i = 0; i < (sizeof(test_data) / sizeof(*test_data)); i++) + { + hr = IDirect3DVertexBuffer9_Lock(buffer, 0, 0, &data, test_data[i].flags); + ok(hr == test_data[i].result, "Lock flags %s returned 0x%08x, expected 0x%08x\n", + test_data[i].debug_string, hr, test_data[i].result); + + if(SUCCEEDED(hr)) + { + hr = IDirect3DVertexBuffer9_Unlock(buffer); + ok(hr == D3D_OK, "IDirect3DVertexBuffer9_Unlock failed, 0x%08x\n", hr); + } + } + + IDirect3DVertexBuffer9_Release(buffer); +} + +START_TEST(buffer) +{ + IDirect3DDevice9 *device_ptr; + ULONG refcount; + + d3d9_handle = LoadLibraryA("d3d9.dll"); + if (!d3d9_handle) + { + skip("Could not load d3d9.dll\n"); + return; + } + + device_ptr = init_d3d9(); + if (!device_ptr) return; + + lock_flag_test(device_ptr); + + refcount = IDirect3DDevice9_Release(device_ptr); + ok(!refcount, "Device has %u references left\n", refcount); +}
1
0
0
0
Stefan Dösinger : wined3d: Implement dynamic buffers with GL_ARB_map_buffer_range.
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: 224043d6cf8b56e9ff2537358646700211d54d1f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=224043d6cf8b56e9ff2537358…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Thu Jan 28 20:51:06 2010 +0100 wined3d: Implement dynamic buffers with GL_ARB_map_buffer_range. --- dlls/wined3d/buffer.c | 53 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 48 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index e0cefc9..f3d3492 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -3,7 +3,7 @@ * Copyright 2002-2005 Raphael Junqueira * Copyright 2004 Christian Costa * Copyright 2005 Oliver Stieber - * Copyright 2007 Stefan Dösinger for CodeWeavers + * Copyright 2007-2010 Stefan Dösinger for CodeWeavers * Copyright 2009 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or @@ -158,6 +158,7 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This) checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE)"); This->flags |= WINED3D_BUFFER_FLUSH; } + /* No setup is needed here for GL_ARB_map_buffer_range */ } else { @@ -1058,6 +1059,25 @@ static DWORD buffer_sanitize_flags(DWORD flags) return flags; } +static GLbitfield buffer_gl_map_flags(DWORD d3d_flags) +{ + GLbitfield ret = GL_MAP_FLUSH_EXPLICIT_BIT; + + if (!(d3d_flags & WINED3DLOCK_READONLY)) ret |= GL_MAP_WRITE_BIT; + + if (d3d_flags & (WINED3DLOCK_DISCARD | WINED3DLOCK_NOOVERWRITE)) + { + if(d3d_flags & WINED3DLOCK_DISCARD) ret |= GL_MAP_INVALIDATE_BUFFER_BIT; + ret |= GL_MAP_UNSYNCHRONIZED_BIT; + } + else + { + ret |= GL_MAP_READ_BIT; + } + + return ret; +} + static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset, UINT size, BYTE **data, DWORD flags) { struct wined3d_buffer *This = (struct wined3d_buffer *)iface; @@ -1076,6 +1096,7 @@ static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset, { IWineD3DDeviceImpl *device = This->resource.device; struct wined3d_context *context; + const struct wined3d_gl_info *gl_info; if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) { @@ -1083,9 +1104,20 @@ static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset, } context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); + gl_info = context->gl_info; ENTER_GL(); GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); - This->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_READ_WRITE_ARB)); + + if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) + { + GLbitfield mapflags = buffer_gl_map_flags(flags); + This->resource.allocatedMemory = GL_EXTCALL(glMapBufferRange(This->buffer_type_hint, 0, + This->resource.size, mapflags)); + } + else + { + This->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_READ_WRITE_ARB)); + } LEAVE_GL(); context_release(context); } @@ -1126,6 +1158,7 @@ static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface) if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER) && This->buffer_object) { IWineD3DDeviceImpl *device = This->resource.device; + const struct wined3d_gl_info *gl_info; struct wined3d_context *context; if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) @@ -1134,10 +1167,21 @@ static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface) } context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); + gl_info = context->gl_info; ENTER_GL(); GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); - if(This->flags & WINED3D_BUFFER_FLUSH) + if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) + { + for(i = 0; i < This->modified_areas; i++) + { + GL_EXTCALL(glFlushMappedBufferRange(This->buffer_type_hint, + This->maps[i].offset, + This->maps[i].size)); + checkGLcall("glFlushMappedBufferRange"); + } + } + else if (This->flags & WINED3D_BUFFER_FLUSH) { for(i = 0; i < This->modified_areas; i++) { @@ -1229,8 +1273,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, TRACE("size %#x, usage %#x, format %s, memory @ %p, iface @ %p.\n", buffer->resource.size, buffer->resource.usage, debug_d3dformat(buffer->resource.format_desc->format), buffer->resource.allocatedMemory, buffer); - /* TODO: GL_ARB_map_buffer_range */ - dynamic_buffer_ok = gl_info->supported[APPLE_FLUSH_BUFFER_RANGE]; + dynamic_buffer_ok = gl_info->supported[APPLE_FLUSH_BUFFER_RANGE] || gl_info->supported[ARB_MAP_BUFFER_RANGE]; /* Observations show that drawStridedSlow is faster on dynamic VBs than converting + * drawStridedFast (half-life 2 and others).
1
0
0
0
Stefan Dösinger : wined3d: Add GL_ARB_map_buffer_range .
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: f6bb86e196a8c72a70245cbe7d6ab3ddf697a07c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f6bb86e196a8c72a70245cbe7…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Thu Jan 28 20:50:55 2010 +0100 wined3d: Add GL_ARB_map_buffer_range. --- dlls/wined3d/directx.c | 7 +++++++ dlls/wined3d/wined3d_gl.h | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index b708b33..7e98292 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -63,6 +63,7 @@ static const struct { {"GL_ARB_half_float_pixel", ARB_HALF_FLOAT_PIXEL, 0 }, {"GL_ARB_half_float_vertex", ARB_HALF_FLOAT_VERTEX, 0 }, {"GL_ARB_imaging", ARB_IMAGING, 0 }, + {"GL_ARB_map_buffer_range", ARB_MAP_BUFFER_RANGE, 0 }, {"GL_ARB_multisample", ARB_MULTISAMPLE, 0 }, /* needs GLX_ARB_MULTISAMPLE as well */ {"GL_ARB_multitexture", ARB_MULTITEXTURE, 0 }, {"GL_ARB_occlusion_query", ARB_OCCLUSION_QUERY, 0 }, @@ -1837,6 +1838,12 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str gl_info->supported[ARB_HALF_FLOAT_PIXEL] = TRUE; } } + if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) + { + /* GL_ARB_map_buffer_range and GL_APPLE_flush_buffer_range provide the same + * functionality. Prefer the ARB extension */ + gl_info->supported[APPLE_FLUSH_BUFFER_RANGE] = FALSE; + } if (gl_info->supported[ARB_TEXTURE_CUBE_MAP]) { TRACE_(d3d_caps)(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support.\n"); diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index f0367ce..07ce7af 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -1743,6 +1743,7 @@ typedef enum wined3d_gl_extension ARB_HALF_FLOAT_PIXEL, ARB_HALF_FLOAT_VERTEX, ARB_IMAGING, + ARB_MAP_BUFFER_RANGE, ARB_MULTISAMPLE, ARB_MULTITEXTURE, ARB_OCCLUSION_QUERY, @@ -2225,6 +2226,19 @@ typedef void (WINE_GLAPI *PGLFNFRAMEBUFFERTEXTUREFACEARBPROC)(GLenum target, GLe typedef void (WINE_GLAPI *PGLFNBLENDCOLORPROC)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); typedef void (WINE_GLAPI *PGLFNBLENDEQUATIONPROC)(GLenum mode); +/* GL_ARB_map_buffer_range */ +#ifndef GL_ARB_map_buffer_range +#define GL_ARB_map_buffer_range 1 +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#endif +typedef GLvoid *(WINE_GLAPI *PGLFNMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (WINE_GLAPI *PGLFNFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); + /* GL_ARB_multisample */ #ifndef GL_ARB_multisample #define GL_ARB_multisample 1 @@ -3934,6 +3948,11 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelForma glBlendColorEXT, EXT_BLEND_COLOR, NULL) \ USE_GL_FUNC(PGLFNBLENDEQUATIONPROC, \ glBlendEquationEXT, EXT_BLEND_MINMAX, NULL) \ + /* GL_ARB_map_buffer_range */ \ + USE_GL_FUNC(PGLFNMAPBUFFERRANGEPROC, \ + glMapBufferRange, ARB_MAP_BUFFER_RANGE, NULL) \ + USE_GL_FUNC(PGLFNFLUSHMAPPEDBUFFERRANGEPROC, \ + glFlushMappedBufferRange, ARB_MAP_BUFFER_RANGE, NULL) \ /* GL_ARB_multisample */ \ USE_GL_FUNC(WINED3D_PFNGLSAMPLECOVERAGEARBPROC, \ glSampleCoverageARB, ARB_MULTISAMPLE, NULL) \
1
0
0
0
Alexandre Julliard : user: Add internal functions for cursor/icon 16<-> 32 conversion to replace the typecasting macros.
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: 8fc1fc49fdf1a86bf149c1b03a789e7a493584cd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8fc1fc49fdf1a86bf149c1b03…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Feb 2 12:14:10 2010 +0100 user: Add internal functions for cursor/icon 16<->32 conversion to replace the typecasting macros. --- dlls/user.exe16/message.c | 14 +++++++------- dlls/user.exe16/user.c | 34 ++++++++++++++++++++++++---------- dlls/user.exe16/user_private.h | 9 +++------ dlls/user.exe16/window.c | 14 +++++++------- 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/dlls/user.exe16/message.c b/dlls/user.exe16/message.c index 1ff58a7..af9da07 100644 --- a/dlls/user.exe16/message.c +++ b/dlls/user.exe16/message.c @@ -2619,7 +2619,7 @@ static LRESULT static_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, HICON16 icon = LoadIcon16( HINSTANCE_16(cs->hInstance), cs->lpszName ); if (!icon) icon = LoadCursor16( HINSTANCE_16(cs->hInstance), cs->lpszName ); if (icon) wow_handlers32.static_proc( hwnd, STM_SETIMAGE, IMAGE_ICON, - (LPARAM)HICON_32(icon), FALSE ); + (LPARAM)get_icon_32(icon), FALSE ); break; } case SS_BITMAP: @@ -2633,10 +2633,10 @@ static LRESULT static_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, return ret; } case STM_SETICON16: - wParam = (WPARAM)HICON_32( (HICON16)wParam ); + wParam = (WPARAM)get_icon_32( (HICON16)wParam ); return wow_handlers32.static_proc( hwnd, STM_SETICON, wParam, lParam, FALSE ); case STM_GETICON16: - return HICON_16( wow_handlers32.static_proc( hwnd, STM_GETICON, wParam, lParam, FALSE )); + return get_icon_16( (HICON)wow_handlers32.static_proc( hwnd, STM_GETICON, wParam, lParam, FALSE )); default: return wow_handlers32.static_proc( hwnd, msg, wParam, lParam, unicode ); } @@ -2678,22 +2678,22 @@ static HICON alloc_icon_handle( unsigned int size ) { HGLOBAL16 handle = GlobalAlloc16( GMEM_MOVEABLE, size ); FarSetOwner16( handle, 0 ); - return HICON_32( handle ); + return (HICON)(ULONG_PTR)handle; } static struct tagCURSORICONINFO *get_icon_ptr( HICON handle ) { - return GlobalLock16( HICON_16(handle) ); + return GlobalLock16( LOWORD(handle) ); } static void release_icon_ptr( HICON handle, struct tagCURSORICONINFO *ptr ) { - GlobalUnlock16( HICON_16(handle) ); + GlobalUnlock16( LOWORD(handle) ); } static int free_icon_handle( HICON handle ) { - return GlobalFree16( HICON_16(handle) ); + return GlobalFree16( LOWORD(handle) ); } diff --git a/dlls/user.exe16/user.c b/dlls/user.exe16/user.c index d415f78..5462d94 100644 --- a/dlls/user.exe16/user.c +++ b/dlls/user.exe16/user.c @@ -289,6 +289,16 @@ static int free_icon_handle( HICON16 handle ) return GlobalFree16( handle ); } +HICON get_icon_32( HICON16 icon16 ) +{ + return (HICON)(ULONG_PTR)icon16; +} + +HICON16 get_icon_16( HICON icon ) +{ + return LOWORD( icon ); +} + static void add_shared_icon( HINSTANCE16 inst, HRSRC16 rsrc, HRSRC16 group, HICON16 icon ) { struct cache_entry *cache = HeapAlloc( GetProcessHeap(), 0, sizeof(*cache) ); @@ -471,7 +481,7 @@ BOOL16 WINAPI AnyPopup16(void) */ HCURSOR16 WINAPI SetCursor16(HCURSOR16 hCursor) { - return HCURSOR_16(SetCursor(HCURSOR_32(hCursor))); + return get_icon_16( SetCursor( get_icon_32(hCursor) )); } @@ -673,7 +683,7 @@ INT16 WINAPI FrameRect16( HDC16 hdc, const RECT16 *rect16, HBRUSH16 hbrush ) */ BOOL16 WINAPI DrawIcon16(HDC16 hdc, INT16 x, INT16 y, HICON16 hIcon) { - return DrawIcon(HDC_32(hdc), x, y, HICON_32(hIcon)); + return DrawIcon(HDC_32(hdc), x, y, get_icon_32(hIcon) ); } @@ -1453,7 +1463,7 @@ BOOL16 WINAPI ExitWindowsExec16( LPCSTR lpszExe, LPCSTR lpszParams ) */ HCURSOR16 WINAPI GetCursor16(void) { - return HCURSOR_16(GetCursor()); + return get_icon_16( GetCursor() ); } @@ -1986,7 +1996,12 @@ HANDLE16 WINAPI LoadImage16(HINSTANCE16 hinst, LPCSTR name, UINT16 type, INT16 c HRSRC16 hRsrc, hGroupRsrc; if (!hinst || (flags & LR_LOADFROMFILE)) - return HICON_16( LoadImageA( 0, name, type, cx, cy, flags )); + { + if (type == IMAGE_BITMAP) + return HBITMAP_16( LoadImageA( 0, name, type, cx, cy, flags )); + else + return get_icon_16( LoadImageA( 0, name, type, cx, cy, flags )); + } hinst = GetExePtr( hinst ); @@ -2110,7 +2125,7 @@ BOOL16 WINAPI DrawIconEx16(HDC16 hdc, INT16 xLeft, INT16 yTop, HICON16 hIcon, INT16 cxWidth, INT16 cyWidth, UINT16 istep, HBRUSH16 hbr, UINT16 flags) { - return DrawIconEx(HDC_32(hdc), xLeft, yTop, HICON_32(hIcon), cxWidth, cyWidth, + return DrawIconEx(HDC_32(hdc), xLeft, yTop, get_icon_32(hIcon), cxWidth, cyWidth, istep, HBRUSH_32(hbr), flags); } @@ -2563,8 +2578,7 @@ HICON16 WINAPI CreateIconFromResourceEx16(LPBYTE bits, UINT16 cbSize, INT16 width, INT16 height, UINT16 cFlag) { - return HICON_16(CreateIconFromResourceEx(bits, cbSize, bIcon, dwVersion, - width, height, cFlag)); + return get_icon_16( CreateIconFromResourceEx( bits, cbSize, bIcon, dwVersion, width, height, cFlag )); } @@ -2722,7 +2736,7 @@ DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj, MSG msg; LPDRAGINFO16 lpDragInfo; SEGPTR spDragInfo; - HCURSOR hOldCursor=0, hBummer=0; + HCURSOR hOldCursor=0, hBummer=0, hCursor32; HGLOBAL16 hDragInfo = GlobalAlloc16( GMEM_SHARE | GMEM_ZEROINIT, 2*sizeof(DRAGINFO16)); HCURSOR hCurrentCursor = 0; HWND16 hCurrentWnd = 0; @@ -2738,7 +2752,7 @@ DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj, return 0L; } - if(hCursor) hOldCursor = SetCursor(HCURSOR_32(hCursor)); + if ((hCursor32 = get_icon_32( hCursor ))) SetCursor( hCursor32 ); lpDragInfo->hWnd = hWnd; lpDragInfo->hScope = 0; @@ -2761,7 +2775,7 @@ DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj, /* update DRAGINFO struct */ if( DRAG_QueryUpdate16(WIN_Handle32(hwndScope), spDragInfo) > 0 ) - hCurrentCursor = HCURSOR_32(hCursor); + hCurrentCursor = hCursor32; else { hCurrentCursor = hBummer; diff --git a/dlls/user.exe16/user_private.h b/dlls/user.exe16/user_private.h index 97cd669..9c68b85 100644 --- a/dlls/user.exe16/user_private.h +++ b/dlls/user.exe16/user_private.h @@ -117,14 +117,11 @@ typedef struct tagDIALOGINFO #define DF_OWNERENABLED 0x0002 /* HANDLE16 <-> HANDLE conversions */ -#define HCURSOR_16(h32) (LOWORD(h32)) -#define HICON_16(h32) (LOWORD(h32)) #define HINSTANCE_16(h32) (LOWORD(h32)) - -#define HCURSOR_32(h16) ((HCURSOR)(ULONG_PTR)(h16)) -#define HICON_32(h16) ((HICON)(ULONG_PTR)(h16)) #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16)) -#define HMODULE_32(h16) ((HMODULE)(ULONG_PTR)(h16)) + +extern HICON16 get_icon_16( HICON icon ) DECLSPEC_HIDDEN; +extern HICON get_icon_32( HICON16 icon16 ) DECLSPEC_HIDDEN; extern DWORD USER16_AlertableWait DECLSPEC_HIDDEN; extern WORD USER_HeapSel DECLSPEC_HIDDEN; diff --git a/dlls/user.exe16/window.c b/dlls/user.exe16/window.c index 0bd4518..b617c4d 100644 --- a/dlls/user.exe16/window.c +++ b/dlls/user.exe16/window.c @@ -1575,12 +1575,12 @@ ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc ) wc32.cbClsExtra = wc->cbClsExtra; wc32.cbWndExtra = wc->cbWndExtra; wc32.hInstance = HINSTANCE_32(inst); - wc32.hIcon = HICON_32(wc->hIcon); - wc32.hCursor = HCURSOR_32(wc->hCursor); + wc32.hIcon = get_icon_32(wc->hIcon); + wc32.hCursor = get_icon_32( wc->hCursor ); wc32.hbrBackground = HBRUSH_32(wc->hbrBackground); wc32.lpszMenuName = MapSL(wc->lpszMenuName); wc32.lpszClassName = MapSL(wc->lpszClassName); - wc32.hIconSm = HICON_32(wc->hIconSm); + wc32.hIconSm = get_icon_32(wc->hIconSm); atom = RegisterClassExA( &wc32 ); if ((class = HeapAlloc( GetProcessHeap(), 0, sizeof(*class) ))) { @@ -1618,9 +1618,9 @@ BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASSEX16 * wc->cbClsExtra = wc32.cbClsExtra; wc->cbWndExtra = wc32.cbWndExtra; wc->hInstance = (wc32.hInstance == user32_module) ? GetModuleHandle16("user") : HINSTANCE_16(wc32.hInstance); - wc->hIcon = HICON_16(wc32.hIcon); - wc->hIconSm = HICON_16(wc32.hIconSm); - wc->hCursor = HCURSOR_16(wc32.hCursor); + wc->hIcon = get_icon_16( wc32.hIcon ); + wc->hIconSm = get_icon_16( wc32.hIconSm ); + wc->hCursor = get_icon_16( wc32.hCursor ); wc->hbrBackground = HBRUSH_16(wc32.hbrBackground); wc->lpszClassName = 0; wc->lpszMenuName = MapLS(wc32.lpszMenuName); /* FIXME: leak */ @@ -2048,7 +2048,7 @@ BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, } return DrawCaptionTempA( WIN_Handle32(hwnd), HDC_32(hdc), rect ? &rect32 : NULL, HFONT_32(hFont), - HICON_32(hIcon), str, uFlags & 0x1f ); + get_icon_32(hIcon), str, uFlags & 0x1f ); }
1
0
0
0
Alexandre Julliard : user: Call the 16-bit CreateIconFromResourceEx from LoadIconHandler16.
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: 3d55d1430bbfcc34a00498667224914876fa9e09 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3d55d1430bbfcc34a00498667…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Feb 1 20:36:35 2010 +0100 user: Call the 16-bit CreateIconFromResourceEx from LoadIconHandler16. --- dlls/user.exe16/user.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/user.exe16/user.c b/dlls/user.exe16/user.c index 7d60bac..d415f78 100644 --- a/dlls/user.exe16/user.c +++ b/dlls/user.exe16/user.c @@ -2614,9 +2614,8 @@ WORD WINAPI GetIconID16( HGLOBAL16 hResource, DWORD resType ) */ HICON16 WINAPI LoadIconHandler16( HGLOBAL16 hResource, BOOL16 bNew ) { - LPBYTE bits = LockResource16( hResource ); - return HICON_16(CreateIconFromResourceEx( bits, 0, TRUE, - bNew ? 0x00030000 : 0x00020000, 0, 0, LR_DEFAULTCOLOR)); + return CreateIconFromResourceEx16( LockResource16( hResource ), 0, TRUE, + bNew ? 0x00030000 : 0x00020000, 0, 0, LR_DEFAULTCOLOR ); }
1
0
0
0
Alexandre Julliard : user: Reimplement GetIconInfo16 using the 16-bit icon structure directly.
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: e474bfe0f39ed13f0364cccb273fbe368653b2d9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e474bfe0f39ed13f0364cccb2…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Feb 1 17:31:27 2010 +0100 user: Reimplement GetIconInfo16 using the 16-bit icon structure directly. --- dlls/user.exe16/user.c | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 38 insertions(+), 9 deletions(-) diff --git a/dlls/user.exe16/user.c b/dlls/user.exe16/user.c index 0b321b7..7d60bac 100644 --- a/dlls/user.exe16/user.c +++ b/dlls/user.exe16/user.c @@ -265,6 +265,8 @@ struct cache_entry static struct list icon_cache = LIST_INIT( icon_cache ); +static const WORD ICON_HOTSPOT = 0x4242; + static HICON16 alloc_icon_handle( unsigned int size ) { HGLOBAL16 handle = GlobalAlloc16( GMEM_MOVEABLE, size ); @@ -2117,15 +2119,43 @@ BOOL16 WINAPI DrawIconEx16(HDC16 hdc, INT16 xLeft, INT16 yTop, HICON16 hIcon, */ BOOL16 WINAPI GetIconInfo16(HICON16 hIcon, LPICONINFO16 iconinfo) { - ICONINFO ii32; - BOOL16 ret = GetIconInfo(HICON_32(hIcon), &ii32); + CURSORICONINFO *info = get_icon_ptr( hIcon ); + INT height; + + if (!info) return FALSE; + + if ((info->ptHotSpot.x == ICON_HOTSPOT) && (info->ptHotSpot.y == ICON_HOTSPOT)) + { + iconinfo->fIcon = TRUE; + iconinfo->xHotspot = info->nWidth / 2; + iconinfo->yHotspot = info->nHeight / 2; + } + else + { + iconinfo->fIcon = FALSE; + iconinfo->xHotspot = info->ptHotSpot.x; + iconinfo->yHotspot = info->ptHotSpot.y; + } - iconinfo->fIcon = ii32.fIcon; - iconinfo->xHotspot = ii32.xHotspot; - iconinfo->yHotspot = ii32.yHotspot; - iconinfo->hbmMask = HBITMAP_16(ii32.hbmMask); - iconinfo->hbmColor = HBITMAP_16(ii32.hbmColor); - return ret; + height = info->nHeight; + + if (info->bBitsPerPixel > 1) + { + iconinfo->hbmColor = HBITMAP_16( CreateBitmap( info->nWidth, info->nHeight, + info->bPlanes, info->bBitsPerPixel, + (char *)(info + 1) + + info->nHeight * + get_bitmap_width_bytes(info->nWidth,1) )); + } + else + { + iconinfo->hbmColor = 0; + height *= 2; + } + + iconinfo->hbmMask = HBITMAP_16( CreateBitmap( info->nWidth, height, 1, 1, info + 1 )); + release_icon_ptr( hIcon, info ); + return TRUE; } @@ -2167,7 +2197,6 @@ HICON16 WINAPI CreateIcon16( HINSTANCE16 hInstance, INT16 nWidth, INT16 nHeight, BYTE bPlanes, BYTE bBitsPixel, LPCVOID lpANDbits, LPCVOID lpXORbits ) { - static const WORD ICON_HOTSPOT = 0x4242; CURSORICONINFO info; info.ptHotSpot.x = ICON_HOTSPOT;
1
0
0
0
Huw Davies : oleaut32: If the font name property is changed, don' t insist on the current charset when selecting a new font.
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: 7e42fd8b4e1acc5c7df9e6a03af07f1a00ec37cb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7e42fd8b4e1acc5c7df9e6a03…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Feb 2 10:20:50 2010 +0000 oleaut32: If the font name property is changed, don't insist on the current charset when selecting a new font. --- dlls/oleaut32/olefont.c | 102 +++++++++++++++++++++++++++++++++++++++-- dlls/oleaut32/tests/olefont.c | 58 +++++++++++++++++++++++ 2 files changed, 155 insertions(+), 5 deletions(-) diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index c0d9b66..df7de87 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -53,6 +53,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); #define FONTPERSIST_UNDERLINE 0x04 #define FONTPERSIST_STRIKETHROUGH 0x08 +static HDC olefont_hdc; /*********************************************************************** * List of the HFONTs it has given out, with each one having a separate @@ -91,6 +92,28 @@ static CRITICAL_SECTION_DEBUG OLEFontImpl_csHFONTLIST_debug = }; static CRITICAL_SECTION OLEFontImpl_csHFONTLIST = { &OLEFontImpl_csHFONTLIST_debug, -1, 0, 0, 0, 0 }; +static HDC get_dc(void) +{ + HDC hdc; + EnterCriticalSection(&OLEFontImpl_csHFONTLIST); + if(!olefont_hdc) + olefont_hdc = CreateCompatibleDC(NULL); + hdc = olefont_hdc; + LeaveCriticalSection(&OLEFontImpl_csHFONTLIST); + return hdc; +} + +static void delete_dc(void) +{ + EnterCriticalSection(&OLEFontImpl_csHFONTLIST); + if(olefont_hdc) + { + DeleteDC(olefont_hdc); + olefont_hdc = NULL; + } + LeaveCriticalSection(&OLEFontImpl_csHFONTLIST); +} + static void HFONTItem_Delete(PHFONTItem item) { DeleteObject(item->gdiFont); @@ -204,6 +227,17 @@ static HRESULT dec_ext_ref(HFONT hfont) return hr; } +static WCHAR *strdupW(const WCHAR* str) +{ + WCHAR *ret; + DWORD size = (strlenW(str) + 1) * sizeof(WCHAR); + + ret = HeapAlloc(GetProcessHeap(), 0, size); + if(ret) + memcpy(ret, str, size); + return ret; +} + /*********************************************************************** * Declaration of the implementation class for the IFont interface */ @@ -531,6 +565,7 @@ static ULONG WINAPI OLEFontImpl_Release( LIST_FOR_EACH_ENTRY_SAFE(item, cursor2, &OLEFontImpl_hFontList, HFONTItem, entry) HFONTItem_Delete(item); LeaveCriticalSection(&OLEFontImpl_csHFONTLIST); + delete_dc(); } else { @@ -542,31 +577,77 @@ static ULONG WINAPI OLEFontImpl_Release( return ret; } +typedef struct +{ + short orig_cs; + short avail_cs; +} enum_data; + +static int CALLBACK font_enum_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lp) +{ + enum_data *data = (enum_data*)lp; + + if(elf->lfCharSet == data->orig_cs) + { + data->avail_cs = data->orig_cs; + return 0; + } + if(data->avail_cs == -1) data->avail_cs = elf->lfCharSet; + return 1; +} + static void realize_font(OLEFontImpl *This) { if (This->dirty) { LOGFONTW logFont; INT fontHeight; + WCHAR text_face[LF_FACESIZE]; + HDC hdc = get_dc(); + HFONT old_font; + TEXTMETRICW tm; + + text_face[0] = 0; if(This->gdiFont) { + old_font = SelectObject(hdc, This->gdiFont); + GetTextFaceW(hdc, sizeof(text_face) / sizeof(text_face[0]), text_face); + SelectObject(hdc, old_font); dec_int_ref(This->gdiFont); This->gdiFont = 0; } + memset(&logFont, 0, sizeof(LOGFONTW)); + + lstrcpynW(logFont.lfFaceName, This->description.lpstrName, LF_FACESIZE); + logFont.lfCharSet = This->description.sCharset; + + /* If the font name has been changed then enumerate all charsets + and pick one that'll result in the font specified being selected */ + if(text_face[0] && lstrcmpiW(text_face, This->description.lpstrName)) + { + enum_data data; + data.orig_cs = This->description.sCharset; + data.avail_cs = -1; + logFont.lfCharSet = DEFAULT_CHARSET; + EnumFontFamiliesExW(get_dc(), &logFont, font_enum_proc, (LPARAM)&data, 0); + if(data.avail_cs != -1) logFont.lfCharSet = data.avail_cs; + } + + /* * The height of the font returned by the get_Size property is the * height of the font in points multiplied by 10000... Using some * simple conversions and the ratio given by the application, it can * be converted to a height in pixels. + * + * Standard ratio is 72 / 2540, or 18 / 635 in lowest terms. + * Ratio is applied here relative to the standard. */ - /* Standard ratio is 72 / 2540, or 18 / 635 in lowest terms. */ - /* Ratio is applied here relative to the standard. */ fontHeight = MulDiv( This->description.cySize.s.Lo, This->cyLogical*635, This->cyHimetric*18 ); - memset(&logFont, 0, sizeof(LOGFONTW)); logFont.lfHeight = ((fontHeight%10000L)>5000L) ? (-fontHeight/10000L) - 1 : (-fontHeight/10000L); @@ -574,17 +655,28 @@ static void realize_font(OLEFontImpl *This) logFont.lfUnderline = This->description.fUnderline; logFont.lfStrikeOut = This->description.fStrikethrough; logFont.lfWeight = This->description.sWeight; - logFont.lfCharSet = This->description.sCharset; logFont.lfOutPrecision = OUT_CHARACTER_PRECIS; logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; logFont.lfQuality = DEFAULT_QUALITY; logFont.lfPitchAndFamily = DEFAULT_PITCH; - lstrcpynW(logFont.lfFaceName, This->description.lpstrName, LF_FACESIZE); This->gdiFont = CreateFontIndirectW(&logFont); This->dirty = FALSE; add_hfontitem(This->gdiFont); + + /* Fixup the name and charset properties so that they match the + selected font */ + old_font = SelectObject(get_dc(), This->gdiFont); + GetTextFaceW(hdc, sizeof(text_face) / sizeof(text_face[0]), text_face); + if(lstrcmpiW(text_face, This->description.lpstrName)) + { + HeapFree(GetProcessHeap(), 0, This->description.lpstrName); + This->description.lpstrName = strdupW(text_face); + } + GetTextMetricsW(hdc, &tm); + This->description.sCharset = tm.tmCharSet; + SelectObject(hdc, old_font); } } diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c index 79dbade..2f3eff8 100644 --- a/dlls/oleaut32/tests/olefont.c +++ b/dlls/oleaut32/tests/olefont.c @@ -45,6 +45,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); static WCHAR MSSansSerif_font[] = {'M','S',' ','S','a','n','s',' ','S','e','r','i','f',0}; static WCHAR system_font[] = { 'S','y','s','t','e','m',0 }; static WCHAR arial_font[] = { 'A','r','i','a','l',0 }; +static WCHAR marlett_font[] = { 'M','a','r','l','e','t','t',0 }; static HMODULE hOleaut32; @@ -1018,6 +1019,62 @@ todo_wine ok(obj_type == 0, "got obj type %d\n", obj_type); } +static void test_realization(void) +{ + IFont *font; + FONTDESC fontdesc; + HRESULT hr; + BSTR name; + SHORT cs; + + /* Try to create a symbol only font (marlett) with charset + set to ANSI. This will result in another, ANSI, font + being selected */ + fontdesc.cbSizeofstruct = sizeof(fontdesc); + fontdesc.lpstrName = marlett_font; + fontdesc.cySize.int64 = 12 * 10000; /* 12 pt */ + fontdesc.sWeight = FW_NORMAL; + fontdesc.sCharset = ANSI_CHARSET; + fontdesc.fItalic = FALSE; + fontdesc.fUnderline = FALSE; + fontdesc.fStrikethrough = FALSE; + + hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); + ok_ole_success(hr, "OleCreateFontIndirect"); + + hr = IFont_get_Charset(font, &cs); + ok_ole_success(hr, "get_Charset"); + ok(cs == ANSI_CHARSET, "got charset %d\n", cs); + + IFont_Release(font); + + /* Now create an ANSI font and change the name to marlett */ + + fontdesc.lpstrName = arial_font; + + hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&font); + ok_ole_success(hr, "OleCreateFontIndirect"); + + hr = IFont_get_Charset(font, &cs); + ok_ole_success(hr, "get_Charset"); + ok(cs == ANSI_CHARSET, "got charset %d\n", cs); + + name = SysAllocString(marlett_font); + hr = IFont_put_Name(font, name); + ok_ole_success(hr, "put_Name"); + SysFreeString(name); + + hr = IFont_get_Name(font, &name); + ok_ole_success(hr, "get_Name"); + ok(!lstrcmpiW(name, marlett_font), "got name %s\n", wine_dbgstr_w(name)); + SysFreeString(name); + + hr = IFont_get_Charset(font, &cs); + ok_ole_success(hr, "get_Charset"); + ok(cs == SYMBOL_CHARSET, "got charset %d\n", cs); + + IFont_Release(font); +} START_TEST(olefont) { @@ -1053,4 +1110,5 @@ START_TEST(olefont) test_AddRefHfont(); test_returns(); test_hfont_lifetime(); + test_realization(); }
1
0
0
0
Huw Davies : oleaut32: Realize the font in getter functions.
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: cf602ca4228f954d7de3b8100cea8fad680ed7f2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cf602ca4228f954d7de3b8100…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Feb 2 10:15:39 2010 +0000 oleaut32: Realize the font in getter functions. --- dlls/oleaut32/olefont.c | 134 +++++++++++++++++++++++++---------------- dlls/oleaut32/tests/olefont.c | 2 - 2 files changed, 83 insertions(+), 53 deletions(-) diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index 9309b0f..c0d9b66 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -111,6 +111,22 @@ static HFONTItem *find_hfontitem(HFONT hfont) return NULL; } +/* Add an item to the list with one internal reference */ +static HRESULT add_hfontitem(HFONT hfont) +{ + HFONTItem *new_item = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_item)); + + if(!new_item) return E_OUTOFMEMORY; + + new_item->int_refs = 1; + new_item->total_refs = 1; + new_item->gdiFont = hfont; + EnterCriticalSection(&OLEFontImpl_csHFONTLIST); + list_add_tail(&OLEFontImpl_hFontList,&new_item->entry); + LeaveCriticalSection(&OLEFontImpl_csHFONTLIST); + return S_OK; +} + static HRESULT inc_int_ref(HFONT hfont) { HFONTItem *item; @@ -221,7 +237,7 @@ struct OLEFontImpl * Contain the font associated with this object. */ HFONT gdiFont; - + BOOL dirty; /* * Size ratio */ @@ -370,8 +386,8 @@ static void OLEFont_SendNotify(OLEFontImpl* this, DISPID dispID) CONNECTDATA CD; HRESULT hres; - dec_int_ref(this->gdiFont); - this->gdiFont = 0; + this->dirty = TRUE; + hres = IConnectionPoint_EnumConnections(this->pPropertyNotifyCP, &pEnum); if (SUCCEEDED(hres)) { @@ -526,6 +542,52 @@ static ULONG WINAPI OLEFontImpl_Release( return ret; } +static void realize_font(OLEFontImpl *This) +{ + if (This->dirty) + { + LOGFONTW logFont; + INT fontHeight; + + if(This->gdiFont) + { + dec_int_ref(This->gdiFont); + This->gdiFont = 0; + } + + /* + * The height of the font returned by the get_Size property is the + * height of the font in points multiplied by 10000... Using some + * simple conversions and the ratio given by the application, it can + * be converted to a height in pixels. + */ + + /* Standard ratio is 72 / 2540, or 18 / 635 in lowest terms. */ + /* Ratio is applied here relative to the standard. */ + fontHeight = MulDiv( This->description.cySize.s.Lo, This->cyLogical*635, This->cyHimetric*18 ); + + memset(&logFont, 0, sizeof(LOGFONTW)); + + logFont.lfHeight = ((fontHeight%10000L)>5000L) ? (-fontHeight/10000L) - 1 : + (-fontHeight/10000L); + logFont.lfItalic = This->description.fItalic; + logFont.lfUnderline = This->description.fUnderline; + logFont.lfStrikeOut = This->description.fStrikethrough; + logFont.lfWeight = This->description.sWeight; + logFont.lfCharSet = This->description.sCharset; + logFont.lfOutPrecision = OUT_CHARACTER_PRECIS; + logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; + logFont.lfQuality = DEFAULT_QUALITY; + logFont.lfPitchAndFamily = DEFAULT_PITCH; + lstrcpynW(logFont.lfFaceName, This->description.lpstrName, LF_FACESIZE); + + This->gdiFont = CreateFontIndirectW(&logFont); + This->dirty = FALSE; + + add_hfontitem(This->gdiFont); + } +} + /************************************************************************ * OLEFontImpl_get_Name (IFont) * @@ -543,6 +605,8 @@ static HRESULT WINAPI OLEFontImpl_get_Name( if (pname==0) return E_POINTER; + if(this->dirty) realize_font(this); + if (this->description.lpstrName!=0) *pname = SysAllocString(this->description.lpstrName); else @@ -607,6 +671,8 @@ static HRESULT WINAPI OLEFontImpl_get_Size( if (psize==0) return E_POINTER; + if(this->dirty) realize_font(this); + psize->s.Hi = 0; psize->s.Lo = this->description.cySize.s.Lo; @@ -648,6 +714,8 @@ static HRESULT WINAPI OLEFontImpl_get_Bold( if (pbold==0) return E_POINTER; + if(this->dirty) realize_font(this); + *pbold = this->description.sWeight > 550; return S_OK; @@ -687,6 +755,8 @@ static HRESULT WINAPI OLEFontImpl_get_Italic( if (pitalic==0) return E_POINTER; + if(this->dirty) realize_font(this); + *pitalic = this->description.fItalic; return S_OK; @@ -728,6 +798,8 @@ static HRESULT WINAPI OLEFontImpl_get_Underline( if (punderline==0) return E_POINTER; + if(this->dirty) realize_font(this); + *punderline = this->description.fUnderline; return S_OK; @@ -769,6 +841,8 @@ static HRESULT WINAPI OLEFontImpl_get_Strikethrough( if (pstrikethrough==0) return E_POINTER; + if(this->dirty) realize_font(this); + *pstrikethrough = this->description.fStrikethrough; return S_OK; @@ -810,6 +884,8 @@ static HRESULT WINAPI OLEFontImpl_get_Weight( if (pweight==0) return E_POINTER; + if(this->dirty) realize_font(this); + *pweight = this->description.sWeight; return S_OK; @@ -851,6 +927,8 @@ static HRESULT WINAPI OLEFontImpl_get_Charset( if (pcharset==0) return E_POINTER; + if(this->dirty) realize_font(this); + *pcharset = this->description.sCharset; return S_OK; @@ -888,54 +966,7 @@ static HRESULT WINAPI OLEFontImpl_get_hFont( if (phfont==NULL) return E_POINTER; - /* - * Realize the font if necessary - */ - if (this->gdiFont==0) -{ - LOGFONTW logFont; - INT fontHeight; - CY cySize; - PHFONTItem newEntry; - - /* - * The height of the font returned by the get_Size property is the - * height of the font in points multiplied by 10000... Using some - * simple conversions and the ratio given by the application, it can - * be converted to a height in pixels. - */ - IFont_get_Size(iface, &cySize); - - /* Standard ratio is 72 / 2540, or 18 / 635 in lowest terms. */ - /* Ratio is applied here relative to the standard. */ - fontHeight = MulDiv( cySize.s.Lo, this->cyLogical*635, this->cyHimetric*18 ); - - memset(&logFont, 0, sizeof(LOGFONTW)); - - logFont.lfHeight = ((fontHeight%10000L)>5000L) ? (-fontHeight/10000L)-1 : - (-fontHeight/10000L); - logFont.lfItalic = this->description.fItalic; - logFont.lfUnderline = this->description.fUnderline; - logFont.lfStrikeOut = this->description.fStrikethrough; - logFont.lfWeight = this->description.sWeight; - logFont.lfCharSet = this->description.sCharset; - logFont.lfOutPrecision = OUT_CHARACTER_PRECIS; - logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; - logFont.lfQuality = DEFAULT_QUALITY; - logFont.lfPitchAndFamily = DEFAULT_PITCH; - strcpyW(logFont.lfFaceName,this->description.lpstrName); - - this->gdiFont = CreateFontIndirectW(&logFont); - - /* Add font to the cache */ - newEntry = HeapAlloc(GetProcessHeap(), 0, sizeof(HFONTItem)); - newEntry->int_refs = 1; - newEntry->total_refs = 1; - newEntry->gdiFont = this->gdiFont; - EnterCriticalSection(&OLEFontImpl_csHFONTLIST); - list_add_tail(&OLEFontImpl_hFontList,&newEntry->entry); - LeaveCriticalSection(&OLEFontImpl_csHFONTLIST); - } + if(this->dirty) realize_font(this); *phfont = this->gdiFont; TRACE("Returning %p\n", *phfont); @@ -2286,6 +2317,7 @@ static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc) * Initializing all the other members. */ newObject->gdiFont = 0; + newObject->dirty = TRUE; newObject->cyLogical = 72L; newObject->cyHimetric = 2540L; newObject->pPropertyNotifyCP = NULL; diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c index 906eeb4..79dbade 100644 --- a/dlls/oleaut32/tests/olefont.c +++ b/dlls/oleaut32/tests/olefont.c @@ -877,7 +877,6 @@ static void test_hfont_lifetime(void) /* put_Size doesn't cause the new font to be realized */ obj_type = GetObjectType(last_hfont); -todo_wine ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_get_hFont(font, &hfont); @@ -939,7 +938,6 @@ todo_wine /* put_Size doesn't cause the new font to be realized */ obj_type = GetObjectType(last_hfont); -todo_wine ok(obj_type == OBJ_FONT, "got obj type %d\n", obj_type); hr = IFont_get_hFont(font, &hfont);
1
0
0
0
Jörg Höhle : winmm: Reset MIDIHDR flags prior to return from midiStreamOut.
by Alexandre Julliard
02 Feb '10
02 Feb '10
Module: wine Branch: master Commit: bc76916b906100581e9e42f8a06ab34e8410d13a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bc76916b906100581e9e42f8a…
Author: Jörg Höhle <hoehle(a)users.sourceforge.net> Date: Tue Feb 2 08:37:09 2010 +0100 winmm: Reset MIDIHDR flags prior to return from midiStreamOut. --- dlls/winmm/winmm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c index 6205466..3fee0a8 100644 --- a/dlls/winmm/winmm.c +++ b/dlls/winmm/winmm.c @@ -1833,7 +1833,8 @@ MMRESULT WINAPI midiStreamOut(HMIDISTRM hMidiStrm, LPMIDIHDR lpMidiHdr, if (!MMSYSTEM_GetMidiStream(hMidiStrm, &lpMidiStrm, NULL)) { ret = MMSYSERR_INVALHANDLE; } else { - lpMidiHdr->dwFlags |= MHDR_ISSTRM; + lpMidiHdr->dwFlags |= MHDR_ISSTRM | MHDR_INQUEUE; + lpMidiHdr->dwFlags &= ~MHDR_DONE; if (!PostThreadMessageA(lpMidiStrm->dwThreadID, WINE_MSM_HEADER, cbMidiHdr, (LPARAM)lpMidiHdr)) {
1
0
0
0
← Newer
1
...
64
65
66
67
68
69
70
...
79
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
Results per page:
10
25
50
100
200