From: Katayama Hirofumi MZ Date: Sun, 27 Nov 2022 03:42:25 +0000 (+0900) Subject: [NTGDI][FREETYPE] Follow-up of #4901 (57702ed) X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=015cd2596c817deecd82437792aabbe8ef7ac5b6 [NTGDI][FREETYPE] Follow-up of #4901 (57702ed) - Drop APIENTRYs for static functions. - Use FIELD_OFFSET instead of offsetof. - Delete unnecessary ASSERTs. - Add annotations. CORE-11848 --- diff --git a/win32ss/gdi/ntgdi/font.h b/win32ss/gdi/ntgdi/font.h index ccf49c39603..e8526d8d91d 100644 --- a/win32ss/gdi/ntgdi/font.h +++ b/win32ss/gdi/ntgdi/font.h @@ -23,7 +23,7 @@ typedef struct _FONT_ENTRY_COLL_MEM FONT_ENTRY_MEM *Entry; } FONT_ENTRY_COLL_MEM, *PFONT_ENTRY_COLL_MEM; -#include /* We don't like padding for these structures */ +#include /* We don't like padding for these structures for hashing */ typedef struct _EMULATION_BOLD_ITALIC { @@ -59,8 +59,8 @@ typedef struct _FONT_CACHE_ENTRY #include -C_ASSERT(offsetof(FONT_CACHE_ENTRY, GlyphIndex) % sizeof(DWORD) == 0); -C_ASSERT(sizeof(FONT_CACHE_ENTRY) % sizeof(DWORD) == 0); +C_ASSERT(FIELD_OFFSET(FONT_CACHE_ENTRY, GlyphIndex) % sizeof(DWORD) == 0); /* for hashing */ +C_ASSERT(sizeof(FONT_CACHE_ENTRY) % sizeof(DWORD) == 0); /* for hashing */ /* * FONTSUBST_... --- constants for font substitutes diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c index 7c9ef1b09d2..7780ced82ae 100644 --- a/win32ss/gdi/ntgdi/freetype.c +++ b/win32ss/gdi/ntgdi/freetype.c @@ -2059,7 +2059,7 @@ TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont) * TRUE on success, FALSE on failure. * */ -static BOOLEAN APIENTRY +static BOOLEAN IntTranslateCharsetInfo(PDWORD Src, /* [in] if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE if flags == TCI_SRCCHARSET: a character set value @@ -3112,8 +3112,8 @@ ftGdiGetRasterizerCaps(LPRASTERIZER_STATUS lprs) return FALSE; } -static DWORD APIENTRY -IntGetHash(LPCVOID pv, DWORD cdw) +static DWORD +IntGetHash(IN LPCVOID pv, IN DWORD cdw) { DWORD dwHash = cdw; const DWORD *pdw = pv; @@ -3127,8 +3127,8 @@ IntGetHash(LPCVOID pv, DWORD cdw) return dwHash; } -FT_BitmapGlyph APIENTRY -ftGdiGlyphCacheGet(const FONT_CACHE_ENTRY *pCache) +static FT_BitmapGlyph +ftGdiGlyphCacheGet(IN const FONT_CACHE_ENTRY *pCache) { PLIST_ENTRY CurrentEntry; PFONT_CACHE_ENTRY FontEntry; @@ -3163,7 +3163,7 @@ ftGdiGlyphCacheGet(const FONT_CACHE_ENTRY *pCache) } /* no cache */ -FT_BitmapGlyph APIENTRY +static FT_BitmapGlyph ftGdiGlyphSet( FT_Face Face, FT_GlyphSlot GlyphSlot, @@ -3206,10 +3206,10 @@ ftGdiGlyphSet( return BitmapGlyph; } -FT_BitmapGlyph APIENTRY +static FT_BitmapGlyph ftGdiGlyphCacheSet( - PFONT_CACHE_ENTRY Cache, - FT_GlyphSlot GlyphSlot) + IN OUT PFONT_CACHE_ENTRY Cache, + IN FT_GlyphSlot GlyphSlot) { FT_Glyph GlyphCopy; INT error; @@ -4206,10 +4206,9 @@ ftGdiGetGlyphOutline( return needed; } -FT_BitmapGlyph -APIENTRY +static FT_BitmapGlyph ftGdiGetRealGlyph( - PFONT_CACHE_ENTRY Cache) + IN OUT PFONT_CACHE_ENTRY Cache) { INT error; FT_GlyphSlot glyph; @@ -4299,10 +4298,7 @@ TextIntGetTextExtentPoint(PDC dc, Cache.lfHeight = plf->lfHeight; Cache.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight); - ASSERT(Cache.Aspect.Emu.Bold <= 1); - Cache.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic); - ASSERT(Cache.Aspect.Emu.Italic <= 1); if (IntIsFontRenderingEnabled()) Cache.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf); @@ -5865,8 +5861,7 @@ ScaleLong(LONG lValue, PFLOATOBJ pef) } /* Calculate width of the text. */ -BOOL -APIENTRY +static BOOL ftGdiGetTextWidth( LONGLONG *pTextWidth64, LPCWSTR String, @@ -6079,10 +6074,7 @@ IntExtTextOutW( Cache.lfHeight = plf->lfHeight; Cache.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight); - ASSERT(Cache.Aspect.Emu.Bold <= 1); - Cache.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic); - ASSERT(Cache.Aspect.Emu.Italic <= 1); if (IntIsFontRenderingEnabled()) Cache.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf);