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
May 2023
----- 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
1 participants
775 discussions
Start a n
N
ew thread
Jacek Caban : win32u: Don't return full OUTLINETEXTMETRICW from __wine_get_file_outline_text_metric.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: da4663d6402bd9f0b23ecd31700a654b034074b0 URL:
https://gitlab.winehq.org/wine/wine/-/commit/da4663d6402bd9f0b23ecd31700a65…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sat May 27 18:27:42 2023 +0200 win32u: Don't return full OUTLINETEXTMETRICW from __wine_get_file_outline_text_metric. --- dlls/gdi32/text.c | 46 ++++++++++++++++++++++---------------------- dlls/win32u/font.c | 7 +++++-- dlls/win32u/win32u.spec | 2 +- dlls/win32u/win32u_private.h | 3 ++- dlls/win32u/wrappers.c | 5 +++-- include/ntgdi.h | 4 ++-- 6 files changed, 36 insertions(+), 31 deletions(-) diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c index 3dd50491e08..2ebfea586e4 100644 --- a/dlls/gdi32/text.c +++ b/dlls/gdi32/text.c @@ -2669,10 +2669,11 @@ static BOOL create_fot( const WCHAR *resource, const WCHAR *font_file, const str BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_file, const WCHAR *font_file, const WCHAR *font_path ) { + WCHAR path[MAX_PATH], face_name[128]; struct fontdir fontdir = { 0 }; UNICODE_STRING nt_name; - OUTLINETEXTMETRICW otm; - WCHAR path[MAX_PATH]; + TEXTMETRICW otm; + UINT em_square; BOOL ret; TRACE("(%ld, %s, %s, %s)\n", hidden, debugstr_w(resource_file), @@ -2689,10 +2690,10 @@ BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_fil if (!RtlDosPathNameToNtPathName_U( path, &nt_name, NULL, NULL )) goto done; } else if (!RtlDosPathNameToNtPathName_U( font_file, &nt_name, NULL, NULL )) goto done; - ret = __wine_get_file_outline_text_metric( nt_name.Buffer, &otm ); + ret = __wine_get_file_outline_text_metric( nt_name.Buffer, &otm, &em_square, face_name ); RtlFreeUnicodeString( &nt_name ); if (!ret) goto done; - if (!(otm.otmTextMetrics.tmPitchAndFamily & TMPF_TRUETYPE)) goto done; + if (!(otm.tmPitchAndFamily & TMPF_TRUETYPE)) goto done; fontdir.num_of_resources = 1; fontdir.res_id = 0; @@ -2700,32 +2701,31 @@ BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_fil fontdir.dfSize = sizeof(fontdir); strcpy( fontdir.dfCopyright, "Wine fontdir" ); fontdir.dfType = 0x4003; /* 0x0080 set if private */ - fontdir.dfPoints = otm.otmEMSquare; + fontdir.dfPoints = em_square; fontdir.dfVertRes = 72; fontdir.dfHorizRes = 72; - fontdir.dfAscent = otm.otmTextMetrics.tmAscent; - fontdir.dfInternalLeading = otm.otmTextMetrics.tmInternalLeading; - fontdir.dfExternalLeading = otm.otmTextMetrics.tmExternalLeading; - fontdir.dfItalic = otm.otmTextMetrics.tmItalic; - fontdir.dfUnderline = otm.otmTextMetrics.tmUnderlined; - fontdir.dfStrikeOut = otm.otmTextMetrics.tmStruckOut; - fontdir.dfWeight = otm.otmTextMetrics.tmWeight; - fontdir.dfCharSet = otm.otmTextMetrics.tmCharSet; + fontdir.dfAscent = otm.tmAscent; + fontdir.dfInternalLeading = otm.tmInternalLeading; + fontdir.dfExternalLeading = otm.tmExternalLeading; + fontdir.dfItalic = otm.tmItalic; + fontdir.dfUnderline = otm.tmUnderlined; + fontdir.dfStrikeOut = otm.tmStruckOut; + fontdir.dfWeight = otm.tmWeight; + fontdir.dfCharSet = otm.tmCharSet; fontdir.dfPixWidth = 0; - fontdir.dfPixHeight = otm.otmTextMetrics.tmHeight; - fontdir.dfPitchAndFamily = otm.otmTextMetrics.tmPitchAndFamily; - fontdir.dfAvgWidth = otm.otmTextMetrics.tmAveCharWidth; - fontdir.dfMaxWidth = otm.otmTextMetrics.tmMaxCharWidth; - fontdir.dfFirstChar = otm.otmTextMetrics.tmFirstChar; - fontdir.dfLastChar = otm.otmTextMetrics.tmLastChar; - fontdir.dfDefaultChar = otm.otmTextMetrics.tmDefaultChar; - fontdir.dfBreakChar = otm.otmTextMetrics.tmBreakChar; + fontdir.dfPixHeight = otm.tmHeight; + fontdir.dfPitchAndFamily = otm.tmPitchAndFamily; + fontdir.dfAvgWidth = otm.tmAveCharWidth; + fontdir.dfMaxWidth = otm.tmMaxCharWidth; + fontdir.dfFirstChar = otm.tmFirstChar; + fontdir.dfLastChar = otm.tmLastChar; + fontdir.dfDefaultChar = otm.tmDefaultChar; + fontdir.dfBreakChar = otm.tmBreakChar; fontdir.dfWidthBytes = 0; fontdir.dfDevice = 0; fontdir.dfFace = FIELD_OFFSET( struct fontdir, szFaceName ); fontdir.dfReserved = 0; - WideCharToMultiByte( CP_ACP, 0, (WCHAR *)otm.otmpFamilyName, -1, - fontdir.szFaceName, LF_FACESIZE, NULL, NULL ); + WideCharToMultiByte( CP_ACP, 0, face_name, -1, fontdir.szFaceName, LF_FACESIZE, NULL, NULL ); if (hidden) fontdir.dfType |= 0x80; return create_fot( resource_file, font_file, &fontdir ); diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index cdac88836b9..c8187e9d07b 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -6341,7 +6341,8 @@ DWORD WINAPI NtGdiGetGlyphOutline( HDC hdc, UINT ch, UINT format, GLYPHMETRICS * /********************************************************************** * __wine_get_file_outline_text_metric (win32u.@) */ -BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm ) +BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ) { struct gdi_font *font = NULL; @@ -6351,7 +6352,9 @@ BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTME font->lf.lfHeight = 100; if (!font_funcs->load_font( font )) goto done; if (!font_funcs->set_outline_text_metrics( font )) goto done; - *otm = font->otm; + *otm = font->otm.otmTextMetrics; + *em_square = font->otm.otmEMSquare; + wcscpy( face_name, (const WCHAR *)font->otm.otmpFamilyName ); free_gdi_font( font ); return TRUE; diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index c90505e7d17..178329d6858 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1325,4 +1325,4 @@ # gdi32 @ cdecl __wine_get_icm_profile(long long ptr ptr) -@ cdecl __wine_get_file_outline_text_metric(wstr ptr) +@ stdcall __wine_get_file_outline_text_metric(wstr ptr ptr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 3b181fe3121..e7e77bf2427 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -35,7 +35,8 @@ struct unix_funcs { /* Wine-specific functions */ - BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm ); + BOOL (WINAPI *get_file_outline_text_metric)( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ); BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); }; diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 9e013c64b59..23dccd55bf1 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -30,10 +30,11 @@ BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCH return unix_funcs->get_icm_profile( hdc, allow_default, size, filename ); } -BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm ) +BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ) { if (!unix_funcs) return FALSE; - return unix_funcs->get_file_outline_text_metric( path, otm ); + return unix_funcs->get_file_outline_text_metric( path, otm, em_square, face_name ); } BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ) diff --git a/include/ntgdi.h b/include/ntgdi.h index e1c5008e4e9..1ac8e0110e2 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -485,7 +485,7 @@ NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER /* Wine extensions */ extern BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); -extern BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, - OUTLINETEXTMETRICW *otm ); +BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ); #endif /* _NTGDI_ */
1
0
0
0
Jacek Caban : win32u: Extend NtGdiSetDIBitsToDeviceInternal for SetDIBits implementation.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: 3dbe180ea554ee6156c206936ced87f3a6b7b2da URL:
https://gitlab.winehq.org/wine/wine/-/commit/3dbe180ea554ee6156c206936ced87…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sat May 27 18:42:09 2023 +0200 win32u: Extend NtGdiSetDIBitsToDeviceInternal for SetDIBits implementation. --- dlls/gdi32/dc.c | 15 +++++++++++++++ dlls/win32u/dib.c | 29 +++++++---------------------- dlls/win32u/gdiobj.c | 1 - dlls/win32u/win32u.spec | 1 - dlls/win32u/win32u_private.h | 3 --- dlls/win32u/wrappers.c | 8 -------- dlls/winex11.drv/bitblt.c | 4 +++- 7 files changed, 25 insertions(+), 36 deletions(-) diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 9a33e343f94..368a38db788 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -1970,6 +1970,21 @@ BOOL WINAPI GdiAlphaBlend( HDC hdc_dst, int x_dst, int y_dst, int width_dst, int *(DWORD *)&blend_function, 0 /* FIXME */ ); } +/****************************************************************************** + * SetDIBits (GDI32.@) + * + * Sets pixels in a bitmap using colors from DIB. + */ +INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, + UINT lines, const void *bits, const BITMAPINFO *info, + UINT coloruse ) +{ + /* Wine-specific: pass hbitmap to NtGdiSetDIBitsToDeviceInternal */ + return NtGdiSetDIBitsToDeviceInternal( hdc, 0, 0, 0, 0, 0, 0, + startscan, lines, bits, info, coloruse, + 0, 0, FALSE, hbitmap ); +} + /*********************************************************************** * SetDIBitsToDevice (GDI32.@) */ diff --git a/dlls/win32u/dib.c b/dlls/win32u/dib.c index 64f96b268c9..7b6b364fb71 100644 --- a/dlls/win32u/dib.c +++ b/dlls/win32u/dib.c @@ -655,27 +655,10 @@ INT WINAPI NtGdiStretchDIBitsInternal( HDC hdc, INT xDst, INT yDst, INT widthDst } -/****************************************************************************** - * SetDIBits [GDI32.@] - * - * Sets pixels in a bitmap using colors from DIB. - * - * PARAMS - * hdc [I] Handle to device context - * hbitmap [I] Handle to bitmap - * startscan [I] Starting scan line - * lines [I] Number of scan lines - * bits [I] Array of bitmap bits - * info [I] Address of structure with data - * coloruse [I] Type of color indexes to use - * - * RETURNS - * Success: Number of scan lines copied - * Failure: 0 - */ -INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, - UINT lines, LPCVOID bits, const BITMAPINFO *info, - UINT coloruse ) +/* Sets pixels in a bitmap using colors from DIB, see SetDIBits */ +static int set_di_bits( HDC hdc, HBITMAP hbitmap, UINT startscan, + UINT lines, LPCVOID bits, const BITMAPINFO *info, + UINT coloruse ) { BITMAPOBJ *bitmap; char src_bmibuf[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; @@ -913,6 +896,8 @@ INT WINAPI NtGdiSetDIBitsToDeviceInternal( HDC hdc, INT xDest, INT yDest, DWORD INT ret = 0; DC *dc; + if (xform) return set_di_bits( hdc, xform, startscan, lines, bits, bmi, coloruse ); + if (!bits) return 0; if (!bitmapinfo_from_user_bitmapinfo( info, bmi, coloruse, TRUE )) { @@ -1468,7 +1453,7 @@ HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWOR { if (init & CBM_INIT) { - if (SetDIBits( hdc, handle, 0, height, bits, data, coloruse ) == 0) + if (set_di_bits( hdc, handle, 0, height, bits, data, coloruse ) == 0) { NtGdiDeleteObjectApp( handle ); handle = 0; diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index be8d3099a49..22cd7dd03ba 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1030,7 +1030,6 @@ BOOL WINAPI NtGdiSetColorAdjustment( HDC hdc, const COLORADJUSTMENT *ca ) static struct unix_funcs unix_funcs = { - SetDIBits, __wine_get_file_outline_text_metric, __wine_get_icm_profile, __wine_send_input, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 219442c30eb..c90505e7d17 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1324,6 +1324,5 @@ @ cdecl __wine_send_input(long ptr ptr) # gdi32 -@ stdcall SetDIBits(long long long long ptr ptr long) @ cdecl __wine_get_icm_profile(long long ptr ptr) @ cdecl __wine_get_file_outline_text_metric(wstr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 7b09ff9aa37..3b181fe3121 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -35,9 +35,6 @@ struct unix_funcs { /* Wine-specific functions */ - INT (WINAPI *pSetDIBits)( HDC hdc, HBITMAP hbitmap, UINT startscan, - UINT lines, const void *bits, const BITMAPINFO *info, - UINT coloruse ); BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm ); BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 0327416e018..9e013c64b59 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -24,14 +24,6 @@ static const struct unix_funcs *unix_funcs; -INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, - UINT lines, const void *bits, const BITMAPINFO *info, - UINT coloruse ) -{ - if (!unix_funcs) return 0; - return unix_funcs->pSetDIBits( hdc, hbitmap, startscan, lines, bits, info, coloruse ); -} - BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ) { if (!unix_funcs) return FALSE; diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 10388a1cc8f..19fc0b0887c 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1497,7 +1497,9 @@ Pixmap create_pixmap_from_image( HDC hdc, const XVisualInfo *vis, const BITMAPIN { if (src_info->bmiHeader.biBitCount == 1 && !src_info->bmiHeader.biClrUsed) memcpy( src_info->bmiColors, default_colortable, sizeof(default_colortable) ); - SetDIBits( hdc, dib, 0, abs(info->bmiHeader.biHeight), bits->ptr, src_info, coloruse ); + NtGdiSetDIBitsToDeviceInternal( hdc, 0, 0, 0, 0, 0, 0, 0, + abs(info->bmiHeader.biHeight), bits->ptr, src_info, coloruse, + 0, 0, FALSE, dib ); /* SetDIBits */ dst_bits.free = NULL; dst_bits.is_copy = TRUE; err = put_pixmap_image( pixmap, vis, dst_info, &dst_bits );
1
0
0
0
Jacek Caban : win32u: Implement NtGdiIcmBrushInfo and use it instead of __wine_get_brush_bitmap_info.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: ab88c7cbb1f7e580a4ae4f4c42a0207481a54a18 URL:
https://gitlab.winehq.org/wine/wine/-/commit/ab88c7cbb1f7e580a4ae4f4c42a020…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sat May 27 17:48:23 2023 +0200 win32u: Implement NtGdiIcmBrushInfo and use it instead of __wine_get_brush_bitmap_info. --- dlls/gdi32/emfdc.c | 4 ++-- dlls/gdi32/metadc.c | 5 +++-- dlls/win32u/brush.c | 12 ++++++++++-- dlls/win32u/gdiobj.c | 1 - dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 3 +-- dlls/win32u/win32u_private.h | 1 - dlls/win32u/wrappers.c | 6 ------ dlls/wow64win/gdi.c | 14 ++++++++++++++ dlls/wow64win/syscall.h | 1 + include/ntgdi.h | 4 ++-- 11 files changed, 34 insertions(+), 18 deletions(-) diff --git a/dlls/gdi32/emfdc.c b/dlls/gdi32/emfdc.c index 57f39e4c162..45938172a37 100644 --- a/dlls/gdi32/emfdc.c +++ b/dlls/gdi32/emfdc.c @@ -489,7 +489,7 @@ static DWORD emfdc_create_brush( struct emf *emf, HBRUSH brush ) DWORD info_size; UINT usage; - if (!__wine_get_brush_bitmap_info( brush, info, NULL, &usage )) break; + if (!NtGdiIcmBrushInfo( 0, brush, info, NULL, NULL, &usage, NULL, 0 )) break; info_size = get_dib_info_size( info, usage ); emr = HeapAlloc( GetProcessHeap(), 0, @@ -530,7 +530,7 @@ static DWORD emfdc_create_brush( struct emf *emf, HBRUSH brush ) if (info->bmiHeader.biClrUsed == 1 << info->bmiHeader.biBitCount) info->bmiHeader.biClrUsed = 0; memcpy( (BYTE *)emr + emr->offBmi, info, emr->cbBmi ); - __wine_get_brush_bitmap_info( brush, NULL, (char *)emr + emr->offBits, NULL ); + NtGdiIcmBrushInfo( 0, brush, NULL, (char *)emr + emr->offBits, NULL, NULL, NULL, 0 ); if (!emfdc_record( emf, &emr->emr )) index = 0; HeapFree( GetProcessHeap(), 0, emr ); diff --git a/dlls/gdi32/metadc.c b/dlls/gdi32/metadc.c index 2f5842ea90a..dbfa311b711 100644 --- a/dlls/gdi32/metadc.c +++ b/dlls/gdi32/metadc.c @@ -547,7 +547,8 @@ static INT16 metadc_create_brush( struct metadc *metadc, HBRUSH brush ) DWORD info_size; UINT usage; - if (!__wine_get_brush_bitmap_info( brush, src_info, NULL, &usage )) goto done; + if (!NtGdiIcmBrushInfo( 0, brush, src_info, NULL, NULL, &usage, NULL, 0 )) + goto done; info_size = get_dib_info_size( src_info, usage ); size = FIELD_OFFSET( METARECORD, rdParm[2] ) + @@ -559,7 +560,7 @@ static INT16 metadc_create_brush( struct metadc *metadc, HBRUSH brush ) mr->rdParm[0] = logbrush.lbStyle; mr->rdParm[1] = usage; dst_info = (BITMAPINFO *)(mr->rdParm + 2); - __wine_get_brush_bitmap_info( brush, dst_info, (char *)dst_info + info_size, NULL ); + NtGdiIcmBrushInfo( 0, brush, dst_info, (char *)dst_info + info_size, NULL, NULL, NULL, 0 ); if (dst_info->bmiHeader.biClrUsed == 1 << dst_info->bmiHeader.biBitCount) dst_info->bmiHeader.biClrUsed = 0; break; diff --git a/dlls/win32u/brush.c b/dlls/win32u/brush.c index 8523826627e..29a96035599 100644 --- a/dlls/win32u/brush.c +++ b/dlls/win32u/brush.c @@ -145,13 +145,20 @@ void free_brush_pattern( struct brush_pattern *pattern ) } /********************************************************************** - * __wine_get_brush_bitmap_info (win32u.@) + * NtGdiIcmBrushInfo (win32u.@) */ -BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ) +BOOL WINAPI NtGdiIcmBrushInfo( HDC hdc, HBRUSH handle, BITMAPINFO *info, void *bits, + ULONG *bits_size, UINT *usage, BOOL *unk, UINT mode ) { BRUSHOBJ *brush; BOOL ret = FALSE; + if (mode) + { + FIXME( "unsupported mode %u\n", mode ); + return FALSE; + } + if (!(brush = GDI_GetObjPtr( handle, NTGDI_OBJ_BRUSH ))) return FALSE; if (brush->pattern.info) @@ -183,6 +190,7 @@ BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void * else memcpy( bits, brush->pattern.bits.ptr, brush->pattern.info->bmiHeader.biSizeImage ); } + if (bits_size) *bits_size = brush->pattern.info->bmiHeader.biSizeImage; if (usage) *usage = brush->pattern.usage; ret = TRUE; } diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 44eac99a30d..be8d3099a49 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1031,7 +1031,6 @@ BOOL WINAPI NtGdiSetColorAdjustment( HDC hdc, const COLORADJUSTMENT *ca ) static struct unix_funcs unix_funcs = { SetDIBits, - __wine_get_brush_bitmap_info, __wine_get_file_outline_text_metric, __wine_get_icm_profile, __wine_send_input, diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index a292fccd1f7..5e342342362 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -145,6 +145,7 @@ static void * const syscalls[] = NtGdiGetTransform, NtGdiGradientFill, NtGdiHfontCreate, + NtGdiIcmBrushInfo, NtGdiInitSpool, NtGdiIntersectClipRect, NtGdiInvertRgn, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 9fef6d021d4..219442c30eb 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -530,7 +530,7 @@ @ stub NtGdiHT_Get8BPPFormatPalette @ stub NtGdiHT_Get8BPPMaskPalette @ stdcall -syscall NtGdiHfontCreate(ptr long long long ptr) -@ stub NtGdiIcmBrushInfo +@ stdcall -syscall NtGdiIcmBrushInfo(long long ptr ptr ptr ptr ptr long) @ stub NtGdiInit @ stdcall -syscall NtGdiInitSpool() @ stdcall -syscall NtGdiIntersectClipRect(long long long long long) @@ -1325,6 +1325,5 @@ # gdi32 @ stdcall SetDIBits(long long long long ptr ptr long) -@ cdecl __wine_get_brush_bitmap_info(long ptr ptr ptr) @ cdecl __wine_get_icm_profile(long long ptr ptr) @ cdecl __wine_get_file_outline_text_metric(wstr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index cf9167aa2d2..7b09ff9aa37 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -38,7 +38,6 @@ struct unix_funcs INT (WINAPI *pSetDIBits)( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, const void *bits, const BITMAPINFO *info, UINT coloruse ); - BOOL (CDECL *get_brush_bitmap_info)( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ); BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm ); BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index c89c0f16edc..0327416e018 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -38,12 +38,6 @@ BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCH return unix_funcs->get_icm_profile( hdc, allow_default, size, filename ); } -BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->get_brush_bitmap_info( handle, info, bits, usage ); -} - BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm ) { if (!unix_funcs) return FALSE; diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c index 7b5ca3f90ef..b1c79c776d7 100644 --- a/dlls/wow64win/gdi.c +++ b/dlls/wow64win/gdi.c @@ -1377,6 +1377,20 @@ NTSTATUS WINAPI wow64_NtGdiGradientFill( UINT *args ) return NtGdiGradientFill( hdc, vert_array, nvert, grad_array, ngrad, mode ); } +NTSTATUS WINAPI wow64_NtGdiIcmBrushInfo( UINT *args ) +{ + HDC hdc = get_handle( &args ); + HBRUSH handle = get_handle( &args ); + BITMAPINFO *info = get_ptr( &args ); + void *bits = get_ptr( &args ); + ULONG *bits_size = get_ptr( &args ); + UINT *usage = get_ptr( &args ); + BOOL *unk = get_ptr( &args ); + UINT mode = get_ulong( &args ); + + return NtGdiIcmBrushInfo( hdc, handle, info, bits, bits_size, usage, unk, mode ); +} + NTSTATUS WINAPI wow64_NtGdiInvertRgn( UINT *args ) { HDC hdc = get_handle( &args ); diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index d2f9cde6d50..0521ad900d8 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -131,6 +131,7 @@ SYSCALL_ENTRY( NtGdiGetTransform ) \ SYSCALL_ENTRY( NtGdiGradientFill ) \ SYSCALL_ENTRY( NtGdiHfontCreate ) \ + SYSCALL_ENTRY( NtGdiIcmBrushInfo ) \ SYSCALL_ENTRY( NtGdiInitSpool ) \ SYSCALL_ENTRY( NtGdiIntersectClipRect ) \ SYSCALL_ENTRY( NtGdiInvertRgn ) \ diff --git a/include/ntgdi.h b/include/ntgdi.h index 0f989189045..e1c5008e4e9 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -375,6 +375,8 @@ BOOL WINAPI NtGdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode ); HFONT WINAPI NtGdiHfontCreate( const void *logfont, ULONG unk2, ULONG unk3, ULONG unk4, void *data ); +BOOL WINAPI NtGdiIcmBrushInfo( HDC hdc, HBRUSH handle, BITMAPINFO *info, void *bits, + ULONG *bits_size, UINT *usage, BOOL *unk, UINT mode ); DWORD WINAPI NtGdiInitSpool(void); INT WINAPI NtGdiIntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom ); BOOL WINAPI NtGdiInvertRgn( HDC hdc, HRGN hrgn ); @@ -481,8 +483,6 @@ NTSTATUS WINAPI NtGdiDdDDISetQueuedLimit( D3DKMT_SETQUEUEDLIMIT *desc ); NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ); /* Wine extensions */ -extern BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, - UINT *usage ); extern BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); extern BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path,
1
0
0
0
Jacek Caban : win32u: Use syscall interface for all ntuser functions.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: 0492108ae8367dfe69d15879b1482876579e7c03 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0492108ae8367dfe69d15879b14828…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Aug 1 21:30:30 2022 +0200 win32u: Use syscall interface for all ntuser functions. --- dlls/win32u/gdiobj.c | 9 ----- dlls/win32u/syscall.c | 8 ++++ dlls/win32u/win32u.spec | 16 ++++---- dlls/win32u/win32u_private.h | 15 -------- dlls/win32u/wrappers.c | 53 -------------------------- dlls/wow64win/syscall.h | 8 ++++ dlls/wow64win/user.c | 88 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 112 insertions(+), 85 deletions(-)
1
0
0
0
Zhiyi Zhang : gdiplus: Support playing back pen custom end line cap.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: f9e77ad77c14cce80c5e57fb30c3a121ee369d21 URL:
https://gitlab.winehq.org/wine/wine/-/commit/f9e77ad77c14cce80c5e57fb30c3a1…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Sun May 14 15:23:04 2023 +0800 gdiplus: Support playing back pen custom end line cap. Fix Cafe Stella (SteamID: 1829980) Flowchart crashes once there are 2 things on it. --- dlls/gdiplus/metafile.c | 7 ++++++- dlls/gdiplus/tests/metafile.c | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index 9d209e81983..4880211ad87 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -2671,7 +2671,12 @@ static GpStatus METAFILE_PlaybackObject(GpMetafile *metafile, UINT flags, UINT d if (pendata->PenDataFlags & PenDataCustomEndCap) { EmfPlusCustomEndCapData *endcap = (EmfPlusCustomEndCapData *)((BYTE *)pendata + offset); - FIXME("PenDataCustomEndCap is not supported.\n"); + if ((status = metafile_deserialize_custom_line_cap((BYTE *)endcap, data_size, &custom_line_cap)) != Ok) + goto penfailed; + status = GdipSetPenCustomEndCap(pen, custom_line_cap); + GdipDeleteCustomLineCap(custom_line_cap); + if (status != Ok) + goto penfailed; offset += FIELD_OFFSET(EmfPlusCustomEndCapData, data) + endcap->CustomEndCapSize; } diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c index 4e4277d4d1f..f6a9f5e54a8 100644 --- a/dlls/gdiplus/tests/metafile.c +++ b/dlls/gdiplus/tests/metafile.c @@ -3987,7 +3987,6 @@ static void test_pen(void) stat = GdipBitmapGetPixel(bitmap, 40, 90, &color); expect(Ok, stat); - todo_wine expect(0xffff0000, color); stat = GdipDisposeImage((GpImage *)clone_metafile);
1
0
0
0
Zhiyi Zhang : gdiplus: Support playing back pen custom start line cap.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: fea3a7447aba49b2f7f6c5e53b581b60b96539f8 URL:
https://gitlab.winehq.org/wine/wine/-/commit/fea3a7447aba49b2f7f6c5e53b581b…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Wed May 3 22:36:13 2023 +0800 gdiplus: Support playing back pen custom start line cap. --- dlls/gdiplus/metafile.c | 124 +++++++++++++++++++++++++++++++++++++++++- dlls/gdiplus/tests/metafile.c | 1 - 2 files changed, 123 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index 92c818afbac..9d209e81983 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -2340,6 +2340,122 @@ static GpStatus metafile_deserialize_brush(const BYTE *record_data, UINT data_si return status; } +static GpStatus metafile_deserialize_custom_line_cap(const BYTE *record_data, UINT data_size, GpCustomLineCap **cap) +{ + EmfPlusCustomStartCapData *custom_cap_data = (EmfPlusCustomStartCapData *)record_data; + EmfPlusCustomLineCap *line_cap; + GpStatus status; + UINT offset; + + *cap = NULL; + + if (data_size < FIELD_OFFSET(EmfPlusCustomStartCapData, data)) + return InvalidParameter; + if (data_size < FIELD_OFFSET(EmfPlusCustomStartCapData, data) + custom_cap_data->CustomStartCapSize) + return InvalidParameter; + offset = FIELD_OFFSET(EmfPlusCustomStartCapData, data); + line_cap = (EmfPlusCustomLineCap *)(record_data + offset); + + if (data_size < offset + FIELD_OFFSET(EmfPlusCustomLineCap, CustomLineCapData)) + return InvalidParameter; + offset += FIELD_OFFSET(EmfPlusCustomLineCap, CustomLineCapData); + + if (line_cap->Type == CustomLineCapTypeAdjustableArrow) + { + EmfPlusCustomLineCapArrowData *arrow_data; + GpAdjustableArrowCap *arrow_cap; + + arrow_data = (EmfPlusCustomLineCapArrowData *)(record_data + offset); + + if (data_size < offset + sizeof(EmfPlusCustomLineCapArrowData)) + return InvalidParameter; + + if ((status = GdipCreateAdjustableArrowCap(arrow_data->Height, arrow_data->Width, + arrow_data->FillState, &arrow_cap))) + return status; + + if ((status = GdipSetAdjustableArrowCapMiddleInset(arrow_cap, arrow_data->MiddleInset))) + goto arrow_cap_failed; + if ((status = GdipSetCustomLineCapStrokeCaps((GpCustomLineCap *)arrow_cap, arrow_data->LineStartCap, arrow_data->LineEndCap))) + goto arrow_cap_failed; + if ((status = GdipSetCustomLineCapStrokeJoin((GpCustomLineCap *)arrow_cap, arrow_data->LineJoin))) + goto arrow_cap_failed; + if ((status = GdipSetCustomLineCapWidthScale((GpCustomLineCap *)arrow_cap, arrow_data->WidthScale))) + goto arrow_cap_failed; + + *cap = (GpCustomLineCap *)arrow_cap; + return Ok; + + arrow_cap_failed: + GdipDeleteCustomLineCap((GpCustomLineCap *)arrow_cap); + return status; + } + else + { + GpPath *path, *fill_path = NULL, *stroke_path = NULL; + EmfPlusCustomLineCapData *line_cap_data; + GpCustomLineCap *line_cap = NULL; + GpStatus status; + + line_cap_data = (EmfPlusCustomLineCapData *)(record_data + offset); + + if (data_size < offset + FIELD_OFFSET(EmfPlusCustomLineCapData, OptionalData)) + return InvalidParameter; + offset += FIELD_OFFSET(EmfPlusCustomLineCapData, OptionalData); + + if (line_cap_data->CustomLineCapDataFlags == CustomLineCapDataFillPath) + { + EmfPlusCustomLineCapDataFillPath *fill_path = (EmfPlusCustomLineCapDataFillPath *)(record_data + offset); + + if (data_size < offset + FIELD_OFFSET(EmfPlusCustomLineCapDataFillPath, FillPath)) + return InvalidParameter; + if (data_size < offset + fill_path->FillPathLength) + return InvalidParameter; + + offset += FIELD_OFFSET(EmfPlusCustomLineCapDataFillPath, FillPath); + } + else + { + EmfPlusCustomLineCapDataLinePath *line_path = (EmfPlusCustomLineCapDataLinePath *)(record_data + offset); + + if (data_size < offset + FIELD_OFFSET(EmfPlusCustomLineCapDataLinePath, LinePath)) + return InvalidParameter; + if (data_size < offset + line_path->LinePathLength) + return InvalidParameter; + + offset += FIELD_OFFSET(EmfPlusCustomLineCapDataLinePath, LinePath); + } + + if ((status = metafile_deserialize_path(record_data + offset, data_size - offset, &path))) + return status; + + if (line_cap_data->CustomLineCapDataFlags == CustomLineCapDataFillPath) + fill_path = path; + else + stroke_path = path; + + if ((status = GdipCreateCustomLineCap(fill_path, stroke_path, line_cap_data->BaseCap, + line_cap_data->BaseInset, &line_cap))) + goto default_cap_failed; + if ((status = GdipSetCustomLineCapStrokeCaps(line_cap, line_cap_data->StrokeStartCap, line_cap_data->StrokeEndCap))) + goto default_cap_failed; + if ((status = GdipSetCustomLineCapStrokeJoin(line_cap, line_cap_data->StrokeJoin))) + goto default_cap_failed; + if ((status = GdipSetCustomLineCapWidthScale(line_cap, line_cap_data->WidthScale))) + goto default_cap_failed; + + GdipDeletePath(path); + *cap = line_cap; + return Ok; + + default_cap_failed: + if (line_cap) + GdipDeleteCustomLineCap(line_cap); + GdipDeletePath(path); + return status; + } +} + static GpStatus metafile_get_pen_brush_data_offset(EmfPlusPen *data, UINT data_size, DWORD *ret) { EmfPlusPenData *pendata = (EmfPlusPenData *)data->data; @@ -2446,6 +2562,7 @@ static GpStatus METAFILE_PlaybackObject(GpMetafile *metafile, UINT flags, UINT d { EmfPlusPen *data = (EmfPlusPen *)record_data; EmfPlusPenData *pendata = (EmfPlusPenData *)data->data; + GpCustomLineCap *custom_line_cap; GpBrush *brush; DWORD offset; GpPen *pen; @@ -2542,7 +2659,12 @@ static GpStatus METAFILE_PlaybackObject(GpMetafile *metafile, UINT flags, UINT d if (pendata->PenDataFlags & PenDataCustomStartCap) { EmfPlusCustomStartCapData *startcap = (EmfPlusCustomStartCapData *)((BYTE *)pendata + offset); - FIXME("PenDataCustomStartCap is not supported.\n"); + if ((status = metafile_deserialize_custom_line_cap((BYTE *)startcap, data_size, &custom_line_cap)) != Ok) + goto penfailed; + status = GdipSetPenCustomStartCap(pen, custom_line_cap); + GdipDeleteCustomLineCap(custom_line_cap); + if (status != Ok) + goto penfailed; offset += FIELD_OFFSET(EmfPlusCustomStartCapData, data) + startcap->CustomStartCapSize; } diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c index ceca8e4a9bb..4e4277d4d1f 100644 --- a/dlls/gdiplus/tests/metafile.c +++ b/dlls/gdiplus/tests/metafile.c @@ -3983,7 +3983,6 @@ static void test_pen(void) stat = GdipBitmapGetPixel(bitmap, 10, 10, &color); expect(Ok, stat); - todo_wine expect(0xffff0000, color); stat = GdipBitmapGetPixel(bitmap, 40, 90, &color);
1
0
0
0
Zhiyi Zhang : gdiplus: Support recording pen custom end line cap.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: 78261ecb98443dd07426afb7e5cacd5ecf979c95 URL:
https://gitlab.winehq.org/wine/wine/-/commit/78261ecb98443dd07426afb7e5cacd…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Fri Apr 28 16:45:51 2023 +0800 gdiplus: Support recording pen custom end line cap. --- dlls/gdiplus/metafile.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index 26f17ad6182..92c818afbac 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -4745,6 +4745,7 @@ static GpStatus METAFILE_AddPathObject(GpMetafile *metafile, GpPath *path, DWORD static GpStatus METAFILE_AddPenObject(GpMetafile *metafile, GpPen *pen, DWORD *id) { DWORD custom_start_cap_size = 0, custom_start_cap_data_size = 0, custom_start_cap_path_size = 0; + DWORD custom_end_cap_size = 0, custom_end_cap_data_size = 0, custom_end_cap_path_size = 0; DWORD i, data_flags, pen_data_size, brush_size; EmfPlusObject *object_record; EmfPlusPenData *pen_data; @@ -4816,7 +4817,10 @@ static GpStatus METAFILE_AddPenObject(GpMetafile *metafile, GpPen *pen, DWORD *i } if (pen->customend) { - FIXME("ignoring custom end cup\n"); + data_flags |= PenDataCustomEndCap; + METAFILE_PrepareCustomLineCapData(pen->customend, &custom_end_cap_size, + &custom_end_cap_data_size, &custom_end_cap_path_size); + pen_data_size += custom_end_cap_size; } stat = METAFILE_PrepareBrushData(pen->brush, &brush_size); @@ -4912,6 +4916,13 @@ static GpStatus METAFILE_AddPenObject(GpMetafile *metafile, GpPen *pen, DWORD *i custom_start_cap_path_size); i += custom_start_cap_size; } + if (data_flags & PenDataCustomEndCap) + { + METAFILE_FillCustomLineCapData(pen->customend, pen_data->OptionalData + i, + pen->miterlimit, custom_end_cap_data_size, + custom_end_cap_path_size); + i += custom_end_cap_size; + } METAFILE_FillBrushData(pen->brush, (EmfPlusBrush*)(object_record->ObjectData.pen.data + pen_data_size));
1
0
0
0
Zhiyi Zhang : gdiplus: Support recording pen custom start line cap.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: abdd45c41a3f5a31815f2627eb6d3de2dfa9d342 URL:
https://gitlab.winehq.org/wine/wine/-/commit/abdd45c41a3f5a31815f2627eb6d3d…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Fri Apr 28 16:44:20 2023 +0800 gdiplus: Support recording pen custom start line cap. --- dlls/gdiplus/metafile.c | 223 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 208 insertions(+), 15 deletions(-) diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index 90ef39e34d6..26f17ad6182 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -46,6 +46,12 @@ HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT, IWICImagingFactory**); typedef ARGB EmfPlusARGB; +typedef struct EmfPlusPointF +{ + float X; + float Y; +} EmfPlusPointF; + typedef struct EmfPlusRecordHeader { WORD Type; @@ -177,6 +183,12 @@ enum PenDataFlags PenDataCustomEndCap = 0x1000 }; +enum CustomLineCapData +{ + CustomLineCapDataFillPath = 0x1, + CustomLineCapDataLinePath = 0x2, +}; + typedef struct EmfPlusTransformMatrix { REAL TransformMatrix[6]; @@ -287,14 +299,20 @@ typedef struct EmfPlusBrush } BrushData; } EmfPlusBrush; -typedef struct EmfPlusPen -{ - DWORD Version; - DWORD Type; - /* EmfPlusPenData */ - /* EmfPlusBrush */ - BYTE data[1]; -} EmfPlusPen; +typedef struct EmfPlusCustomLineCapArrowData +{ + REAL Width; + REAL Height; + REAL MiddleInset; + BOOL FillState; + DWORD LineStartCap; + DWORD LineEndCap; + DWORD LineJoin; + REAL LineMiterLimit; + REAL WidthScale; + EmfPlusPointF FillHotSpot; + EmfPlusPointF LineHotSpot; +} EmfPlusCustomLineCapArrowData; typedef struct EmfPlusPath { @@ -307,6 +325,55 @@ typedef struct EmfPlusPath BYTE data[1]; } EmfPlusPath; +typedef struct EmfPlusCustomLineCapDataFillPath +{ + INT FillPathLength; + /* EmfPlusPath */ + BYTE FillPath[1]; +} EmfPlusCustomLineCapDataFillPath; + +typedef struct EmfPlusCustomLineCapDataLinePath +{ + INT LinePathLength; + /* EmfPlusPath */ + BYTE LinePath[1]; +} EmfPlusCustomLineCapDataLinePath; + +typedef struct EmfPlusCustomLineCapData +{ + DWORD CustomLineCapDataFlags; + DWORD BaseCap; + REAL BaseInset; + DWORD StrokeStartCap; + DWORD StrokeEndCap; + DWORD StrokeJoin; + REAL StrokeMiterLimit; + REAL WidthScale; + EmfPlusPointF FillHotSpot; + EmfPlusPointF LineHotSpot; + /* EmfPlusCustomLineCapDataFillPath */ + /* EmfPlusCustomLineCapDataLinePath */ + BYTE OptionalData[1]; +} EmfPlusCustomLineCapData; + +typedef struct EmfPlusCustomLineCap +{ + DWORD Version; + DWORD Type; + /* EmfPlusCustomLineCapArrowData */ + /* EmfPlusCustomLineCapData */ + BYTE CustomLineCapData[1]; +} EmfPlusCustomLineCap; + +typedef struct EmfPlusPen +{ + DWORD Version; + DWORD Type; + /* EmfPlusPenData */ + /* EmfPlusBrush */ + BYTE data[1]; +} EmfPlusPen; + typedef struct EmfPlusRegionNodePath { DWORD RegionNodePathLength; @@ -416,12 +483,6 @@ typedef struct EmfPlusPoint short Y; } EmfPlusPoint; -typedef struct EmfPlusPointF -{ - float X; - float Y; -} EmfPlusPointF; - typedef struct EmfPlusDrawImage { EmfPlusRecordHeader Header; @@ -1055,6 +1116,127 @@ static void METAFILE_FillBrushData(GDIPCONST GpBrush *brush, EmfPlusBrush *data) } } +static void METAFILE_PrepareCustomLineCapData(GDIPCONST GpCustomLineCap *cap, DWORD *ret_cap_size, + DWORD *ret_cap_data_size, DWORD *ret_path_size) +{ + DWORD cap_size, path_size = 0; + + /* EmfPlusCustomStartCapData */ + cap_size = FIELD_OFFSET(EmfPlusCustomStartCapData, data); + /* -> EmfPlusCustomLineCap */ + cap_size += FIELD_OFFSET(EmfPlusCustomLineCap, CustomLineCapData); + /* -> EmfPlusCustomLineCapArrowData */ + if (cap->type == CustomLineCapTypeAdjustableArrow) + cap_size += sizeof(EmfPlusCustomLineCapArrowData); + /* -> EmfPlusCustomLineCapData */ + else + { + /* -> EmfPlusCustomLineCapOptionalData */ + cap_size += FIELD_OFFSET(EmfPlusCustomLineCapData, OptionalData); + if (cap->fill) + /* -> EmfPlusCustomLineCapDataFillPath */ + cap_size += FIELD_OFFSET(EmfPlusCustomLineCapDataFillPath, FillPath); + else + /* -> EmfPlusCustomLineCapDataLinePath */ + cap_size += FIELD_OFFSET(EmfPlusCustomLineCapDataLinePath, LinePath); + + /* -> EmfPlusPath in EmfPlusCustomLineCapDataFillPath and EmfPlusCustomLineCapDataLinePath */ + path_size = FIELD_OFFSET(EmfPlusPath, data); + path_size += sizeof(PointF) * cap->pathdata.Count; + path_size += sizeof(BYTE) * cap->pathdata.Count; + path_size = (path_size + 3) & ~3; + + cap_size += path_size; + } + + *ret_cap_size = cap_size; + *ret_cap_data_size = cap_size - FIELD_OFFSET(EmfPlusCustomStartCapData, data); + *ret_path_size = path_size; +} + +static void METAFILE_FillCustomLineCapData(GDIPCONST GpCustomLineCap *cap, BYTE *ptr, + REAL line_miter_limit, DWORD data_size, DWORD path_size) +{ + EmfPlusCustomStartCapData *cap_data; + EmfPlusCustomLineCap *line_cap; + DWORD i; + + cap_data = (EmfPlusCustomStartCapData *)ptr; + cap_data->CustomStartCapSize = data_size; + i = FIELD_OFFSET(EmfPlusCustomStartCapData, data); + + line_cap = (EmfPlusCustomLineCap *)(ptr + i); + line_cap->Version = VERSION_MAGIC2; + line_cap->Type = cap->type; + i += FIELD_OFFSET(EmfPlusCustomLineCap, CustomLineCapData); + + if (cap->type == CustomLineCapTypeAdjustableArrow) + { + EmfPlusCustomLineCapArrowData *arrow_data; + GpAdjustableArrowCap *arrow_cap; + + arrow_data = (EmfPlusCustomLineCapArrowData *)(ptr + i); + arrow_cap = (GpAdjustableArrowCap *)cap; + arrow_data->Width = arrow_cap->width; + arrow_data->Height = arrow_cap->height; + arrow_data->MiddleInset = arrow_cap->middle_inset; + arrow_data->FillState = arrow_cap->cap.fill; + arrow_data->LineStartCap = arrow_cap->cap.strokeStartCap; + arrow_data->LineEndCap = arrow_cap->cap.strokeEndCap; + arrow_data->LineJoin = arrow_cap->cap.join; + arrow_data->LineMiterLimit = line_miter_limit; + arrow_data->WidthScale = arrow_cap->cap.scale; + arrow_data->FillHotSpot.X = 0; + arrow_data->FillHotSpot.Y = 0; + arrow_data->LineHotSpot.X = 0; + arrow_data->LineHotSpot.Y = 0; + } + else + { + EmfPlusCustomLineCapData *line_cap_data = (EmfPlusCustomLineCapData *)(ptr + i); + EmfPlusPath *path; + + if (cap->fill) + line_cap_data->CustomLineCapDataFlags = CustomLineCapDataFillPath; + else + line_cap_data->CustomLineCapDataFlags = CustomLineCapDataLinePath; + line_cap_data->BaseCap = cap->basecap; + line_cap_data->BaseInset = cap->inset; + line_cap_data->StrokeStartCap = cap->strokeStartCap; + line_cap_data->StrokeEndCap = cap->strokeEndCap; + line_cap_data->StrokeJoin = cap->join; + line_cap_data->StrokeMiterLimit = line_miter_limit; + line_cap_data->WidthScale = cap->scale; + line_cap_data->FillHotSpot.X = 0; + line_cap_data->FillHotSpot.Y = 0; + line_cap_data->LineHotSpot.X = 0; + line_cap_data->LineHotSpot.Y = 0; + i += FIELD_OFFSET(EmfPlusCustomLineCapData, OptionalData); + + if (cap->fill) + { + EmfPlusCustomLineCapDataFillPath *fill_path = (EmfPlusCustomLineCapDataFillPath *)(ptr + i); + fill_path->FillPathLength = path_size; + i += FIELD_OFFSET(EmfPlusCustomLineCapDataFillPath, FillPath); + } + else + { + EmfPlusCustomLineCapDataLinePath *line_path = (EmfPlusCustomLineCapDataLinePath *)(ptr + i); + line_path->LinePathLength = path_size; + i += FIELD_OFFSET(EmfPlusCustomLineCapDataLinePath, LinePath); + } + + path = (EmfPlusPath *)(ptr + i); + path->Version = VERSION_MAGIC2; + path->PathPointCount = cap->pathdata.Count; + path->PathPointFlags = 0; + i += FIELD_OFFSET(EmfPlusPath, data); + memcpy(ptr + i, cap->pathdata.Points, cap->pathdata.Count * sizeof(PointF)); + i += cap->pathdata.Count * sizeof(PointF); + memcpy(ptr + i, cap->pathdata.Types, cap->pathdata.Count * sizeof(BYTE)); + } +} + static GpStatus METAFILE_AddBrushObject(GpMetafile *metafile, GDIPCONST GpBrush *brush, DWORD *id) { EmfPlusObject *object_record; @@ -4562,6 +4744,7 @@ static GpStatus METAFILE_AddPathObject(GpMetafile *metafile, GpPath *path, DWORD static GpStatus METAFILE_AddPenObject(GpMetafile *metafile, GpPen *pen, DWORD *id) { + DWORD custom_start_cap_size = 0, custom_start_cap_data_size = 0, custom_start_cap_path_size = 0; DWORD i, data_flags, pen_data_size, brush_size; EmfPlusObject *object_record; EmfPlusPenData *pen_data; @@ -4626,7 +4809,10 @@ static GpStatus METAFILE_AddPenObject(GpMetafile *metafile, GpPen *pen, DWORD *i /* TODO: Add support for PenDataCompoundLine */ if (pen->customstart) { - FIXME("ignoring custom start cup\n"); + data_flags |= PenDataCustomStartCap; + METAFILE_PrepareCustomLineCapData(pen->customstart, &custom_start_cap_size, + &custom_start_cap_data_size, &custom_start_cap_path_size); + pen_data_size += custom_start_cap_size; } if (pen->customend) { @@ -4719,6 +4905,13 @@ static GpStatus METAFILE_AddPenObject(GpMetafile *metafile, GpPen *pen, DWORD *i *(REAL*)(pen_data->OptionalData + i) = pen->align; i += sizeof(DWORD); } + if (data_flags & PenDataCustomStartCap) + { + METAFILE_FillCustomLineCapData(pen->customstart, pen_data->OptionalData + i, + pen->miterlimit, custom_start_cap_data_size, + custom_start_cap_path_size); + i += custom_start_cap_size; + } METAFILE_FillBrushData(pen->brush, (EmfPlusBrush*)(object_record->ObjectData.pen.data + pen_data_size));
1
0
0
0
Zhiyi Zhang : gdiplus/tests: Add pen custom line cap record and play back tests.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: f76caee6e733c25b8cec414e39a5f8aa11916363 URL:
https://gitlab.winehq.org/wine/wine/-/commit/f76caee6e733c25b8cec414e39a5f8…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Sun May 14 15:34:24 2023 +0800 gdiplus/tests: Add pen custom line cap record and play back tests. --- dlls/gdiplus/tests/metafile.c | 126 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c index aa844a62ff9..ceca8e4a9bb 100644 --- a/dlls/gdiplus/tests/metafile.c +++ b/dlls/gdiplus/tests/metafile.c @@ -3874,6 +3874,131 @@ static void test_setclippath(void) expect(Ok, stat); } +static const emfplus_record pen_dc_records[] = +{ + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeObject, ObjectTypePen << 8 }, + { EmfPlusRecordTypeObject, (ObjectTypePath << 8) | 1 }, + { EmfPlusRecordTypeDrawPath, 1 }, + { EMR_SAVEDC, 0, 1 }, + { EMR_SETICMMODE, 0, 1 }, + { EMR_BITBLT, 0, 1 }, + { EMR_RESTOREDC, 0, 1 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } +}; + +static const emfplus_record pen_bitmap_records[] = +{ + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeObject, ObjectTypePen << 8 }, + { EmfPlusRecordTypeObject, (ObjectTypePath << 8) | 1 }, + { EmfPlusRecordTypeDrawPath, 1 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } +}; + +static void test_pen(void) +{ + static const GpPointF dst_points[3] = {{0.0, 0.0}, {100.0, 0.0}, {0.0, 100.0}}; + static const GpRectF frame = {0.0, 0.0, 100.0, 100.0}; + GpMetafile *metafile, *clone_metafile; + GpPath *draw_path, *line_cap_path; + GpCustomLineCap *custom_line_cap; + GpGraphics *graphics; + HENHMETAFILE hemf; + GpBitmap *bitmap; + GpStatus stat; + ARGB color; + GpPen *pen; + BOOL ret; + HDC hdc; + + /* Record */ + hdc = CreateCompatibleDC(0); + stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile); + expect(Ok, stat); + DeleteDC(hdc); + + stat = GdipGetImageGraphicsContext((GpImage *)metafile, &graphics); + expect(Ok, stat); + + stat = GdipCreatePath(FillModeAlternate, &draw_path); + expect(Ok, stat); + stat = GdipAddPathLine(draw_path, 25, 25, 25, 75); + expect(Ok, stat); + + stat = GdipCreatePen1((ARGB)0xffff0000, 1.0f, UnitPixel, &pen); + expect(Ok, stat); + stat = GdipCreatePath(FillModeAlternate, &line_cap_path); + expect(Ok, stat); + stat = GdipAddPathRectangle(line_cap_path, 5.0, 5.0, 10.0, 10.0); + expect(Ok, stat); + stat = GdipCreateCustomLineCap(NULL, line_cap_path, LineCapCustom, 0.0, &custom_line_cap); + expect(Ok, stat); + stat = GdipSetPenCustomStartCap(pen, custom_line_cap); + expect(Ok, stat); + stat = GdipSetPenCustomEndCap(pen, custom_line_cap); + expect(Ok, stat); + stat = GdipDeleteCustomLineCap(custom_line_cap); + expect(Ok, stat); + stat = GdipDeletePath(line_cap_path); + expect(Ok, stat); + + stat = GdipDrawPath(graphics, pen, draw_path); + expect(Ok, stat); + + stat = GdipDeletePen(pen); + expect(Ok, stat); + stat = GdipDeletePath(draw_path); + expect(Ok, stat); + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + sync_metafile(&metafile, "pen.emf"); + GdipCloneImage((GpImage *)metafile, (GpImage **)&clone_metafile); + + stat = GdipGetHemfFromMetafile(metafile, &hemf); + expect(Ok, stat); + + check_emfplus(hemf, pen_dc_records, "pen record"); + + ret = DeleteEnhMetaFile(hemf); + ok(ret != 0, "Failed to delete enhmetafile.\n"); + stat = GdipDisposeImage((GpImage *)metafile); + expect(Ok, stat); + + /* Play back */ + stat = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat24bppRGB, NULL, &bitmap); + expect(Ok, stat); + + stat = GdipGetImageGraphicsContext((GpImage *)bitmap, &graphics); + expect(Ok, stat); + + play_metafile(clone_metafile, graphics, pen_bitmap_records, "pen playback", dst_points, &frame, UnitPixel); + + stat = GdipBitmapGetPixel(bitmap, 10, 10, &color); + expect(Ok, stat); + todo_wine + expect(0xffff0000, color); + + stat = GdipBitmapGetPixel(bitmap, 40, 90, &color); + expect(Ok, stat); + todo_wine + expect(0xffff0000, color); + + stat = GdipDisposeImage((GpImage *)clone_metafile); + expect(Ok, stat); + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + stat = GdipDisposeImage((GpImage *)bitmap); + expect(Ok, stat); +} + START_TEST(metafile) { struct GdiplusStartupInput gdiplusStartupInput; @@ -3934,6 +4059,7 @@ START_TEST(metafile) test_offsetclip(); test_resetclip(); test_setclippath(); + test_pen(); GdiplusShutdown(gdiplusToken); }
1
0
0
0
David Kahurani : gdiplus: Handle Windows style newline.
by Alexandre Julliard
29 May '23
29 May '23
Module: wine Branch: master Commit: c1da4fb1670e8b05b47fb01d4bc30d62857c348b URL:
https://gitlab.winehq.org/wine/wine/-/commit/c1da4fb1670e8b05b47fb01d4bc30d…
Author: David Kahurani <k.kahurani(a)gmail.com> Date: Thu May 25 19:14:04 2023 +0300 gdiplus: Handle Windows style newline. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54962
Signed-off-by: David Kahurani <k.kahurani(a)gmail.com> --- dlls/gdiplus/graphics.c | 33 +++++++++++++++++++++++++++------ dlls/gdiplus/tests/graphics.c | 7 +++++++ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 03542b31ea7..835c2889bd1 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5186,7 +5186,7 @@ GpStatus gdip_format_string(HDC hdc, INT *hotkeyprefix_offsets=NULL; INT hotkeyprefix_count=0; INT hotkeyprefix_pos=0, hotkeyprefix_end_pos=0; - BOOL seen_prefix = FALSE; + BOOL seen_prefix = FALSE, unixstyle_newline = TRUE; if(length == -1) length = lstrlenW(string); @@ -5259,9 +5259,20 @@ GpStatus gdip_format_string(HDC hdc, if(fit == 0) break; - for(lret = 0; lret < fit; lret++) + for(lret = 0; lret < fit; lret++) { if(*(stringdup + sum + lret) == '\n') - break; + { + unixstyle_newline = TRUE; + break; + } + + if(*(stringdup + sum + lret) == '\r' && lret + 1 < fit + && *(stringdup + sum + lret + 1) == '\n') + { + unixstyle_newline = FALSE; + break; + } + } /* Line break code (may look strange, but it imitates windows). */ if(lret < fit) @@ -5332,9 +5343,19 @@ GpStatus gdip_format_string(HDC hdc, if (stat != Ok) break; - sum += fit + (lret < fitcpy ? 1 : 0); - height += size.cy; - lineno++; + + if (unixstyle_newline) + { + height += size.cy; + lineno++; + sum += fit + (lret < fitcpy ? 1 : 0); + } + else + { + height += size.cy; + lineno++; + sum += fit + (lret < fitcpy ? 2 : 0); + } hotkeyprefix_pos = hotkeyprefix_end_pos; diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 0ee2b73c413..0456a451970 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -3197,6 +3197,7 @@ static void test_string_functions(void) HDC hdc = GetDC( hwnd ); const WCHAR teststring[] = L"MM M\nM"; const WCHAR teststring2[] = L"j"; + const WCHAR teststring3[] = L"MM M\r\nM\0"; REAL char_width, char_height; INT codepointsfitted, linesfilled; GpStringFormat *format; @@ -3268,6 +3269,12 @@ static void test_string_functions(void) status = GdipMeasureString(graphics, teststring, 6, font, &rc, NULL, &bounds, &codepointsfitted, NULL); expect(Ok, status); + /* new line handling */ + status = GdipMeasureString(graphics, teststring3, -1, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled); + expect(Ok, status); + expect(7, codepointsfitted); + expect(2, linesfilled); + status = GdipMeasureString(graphics, teststring, 1, font, &rc, NULL, &char_bounds, &codepointsfitted, &linesfilled); expect(Ok, status); expectf(0.0, char_bounds.X);
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
78
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Results per page:
10
25
50
100
200