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
September 2013
----- 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
645 discussions
Start a n
N
ew thread
Dmitry Timoshkov : windowscodecs: Implement CreateBitmapFromHBITMAP.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: c6d62ff081410eed07b3e788c8c4539f0fc36b92 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c6d62ff081410eed07b3e788c…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Mon Sep 16 17:28:07 2013 +0900 windowscodecs: Implement CreateBitmapFromHBITMAP. --- dlls/windowscodecs/imgfactory.c | 149 ++++++++++++++++++++++++++++++++++++- dlls/windowscodecs/tests/bitmap.c | 14 ++- 2 files changed, 154 insertions(+), 9 deletions(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index e5f2125..bb4cf67 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -603,12 +603,153 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFacto return BitmapImpl_Create(width, height, stride, size, buffer, format, WICBitmapCacheOnLoad, bitmap); } +static BOOL get_16bpp_format(HBITMAP hbm, WICPixelFormatGUID *format) +{ + BOOL ret = TRUE; + BITMAPV4HEADER bmh; + HDC hdc; + + hdc = CreateCompatibleDC(0); + + memset(&bmh, 0, sizeof(bmh)); + bmh.bV4Size = sizeof(bmh); + bmh.bV4Width = 1; + bmh.bV4Height = 1; + bmh.bV4V4Compression = BI_BITFIELDS; + bmh.bV4BitCount = 16; + + GetDIBits(hdc, hbm, 0, 0, NULL, (BITMAPINFO *)&bmh, DIB_RGB_COLORS); + + if (bmh.bV4RedMask == 0x7c00 && + bmh.bV4GreenMask == 0x3e0 && + bmh.bV4BlueMask == 0x1f) + { + *format = GUID_WICPixelFormat16bppBGR555; + } + else if (bmh.bV4RedMask == 0xf800 && + bmh.bV4GreenMask == 0x7e0 && + bmh.bV4BlueMask == 0x1f) + { + *format = GUID_WICPixelFormat16bppBGR565; + } + else + { + FIXME("unrecognized bitfields %x,%x,%x\n", bmh.bV4RedMask, + bmh.bV4GreenMask, bmh.bV4BlueMask); + ret = FALSE; + } + + DeleteDC(hdc); + return ret; +} + static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface, - HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options, - IWICBitmap **ppIBitmap) + HBITMAP hbm, HPALETTE hpal, WICBitmapAlphaChannelOption option, IWICBitmap **bitmap) { - FIXME("(%p,%p,%p,%u,%p): stub\n", iface, hBitmap, hPalette, options, ppIBitmap); - return E_NOTIMPL; + BITMAP bm; + HRESULT hr; + WICPixelFormatGUID format; + IWICBitmapLock *lock; + UINT size, num_palette_entries = 0; + PALETTEENTRY entry[256]; + + TRACE("(%p,%p,%p,%u,%p)\n", iface, hbm, hpal, option, bitmap); + + if (!bitmap) return E_INVALIDARG; + + if (GetObjectW(hbm, sizeof(bm), &bm) != sizeof(bm)) + return WINCODEC_ERR_WIN32ERROR; + + if (hpal) + { + num_palette_entries = GetPaletteEntries(hpal, 0, 256, entry); + if (!num_palette_entries) + return WINCODEC_ERR_WIN32ERROR; + } + + /* TODO: Figure out the correct format for 16, 32, 64 bpp */ + switch(bm.bmBitsPixel) + { + case 1: + format = GUID_WICPixelFormat1bppIndexed; + break; + case 4: + format = GUID_WICPixelFormat4bppIndexed; + break; + case 8: + format = GUID_WICPixelFormat8bppIndexed; + break; + case 16: + if (!get_16bpp_format(hbm, &format)) + return E_INVALIDARG; + break; + case 24: + format = GUID_WICPixelFormat24bppBGR; + break; + case 32: + format = GUID_WICPixelFormat32bppBGR; + break; + case 48: + format = GUID_WICPixelFormat48bppRGB; + break; + default: + FIXME("unsupported %d bpp\n", bm.bmBitsPixel); + return E_INVALIDARG; + } + + hr = BitmapImpl_Create(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, 0, NULL, &format, option, bitmap); + if (hr != S_OK) return hr; + + hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock); + if (hr == S_OK) + { + BYTE *buffer; + HDC hdc; + char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors[256])]; + BITMAPINFO *bmi = (BITMAPINFO *)bmibuf; + + IWICBitmapLock_GetDataPointer(lock, &size, &buffer); + + hdc = CreateCompatibleDC(0); + + bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi->bmiHeader.biBitCount = 0; + GetDIBits(hdc, hbm, 0, 0, NULL, bmi, DIB_RGB_COLORS); + bmi->bmiHeader.biHeight = -bm.bmHeight; + GetDIBits(hdc, hbm, 0, bm.bmHeight, buffer, bmi, DIB_RGB_COLORS); + + DeleteDC(hdc); + IWICBitmapLock_Release(lock); + + if (num_palette_entries) + { + IWICPalette *palette; + WICColor colors[256]; + UINT i; + + hr = PaletteImpl_Create(&palette); + if (hr == S_OK) + { + for (i = 0; i < num_palette_entries; i++) + colors[i] = 0xff000000 | entry[i].peRed << 16 | + entry[i].peGreen << 8 | entry[i].peBlue; + + hr = IWICPalette_InitializeCustom(palette, colors, num_palette_entries); + if (hr == S_OK) + hr = IWICBitmap_SetPalette(*bitmap, palette); + + IWICPalette_Release(palette); + } + } + } + + if (hr != S_OK) + { + IWICBitmap_Release(*bitmap); + *bitmap = NULL; + } + + return hr; } static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory *iface, diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c index 8795048..3c79ce8 100644 --- a/dlls/windowscodecs/tests/bitmap.c +++ b/dlls/windowscodecs/tests/bitmap.c @@ -727,17 +727,13 @@ static void test_CreateBitmapFromHBITMAP(void) ok(hbmp != 0, "failed to create bitmap\n"); hr = IWICImagingFactory_CreateBitmapFromHBITMAP(factory, 0, 0, WICBitmapIgnoreAlpha, &bitmap); -todo_wine ok(hr == WINCODEC_ERR_WIN32ERROR || hr == 0x88980003 /*XP*/, "expected WINCODEC_ERR_WIN32ERROR, got %#x\n", hr); hr = IWICImagingFactory_CreateBitmapFromHBITMAP(factory, hbmp, 0, WICBitmapIgnoreAlpha, NULL); -todo_wine ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); hr = IWICImagingFactory_CreateBitmapFromHBITMAP(factory, hbmp, 0, WICBitmapIgnoreAlpha, &bitmap); -todo_wine ok(hr == S_OK, "CreateBitmapFromHBITMAP error %#x\n", hr); - if (hr != S_OK) return; IWICBitmap_GetPixelFormat(bitmap, &format); ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed), @@ -770,6 +766,7 @@ todo_wine ok(hr == S_OK, "CreateBitmapFromHBITMAP error %#x\n", hr); IWICBitmap_GetPixelFormat(bitmap, &format); +todo_wine ok(IsEqualGUID(&format, &GUID_WICPixelFormat4bppIndexed), "unexpected pixel format %s\n", debugstr_guid(&format)); @@ -789,6 +786,7 @@ todo_wine hr = IWICPalette_GetColorCount(palette, &count); ok(hr == S_OK, "GetColorCount error %#x\n", hr); +todo_wine ok(count == 16, "expected 16, got %u\n", count); IWICPalette_Release(palette); @@ -837,7 +835,13 @@ todo_wine hr = IWICBitmap_CopyPixels(bitmap, NULL, 4, sizeof(data), data); ok(hr == S_OK, "IWICBitmap_CopyPixels error %#x\n", hr); for (i = 0; i < sizeof(data); i++) - ok(data[i] == data_8bpp_pal_wic[i], "%u: expected %#x, got %#x\n", i, data_8bpp_pal_wic[i], data[i]); + { + if (data[i] != data_8bpp_pal_wic[i]) +todo_wine + ok(data[i] == data_8bpp_pal_wic[i], "%u: expected %#x, got %#x\n", i, data_8bpp_pal_wic[i], data[i]); + else + ok(data[i] == data_8bpp_pal_wic[i], "%u: expected %#x, got %#x\n", i, data_8bpp_pal_wic[i], data[i]); + } IWICBitmap_Release(bitmap); DeleteObject(hbmp);
1
0
0
0
Stefan Dösinger : d3d9/tests: Test invalid volume lock boxes.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: 2f9d9b503266d1a8f9f65ef37b1243947d0efb8c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2f9d9b503266d1a8f9f65ef37…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Wed Sep 18 12:24:59 2013 +0200 d3d9/tests: Test invalid volume lock boxes. --- dlls/d3d9/tests/device.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 121 insertions(+), 0 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 5e09e32..f71f8be 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -7299,6 +7299,126 @@ static void test_volume_blocks(void) DestroyWindow(window); } +static void test_lockbox_invalid(void) +{ + static const struct + { + D3DBOX box; + HRESULT result; + } + test_data[] = + { + {{0, 0, 2, 2, 0, 1}, D3D_OK}, /* Valid */ + {{0, 0, 4, 4, 0, 1}, D3D_OK}, /* Valid */ + {{0, 0, 0, 4, 0, 1}, D3DERR_INVALIDCALL}, /* 0 height */ + {{0, 0, 4, 0, 0, 1}, D3DERR_INVALIDCALL}, /* 0 width */ + {{0, 0, 4, 4, 1, 1}, D3DERR_INVALIDCALL}, /* 0 depth */ + {{4, 0, 0, 4, 0, 1}, D3DERR_INVALIDCALL}, /* left > right */ + {{0, 4, 4, 0, 0, 1}, D3DERR_INVALIDCALL}, /* top > bottom */ + {{0, 0, 4, 4, 1, 0}, D3DERR_INVALIDCALL}, /* back > front */ + {{0, 0, 8, 4, 0, 1}, D3DERR_INVALIDCALL}, /* right > surface */ + {{0, 0, 4, 8, 0, 1}, D3DERR_INVALIDCALL}, /* bottom > surface */ + {{0, 0, 4, 4, 0, 3}, D3DERR_INVALIDCALL}, /* back > surface */ + {{8, 0, 16, 4, 0, 1}, D3DERR_INVALIDCALL}, /* left > surface */ + {{0, 8, 4, 16, 0, 1}, D3DERR_INVALIDCALL}, /* top > surface */ + {{0, 0, 4, 4, 2, 4}, D3DERR_INVALIDCALL}, /* top > surface */ + }; + static const D3DBOX test_boxt_2 = {2, 2, 4, 4, 0, 1}; + IDirect3DVolumeTexture9 *texture = NULL; + D3DLOCKED_BOX locked_box; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + unsigned int i; + ULONG refcount; + HWND window; + BYTE *base; + HRESULT hr; + + if (!(d3d = pDirect3DCreate9(D3D_SDK_VERSION))) + { + skip("Failed to create D3D object, skipping tests.\n"); + return; + } + + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9_CreateVolumeTexture(device, 4, 4, 2, 1, 0, + D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &texture, NULL); + ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr); + hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &locked_box, NULL, 0); + ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr); + base = locked_box.pBits; + hr = IDirect3DVolumeTexture9_UnlockBox(texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); + + for (i = 0; i < (sizeof(test_data) / sizeof(*test_data)); ++i) + { + unsigned int offset, expected_offset; + const D3DBOX *box = &test_data[i].box; + + locked_box.pBits = (BYTE *)0xdeadbeef; + locked_box.RowPitch = 0xdeadbeef; + locked_box.SlicePitch = 0xdeadbeef; + + hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &locked_box, box, 0); + /* Unlike surfaces, volumes properly check the box even in Windows XP */ + ok(hr == test_data[i].result, + "Got unexpected hr %#x with box [%u, %u, %u]->[%u, %u, %u], expected %#x.\n", + hr, box->Left, box->Top, box->Front, box->Right, box->Bottom, box->Back, + test_data[i].result); + if (FAILED(hr)) + continue; + + offset = (BYTE *)locked_box.pBits - base; + expected_offset = box->Front * locked_box.SlicePitch + box->Top * locked_box.RowPitch + box->Left * 4; + ok(offset == expected_offset, + "Got unexpected offset %u (expected %u) for rect [%u, %u, %u]->[%u, %u, %u].\n", + offset, expected_offset, box->Left, box->Top, box->Front, box->Right, box->Bottom, box->Back); + + hr = IDirect3DVolumeTexture9_UnlockBox(texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); + } + + /* locked_box = NULL throws an exception on Windows */ + hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &locked_box, NULL, 0); + ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr); + hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &locked_box, NULL, 0); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DVolumeTexture9_UnlockBox(texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); + hr = IDirect3DVolumeTexture9_UnlockBox(texture, 0); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &locked_box, &test_data[0].box, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x for rect [%u, %u, %u]->[%u, %u, %u].\n", + hr, test_data[0].box.Left, test_data[0].box.Top, test_data[0].box.Front, + test_data[0].box.Right, test_data[0].box.Bottom, test_data[0].box.Back); + hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &locked_box, &test_data[0].box, 0); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for rect [%u, %u, %u]->[%u, %u, %u].\n", + hr, test_data[0].box.Left, test_data[0].box.Top, test_data[0].box.Front, + test_data[0].box.Right, test_data[0].box.Bottom, test_data[0].box.Back); + hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &locked_box, &test_boxt_2, 0); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for rect [%u, %u, %u]->[%u, %u, %u].\n", + hr, test_boxt_2.Left, test_boxt_2.Top, test_boxt_2.Front, + test_boxt_2.Right, test_boxt_2.Bottom, test_boxt_2.Back); + hr = IDirect3DVolumeTexture9_UnlockBox(texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); + + IDirect3DVolumeTexture9_Release(texture); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { HMODULE d3d9_handle = LoadLibraryA( "d3d9.dll" ); @@ -7393,6 +7513,7 @@ START_TEST(device) test_update_volumetexture(); test_create_rt_ds_fail(); test_volume_blocks(); + test_lockbox_invalid(); } out:
1
0
0
0
Stefan Dösinger : d3d9/tests: Add tests for block-based volume formats.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: 50d2cdd0ea7193178cd44e3e8e3f47400be30e04 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=50d2cdd0ea7193178cd44e3e8…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Wed Sep 18 12:24:58 2013 +0200 d3d9/tests: Add tests for block-based volume formats. --- dlls/d3d9/tests/device.c | 361 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 361 insertions(+), 0 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=50d2cdd0ea7193178cd44…
1
0
0
0
Stefan Dösinger : wined3d: Check box dimensions in volume_map.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: 2680f3301585e2263e3800454f51c8f09314926f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2680f3301585e2263e3800454…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Wed Sep 18 12:24:57 2013 +0200 wined3d: Check box dimensions in volume_map. --- dlls/wined3d/volume.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index fcab45b..2fa04c5 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -566,6 +566,28 @@ static BOOL volume_check_block_align(const struct wined3d_volume *volume, return TRUE; } +static BOOL wined3d_volume_check_box_dimensions(const struct wined3d_volume *volume, + const struct wined3d_box *box) +{ + if (!box) + return TRUE; + + if (box->left >= box->right) + return FALSE; + if (box->top >= box->bottom) + return FALSE; + if (box->front >= box->back) + return FALSE; + if (box->right > volume->resource.width) + return FALSE; + if (box->bottom > volume->resource.height) + return FALSE; + if (box->back > volume->resource.depth) + return FALSE; + + return TRUE; +} + HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags) { @@ -589,6 +611,11 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, WARN("Volume is already mapped.\n"); return WINED3DERR_INVALIDCALL; } + if (!wined3d_volume_check_box_dimensions(volume, box)) + { + WARN("Map box is invalid.\n"); + return WINED3DERR_INVALIDCALL; + } if ((format->flags & WINED3DFMT_FLAG_BLOCKS) && !volume_check_block_align(volume, box)) { WARN("Map box is misaligned for %ux%u blocks.\n",
1
0
0
0
Stefan Dösinger : wined3d: Implement locking of block-based volume textures.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: ac37f7a2ac09c77f7bd9db39c3180307696fdc6c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ac37f7a2ac09c77f7bd9db39c…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Wed Sep 18 12:24:56 2013 +0200 wined3d: Implement locking of block-based volume textures. --- dlls/wined3d/volume.c | 95 +++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 88 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 508b1df..fcab45b 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -71,6 +71,31 @@ static void wined3d_volume_allocate_texture(const struct wined3d_volume *volume, checkGLcall("glTexImage3D"); } +static void wined3d_volume_get_pitch(const struct wined3d_volume *volume, UINT *row_pitch, + UINT *slice_pitch) +{ + const struct wined3d_format *format = volume->resource.format; + + if (format->flags & WINED3DFMT_FLAG_BLOCKS) + { + /* Since compressed formats are block based, pitch means the amount of + * bytes to the next row of block rather than the next row of pixels. */ + UINT row_block_count = (volume->resource.width + format->block_width - 1) / format->block_width; + UINT slice_block_count = (volume->resource.height + format->block_height - 1) / format->block_height; + *row_pitch = row_block_count * format->block_byte_count; + *slice_pitch = *row_pitch * slice_block_count; + } + else + { + unsigned char alignment = volume->resource.device->surface_alignment; + *row_pitch = format->byte_count * volume->resource.width; /* Bytes / row */ + *row_pitch = (*row_pitch + alignment - 1) & ~(alignment - 1); + *slice_pitch = *row_pitch * volume->resource.height; + } + + TRACE("Returning row pitch %u, slice pitch %u.\n", *row_pitch, *slice_pitch); +} + /* Context activation is done by the caller. */ void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wined3d_context *context, const struct wined3d_bo_address *data) @@ -513,6 +538,34 @@ struct wined3d_resource * CDECL wined3d_volume_get_resource(struct wined3d_volum return &volume->resource; } +static BOOL volume_check_block_align(const struct wined3d_volume *volume, + const struct wined3d_box *box) +{ + UINT width_mask, height_mask; + const struct wined3d_format *format = volume->resource.format; + + if (!box) + return TRUE; + + /* This assumes power of two block sizes, but NPOT block sizes would be + * silly anyway. + * + * This also assumes that the format's block depth is 1. */ + width_mask = format->block_width - 1; + height_mask = format->block_height - 1; + + if (box->left & width_mask) + return FALSE; + if (box->top & height_mask) + return FALSE; + if (box->right & width_mask && box->right != volume->resource.width) + return FALSE; + if (box->bottom & height_mask && box->bottom != volume->resource.height) + return FALSE; + + return TRUE; +} + HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags) { @@ -520,6 +573,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, struct wined3d_context *context; const struct wined3d_gl_info *gl_info; BYTE *base_memory; + const struct wined3d_format *format = volume->resource.format; TRACE("volume %p, map_desc %p, box %p, flags %#x.\n", volume, map_desc, box, flags); @@ -535,6 +589,13 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, WARN("Volume is already mapped.\n"); return WINED3DERR_INVALIDCALL; } + if ((format->flags & WINED3DFMT_FLAG_BLOCKS) && !volume_check_block_align(volume, box)) + { + WARN("Map box is misaligned for %ux%u blocks.\n", + format->block_width, format->block_height); + return WINED3DERR_INVALIDCALL; + } + flags = wined3d_resource_sanitize_map_flags(&volume->resource, flags); if (volume->flags & WINED3D_VFLAG_PBO) @@ -591,9 +652,16 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, TRACE("Base memory pointer %p.\n", base_memory); - map_desc->row_pitch = volume->resource.format->byte_count * volume->resource.width; /* Bytes / row */ - map_desc->slice_pitch = volume->resource.format->byte_count - * volume->resource.width * volume->resource.height; /* Bytes / slice */ + if (format->flags & WINED3DFMT_FLAG_BROKEN_PITCH) + { + map_desc->row_pitch = volume->resource.width * format->byte_count; + map_desc->slice_pitch = map_desc->row_pitch * volume->resource.height; + } + else + { + wined3d_volume_get_pitch(volume, &map_desc->row_pitch, &map_desc->slice_pitch); + } + if (!box) { TRACE("No box supplied - all is ok\n"); @@ -603,10 +671,23 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, { TRACE("Lock Box (%p) = l %u, t %u, r %u, b %u, fr %u, ba %u\n", box, box->left, box->top, box->right, box->bottom, box->front, box->back); - map_desc->data = base_memory - + (map_desc->slice_pitch * box->front) /* FIXME: is front < back or vica versa? */ - + (map_desc->row_pitch * box->top) - + (box->left * volume->resource.format->byte_count); + + if ((format->flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS) + { + /* Compressed textures are block based, so calculate the offset of + * the block that contains the top-left pixel of the locked rectangle. */ + map_desc->data = base_memory + + (box->front * map_desc->slice_pitch) + + ((box->top / format->block_height) * map_desc->row_pitch) + + ((box->left / format->block_width) * format->block_byte_count); + } + else + { + map_desc->data = base_memory + + (map_desc->slice_pitch * box->front) + + (map_desc->row_pitch * box->top) + + (box->left * volume->resource.format->byte_count); + } } if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY)))
1
0
0
0
Stefan Dösinger : wined3d: Mapping a mapped volume is an error.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: 83b404879c091e192b770f73e0065abea5eb7856 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=83b404879c091e192b770f73e…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Wed Sep 18 12:24:55 2013 +0200 wined3d: Mapping a mapped volume is an error. --- dlls/wined3d/volume.c | 15 ++++++++++----- dlls/wined3d/wined3d_private.h | 7 +++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 540db93..508b1df 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -524,10 +524,15 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, TRACE("volume %p, map_desc %p, box %p, flags %#x.\n", volume, map_desc, box, flags); + map_desc->data = NULL; if (!(volume->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU)) { WARN("Volume %p is not CPU accessible.\n", volume); - map_desc->data = NULL; + return WINED3DERR_INVALIDCALL; + } + if (volume->resource.map_count) + { + WARN("Volume is already mapped.\n"); return WINED3DERR_INVALIDCALL; } flags = wined3d_resource_sanitize_map_flags(&volume->resource, flags); @@ -614,7 +619,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_SYSMEM); } - volume->flags |= WINED3D_VFLAG_LOCKED; + volume->resource.map_count++; TRACE("Returning memory %p, row pitch %d, slice pitch %d.\n", map_desc->data, map_desc->row_pitch, map_desc->slice_pitch); @@ -631,9 +636,9 @@ HRESULT CDECL wined3d_volume_unmap(struct wined3d_volume *volume) { TRACE("volume %p.\n", volume); - if (!(volume->flags & WINED3D_VFLAG_LOCKED)) + if (!volume->resource.map_count) { - WARN("Trying to unlock unlocked volume %p.\n", volume); + WARN("Trying to unlock an unlocked volume %p.\n", volume); return WINED3DERR_INVALIDCALL; } @@ -651,7 +656,7 @@ HRESULT CDECL wined3d_volume_unmap(struct wined3d_volume *volume) context_release(context); } - volume->flags &= ~WINED3D_VFLAG_LOCKED; + volume->resource.map_count--; return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 4928f92..f85bfec 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2110,10 +2110,9 @@ void wined3d_texture_apply_state_changes(struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN; -#define WINED3D_VFLAG_LOCKED 0x00000001 -#define WINED3D_VFLAG_ALLOCATED 0x00000002 -#define WINED3D_VFLAG_SRGB_ALLOCATED 0x00000004 -#define WINED3D_VFLAG_PBO 0x00000008 +#define WINED3D_VFLAG_ALLOCATED 0x00000001 +#define WINED3D_VFLAG_SRGB_ALLOCATED 0x00000002 +#define WINED3D_VFLAG_PBO 0x00000004 #define WINED3D_LOCATION_DISCARDED 0x00000001 #define WINED3D_LOCATION_SYSMEM 0x00000002
1
0
0
0
Alistair Leslie-Hughes : dbs.idl: Add type DB_NUMERIC.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: 16f99ce6623d404b20b55f8b73ae40a1fae81d85 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=16f99ce6623d404b20b55f8b7…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Mon Sep 16 11:38:16 2013 +1000 dbs.idl: Add type DB_NUMERIC. --- include/dbs.idl | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/include/dbs.idl b/include/dbs.idl index ceb9773..1e0ac6c 100644 --- a/include/dbs.idl +++ b/include/dbs.idl @@ -50,6 +50,13 @@ typedef struct tagDBID { } uName; } DBID; +typedef struct tagDB_NUMERIC { + BYTE precision; + BYTE scale; + BYTE sign; + BYTE val[16]; +} DB_NUMERIC; + typedef DWORD DBPROPID; typedef struct tagDBPROPIDSET {
1
0
0
0
Roderick Colenbrander : winex11: Support GLX_MESA_swap_control for WGL_EXT_swap_control.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: af58ccebbaeaa732a678a42081afb5d2bad47148 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=af58ccebbaeaa732a678a4208…
Author: Roderick Colenbrander <thunderbird2k(a)gmail.com> Date: Sat Sep 14 19:57:39 2013 -0700 winex11: Support GLX_MESA_swap_control for WGL_EXT_swap_control. --- dlls/winex11.drv/opengl.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 5ec33c8..e28302e 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -258,7 +258,8 @@ enum glx_swap_control_method { GLX_SWAP_CONTROL_NONE, GLX_SWAP_CONTROL_EXT, - GLX_SWAP_CONTROL_SGI + GLX_SWAP_CONTROL_SGI, + GLX_SWAP_CONTROL_MESA }; /* X context to associate a struct gl_drawable to an hwnd */ @@ -404,6 +405,7 @@ static void (*pglXFreeMemoryNV)(GLvoid *pointer); /* MESA GLX Extensions */ static void (*pglXCopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +static int (*pglXSwapIntervalMESA)(unsigned int interval); /* Standard OpenGL */ static void (*pglFinish)(void); @@ -650,6 +652,8 @@ static BOOL has_opengl(void) LOAD_FUNCPTR(glXCreateContextAttribsARB); /* EXT GLX Extension */ LOAD_FUNCPTR(glXSwapIntervalEXT); + /* MESA GLX Extension */ + LOAD_FUNCPTR(glXSwapIntervalMESA); /* SGI GLX Extension */ LOAD_FUNCPTR(glXSwapIntervalSGI); /* NV GLX Extension */ @@ -2963,6 +2967,10 @@ static BOOL X11DRV_wglSwapIntervalEXT(int interval) ret = !X11DRV_check_error(); break; + case GLX_SWAP_CONTROL_MESA: + ret = !pglXSwapIntervalMESA(interval); + break; + case GLX_SWAP_CONTROL_SGI: /* wglSwapIntervalEXT considers an interval value of zero to mean that * vsync should be disabled, but glXSwapIntervalSGI considers such a @@ -3146,6 +3154,10 @@ static void X11DRV_WineGL_LoadExtensions(void) has_swap_control_tear = TRUE; } } + else if (has_extension( WineGLInfo.glxExtensions, "GLX_MESA_swap_control")) + { + swap_control_method = GLX_SWAP_CONTROL_MESA; + } else if (has_extension( WineGLInfo.glxExtensions, "GLX_SGI_swap_control")) { swap_control_method = GLX_SWAP_CONTROL_SGI;
1
0
0
0
Andrew Eikum : oleaut32: Implement VarDecRound.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: 87c459ab2359784f238c30073b1adc0111876987 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=87c459ab2359784f238c30073…
Author: Andrew Eikum <aeikum(a)codeweavers.com> Date: Tue Sep 17 13:01:45 2013 -0500 oleaut32: Implement VarDecRound. --- dlls/oleaut32/tests/vartype.c | 35 +++++++++++++++++ dlls/oleaut32/vartype.c | 86 ++++++++++++++++++++++++++++++----------- 2 files changed, 98 insertions(+), 23 deletions(-) diff --git a/dlls/oleaut32/tests/vartype.c b/dlls/oleaut32/tests/vartype.c index 4c823c6..e296e77 100644 --- a/dlls/oleaut32/tests/vartype.c +++ b/dlls/oleaut32/tests/vartype.c @@ -455,6 +455,7 @@ static HRESULT (WINAPI *pVarDecDiv)(const DECIMAL*,const DECIMAL*,DECIMAL*); static HRESULT (WINAPI *pVarDecCmp)(const DECIMAL*,const DECIMAL*); static HRESULT (WINAPI *pVarDecCmpR8)(const DECIMAL*,double); static HRESULT (WINAPI *pVarDecNeg)(const DECIMAL*,DECIMAL*); +static HRESULT (WINAPI *pVarDecRound)(const DECIMAL*,int,DECIMAL*); static HRESULT (WINAPI *pVarBoolFromUI1)(BYTE,VARIANT_BOOL*); static HRESULT (WINAPI *pVarBoolFromI2)(SHORT,VARIANT_BOOL*); @@ -4545,6 +4546,39 @@ static void test_VarDecCmpR8(void) SETDEC(l,0,DECIMAL_NEG,-1,-1); r = DECIMAL_NEG; MATH3(VarDecCmpR8); EXPECT_LT; } +#define CLEAR(x) memset(&(x), 0xBB, sizeof(x)) + +static void test_VarDecRound(void) +{ + HRESULT hres; + DECIMAL l, out; + + CHECKPTR(VarDecRound); + + CLEAR(out); SETDEC(l, 0, 0, 0, 1); hres = pVarDecRound(&l, 3, &out); EXPECTDEC(0, 0, 0, 1); + + CLEAR(out); SETDEC(l, 0, 0, 0, 1); hres = pVarDecRound(&l, 0, &out); EXPECTDEC(0, 0, 0, 1); + CLEAR(out); SETDEC(l, 1, 0, 0, 1); hres = pVarDecRound(&l, 0, &out); EXPECTDEC(0, 0, 0, 0); + CLEAR(out); SETDEC(l, 1, 0, 0, 1); hres = pVarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 1); + CLEAR(out); SETDEC(l, 2, 0, 0, 11); hres = pVarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 1); + CLEAR(out); SETDEC(l, 2, 0, 0, 15); hres = pVarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 2); + CLEAR(out); SETDEC(l, 6, 0, 0, 550001); hres = pVarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 6); + + CLEAR(out); SETDEC(l, 0, DECIMAL_NEG, 0, 1); hres = pVarDecRound(&l, 0, &out); EXPECTDEC(0, DECIMAL_NEG, 0, 1); + CLEAR(out); SETDEC(l, 1, DECIMAL_NEG, 0, 1); hres = pVarDecRound(&l, 0, &out); EXPECTDEC(0, DECIMAL_NEG, 0, 0); + CLEAR(out); SETDEC(l, 1, DECIMAL_NEG, 0, 1); hres = pVarDecRound(&l, 1, &out); EXPECTDEC(1, DECIMAL_NEG, 0, 1); + CLEAR(out); SETDEC(l, 2, DECIMAL_NEG, 0, 11); hres = pVarDecRound(&l, 1, &out); EXPECTDEC(1, DECIMAL_NEG, 0, 1); + CLEAR(out); SETDEC(l, 2, DECIMAL_NEG, 0, 15); hres = pVarDecRound(&l, 1, &out); EXPECTDEC(1, DECIMAL_NEG, 0, 2); + CLEAR(out); SETDEC(l, 6, DECIMAL_NEG, 0, 550001); hres = pVarDecRound(&l, 1, &out); EXPECTDEC(1, DECIMAL_NEG, 0, 6); + + CLEAR(out); SETDEC64(l, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff); hres = pVarDecRound(&l, 0, &out); EXPECTDEC64(0, 0, 0xffffffff, 0xffffffff, 0xffffffff); + CLEAR(out); SETDEC64(l, 28, 0, 0xffffffff, 0xffffffff, 0xffffffff); hres = pVarDecRound(&l, 0, &out); EXPECTDEC64(0, 0, 0, 0, 8); + CLEAR(out); SETDEC64(l, 0, DECIMAL_NEG, 0xffffffff, 0xffffffff, 0xffffffff); hres = pVarDecRound(&l, 0, &out); EXPECTDEC64(0, DECIMAL_NEG, 0xffffffff, 0xffffffff, 0xffffffff); + CLEAR(out); SETDEC64(l, 28, DECIMAL_NEG, 0xffffffff, 0xffffffff, 0xffffffff); hres = pVarDecRound(&l, 0, &out); EXPECTDEC64(0, DECIMAL_NEG, 0, 0, 8); + + CLEAR(out); SETDEC(l, 2, 0, 0, 0); hres = pVarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 0); +} + /* * VT_BOOL */ @@ -6334,6 +6368,7 @@ START_TEST(vartype) test_VarDecCmpR8(); test_VarDecMul(); test_VarDecDiv(); + test_VarDecRound(); test_VarBoolFromI1(); test_VarBoolFromUI1(); diff --git a/dlls/oleaut32/vartype.c b/dlls/oleaut32/vartype.c index 74f66de..e1672a1 100644 --- a/dlls/oleaut32/vartype.c +++ b/dlls/oleaut32/vartype.c @@ -5137,7 +5137,7 @@ static int VARIANT_int_addlossy( in case of quotient overflow. */ static HRESULT VARIANT_DI_div(const VARIANT_DI * dividend, const VARIANT_DI * divisor, - VARIANT_DI * quotient) + VARIANT_DI * quotient, BOOL round_remainder) { HRESULT r_overflow = S_OK; @@ -5180,8 +5180,21 @@ static HRESULT VARIANT_DI_div(const VARIANT_DI * dividend, const VARIANT_DI * di underflow = VARIANT_int_addlossy( quotient->bitsnum, "ientscale, sizeof(quotient->bitsnum) / sizeof(DWORD), remainderplusquotient, &tempquotientscale, 4); - VARIANT_int_mulbychar(remainderplusquotient + 4, 4, 10); - memcpy(remainderplusquotient, remainderplusquotient + 4, 4 * sizeof(DWORD)); + if (round_remainder) { + if(remainderplusquotient[4] >= 5){ + unsigned int i; + unsigned char remainder = 1; + for (i = 0; i < sizeof(quotient->bitsnum) / sizeof(DWORD) && remainder; i++) { + ULONGLONG digit = quotient->bitsnum[i] + 1; + remainder = (digit > 0xFFFFFFFF) ? 1 : 0; + quotient->bitsnum[i] = digit & 0xFFFFFFFF; + } + } + memset(remainderplusquotient, 0, sizeof(remainderplusquotient)); + } else { + VARIANT_int_mulbychar(remainderplusquotient + 4, 4, 10); + memcpy(remainderplusquotient, remainderplusquotient + 4, 4 * sizeof(DWORD)); + } tempquotientscale = ++remainderscale; } while (!underflow && !VARIANT_int_iszero(remainderplusquotient + 4, 4)); @@ -5485,31 +5498,16 @@ static HRESULT VARIANT_DI_FromR8(double source, VARIANT_DI * dest) return hres; } -/************************************************************************ - * VarDecDiv (OLEAUT32.178) - * - * Divide one DECIMAL by another. - * - * PARAMS - * pDecLeft [I] Source - * pDecRight [I] Value to divide by - * pDecOut [O] Destination - * - * RETURNS - * Success: S_OK. - * Failure: DISP_E_OVERFLOW, if the value will not fit in the destination - */ -HRESULT WINAPI VarDecDiv(const DECIMAL* pDecLeft, const DECIMAL* pDecRight, DECIMAL* pDecOut) +static HRESULT VARIANT_do_division(const DECIMAL *pDecLeft, const DECIMAL *pDecRight, DECIMAL *pDecOut, + BOOL round) { HRESULT hRet = S_OK; VARIANT_DI di_left, di_right, di_result; HRESULT divresult; - if (!pDecLeft || !pDecRight || !pDecOut) return E_INVALIDARG; - VARIANT_DIFromDec(pDecLeft, &di_left); VARIANT_DIFromDec(pDecRight, &di_right); - divresult = VARIANT_DI_div(&di_left, &di_right, &di_result); + divresult = VARIANT_DI_div(&di_left, &di_right, &di_result, round); if (divresult != S_OK) { /* division actually overflowed */ @@ -5557,6 +5555,27 @@ HRESULT WINAPI VarDecDiv(const DECIMAL* pDecLeft, const DECIMAL* pDecRight, DECI } /************************************************************************ + * VarDecDiv (OLEAUT32.178) + * + * Divide one DECIMAL by another. + * + * PARAMS + * pDecLeft [I] Source + * pDecRight [I] Value to divide by + * pDecOut [O] Destination + * + * RETURNS + * Success: S_OK. + * Failure: DISP_E_OVERFLOW, if the value will not fit in the destination + */ +HRESULT WINAPI VarDecDiv(const DECIMAL* pDecLeft, const DECIMAL* pDecRight, DECIMAL* pDecOut) +{ + if (!pDecLeft || !pDecRight || !pDecOut) return E_INVALIDARG; + + return VARIANT_do_division(pDecLeft, pDecRight, pDecOut, FALSE); +} + +/************************************************************************ * VarDecMul (OLEAUT32.179) * * Multiply one DECIMAL by another. @@ -5765,6 +5784,10 @@ HRESULT WINAPI VarDecNeg(const DECIMAL* pDecIn, DECIMAL* pDecOut) */ HRESULT WINAPI VarDecRound(const DECIMAL* pDecIn, int cDecimals, DECIMAL* pDecOut) { + DECIMAL divisor, tmp; + HRESULT hr; + unsigned int i; + if (cDecimals < 0 || (DEC_SIGN(pDecIn) & ~DECIMAL_NEG) || DEC_SCALE(pDecIn) > DEC_MAX_SCALE) return E_INVALIDARG; @@ -5774,9 +5797,26 @@ HRESULT WINAPI VarDecRound(const DECIMAL* pDecIn, int cDecimals, DECIMAL* pDecOu return S_OK; } - FIXME("semi-stub!\n"); + /* truncate significant digits and rescale */ + memset(&divisor, 0, sizeof(divisor)); + DEC_LO64(&divisor) = 1; - return DISP_E_OVERFLOW; + memset(&tmp, 0, sizeof(tmp)); + DEC_LO64(&tmp) = 10; + for (i = 0; i < DEC_SCALE(pDecIn) - cDecimals; ++i) + { + hr = VarDecMul(&divisor, &tmp, &divisor); + if (FAILED(hr)) + return hr; + } + + hr = VARIANT_do_division(pDecIn, &divisor, pDecOut, TRUE); + if (FAILED(hr)) + return hr; + + DEC_SCALE(pDecOut) = cDecimals; + + return S_OK; } /************************************************************************
1
0
0
0
Jacek Caban : d3d11sdklayers.idl: Added new file.
by Alexandre Julliard
18 Sep '13
18 Sep '13
Module: wine Branch: master Commit: 515af78f6b4b33dfd11c4d0f9d9c0427e3712c29 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=515af78f6b4b33dfd11c4d0f9…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Sep 18 11:36:13 2013 +0200 d3d11sdklayers.idl: Added new file. --- .gitignore | 1 + include/Makefile.in | 1 + include/d3d11.idl | 2 +- include/d3d11sdklayers.idl | 1259 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1262 insertions(+), 1 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=515af78f6b4b33dfd11c4…
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
29
...
65
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
Results per page:
10
25
50
100
200