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
November 2020
----- 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
851 discussions
Start a n
N
ew thread
Alexandre Julliard : gdi32: Use ntdll functions for DOS<->Unix path conversions.
by Alexandre Julliard
05 Nov '20
05 Nov '20
Module: wine Branch: master Commit: acc1f6545f2afa6b8365933833aa50f759cf0656 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=acc1f6545f2afa6b83659338…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Nov 5 10:04:15 2020 +0100 gdi32: Use ntdll functions for DOS<->Unix path conversions. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 7324622a4e3..c3626f18358 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -93,6 +93,8 @@ #endif #endif /* HAVE_FT2BUILD_H */ +#include "ntstatus.h" +#define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" #include "winternl.h" @@ -1097,6 +1099,57 @@ fail: return NULL; } +static WCHAR *get_dos_file_name( LPCSTR str ) +{ + WCHAR *buffer; + SIZE_T len = strlen(str) + 1; + + len += 8; /* \??\unix prefix */ + if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL; + if (wine_unix_to_nt_file_name( str, buffer, &len )) + { + RtlFreeHeap( GetProcessHeap(), 0, buffer ); + return NULL; + } + if (buffer[5] == ':') + { + /* get rid of the \??\ prefix */ + /* FIXME: should implement RtlNtPathNameToDosPathName and use that instead */ + memmove( buffer, buffer + 4, (len - 4) * sizeof(WCHAR) ); + } + else buffer[1] = '\\'; + return buffer; +} + +static char *get_unix_file_name( LPCWSTR dosW ) +{ + UNICODE_STRING nt_name; + NTSTATUS status; + SIZE_T size = 256; + char *buffer; + + if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL; + for (;;) + { + if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + { + RtlFreeUnicodeString( &nt_name ); + return NULL; + } + status = wine_nt_to_unix_file_name( &nt_name, buffer, &size, FILE_OPEN_IF ); + if (status != STATUS_BUFFER_TOO_SMALL) break; + RtlFreeHeap( GetProcessHeap(), 0, buffer ); + } + RtlFreeUnicodeString( &nt_name ); + if (status && status != STATUS_NO_SUCH_FILE) + { + RtlFreeHeap( GetProcessHeap(), 0, buffer ); + RtlSetLastWin32ErrorAndNtStatusFromNtStatus( status ); + return NULL; + } + return buffer; +} + static INT AddFontToList(const WCHAR *dos_name, const char *unix_name, void *font_data_ptr, DWORD font_data_size, DWORD flags) { @@ -1129,7 +1182,7 @@ static INT AddFontToList(const WCHAR *dos_name, const char *unix_name, void *fon } #endif /* HAVE_CARBON_CARBON_H */ - if (!dos_name && unix_name) dos_name = filename = wine_get_dos_file_name( unix_name ); + if (!dos_name && unix_name) dos_name = filename = get_dos_file_name( unix_name ); do { ft_face = new_ft_face( unix_name, font_data_ptr, font_data_size, face_index, flags & ADDFONT_ALLOW_BITMAP ); @@ -1157,7 +1210,7 @@ static INT AddFontToList(const WCHAR *dos_name, const char *unix_name, void *fon static INT CDECL freetype_add_font( const WCHAR *file, DWORD flags ) { int ret = 0; - char *unixname = wine_get_unix_file_name( file ); + char *unixname = get_unix_file_name( file ); if (unixname) { @@ -2110,7 +2163,7 @@ static BOOL CDECL freetype_load_font( struct gdi_font *font ) if (font->file[0]) { - char *filename = wine_get_unix_file_name( font->file ); + char *filename = get_unix_file_name( font->file ); data->mapping = map_font_file( filename ); HeapFree( GetProcessHeap(), 0, filename ); if (!data->mapping)
1
0
0
0
Alexandre Julliard : gdi32: Use ntdll functions for codepage conversions.
by Alexandre Julliard
05 Nov '20
05 Nov '20
Module: wine Branch: master Commit: 8db165000d7188468bf55f9f73deca13a82a5749 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8db165000d7188468bf55f9f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Nov 5 10:02:50 2020 +0100 gdi32: Use ntdll functions for codepage conversions. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 62 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index c73305ad494..7324622a4e3 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -561,14 +561,11 @@ static LPWSTR strdupW(LPCWSTR p) return ret; } -static WCHAR *towstr(UINT cp, const char *str) +static WCHAR *towstr(const char *str) { - int len; - WCHAR *wstr; - - len = MultiByteToWideChar(cp, 0, str, -1, NULL, 0); - wstr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - MultiByteToWideChar(cp, 0, str, -1, wstr, len); + DWORD len = strlen(str) + 1; + WCHAR *wstr = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + RtlMultiByteToUnicodeN( wstr, len * sizeof(WCHAR), &len, str, len ); return wstr; } @@ -697,10 +694,21 @@ static const LANGID mac_langid_table[] = MAKELANGID(LANG_AZERI,SUBLANG_AZERI_LATIN), /* TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT */ }; -static inline WORD get_mac_code_page( const FT_SfntName *name ) +static CPTABLEINFO *get_mac_code_page( const FT_SfntName *name ) { - if (name->encoding_id == TT_MAC_ID_SIMPLIFIED_CHINESE) return 10008; /* special case */ - return 10000 + name->encoding_id; + static CPTABLEINFO tables[100]; + int id = name->encoding_id; + USHORT *ptr; + SIZE_T size; + + if (name->encoding_id == TT_MAC_ID_SIMPLIFIED_CHINESE) id = 8; /* special case */ + if (id >= ARRAY_SIZE(tables)) return NULL; + if (!tables[id].CodePage) + { + if (NtGetNlsSectionPtr( 11, 10000 + id, NULL, (void **)&ptr, &size )) return NULL; + RtlInitCodePageTable( ptr, &tables[id] ); + } + return &tables[id]; } static int match_name_table_language( const FT_SfntName *name, LANGID lang ) @@ -723,7 +731,7 @@ static int match_name_table_language( const FT_SfntName *name, LANGID lang ) } break; case TT_PLATFORM_MACINTOSH: - if (!IsValidCodePage( get_mac_code_page( name ))) return 0; + if (!get_mac_code_page( name )) return 0; if (name->language_id >= ARRAY_SIZE( mac_langid_table )) return 0; name_lang = mac_langid_table[name->language_id]; break; @@ -754,8 +762,8 @@ static int match_name_table_language( const FT_SfntName *name, LANGID lang ) static WCHAR *copy_name_table_string( const FT_SfntName *name ) { WCHAR *ret; - WORD codepage; - int i; + CPTABLEINFO *cp; + DWORD i; switch (name->platform_id) { @@ -767,11 +775,11 @@ static WCHAR *copy_name_table_string( const FT_SfntName *name ) ret[i] = 0; return ret; case TT_PLATFORM_MACINTOSH: - codepage = get_mac_code_page( name ); - i = MultiByteToWideChar( codepage, 0, (char *)name->string, name->string_len, NULL, 0 ); - ret = HeapAlloc( GetProcessHeap(), 0, (i + 1) * sizeof(WCHAR) ); - MultiByteToWideChar( codepage, 0, (char *)name->string, name->string_len, ret, i ); - ret[i] = 0; + if (!(cp = get_mac_code_page( name ))) return NULL; + ret = RtlAllocateHeap( GetProcessHeap(), 0, (name->string_len + 1) * sizeof(WCHAR) ); + RtlCustomCPToUnicodeN( cp, ret, name->string_len * sizeof(WCHAR), &i, + (char *)name->string, name->string_len ); + ret[i / sizeof(WCHAR)] = 0; return ret; } return NULL; @@ -816,7 +824,7 @@ static WCHAR *ft_face_get_family_name( FT_Face ft_face, LANGID langid ) if ((family_name = get_face_name( ft_face, TT_NAME_ID_FONT_FAMILY, langid ))) return family_name; - return towstr( CP_ACP, ft_face->family_name ); + return towstr( ft_face->family_name ); } static WCHAR *ft_face_get_style_name( FT_Face ft_face, LANGID langid ) @@ -826,7 +834,7 @@ static WCHAR *ft_face_get_style_name( FT_Face ft_face, LANGID langid ) if ((style_name = get_face_name( ft_face, TT_NAME_ID_FONT_SUBFAMILY, langid ))) return style_name; - return towstr( CP_ACP, ft_face->style_name ); + return towstr( ft_face->style_name ); } static WCHAR *ft_face_get_full_name( FT_Face ft_face, LANGID langid ) @@ -2053,16 +2061,17 @@ static BOOL CDECL fontconfig_enum_family_fallbacks( DWORD pitch_and_family, int { #ifdef SONAME_LIBFONTCONFIG FcPattern *pat; - FcChar8 *str; + char *str; + DWORD len; if ((pitch_and_family & FIXED_PITCH) || (pitch_and_family & 0xf0) == FF_MODERN) pat = pattern_fixed; else if ((pitch_and_family & 0xf0) == FF_ROMAN) pat = pattern_serif; else pat = pattern_sans; if (!pat) return FALSE; - if (pFcPatternGetString( pat, FC_FAMILY, index, &str ) != FcResultMatch) return FALSE; - if (!MultiByteToWideChar( CP_UTF8, 0, (char *)str, -1, buffer, LF_FACESIZE )) - buffer[LF_FACESIZE - 1] = 0; + if (pFcPatternGetString( pat, FC_FAMILY, index, (FcChar8 **)&str ) != FcResultMatch) return FALSE; + RtlUTF8ToUnicodeN( buffer, (LF_FACESIZE - 1) * sizeof(WCHAR), &len, str, strlen(str) ); + buffer[len / sizeof(WCHAR)] = 0; return TRUE; #endif return FALSE; @@ -2228,10 +2237,11 @@ static BOOL CDECL freetype_get_glyph_index( struct gdi_font *font, UINT *glyph, if (!(*glyph = get_glyph_index_symbol( font, *glyph ))) { WCHAR wc = *glyph; + DWORD len; char ch; - if (WideCharToMultiByte( CP_ACP, 0, &wc, 1, &ch, 1, NULL, NULL )) - *glyph = get_glyph_index_symbol( font, (unsigned char)ch ); + RtlUnicodeToMultiByteN( &ch, 1, &len, &wc, sizeof(wc) ); + if (len) *glyph = get_glyph_index_symbol( font, (unsigned char)ch ); } return TRUE; }
1
0
0
0
Alexandre Julliard : gdi32: Use FT_MulDiv() instead of the kernel32 function.
by Alexandre Julliard
05 Nov '20
05 Nov '20
Module: wine Branch: master Commit: fd9e1612d9a0c40dfefead092bb11d6cf79cf5e1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fd9e1612d9a0c40dfefead09…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Nov 5 10:01:32 2020 +0100 gdi32: Use FT_MulDiv() instead of the kernel32 function. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index ff39ffd9541..c73305ad494 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -146,6 +146,7 @@ MAKE_FUNCPTR(FT_Library_Version); MAKE_FUNCPTR(FT_Load_Glyph); MAKE_FUNCPTR(FT_Load_Sfnt_Table); MAKE_FUNCPTR(FT_Matrix_Multiply); +MAKE_FUNCPTR(FT_MulDiv); #ifdef FT_MULFIX_INLINED #define pFT_MulFix FT_MULFIX_INLINED #else @@ -1509,6 +1510,7 @@ static BOOL init_freetype(void) LOAD_FUNCPTR(FT_Load_Glyph) LOAD_FUNCPTR(FT_Load_Sfnt_Table) LOAD_FUNCPTR(FT_Matrix_Multiply) + LOAD_FUNCPTR(FT_MulDiv) #ifndef FT_MULFIX_INLINED LOAD_FUNCPTR(FT_MulFix) #endif @@ -1635,11 +1637,9 @@ static LONG calc_ppem_for_height(FT_Face ft_face, LONG height) if(height > 0) { USHORT windescent = get_fixed_windescent(pOS2->usWinDescent); if(pOS2->usWinAscent + windescent == 0) - ppem = MulDiv(ft_face->units_per_EM, height, - pHori->Ascender - pHori->Descender); + ppem = pFT_MulDiv(ft_face->units_per_EM, height, pHori->Ascender - pHori->Descender); else - ppem = MulDiv(ft_face->units_per_EM, height, - pOS2->usWinAscent + windescent); + ppem = pFT_MulDiv(ft_face->units_per_EM, height, pOS2->usWinAscent + windescent); if(ppem > MAX_PPEM) { WARN("Ignoring too large height %d, ppem %d\n", height, ppem); ppem = 1; @@ -2340,7 +2340,7 @@ static BOOL get_transform_matrices( struct gdi_font *font, BOOL vertical, const FT_Matrix rotation_mat; FT_Vector angle; - pFT_Vector_Unit( &angle, MulDiv( 1 << 16, font->lf.lfOrientation, 10 ) ); + pFT_Vector_Unit( &angle, pFT_MulDiv( 1 << 16, font->lf.lfOrientation, 10 ) ); rotation_mat.xx = angle.x; rotation_mat.xy = -angle.y; rotation_mat.yx = angle.y; @@ -2401,7 +2401,7 @@ static BOOL get_bold_glyph_outline(FT_GlyphSlot glyph, LONG ppem, FT_Glyph_Metri if(!pFT_Outline_Embolden) return FALSE; - strength = MulDiv(ppem, 1 << 6, 24); + strength = pFT_MulDiv(ppem, 1 << 6, 24); err = pFT_Outline_Embolden(&glyph->outline, strength); if(err) { TRACE("FT_Ouline_Embolden returns %d\n", err); @@ -2452,8 +2452,7 @@ static FT_Vector get_advance_metric(struct gdi_font *incoming_font, struct gdi_f if (freetype_set_outline_text_metrics(incoming_font) && !(incoming_font->otm.otmTextMetrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) { UINT avg_advance; - em_scale = MulDiv(incoming_font->ppem, 1 << 16, - get_ft_face(incoming_font)->units_per_EM); + em_scale = pFT_MulDiv(incoming_font->ppem, 1 << 16, get_ft_face(incoming_font)->units_per_EM); avg_advance = pFT_MulFix(incoming_font->ntmAvgWidth, em_scale); fixed_pitch_full = (avg_advance > 0 && (base_advance + 63) >> 6 == @@ -3395,7 +3394,7 @@ static BOOL CDECL freetype_set_outline_text_metrics( struct gdi_font *font ) strlenW( (WCHAR *)font->otm.otmpFaceName ) + 1 + strlenW( (WCHAR *)font->otm.otmpFullName ) + 1) * sizeof(WCHAR); - em_scale = (FT_Fixed)MulDiv(font->ppem, 1 << 16, ft_face->units_per_EM); + em_scale = (FT_Fixed)pFT_MulDiv(font->ppem, 1 << 16, ft_face->units_per_EM); pOS2 = pFT_Get_Sfnt_Table(ft_face, ft_sfnt_os2); if(!pOS2) { @@ -3651,7 +3650,7 @@ static BOOL CDECL freetype_get_char_width_info( struct gdi_font *font, struct ch if ((pHori = pFT_Get_Sfnt_Table(ft_face, ft_sfnt_hhea))) { - FT_Fixed em_scale = MulDiv(font->ppem, 1 << 16, ft_face->units_per_EM); + FT_Fixed em_scale = pFT_MulDiv(font->ppem, 1 << 16, ft_face->units_per_EM); info->lsb = (SHORT)pFT_MulFix(pHori->min_Left_Side_Bearing, em_scale); info->rsb = (SHORT)pFT_MulFix(pHori->min_Right_Side_Bearing, em_scale); return TRUE;
1
0
0
0
Alexandre Julliard : gdi32: Store scale as an integer.
by Alexandre Julliard
05 Nov '20
05 Nov '20
Module: wine Branch: master Commit: 8768f605273c88d1041afcdd4375a87b9adb8d32 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8768f605273c88d1041afcdd…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Nov 5 09:59:32 2020 +0100 gdi32: Store scale as an integer. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 4 ++-- dlls/gdi32/freetype.c | 4 ++-- dlls/gdi32/gdi_private.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 300b8fc1106..6a76e28d06d 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -1698,7 +1698,7 @@ static struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_ font->refcount = 1; font->matrix.eM11 = font->matrix.eM22 = 1.0; - font->scale_y = 1.0; + font->scale_y = 1; font->kern_count = -1; list_init( &font->child_fonts ); @@ -3686,8 +3686,8 @@ static struct gdi_font *select_font( LOGFONTW *lf, FMAT2 dcmat, BOOL can_use_bit /* The jump between unscaled and doubled is delayed by 1 */ else if (scale == 2 && scaled_height - height > (face->size.height / 4 - 1)) scale--; font->scale_y = scale; + TRACE("font scale y: %d\n", font->scale_y); } - TRACE("font scale y: %f\n", font->scale_y); if (!font_funcs->load_font( font )) { diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index c23ed714b4c..ff39ffd9541 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -2308,13 +2308,13 @@ static BOOL get_transform_matrices( struct gdi_font *font, BOOL vertical, const width_ratio = font->scale_y; /* Scaling transform */ - if (width_ratio != 1.0 || font->scale_y != 1.0) + if (width_ratio != 1.0 || font->scale_y != 1) { FT_Matrix scale_mat; scale_mat.xx = FT_FixedFromFloat( width_ratio ); scale_mat.xy = 0; scale_mat.yx = 0; - scale_mat.yy = FT_FixedFromFloat( font->scale_y ); + scale_mat.yy = font->scale_y << 16; pFT_Matrix_Multiply( &scale_mat, &matrices[matrix_unrotated] ); needs_transform = TRUE; diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 12f469af979..c5703689d46 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -335,7 +335,7 @@ struct gdi_font LOGFONTW lf; FMAT2 matrix; UINT face_index; - double scale_y; + INT scale_y; INT aveWidth; INT ppem; SHORT yMax;
1
0
0
0
Alexandre Julliard : gdi32: Don't abort enumeration if a font fails to load.
by Alexandre Julliard
05 Nov '20
05 Nov '20
Module: wine Branch: master Commit: fe6bb5f72394b4d56c6f4956363f347b050ce4ee URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fe6bb5f72394b4d56c6f4956…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Nov 5 09:59:22 2020 +0100 gdi32: Don't abort enumeration if a font fails to load. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 89197361fe2..300b8fc1106 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -2772,11 +2772,11 @@ static BOOL enum_face_charsets( const struct gdi_font_family *family, struct gdi { struct gdi_font_enum_data *data; - if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) ))) return FALSE; - if (!get_face_enum_data( face, &data->elf, &data->ntm )) + if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) )) || + !get_face_enum_data( face, &data->elf, &data->ntm )) { HeapFree( GetProcessHeap(), 0, data ); - return FALSE; + return TRUE; } face->cached_enum_data = data; }
1
0
0
0
Brendan Shanks : include: Force stack alignment on x86_64 with Clang.
by Alexandre Julliard
05 Nov '20
05 Nov '20
Module: wine Branch: master Commit: 91741446c7c8d2e6eb4c87774f20ef8eb9295254 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=91741446c7c8d2e6eb4c8777…
Author: Brendan Shanks <bshanks(a)codeweavers.com> Date: Wed Nov 4 17:29:28 2020 -0800 include: Force stack alignment on x86_64 with Clang. Signed-off-by: Brendan Shanks <bshanks(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/msvcrt/corecrt.h | 8 ++++++-- include/windef.h | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index ad46c56591c..587dcce2a54 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -57,6 +57,10 @@ #endif #endif +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + #if !defined(_MSC_VER) && !defined(__stdcall) # ifdef __i386__ # ifdef __GNUC__ @@ -69,7 +73,7 @@ # error You need to define __stdcall for your compiler # endif # elif defined(__x86_64__) && defined (__GNUC__) -# if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3)) +# if __has_attribute(__force_align_arg_pointer__) # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__)) # else # define __stdcall __attribute__((ms_abi)) @@ -91,7 +95,7 @@ # define __cdecl __attribute__((__cdecl__)) # endif # elif defined(__x86_64__) && defined (__GNUC__) -# if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3)) +# if __has_attribute(__force_align_arg_pointer__) # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__)) # else # define __cdecl __attribute__((ms_abi)) diff --git a/include/windef.h b/include/windef.h index 521c3ab4512..db5c60641d4 100644 --- a/include/windef.h +++ b/include/windef.h @@ -31,6 +31,10 @@ # endif /* STRICT */ #endif /* NO_STRICT */ +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + #ifdef __cplusplus extern "C" { #endif @@ -62,7 +66,7 @@ extern "C" { # error You need to define __stdcall for your compiler # endif # elif defined(__x86_64__) && defined (__GNUC__) -# if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3)) +# if __has_attribute(__force_align_arg_pointer__) # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__)) # else # define __stdcall __attribute__((ms_abi)) @@ -84,7 +88,7 @@ extern "C" { # define __cdecl __attribute__((__cdecl__)) # endif # elif defined(__x86_64__) && defined (__GNUC__) -# if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3)) +# if __has_attribute(__force_align_arg_pointer__) # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__)) # else # define __cdecl __attribute__((ms_abi))
1
0
0
0
Michael Stefaniuc : mpr: Use wide-char string literals.
by Alexandre Julliard
05 Nov '20
05 Nov '20
Module: wine Branch: master Commit: 2a9407dd1521fed6ba3183ef70a994b902162580 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2a9407dd1521fed6ba3183ef…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Thu Nov 5 02:17:10 2020 +0100 mpr: Use wide-char string literals. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mpr/tests/mpr.c | 4 ++-- dlls/mpr/wnet.c | 68 +++++++++++++++++++--------------------------------- 2 files changed, 26 insertions(+), 46 deletions(-) diff --git a/dlls/mpr/tests/mpr.c b/dlls/mpr/tests/mpr.c index 3e5ca099eb7..578853eb12a 100644 --- a/dlls/mpr/tests/mpr.c +++ b/dlls/mpr/tests/mpr.c @@ -31,7 +31,7 @@ static void test_WNetGetUniversalName(void) DWORD drive_type, info_size, fail_size; char driveA[] = "A:\\"; char driveandpathA[] = "A:\\file.txt"; - WCHAR driveW[] = {'A',':','\\',0}; + WCHAR driveW[] = L"A:\\"; for(; *driveA <= 'Z'; ++*driveA, ++*driveandpathA, ++*driveW){ drive_type = GetDriveTypeW(driveW); @@ -96,7 +96,7 @@ static void test_WNetGetRemoteName(void) DWORD drive_type, info_size, fail_size; char driveA[] = "A:\\"; char driveandpathA[] = "A:\\file.txt"; - WCHAR driveW[] = {'A',':','\\',0}; + WCHAR driveW[] = L"A:\\"; for(; *driveA <= 'Z'; ++*driveA, ++*driveandpathA, ++*driveW){ drive_type = GetDriveTypeW(driveW); diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c index 1333082705b..27dd1be15b5 100644 --- a/dlls/mpr/wnet.c +++ b/dlls/mpr/wnet.c @@ -126,29 +126,22 @@ static PWNetProviderTable providerTable; static void _tryLoadProvider(PCWSTR provider) { - static const WCHAR servicePrefix[] = { 'S','y','s','t','e','m','\\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'S','e','r','v','i','c','e','s','\\',0 }; - static const WCHAR serviceFmt[] = { '%','s','%','s','\\', - 'N','e','t','w','o','r','k','P','r','o','v','i','d','e','r',0 }; WCHAR serviceName[MAX_PATH]; HKEY hKey; TRACE("%s\n", debugstr_w(provider)); - swprintf(serviceName, ARRAY_SIZE(serviceName), serviceFmt, servicePrefix, provider); + swprintf(serviceName, ARRAY_SIZE(serviceName), L"%s%s\\NetworkProvider", + L"System\\CurrentControlSet\\Services\\", provider); serviceName[ARRAY_SIZE(serviceName) - 1] = '\0'; if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, serviceName, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { - static const WCHAR szProviderPath[] = { 'P','r','o','v','i','d','e','r', - 'P','a','t','h',0 }; WCHAR providerPath[MAX_PATH]; DWORD type, size = sizeof(providerPath); - if (RegQueryValueExW(hKey, szProviderPath, NULL, &type, - (LPBYTE)providerPath, &size) == ERROR_SUCCESS && (type == REG_SZ || type == REG_EXPAND_SZ)) + if (RegQueryValueExW(hKey, L"ProviderPath", NULL, &type, (BYTE *)providerPath, &size) == ERROR_SUCCESS + && (type == REG_SZ || type == REG_EXPAND_SZ)) { - static const WCHAR szProviderName[] = { 'N','a','m','e',0 }; PWSTR name = NULL; if (type == REG_EXPAND_SZ) @@ -158,12 +151,12 @@ static void _tryLoadProvider(PCWSTR provider) } size = 0; - RegQueryValueExW(hKey, szProviderName, NULL, NULL, NULL, &size); + RegQueryValueExW(hKey, L"Name", NULL, NULL, NULL, &size); if (size) { name = HeapAlloc(GetProcessHeap(), 0, size); - if (RegQueryValueExW(hKey, szProviderName, NULL, &type, - (LPBYTE)name, &size) != ERROR_SUCCESS || type != REG_SZ) + if (RegQueryValueExW(hKey, L"Name", NULL, &type, (BYTE *)name, &size) != ERROR_SUCCESS + || type != REG_SZ) { HeapFree(GetProcessHeap(), 0, name); name = NULL; @@ -252,7 +245,7 @@ static void _tryLoadProvider(PCWSTR provider) } } else - WARN("Couldn't open value %s\n", debugstr_w(szProviderPath)); + WARN("Couldn't open value ProviderPath\n"); RegCloseKey(hKey); } else @@ -262,21 +255,14 @@ static void _tryLoadProvider(PCWSTR provider) void wnetInit(HINSTANCE hInstDll) { - static const WCHAR providerOrderKey[] = { 'S','y','s','t','e','m','\\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'C','o','n','t','r','o','l','\\', - 'N','e','t','w','o','r','k','P','r','o','v','i','d','e','r','\\', - 'O','r','d','e','r',0 }; - static const WCHAR providerOrder[] = { 'P','r','o','v','i','d','e','r', - 'O','r','d','e','r',0 }; HKEY hKey; - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, providerOrderKey, 0, KEY_READ, &hKey) - == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\NetworkProvider\\Order", + 0, KEY_READ, &hKey) == ERROR_SUCCESS) { DWORD size = 0; - RegQueryValueExW(hKey, providerOrder, NULL, NULL, NULL, &size); + RegQueryValueExW(hKey, L"ProviderOrder", NULL, NULL, NULL, &size); if (size) { PWSTR providers = HeapAlloc(GetProcessHeap(), 0, size); @@ -285,8 +271,8 @@ void wnetInit(HINSTANCE hInstDll) { DWORD type; - if (RegQueryValueExW(hKey, providerOrder, NULL, &type, - (LPBYTE)providers, &size) == ERROR_SUCCESS && type == REG_SZ) + if (RegQueryValueExW(hKey, L"ProviderOrder", NULL, &type, (BYTE *)providers, &size) + == ERROR_SUCCESS && type == REG_SZ) { PWSTR ptr; DWORD numToAllocate; @@ -1391,10 +1377,6 @@ static DWORD _enumerateConnectedW(PWNetEnumerator enumerator, DWORD* user_count, return ret; } -static const WCHAR connectionType[] = { 'C','o','n','n','e','c','t','i','o','n','T','y','p','e',0 }; -static const WCHAR providerName[] = { 'P','r','o','v','i','d','e','r','N','a','m','e',0 }; -static const WCHAR remotePath[] = { 'R','e','m','o','t','e','P','a','t','h',0 }; - static WCHAR *get_reg_str(HKEY hkey, const WCHAR *value, DWORD *len) { DWORD type; @@ -1457,7 +1439,7 @@ static DWORD _enumeratorRememberedW(PWNetEnumerator enumerator, DWORD* user_coun if (size_left > 0) { size = sizeof(DWORD); - RegQueryValueExW(connection, connectionType, NULL, NULL, (BYTE *)&net_buffer->dwType, &size); + RegQueryValueExW(connection, L"ConnectionType", NULL, NULL, (BYTE *)&net_buffer->dwType, &size); if (type != RESOURCETYPE_ANY && net_buffer->dwType != type) { size_left += sizeof(NETRESOURCEW); @@ -1485,7 +1467,7 @@ static DWORD _enumeratorRememberedW(PWNetEnumerator enumerator, DWORD* user_coun } registry_size = 0; - registry_string = get_reg_str(connection, providerName, ®istry_size); + registry_string = get_reg_str(connection, L"ProviderName", ®istry_size); if (registry_string) { full_size += registry_size; @@ -1504,7 +1486,7 @@ static DWORD _enumeratorRememberedW(PWNetEnumerator enumerator, DWORD* user_coun } registry_size = 0; - registry_string = get_reg_str(connection, remotePath, ®istry_size); + registry_string = get_reg_str(connection, L"RemotePath", ®istry_size); if (registry_string) { full_size += registry_size; @@ -2003,9 +1985,6 @@ static DWORD wnet_use_provider( struct use_connection_context *ctxt, NETRESOURCE return ret; } -static const WCHAR providerType[] = { 'P','r','o','v','i','d','e','r','T','y','p','e',0 }; -static const WCHAR userName[] = { 'U','s','e','r','N','a','m','e',0 }; - static DWORD wnet_use_connection( struct use_connection_context *ctxt ) { WNetProvider *provider = NULL; @@ -2082,15 +2061,16 @@ static DWORD wnet_use_connection( struct use_connection_context *ctxt ) { DWORD dword_arg = RESOURCETYPE_DISK; DWORD len = (lstrlenW(provider->name) + 1) * sizeof(WCHAR); - static const WCHAR empty[1] = {0}; - RegSetValueExW(network, connectionType, 0, REG_DWORD, (const BYTE *)&dword_arg, sizeof(DWORD)); - RegSetValueExW(network, providerName, 0, REG_SZ, (const BYTE *)provider->name, len); - RegSetValueExW(network, providerType, 0, REG_DWORD, (const BYTE *)&provider->dwNetType, sizeof(DWORD)); + RegSetValueExW(network, L"ConnectionType", 0, REG_DWORD, (const BYTE *)&dword_arg, + sizeof(DWORD)); + RegSetValueExW(network, L"ProviderName", 0, REG_SZ, (const BYTE *)provider->name, len); + RegSetValueExW(network, L"ProviderType", 0, REG_DWORD, + (const BYTE *)&provider->dwNetType, sizeof(DWORD)); len = (lstrlenW(netres.lpRemoteName) + 1) * sizeof(WCHAR); - RegSetValueExW(network, remotePath, 0, REG_SZ, (const BYTE *)netres.lpRemoteName, len); - len = sizeof(empty); - RegSetValueExW(network, userName, 0, REG_SZ, (const BYTE *)empty, len); + RegSetValueExW(network, L"RemotePath", 0, REG_SZ, (const BYTE *)netres.lpRemoteName, len); + len = sizeof(L""); + RegSetValueExW(network, L"UserName", 0, REG_SZ, (const BYTE *) L"", len); RegCloseKey(network); }
1
0
0
0
Michael Stefaniuc : pdh: Use wide-char string literals.
by Alexandre Julliard
05 Nov '20
05 Nov '20
Module: wine Branch: master Commit: 7fb6c7a034a2cf740fa7bda6c2320da704444ed4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7fb6c7a034a2cf740fa7bda6…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Thu Nov 5 02:07:33 2020 +0100 pdh: Use wide-char string literals. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/pdh/pdh_main.c | 31 +++++++++---------------------- dlls/pdh/tests/pdh.c | 36 +++++++++++------------------------- 2 files changed, 20 insertions(+), 47 deletions(-) diff --git a/dlls/pdh/pdh_main.c b/dlls/pdh/pdh_main.c index daa0e2d3395..d3bf6ab8706 100644 --- a/dlls/pdh/pdh_main.c +++ b/dlls/pdh/pdh_main.c @@ -174,12 +174,6 @@ struct source LONGLONG base; /* samples per second */ }; -static const WCHAR path_processor_time[] = - {'\\','P','r','o','c','e','s','s','o','r','(','_','T','o','t','a','l',')', - '\\','%',' ','P','r','o','c','e','s','s','o','r',' ','T','i','m','e',0}; -static const WCHAR path_uptime[] = - {'\\','S','y','s','t','e','m', '\\', 'S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0}; - static void CALLBACK collect_processor_time( struct counter *counter ) { counter->two.largevalue = 500000; /* FIXME */ @@ -202,8 +196,8 @@ static void CALLBACK collect_uptime( struct counter *counter ) /* counter source registry */ static const struct source counter_sources[] = { - { 6, path_processor_time, collect_processor_time, TYPE_PROCESSOR_TIME, -5, 10000000 }, - { 674, path_uptime, collect_uptime, TYPE_UPTIME, -3, 1000 } + { 6, L"\\Processor(_Total)\\% Processor Time", collect_processor_time, TYPE_PROCESSOR_TIME, -5, 10000000 }, + { 674, L"\\System\\System Up Time", collect_uptime, TYPE_UPTIME, -3, 1000 } }; static BOOL is_local_machine( const WCHAR *name, DWORD len ) @@ -1181,12 +1175,6 @@ done: PDH_STATUS WINAPI PdhMakeCounterPathW( PDH_COUNTER_PATH_ELEMENTS_W *e, LPWSTR buffer, LPDWORD buflen, DWORD flags ) { - static const WCHAR bslash[] = {'\\',0}; - static const WCHAR fslash[] = {'/',0}; - static const WCHAR lparen[] = {'(',0}; - static const WCHAR rparen[] = {')',0}; - static const WCHAR fmt[] = {'#','%','u',0}; - WCHAR path[PDH_MAX_COUNTER_NAME], instance[12]; PDH_STATUS ret = ERROR_SUCCESS; DWORD len; @@ -1201,26 +1189,25 @@ PDH_STATUS WINAPI PdhMakeCounterPathW( PDH_COUNTER_PATH_ELEMENTS_W *e, LPWSTR bu path[0] = 0; if (e->szMachineName) { - lstrcatW(path, bslash); - lstrcatW(path, bslash); + lstrcatW(path, L"\\\\"); lstrcatW(path, e->szMachineName); } - lstrcatW(path, bslash); + lstrcatW(path, L"\\"); lstrcatW(path, e->szObjectName); if (e->szInstanceName) { - lstrcatW(path, lparen); + lstrcatW(path, L"("); if (e->szParentInstance) { lstrcatW(path, e->szParentInstance); - lstrcatW(path, fslash); + lstrcatW(path, L"/"); } lstrcatW(path, e->szInstanceName); - swprintf(instance, ARRAY_SIZE(instance), fmt, e->dwInstanceIndex); + swprintf(instance, ARRAY_SIZE(instance), L"#%u", e->dwInstanceIndex); lstrcatW(path, instance); - lstrcatW(path, rparen); + lstrcatW(path, L")"); } - lstrcatW(path, bslash); + lstrcatW(path, L"\\"); lstrcatW(path, e->szCounterName); len = lstrlenW(path) + 1; diff --git a/dlls/pdh/tests/pdh.c b/dlls/pdh/tests/pdh.c index 0a17906afbd..71603f8c6ba 100644 --- a/dlls/pdh/tests/pdh.c +++ b/dlls/pdh/tests/pdh.c @@ -71,18 +71,12 @@ static void init_function_ptrs( void ) GETFUNCPTR( PdhValidatePathExW ) } -static const WCHAR processor_time[] = - {'%',' ','P','r','o','c','e','s','s','o','r',' ','T','i','m','e',0}; -static const WCHAR uptime[] = - {'S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0}; - -static const WCHAR system_uptime[] = - {'\\','S','y','s','t','e','m','\\','S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0}; -static const WCHAR nonexistent_counter[] = - {'\\','S','y','s','t','e','m','\\','S','y','s','t','e','m',' ','D','o','w','n',' ','T','i','m','e',0}; -static const WCHAR percentage_processor_time[] = - {'\\','P','r','o','c','e','s','s','o','r','(','_','T','o','t','a','l',')', - '\\','%',' ','P','r','o','c','e','s','s','o','r',' ','T','i','m','e',0}; +static const WCHAR processor_time[] = L"% Processor Time"; +static const WCHAR uptime[] = L"System Up Time"; + +static const WCHAR system_uptime[] = L"\\System\\System Up Time"; +static const WCHAR nonexistent_counter[] = L"\\System\\System Down Time"; +static const WCHAR percentage_processor_time[] = L"\\Processor(_Total)\\% Processor Time"; static void test_PdhOpenQueryA( void ) { @@ -630,15 +624,13 @@ static void test_PdhLookupPerfIndexByNameW( void ) PDH_STATUS ret; DWORD index; - static const WCHAR no_counter[] = {'N','o',' ','C','o','u','n','t','e','r',0}; - ret = PdhLookupPerfIndexByNameW( NULL, NULL, NULL ); ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret); ret = PdhLookupPerfIndexByNameW( NULL, NULL, &index ); ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret); - ret = PdhLookupPerfIndexByNameW( NULL, no_counter, &index ); + ret = PdhLookupPerfIndexByNameW( NULL, L"No Counter", &index ); ok(ret == PDH_STRING_NOT_FOUND, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret); ret = PdhLookupPerfIndexByNameW( NULL, processor_time, NULL ); @@ -744,16 +736,13 @@ static void test_PdhValidatePathW( void ) { PDH_STATUS ret; - static const WCHAR empty[] = {0}; - static const WCHAR system[] = {'\\','S','y','s','t','e','m',0}; - ret = PdhValidatePathW( NULL ); ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathW failed 0x%08x\n", ret); - ret = PdhValidatePathW( empty ); + ret = PdhValidatePathW( L"" ); ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathW failed 0x%08x\n", ret); - ret = PdhValidatePathW( system ); + ret = PdhValidatePathW( L"\\System" ); ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathW failed 0x%08x\n", ret); ret = PdhValidatePathW( uptime ); @@ -793,16 +782,13 @@ static void test_PdhValidatePathExW( void ) { PDH_STATUS ret; - static const WCHAR empty[] = {0}; - static const WCHAR system[] = {'\\','S','y','s','t','e','m',0}; - ret = pPdhValidatePathExW( NULL, NULL ); ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathExW failed 0x%08x\n", ret); - ret = pPdhValidatePathExW( NULL, empty ); + ret = pPdhValidatePathExW( NULL, L"" ); ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathExW failed 0x%08x\n", ret); - ret = pPdhValidatePathExW( NULL, system ); + ret = pPdhValidatePathExW( NULL, L"\\System" ); ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathExW failed 0x%08x\n", ret); ret = pPdhValidatePathExW( NULL, uptime );
1
0
0
0
Nikolay Sivov : mfmediaengine: Implement GetNativeVideoSize().
by Alexandre Julliard
04 Nov '20
04 Nov '20
Module: wine Branch: master Commit: b793799d3d5facb765d97041669da4bc159b860b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b793799d3d5facb765d97041…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Nov 4 16:45:08 2020 +0300 mfmediaengine: Implement GetNativeVideoSize(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfmediaengine/Makefile.in | 2 +- dlls/mfmediaengine/main.c | 113 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 101 insertions(+), 14 deletions(-) diff --git a/dlls/mfmediaengine/Makefile.in b/dlls/mfmediaengine/Makefile.in index b97e9eec331..ed06dd40f26 100644 --- a/dlls/mfmediaengine/Makefile.in +++ b/dlls/mfmediaengine/Makefile.in @@ -1,6 +1,6 @@ MODULE = mfmediaengine.dll IMPORTLIB = mfmediaengine -IMPORTS = oleaut32 mfplat mf mfuuid uuid +IMPORTS = oleaut32 ole32 mfplat mf mfuuid uuid EXTRADLLFLAGS = -mno-cygwin diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index e126a925b67..cbea4263702 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -74,6 +74,8 @@ enum media_engine_flags struct video_frame { LONGLONG pts; + UINT64 size; + TOPOID node_id; }; struct media_engine @@ -250,6 +252,42 @@ static struct media_engine *impl_from_IMFSampleGrabberSinkCallback(IMFSampleGrab return CONTAINING_RECORD(iface, struct media_engine, grabber_callback); } +static void media_engine_get_frame_size(struct media_engine *engine, IMFTopology *topology) +{ + IMFMediaTypeHandler *handler; + IMFMediaType *media_type; + IMFStreamDescriptor *sd; + IMFTopologyNode *node; + HRESULT hr; + + engine->video_frame.size = 0; + + if (FAILED(IMFTopology_GetNodeByID(topology, engine->video_frame.node_id, &node))) + return; + + hr = IMFTopologyNode_GetUnknown(node, &MF_TOPONODE_STREAM_DESCRIPTOR, + &IID_IMFStreamDescriptor, (void **)&sd); + IMFTopologyNode_Release(node); + if (FAILED(hr)) + return; + + hr = IMFStreamDescriptor_GetMediaTypeHandler(sd, &handler); + IMFStreamDescriptor_Release(sd); + if (FAILED(hr)) + return; + + hr = IMFMediaTypeHandler_GetCurrentMediaType(handler, &media_type); + IMFMediaTypeHandler_Release(handler); + if (FAILED(hr)) + { + WARN("Failed to get current media type %#x.\n", hr); + return; + } + + IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &engine->video_frame.size); + IMFMediaType_Release(media_type); +} + static HRESULT WINAPI media_engine_callback_QueryInterface(IMFAsyncCallback *iface, REFIID riid, void **obj) { if (IsEqualIID(riid, &IID_IMFAsyncCallback) || @@ -312,9 +350,43 @@ static HRESULT WINAPI media_engine_session_events_Invoke(IMFAsyncCallback *iface case MESessionTopologyStatus: { UINT32 topo_status = 0; + IMFTopology *topology; + PROPVARIANT value; + IMFMediaEvent_GetUINT32(event, &MF_EVENT_TOPOLOGY_STATUS, &topo_status); - if (topo_status == MF_TOPOSTATUS_READY) - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_CANPLAY, 0, 0); + if (topo_status != MF_TOPOSTATUS_READY) + break; + + value.vt = VT_EMPTY; + if (FAILED(IMFMediaEvent_GetValue(event, &value))) + break; + + if (value.vt != VT_UNKNOWN) + { + PropVariantClear(&value); + break; + } + + topology = (IMFTopology *)value.punkVal; + + EnterCriticalSection(&engine->cs); + + engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_METADATA; + + media_engine_get_frame_size(engine, topology); + + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_DURATIONCHANGE, 0, 0); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_LOADEDMETADATA, 0, 0); + + engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_ENOUGH_DATA; + + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_LOADEDDATA, 0, 0); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_CANPLAY, 0, 0); + + LeaveCriticalSection(&engine->cs); + + PropVariantClear(&value); + break; } case MESessionStarted: @@ -461,6 +533,9 @@ static HRESULT media_engine_create_topology(struct media_engine *engine, IMFMedi UINT64 duration; HRESULT hr; + engine->video_frame.node_id = 0; + engine->video_frame.size = 0; + if (FAILED(hr = IMFMediaSource_CreatePresentationDescriptor(source, &pd))) return hr; @@ -525,15 +600,6 @@ static HRESULT media_engine_create_topology(struct media_engine *engine, IMFMedi else engine->duration = INFINITY; - engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_METADATA; - - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_DURATIONCHANGE, 0, 0); - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_LOADEDMETADATA, 0, 0); - - engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_ENOUGH_DATA; - - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_LOADEDDATA, 0, 0); - if (SUCCEEDED(hr = MFCreateTopology(&topology))) { IMFTopologyNode *sar_node = NULL, *audio_src = NULL; @@ -575,6 +641,9 @@ static HRESULT media_engine_create_topology(struct media_engine *engine, IMFMedi IMFTopologyNode_ConnectOutput(video_src, 0, grabber_node, 0); } + if (SUCCEEDED(hr)) + IMFTopologyNode_GetTopoNodeID(video_src, &engine->video_frame.node_id); + if (grabber_node) IMFTopologyNode_Release(grabber_node); if (video_src) @@ -1230,9 +1299,27 @@ static BOOL WINAPI media_engine_HasAudio(IMFMediaEngine *iface) static HRESULT WINAPI media_engine_GetNativeVideoSize(IMFMediaEngine *iface, DWORD *cx, DWORD *cy) { - FIXME("(%p, %p, %p): stub.\n", iface, cx, cy); + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + HRESULT hr = S_OK; - return E_NOTIMPL; + TRACE("%p, %p, %p.\n", iface, cx, cy); + + if (!cx && !cy) + return E_INVALIDARG; + + EnterCriticalSection(&engine->cs); + + if (!engine->video_frame.size) + hr = E_FAIL; + else + { + if (cx) *cx = engine->video_frame.size >> 32; + if (cy) *cy = engine->video_frame.size; + } + + LeaveCriticalSection(&engine->cs); + + return hr; } static HRESULT WINAPI media_engine_GetVideoAspectRatio(IMFMediaEngine *iface, DWORD *cx, DWORD *cy)
1
0
0
0
Alexandre Julliard : gdi32: Make a few definitions private to font.c.
by Alexandre Julliard
04 Nov '20
04 Nov '20
Module: wine Branch: master Commit: e1b193d8bab3ab295a0dbfde2e3721e63054a592 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e1b193d8bab3ab295a0dbfde…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Nov 4 09:20:50 2020 +0100 gdi32: Make a few definitions private to font.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 56 ++++++++++++++++++++++++++++++++++++++++++------ dlls/gdi32/freetype.c | 17 ++++----------- dlls/gdi32/gdi_private.h | 50 ------------------------------------------ 3 files changed, 54 insertions(+), 69 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 24681c2097e..89197361fe2 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -58,6 +58,36 @@ static inline struct font_physdev *get_font_dev( PHYSDEV dev ) return (struct font_physdev *)dev; } +struct gdi_font_family +{ + struct list entry; + unsigned int refcount; + WCHAR family_name[LF_FACESIZE]; + WCHAR second_name[LF_FACESIZE]; + struct list faces; + struct gdi_font_family *replacement; +}; + +struct gdi_font_face +{ + struct list entry; + unsigned int refcount; + WCHAR *style_name; + WCHAR *full_name; + WCHAR *file; + void *data_ptr; + SIZE_T data_size; + UINT face_index; + FONTSIGNATURE fs; + DWORD ntmFlags; + DWORD version; + DWORD flags; /* ADDFONT flags */ + BOOL scalable; + struct bitmap_font_size size; /* set if face is a bitmap */ + struct gdi_font_family *family; + struct gdi_font_enum_data *cached_enum_data; +}; + static const struct font_backend_funcs *font_funcs; static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} }; @@ -1160,6 +1190,21 @@ static void remove_face_from_cache( struct gdi_font_face *face ) /* font links */ +struct gdi_font_link +{ + struct list entry; + struct list links; + WCHAR name[LF_FACESIZE]; + FONTSIGNATURE fs; +}; + +struct gdi_font_link_entry +{ + struct list entry; + FONTSIGNATURE fs; + WCHAR family_name[LF_FACESIZE]; +}; + static struct list font_links = LIST_INIT(font_links); static struct gdi_font_link *find_gdi_font_link( const WCHAR *name ) @@ -1704,12 +1749,9 @@ static void free_gdi_font( struct gdi_font *font ) HeapFree( GetProcessHeap(), 0, font ); } -void set_gdi_font_names( struct gdi_font *font, const WCHAR *family_name, const WCHAR *style_name, - const WCHAR *full_name ) +static inline const WCHAR *get_gdi_font_name( struct gdi_font *font ) { - font->otm.otmpFamilyName = (char *)strdupW( family_name ); - font->otm.otmpStyleName = (char *)strdupW( style_name ); - font->otm.otmpFaceName = (char *)strdupW( full_name ); + return (WCHAR *)font->otm.otmpFamilyName; } static struct gdi_font *create_gdi_font( const struct gdi_font_face *face, const WCHAR *family_name, @@ -1727,7 +1769,9 @@ static struct gdi_font *create_gdi_font( const struct gdi_font_face *face, const font->ntmFlags = face->ntmFlags; font->aa_flags = HIWORD( face->flags ); if (!family_name) family_name = face->family->family_name; - set_gdi_font_names( font, family_name, face->style_name, face->full_name ); + font->otm.otmpFamilyName = (char *)strdupW( family_name ); + font->otm.otmpStyleName = (char *)strdupW( face->style_name ); + font->otm.otmpFaceName = (char *)strdupW( face->full_name ); return font; } diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index ff1fa7d0c04..c23ed714b4c 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -233,10 +233,6 @@ typedef struct { FT_Pos size, x_ppem, y_ppem; } My_FT_Bitmap_Size; -typedef struct gdi_font_face Face; - -typedef struct gdi_font_family Family; - struct font_private_data { FT_Face ft_face; @@ -2131,14 +2127,9 @@ static BOOL CDECL freetype_load_font( struct gdi_font *font ) if (!font->aa_flags) font->aa_flags = ADDFONT_AA_FLAGS( default_aa_flags ); if (!font->otm.otmpFamilyName) { - WCHAR *family_name = ft_face_get_family_name( ft_face, GetSystemDefaultLCID() ); - WCHAR *style_name = ft_face_get_style_name( ft_face, GetSystemDefaultLangID() ); - WCHAR *full_name = ft_face_get_full_name( ft_face, GetSystemDefaultLangID() ); - - set_gdi_font_names( font, family_name, style_name, full_name ); - HeapFree( GetProcessHeap(), 0, family_name ); - HeapFree( GetProcessHeap(), 0, style_name ); - HeapFree( GetProcessHeap(), 0, full_name ); + font->otm.otmpFamilyName = (char *)ft_face_get_family_name( ft_face, GetSystemDefaultLCID() ); + font->otm.otmpStyleName = (char *)ft_face_get_style_name( ft_face, GetSystemDefaultLangID() ); + font->otm.otmpFaceName = (char *)ft_face_get_full_name( ft_face, GetSystemDefaultLangID() ); } if (font->scalable) @@ -3396,7 +3387,7 @@ static BOOL CDECL freetype_set_outline_text_metrics( struct gdi_font *font ) GetSystemDefaultLangID() ))) { static const WCHAR fake_nameW[] = {'f','a','k','e',' ','n','a','m','e', 0}; - FIXME("failed to read full_nameW for font %s!\n", wine_dbgstr_w(get_gdi_font_name(font))); + FIXME("failed to read full_nameW for font %s!\n", wine_dbgstr_w((WCHAR *)font->otm.otmpFamilyName)); font->otm.otmpFullName = (char *)strdupW(fake_nameW); } needed = sizeof(font->otm) + (strlenW( (WCHAR *)font->otm.otmpFamilyName ) + 1 + diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index fdedb4ab705..12f469af979 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -303,18 +303,6 @@ struct char_width_info typedef struct { FLOAT eM11, eM12, eM21, eM22; } FMAT2; -struct glyph_metrics; - -struct gdi_font_family -{ - struct list entry; - unsigned int refcount; - WCHAR family_name[LF_FACESIZE]; - WCHAR second_name[LF_FACESIZE]; - struct list faces; - struct gdi_font_family *replacement; -}; - struct bitmap_font_size { int width; @@ -325,41 +313,6 @@ struct bitmap_font_size int internal_leading; }; -struct gdi_font_face -{ - struct list entry; - unsigned int refcount; - WCHAR *style_name; - WCHAR *full_name; - WCHAR *file; - void *data_ptr; - SIZE_T data_size; - UINT face_index; - FONTSIGNATURE fs; - DWORD ntmFlags; - DWORD version; - DWORD flags; /* ADDFONT flags */ - BOOL scalable; - struct bitmap_font_size size; /* set if face is a bitmap */ - struct gdi_font_family *family; - struct gdi_font_enum_data *cached_enum_data; -}; - -struct gdi_font_link -{ - struct list entry; - struct list links; - WCHAR name[LF_FACESIZE]; - FONTSIGNATURE fs; -}; - -struct gdi_font_link_entry -{ - struct list entry; - FONTSIGNATURE fs; - WCHAR family_name[LF_FACESIZE]; -}; - struct gdi_font { struct list entry; @@ -453,9 +406,6 @@ extern int add_gdi_face( const WCHAR *family_name, const WCHAR *second_name, DWORD ntmflags, DWORD version, DWORD flags, const struct bitmap_font_size *size ) DECLSPEC_HIDDEN; -static inline const WCHAR *get_gdi_font_name( struct gdi_font *font ) { return (WCHAR *)font->otm.otmpFamilyName; } -extern void set_gdi_font_names( struct gdi_font *font, const WCHAR *family_name, const WCHAR *style_name, - const WCHAR *full_name ) DECLSPEC_HIDDEN; extern void font_init(void) DECLSPEC_HIDDEN; /* freetype.c */
1
0
0
0
← Newer
1
...
73
74
75
76
77
78
79
...
86
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Results per page:
10
25
50
100
200