ReactOS.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
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
List overview
Download
Ros-diffs
February 2021
----- 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
ros-diffs@reactos.org
30 participants
434 discussions
Start a n
N
ew thread
[reactos] 189/218: [WINESYNC] d3dx9: Handle horizontal alignment in ID3DXFont_DrawText.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4ff131d352559da9da3b4…
commit 4ff131d352559da9da3b45dc089ab2e1e4de6f3f Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:33 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9: Handle horizontal alignment in ID3DXFont_DrawText. Signed-off-by: Sven Baars <sbaars(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id d511853d45bc3302b2a4501b1aa0097a4e78b3d9 by Sven Baars <sbaars(a)codeweavers.com> --- dll/directx/wine/d3dx9_36/font.c | 23 +++- modules/rostests/winetests/d3dx9_36/core.c | 162 ++++++++++++++++++++++++++++- sdk/tools/winesync/d3dx9.cfg | 2 +- 3 files changed, 183 insertions(+), 4 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c index d327d2401e5..2fb924d77ec 100644 --- a/dll/directx/wine/d3dx9_36/font.c +++ b/dll/directx/wine/d3dx9_36/font.c @@ -628,7 +628,20 @@ static int compute_rect(struct d3dx_font *font, const WCHAR *string, unsigned in break; } - rect->right = rect->left + max_width; + if (format & DT_CENTER) + { + rect->left += (rect->right - rect->left - max_width) / 2; + rect->right = rect->left + max_width; + } + else if (format & DT_RIGHT) + { + rect->left = rect->right - max_width; + } + else + { + rect->right = rect->left + max_width; + } + if (format & DT_VCENTER) { rect->top += (rect->bottom - y) / 2; @@ -703,7 +716,6 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, top = rect->top; } - x = rect->left; y = rect->top; lh = font->metrics.tmHeight; width = rect->right - rect->left; @@ -722,6 +734,13 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, string = read_line(font->hdc, string, &count, line, &line_len, width, format, &size); + if (format & DT_CENTER) + x = (rect->left + rect->right - size.cx) / 2; + else if (format & DT_RIGHT) + x = rect->right - size.cx; + else + x = rect->left; + memset(&results, 0, sizeof(results)); results.nGlyphs = line_len; diff --git a/modules/rostests/winetests/d3dx9_36/core.c b/modules/rostests/winetests/d3dx9_36/core.c index 9de91b2b089..020f18e622c 100644 --- a/modules/rostests/winetests/d3dx9_36/core.c +++ b/modules/rostests/winetests/d3dx9_36/core.c @@ -842,7 +842,7 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_RIGHT, 0xff00ff); ok(height == 36, "Got unexpected height %d.\n", height); - height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_RIGHT, 0xff00ff); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CENTER, 0xff00ff); ok(height == 36, "Got unexpected height %d.\n", height); height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM, 0xff00ff); @@ -1007,6 +1007,166 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) ok(height == -8, "Got unexpected height %d.\n", height); check_rect(&rect, 10, -22, 30, 2); + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 30, 10, 50, 34); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 10, 30, 34); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 30, -10, 50, 14); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, -50, 10, -30, 34); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 30, 10, 50, 34); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 30, 10, 50, 34); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 10, 30, 34); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 30, -10, 50, 14); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 12, "Got unexpected height %d.\n", height); + check_rect(&rect, -73, 10, -30, 22); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 30, 10, 50, 34); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, 10, 40, 34); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 0, 10, 20, 34); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, -10, 40, 14); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, -20, 10, 0, 34); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, 10, 40, 34); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, 10, 40, 34); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 0, 10, 20, 34); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, -10, 40, 14); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 12, "Got unexpected height %d.\n", height); + check_rect(&rect, -31, 10, 12, 22); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, 10, 40, 34); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, 18, 40, 42); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, 18, 40, 42); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 0, 18, 20, 42); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, -2, 40, 22); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, -20, 18, 0, 42); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == -8, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, -22, 40, 2); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, 18, 40, 42); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, 18, 40, 42); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 0, 18, 20, 42); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, -2, 40, 22); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 26, "Got unexpected height %d.\n", height); + check_rect(&rect, -31, 24, 12, 36); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == -8, "Got unexpected height %d.\n", height); + check_rect(&rect, 20, -22, 40, 2); + ID3DXFont_Release(font); } diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 8b6cbbe2589..7dbe3ecf72f 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: fd9808b45af4bf4c6771fe2932e3169cb193bf44} +tags: {wine: d511853d45bc3302b2a4501b1aa0097a4e78b3d9}
3 years, 10 months
1
0
0
0
[reactos] 188/218: [WINESYNC] d3dx9: Handle vertical alignment in ID3DXFont_DrawText.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=69ca9a58521796a5ea087…
commit 69ca9a58521796a5ea087e91956f6e8adec4233c Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:33 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9: Handle vertical alignment in ID3DXFont_DrawText. Signed-off-by: Sven Baars <sbaars(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id fd9808b45af4bf4c6771fe2932e3169cb193bf44 by Sven Baars <sbaars(a)codeweavers.com> --- dll/directx/wine/d3dx9_36/font.c | 21 +++- modules/rostests/winetests/d3dx9_36/core.c | 152 ++++++++++++++++++++++++++++- sdk/tools/winesync/d3dx9.cfg | 2 +- 3 files changed, 170 insertions(+), 5 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c index 8157f5a9067..d327d2401e5 100644 --- a/dll/directx/wine/d3dx9_36/font.c +++ b/dll/directx/wine/d3dx9_36/font.c @@ -629,7 +629,19 @@ static int compute_rect(struct d3dx_font *font, const WCHAR *string, unsigned in } rect->right = rect->left + max_width; - rect->bottom = y; + if (format & DT_VCENTER) + { + rect->top += (rect->bottom - y) / 2; + rect->bottom = rect->top + y - top; + } + else if (format & DT_BOTTOM) + { + rect->top += rect->bottom - y; + } + else + { + rect->bottom = y; + } return rect->bottom - top; } @@ -666,13 +678,18 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, if (!line) return 0; - if (!rect || format & DT_CALCRECT) + if (!rect || format & (DT_CALCRECT | DT_VCENTER | DT_BOTTOM)) { if (!rect) { rect = &r; format |= DT_NOCLIP; } + else if (!(format & DT_CALCRECT)) + { + r = *rect; + rect = &r; + } top = rect->top; diff --git a/modules/rostests/winetests/d3dx9_36/core.c b/modules/rostests/winetests/d3dx9_36/core.c index fb55a547a07..9de91b2b089 100644 --- a/modules/rostests/winetests/d3dx9_36/core.c +++ b/modules/rostests/winetests/d3dx9_36/core.c @@ -770,6 +770,9 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) height = ID3DXFont_DrawTextW(font, NULL, long_textW, -1, &rect, DT_WORDBREAK | DT_NOCLIP, 0xff00ff); ok(height == 96, "Got unexpected height %d.\n", height); + height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, NULL, 0, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, 0, 0xff00ff); ok(height == 24, "Got unexpected height %d.\n", height); @@ -843,10 +846,10 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) ok(height == 36, "Got unexpected height %d.\n", height); height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM, 0xff00ff); - todo_wine ok(height == 40, "Got unexpected height %d.\n", height); + ok(height == 40, "Got unexpected height %d.\n", height); height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER, 0xff00ff); - todo_wine ok(height == 32, "Got unexpected height %d.\n", height); + ok(height == 32, "Got unexpected height %d.\n", height); height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT, 0xff00ff); ok(height == 24, "Got unexpected height %d.\n", height); @@ -859,6 +862,151 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) ok(height == 24, "Got unexpected height %d.\n", height); check_rect(&rect, 10, 10, 30, 34); + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, -10, 10, 10, 34); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, -10, 30, 14); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 10, 30, 34); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 10, 30, 34); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 10, 30, 34); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, -10, 10, 10, 34); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, -10, 30, 14); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 12, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 10, 53, 22); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 24, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 10, 30, 34); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff); + ok(height == 40, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 26, 30, 50); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff); + ok(height == 40, "Got unexpected height %d.\n", height); + check_rect(&rect, -10, 26, 10, 50); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff); + ok(height == 40, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 6, 30, 30); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff); + ok(height == 40, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 26, 30, 50); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff); + ok(height == -40, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, -54, 30, -30); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 40, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 26, 30, 50); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 40, "Got unexpected height %d.\n", height); + check_rect(&rect, -10, 26, 10, 50); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 40, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 6, 30, 30); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 40, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 38, 53, 50); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == -40, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, -54, 30, -30); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 18, 30, 42); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, -10, 18, 10, 42); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, -2, 30, 22); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 18, 30, 42); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff); + ok(height == -8, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, -22, 30, 2); + + SetRect(&rect, 10, 10, 50, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 18, 30, 42); + + SetRect(&rect, -10, 10, 30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, -10, 18, 10, 42); + + SetRect(&rect, 10, -10, 50, 30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 32, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, -2, 30, 22); + + SetRect(&rect, 10, 10, -30, 50); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == 26, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, 24, 53, 36); + + SetRect(&rect, 10, 10, 50, -30); + height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff); + ok(height == -8, "Got unexpected height %d.\n", height); + check_rect(&rect, 10, -22, 30, 2); + ID3DXFont_Release(font); } diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 186b4a14495..8b6cbbe2589 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: 53769e7bde9cfb808e26cf67057314c2ca03345a} +tags: {wine: fd9808b45af4bf4c6771fe2932e3169cb193bf44}
3 years, 10 months
1
0
0
0
[reactos] 187/218: [WINESYNC] d3dx9: Add a helper for computing the bounding rectangle in ID3DXFont_DrawText.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=841a23759e85b0e8e91ca…
commit 841a23759e85b0e8e91ca96ca630b57c3ea94809 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:33 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9: Add a helper for computing the bounding rectangle in ID3DXFont_DrawText. Signed-off-by: Sven Baars <sbaars(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 53769e7bde9cfb808e26cf67057314c2ca03345a by Sven Baars <sbaars(a)codeweavers.com> --- dll/directx/wine/d3dx9_36/font.c | 154 +++++++++++++++++++++++---------------- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 92 insertions(+), 64 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c index 35173956dc1..8157f5a9067 100644 --- a/dll/directx/wine/d3dx9_36/font.c +++ b/dll/directx/wine/d3dx9_36/font.c @@ -603,17 +603,46 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, unsigned int *count, return NULL; } +static int compute_rect(struct d3dx_font *font, const WCHAR *string, unsigned int count, + WCHAR *line, RECT *rect, DWORD format) +{ + int y, lh, width, top = rect->top; + int max_width = 0; + SIZE size; + + y = rect->top; + lh = font->metrics.tmHeight; + width = rect->right - rect->left; + + while (string) + { + unsigned int line_len; + + string = read_line(font->hdc, string, &count, line, &line_len, width, format, &size); + + if (size.cx > max_width) + max_width = size.cx; + + y += lh; + if (!(format & DT_NOCLIP) && (y > rect->bottom)) + break; + } + + rect->right = rect->left + max_width; + rect->bottom = y; + + return rect->bottom - top; +} + static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, const WCHAR *string, INT in_count, RECT *rect, DWORD format, D3DCOLOR color) { struct d3dx_font *font = impl_from_ID3DXFont(iface); + int lh, x, y, width, top, ret = 0; ID3DXSprite *target = sprite; - RECT textrect = {0}; - int lh, x, y, width; unsigned int count; - int max_width = 0; + RECT r = {0}; WCHAR *line; - int ret = 0; SIZE size; TRACE("iface %p, sprite %p, string %s, in_count %d, rect %s, format %#x, color 0x%08x.\n", @@ -633,20 +662,36 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, if (format & DT_SINGLELINE) format &= ~DT_WORDBREAK; - if (rect) - textrect = *rect; - - x = textrect.left; - y = textrect.top; - width = textrect.right - textrect.left; - - lh = font->metrics.tmHeight; - line = heap_alloc(count * sizeof(*line)); if (!line) return 0; - if (!(format & DT_CALCRECT) && !sprite) + if (!rect || format & DT_CALCRECT) + { + if (!rect) + { + rect = &r; + format |= DT_NOCLIP; + } + + top = rect->top; + + ret = compute_rect(font, string, count, line, rect, format); + + if (format & DT_CALCRECT) + goto cleanup; + } + else + { + top = rect->top; + } + + x = rect->left; + y = rect->top; + lh = font->metrics.tmHeight; + width = rect->right - rect->left; + + if (!sprite) { D3DXCreateSprite(font->device, &target); ID3DXSprite_Begin(target, 0); @@ -654,72 +699,55 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, while (string) { - unsigned int line_len; + unsigned int line_len, i; + GCP_RESULTSW results; + D3DXVECTOR3 pos; string = read_line(font->hdc, string, &count, line, &line_len, width, format, &size); - if (!(format & DT_CALCRECT)) - { - GCP_RESULTSW results; - D3DXVECTOR3 pos; - unsigned int i; - - memset(&results, 0, sizeof(results)); - results.nGlyphs = line_len; + memset(&results, 0, sizeof(results)); + results.nGlyphs = line_len; - results.lpCaretPos = heap_alloc(line_len * sizeof(*results.lpCaretPos)); - if (!results.lpCaretPos) - goto cleanup; + results.lpCaretPos = heap_alloc(line_len * sizeof(*results.lpCaretPos)); + if (!results.lpCaretPos) + goto cleanup; - results.lpGlyphs = heap_alloc(line_len * sizeof(*results.lpGlyphs)); - if (!results.lpGlyphs) - { - heap_free(results.lpCaretPos); - goto cleanup; - } - - GetCharacterPlacementW(font->hdc, line, line_len, 0, &results, 0); + results.lpGlyphs = heap_alloc(line_len * sizeof(*results.lpGlyphs)); + if (!results.lpGlyphs) + { + heap_free(results.lpCaretPos); + goto cleanup; + } - for (i = 0; i < results.nGlyphs; ++i) - { - IDirect3DTexture9 *texture; - POINT cell_inc; - RECT black_box; + GetCharacterPlacementW(font->hdc, line, line_len, 0, &results, 0); - ID3DXFont_GetGlyphData(iface, results.lpGlyphs[i], &texture, &black_box, &cell_inc); + for (i = 0; i < results.nGlyphs; ++i) + { + IDirect3DTexture9 *texture; + POINT cell_inc; + RECT black_box; - if (!texture) - continue; + ID3DXFont_GetGlyphData(iface, results.lpGlyphs[i], &texture, &black_box, &cell_inc); - pos.x = cell_inc.x + x + results.lpCaretPos[i]; - pos.y = cell_inc.y + y; + if (!texture) + continue; - ID3DXSprite_Draw(target, texture, &black_box, NULL, &pos, color); - IDirect3DTexture9_Release(texture); - } + pos.x = cell_inc.x + x + results.lpCaretPos[i]; + pos.y = cell_inc.y + y; - heap_free(results.lpCaretPos); - heap_free(results.lpGlyphs); - } - else if (size.cx > max_width) - { - max_width = size.cx; + ID3DXSprite_Draw(target, texture, &black_box, NULL, &pos, color); + IDirect3DTexture9_Release(texture); } + heap_free(results.lpCaretPos); + heap_free(results.lpGlyphs); + y += lh; - if (!(DT_NOCLIP & format) && (y > textrect.bottom)) + if (!(DT_NOCLIP & format) && (y > rect->bottom)) break; } - if (format & DT_CALCRECT && rect) - { - *rect = textrect; - - rect->bottom = y; - rect->right = rect->left + max_width; - } - - ret = y - textrect.top; + ret = y - top; cleanup: if (target != sprite) diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 0767e5b37c3..186b4a14495 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: b5df43b9118074485a1f4a917b16d37bc068839d} +tags: {wine: 53769e7bde9cfb808e26cf67057314c2ca03345a}
3 years, 10 months
1
0
0
0
[reactos] 186/218: [WINESYNC] d3dx9: Switch character count to unsigned int in the DrawText implementation.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4f3d8e9fbf544f595c69a…
commit 4f3d8e9fbf544f595c69a71ba6317de4245e5e09 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:33 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9: Switch character count to unsigned int in the DrawText implementation. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id b5df43b9118074485a1f4a917b16d37bc068839d by Matteo Bruni <mbruni(a)codeweavers.com> --- dll/directx/wine/d3dx9_36/font.c | 16 ++++++++-------- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c index 4546a261a49..35173956dc1 100644 --- a/dll/directx/wine/d3dx9_36/font.c +++ b/dll/directx/wine/d3dx9_36/font.c @@ -556,11 +556,11 @@ static void word_break(HDC hdc, const WCHAR *str, unsigned int *str_len, heap_free(sla); } -static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count, +static const WCHAR *read_line(HDC hdc, const WCHAR *str, unsigned int *count, WCHAR *dest, unsigned int *dest_len, int width, DWORD format, SIZE *size) { + unsigned int orig_count = *count; unsigned int i = 0; - int orig_count = *count; int num_fit; *dest_len = 0; @@ -604,25 +604,25 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count, } static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, - const WCHAR *string, INT count, RECT *rect, DWORD format, D3DCOLOR color) + const WCHAR *string, INT in_count, RECT *rect, DWORD format, D3DCOLOR color) { struct d3dx_font *font = impl_from_ID3DXFont(iface); ID3DXSprite *target = sprite; - WCHAR *line; RECT textrect = {0}; int lh, x, y, width; + unsigned int count; int max_width = 0; + WCHAR *line; int ret = 0; SIZE size; - TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x.\n", - iface, sprite, debugstr_wn(string, count), count, wine_dbgstr_rect(rect), format, color); + TRACE("iface %p, sprite %p, string %s, in_count %d, rect %s, format %#x, color 0x%08x.\n", + iface, sprite, debugstr_wn(string, in_count), in_count, wine_dbgstr_rect(rect), format, color); if (!string) return 0; - if (count < 0) - count = lstrlenW(string); + count = in_count < 0 ? lstrlenW(string) : in_count; if (!count) return 0; diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 30c69c92f33..0767e5b37c3 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: 9bcb1f5195d1e65e0e7afb288d36fee716fe3a60} +tags: {wine: b5df43b9118074485a1f4a917b16d37bc068839d}
3 years, 10 months
1
0
0
0
[reactos] 185/218: [WINESYNC] d3dx9/tests: Introduce compare_uint().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1697b87434b7bda857c42…
commit 1697b87434b7bda857c428409875705b24d18694 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:32 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9/tests: Introduce compare_uint(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 9bcb1f5195d1e65e0e7afb288d36fee716fe3a60 by Henri Verbeet <hverbeet(a)codeweavers.com> --- modules/rostests/winetests/d3dx9_36/texture.c | 23 +++++++++++------------ sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/modules/rostests/winetests/d3dx9_36/texture.c b/modules/rostests/winetests/d3dx9_36/texture.c index 2688559c2c7..bec7ba48279 100644 --- a/modules/rostests/winetests/d3dx9_36/texture.c +++ b/modules/rostests/winetests/d3dx9_36/texture.c @@ -146,20 +146,19 @@ static inline void expect_vec4_(unsigned int line, const D3DXVECTOR4 *expected, got->x, got->y, got->z, got->w); } +static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) +{ + unsigned int diff = x > y ? x - y : y - x; + + return diff <= max_diff; +} + static BOOL compare_color(DWORD c1, DWORD c2, BYTE max_diff) { - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) - return FALSE; - c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) - return FALSE; - c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) - return FALSE; - c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) - return FALSE; - return TRUE; + return compare_uint(c1 & 0xff, c2 & 0xff, max_diff) + && compare_uint((c1 >> 8) & 0xff, (c2 >> 8) & 0xff, max_diff) + && compare_uint((c1 >> 16) & 0xff, (c2 >> 16) & 0xff, max_diff) + && compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff); } static BOOL is_autogenmipmap_supported(IDirect3DDevice9 *device, D3DRESOURCETYPE resource_type) diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 38b733ba03d..30c69c92f33 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: aab980a16253ff6bb6286572576899bfc0f83945} +tags: {wine: 9bcb1f5195d1e65e0e7afb288d36fee716fe3a60}
3 years, 10 months
1
0
0
0
[reactos] 184/218: [WINESYNC] d3dx9: Use stricmp() instead of _strnicmp(..., -1).
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=67c812be35b085a2d282d…
commit 67c812be35b085a2d282d74fcd378ae8245da841 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:32 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9: Use stricmp() instead of _strnicmp(..., -1). Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id aab980a16253ff6bb6286572576899bfc0f83945 by Paul Gofman <gofmanp(a)gmail.com> --- dll/directx/wine/d3dx9_36/effect.c | 4 ++-- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c index 32e64daed0f..54d44341a24 100644 --- a/dll/directx/wine/d3dx9_36/effect.c +++ b/dll/directx/wine/d3dx9_36/effect.c @@ -2206,7 +2206,7 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameterBySemantic(ID3DXEffect *iface, continue; } - if (!_strnicmp(temp_param->semantic, semantic, -1)) + if (!stricmp(temp_param->semantic, semantic)) { TRACE("Returning parameter %p\n", temp_param); return get_parameter_handle(temp_param); @@ -2229,7 +2229,7 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameterBySemantic(ID3DXEffect *iface, continue; } - if (!_strnicmp(temp_param->semantic, semantic, -1)) + if (!stricmp(temp_param->semantic, semantic)) { TRACE("Returning parameter %p\n", temp_param); return get_parameter_handle(temp_param); diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index ed3974a73d2..38b733ba03d 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: 2b5b069dd70ba328dc0ce660861ad802feae912c} +tags: {wine: aab980a16253ff6bb6286572576899bfc0f83945}
3 years, 10 months
1
0
0
0
[reactos] 183/218: [WINESYNC] d3dx9: Validate state operation in d3dx_parse_state().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=51b2c71b54c551b0b97a4…
commit 51b2c71b54c551b0b97a4c89bbfbf0e958b0b36e Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:32 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9: Validate state operation in d3dx_parse_state(). Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 2b5b069dd70ba328dc0ce660861ad802feae912c by Paul Gofman <gofmanp(a)gmail.com> --- dll/directx/wine/d3dx9_36/effect.c | 6 ++++++ sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c index 8670daa81b2..32e64daed0f 100644 --- a/dll/directx/wine/d3dx9_36/effect.c +++ b/dll/directx/wine/d3dx9_36/effect.c @@ -5568,6 +5568,12 @@ static HRESULT d3dx_parse_state(struct d3dx_effect *effect, struct d3dx_state *s state->type = ST_CONSTANT; read_dword(ptr, &state->operation); + if (state->operation >= ARRAY_SIZE(state_table)) + { + WARN("Unknown state operation %u.\n", state->operation); + return D3DERR_INVALIDCALL; + } + TRACE("Operation: %#x (%s)\n", state->operation, state_table[state->operation].name); read_dword(ptr, &state->index); diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 7ebb6f89bd1..ed3974a73d2 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: cfc533b40d2d1426a8f05501152b28aa1ec78f07} +tags: {wine: 2b5b069dd70ba328dc0ce660861ad802feae912c}
3 years, 10 months
1
0
0
0
[reactos] 182/218: [WINESYNC] d3dx9: Use an assert() to validate access to const_tbl[].
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=777269ea64113ed7c11e4…
commit 777269ea64113ed7c11e4edda39031ea79b67c68 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:32 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9: Use an assert() to validate access to const_tbl[]. This check is essentially validating that the hardcoded state_table[] has reasonable values for the shader constant states. Use ARRAY_SIZE() to avoid warnings if the compiler chooses an unsigned integer to back enum SHADER_CONSTANT_TYPE. Based on an idea by Henri Verbeet. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id cfc533b40d2d1426a8f05501152b28aa1ec78f07 by Matteo Bruni <mbruni(a)codeweavers.com> --- dll/directx/wine/d3dx9_36/effect.c | 6 +----- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c index c38ca0f0bdf..8670daa81b2 100644 --- a/dll/directx/wine/d3dx9_36/effect.c +++ b/dll/directx/wine/d3dx9_36/effect.c @@ -1473,11 +1473,7 @@ static HRESULT d3dx_set_shader_const_state(struct d3dx_effect *effect, enum SHAD D3DXVECTOR4 value; HRESULT ret; - if (op < 0 || op > SCT_PSINT) - { - FIXME("Unknown op %u.\n", op); - return D3DERR_INVALIDCALL; - } + assert(op < ARRAY_SIZE(const_tbl)); element_count = param->bytes / const_tbl[op].elem_size; TRACE("%s, index %u, element_count %u.\n", const_tbl[op].name, index, element_count); if (param->type != const_tbl[op].type) diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 8db3c5290ea..7ebb6f89bd1 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: 9796bdc966a89cd31829f3a094bb37ec71e21871} +tags: {wine: cfc533b40d2d1426a8f05501152b28aa1ec78f07}
3 years, 10 months
1
0
0
0
[reactos] 181/218: [WINESYNC] d3dx9: Remove a recursive call to ID3DXFont_DrawTextW when no rect is specified.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e6e305520c79c4a31230a…
commit e6e305520c79c4a31230a53bbada76225cf73182 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:32 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9: Remove a recursive call to ID3DXFont_DrawTextW when no rect is specified. Signed-off-by: Sven Baars <sbaars(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 9796bdc966a89cd31829f3a094bb37ec71e21871 by Sven Baars <sbaars(a)codeweavers.com> --- dll/directx/wine/d3dx9_36/font.c | 13 ++----------- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c index b260436e8ef..4546a261a49 100644 --- a/dll/directx/wine/d3dx9_36/font.c +++ b/dll/directx/wine/d3dx9_36/font.c @@ -633,17 +633,8 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, if (format & DT_SINGLELINE) format &= ~DT_WORDBREAK; - if (!rect) - { - y = ID3DXFont_DrawTextW(iface, NULL, string, count, &textrect, format | DT_CALCRECT, 0); - - if (format & DT_CALCRECT) - return y; - } - else - { + if (rect) textrect = *rect; - } x = textrect.left; y = textrect.top; @@ -720,7 +711,7 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, break; } - if (format & DT_CALCRECT) + if (format & DT_CALCRECT && rect) { *rect = textrect; diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 21245aabfc6..8db3c5290ea 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: 787d98f47ce7254dda7f644fa6d033fe1776ae38} +tags: {wine: 9796bdc966a89cd31829f3a094bb37ec71e21871}
3 years, 10 months
1
0
0
0
[reactos] 180/218: [WINESYNC] d3dx9: Add two more DT_SINGLELINE tests.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cf5abba9d887c5fa3eaaf…
commit cf5abba9d887c5fa3eaaf3b285acde5b0a3e3186 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Sep 21 23:07:32 2020 +0200 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:06 2021 +0100 [WINESYNC] d3dx9: Add two more DT_SINGLELINE tests. Signed-off-by: Sven Baars <sbaars(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 787d98f47ce7254dda7f644fa6d033fe1776ae38 by Sven Baars <sbaars(a)codeweavers.com> --- modules/rostests/winetests/d3dx9_36/core.c | 6 ++++++ sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/d3dx9_36/core.c b/modules/rostests/winetests/d3dx9_36/core.c index 6fae8bf8d5a..fb55a547a07 100644 --- a/modules/rostests/winetests/d3dx9_36/core.c +++ b/modules/rostests/winetests/d3dx9_36/core.c @@ -782,12 +782,18 @@ static void test_ID3DXFont(IDirect3DDevice9 *device) height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, DT_SINGLELINE, 0xff00ff); ok(height == 12, "Got unexpected height %d.\n", height); + height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_SINGLELINE, 0xff00ff); + ok(height == 12, "Got unexpected height %d.\n", height); + height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, 0, 0xff00ff); ok(height == 24, "Got unexpected height %d.\n", height); height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_WORDBREAK, 0xff00ff); ok(height == 36, "Got unexpected height %d.\n", height); + height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_WORDBREAK | DT_SINGLELINE, 0xff00ff); + ok(height == 12, "Got unexpected height %d.\n", height); + height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, 0, 0xff00ff); ok(height == 48, "Got unexpected height %d.\n", height); diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 104b780e0f0..21245aabfc6 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: 143a2a30f89dfc79cc2a49cd34af6fd587ce3f69} +tags: {wine: 787d98f47ce7254dda7f644fa6d033fe1776ae38}
3 years, 10 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
44
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
Results per page:
10
25
50
100
200