[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
This commit is contained in:
Katayama Hirofumi MZ 2022-11-27 12:42:25 +09:00
parent 57702ed401
commit 015cd2596c
2 changed files with 15 additions and 23 deletions

View file

@ -23,7 +23,7 @@ typedef struct _FONT_ENTRY_COLL_MEM
FONT_ENTRY_MEM *Entry; FONT_ENTRY_MEM *Entry;
} FONT_ENTRY_COLL_MEM, *PFONT_ENTRY_COLL_MEM; } FONT_ENTRY_COLL_MEM, *PFONT_ENTRY_COLL_MEM;
#include <pshpack1.h> /* We don't like padding for these structures */ #include <pshpack1.h> /* We don't like padding for these structures for hashing */
typedef struct _EMULATION_BOLD_ITALIC typedef struct _EMULATION_BOLD_ITALIC
{ {
@ -59,8 +59,8 @@ typedef struct _FONT_CACHE_ENTRY
#include <poppack.h> #include <poppack.h>
C_ASSERT(offsetof(FONT_CACHE_ENTRY, GlyphIndex) % 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); C_ASSERT(sizeof(FONT_CACHE_ENTRY) % sizeof(DWORD) == 0); /* for hashing */
/* /*
* FONTSUBST_... --- constants for font substitutes * FONTSUBST_... --- constants for font substitutes

View file

@ -2059,7 +2059,7 @@ TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont)
* TRUE on success, FALSE on failure. * TRUE on success, FALSE on failure.
* *
*/ */
static BOOLEAN APIENTRY static BOOLEAN
IntTranslateCharsetInfo(PDWORD Src, /* [in] IntTranslateCharsetInfo(PDWORD Src, /* [in]
if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE
if flags == TCI_SRCCHARSET: a character set value if flags == TCI_SRCCHARSET: a character set value
@ -3112,8 +3112,8 @@ ftGdiGetRasterizerCaps(LPRASTERIZER_STATUS lprs)
return FALSE; return FALSE;
} }
static DWORD APIENTRY static DWORD
IntGetHash(LPCVOID pv, DWORD cdw) IntGetHash(IN LPCVOID pv, IN DWORD cdw)
{ {
DWORD dwHash = cdw; DWORD dwHash = cdw;
const DWORD *pdw = pv; const DWORD *pdw = pv;
@ -3127,8 +3127,8 @@ IntGetHash(LPCVOID pv, DWORD cdw)
return dwHash; return dwHash;
} }
FT_BitmapGlyph APIENTRY static FT_BitmapGlyph
ftGdiGlyphCacheGet(const FONT_CACHE_ENTRY *pCache) ftGdiGlyphCacheGet(IN const FONT_CACHE_ENTRY *pCache)
{ {
PLIST_ENTRY CurrentEntry; PLIST_ENTRY CurrentEntry;
PFONT_CACHE_ENTRY FontEntry; PFONT_CACHE_ENTRY FontEntry;
@ -3163,7 +3163,7 @@ ftGdiGlyphCacheGet(const FONT_CACHE_ENTRY *pCache)
} }
/* no cache */ /* no cache */
FT_BitmapGlyph APIENTRY static FT_BitmapGlyph
ftGdiGlyphSet( ftGdiGlyphSet(
FT_Face Face, FT_Face Face,
FT_GlyphSlot GlyphSlot, FT_GlyphSlot GlyphSlot,
@ -3206,10 +3206,10 @@ ftGdiGlyphSet(
return BitmapGlyph; return BitmapGlyph;
} }
FT_BitmapGlyph APIENTRY static FT_BitmapGlyph
ftGdiGlyphCacheSet( ftGdiGlyphCacheSet(
PFONT_CACHE_ENTRY Cache, IN OUT PFONT_CACHE_ENTRY Cache,
FT_GlyphSlot GlyphSlot) IN FT_GlyphSlot GlyphSlot)
{ {
FT_Glyph GlyphCopy; FT_Glyph GlyphCopy;
INT error; INT error;
@ -4206,10 +4206,9 @@ ftGdiGetGlyphOutline(
return needed; return needed;
} }
FT_BitmapGlyph static FT_BitmapGlyph
APIENTRY
ftGdiGetRealGlyph( ftGdiGetRealGlyph(
PFONT_CACHE_ENTRY Cache) IN OUT PFONT_CACHE_ENTRY Cache)
{ {
INT error; INT error;
FT_GlyphSlot glyph; FT_GlyphSlot glyph;
@ -4299,10 +4298,7 @@ TextIntGetTextExtentPoint(PDC dc,
Cache.lfHeight = plf->lfHeight; Cache.lfHeight = plf->lfHeight;
Cache.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight); Cache.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
ASSERT(Cache.Aspect.Emu.Bold <= 1);
Cache.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic); Cache.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic);
ASSERT(Cache.Aspect.Emu.Italic <= 1);
if (IntIsFontRenderingEnabled()) if (IntIsFontRenderingEnabled())
Cache.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf); Cache.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf);
@ -5865,8 +5861,7 @@ ScaleLong(LONG lValue, PFLOATOBJ pef)
} }
/* Calculate width of the text. */ /* Calculate width of the text. */
BOOL static BOOL
APIENTRY
ftGdiGetTextWidth( ftGdiGetTextWidth(
LONGLONG *pTextWidth64, LONGLONG *pTextWidth64,
LPCWSTR String, LPCWSTR String,
@ -6079,10 +6074,7 @@ IntExtTextOutW(
Cache.lfHeight = plf->lfHeight; Cache.lfHeight = plf->lfHeight;
Cache.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight); Cache.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
ASSERT(Cache.Aspect.Emu.Bold <= 1);
Cache.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic); Cache.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic);
ASSERT(Cache.Aspect.Emu.Italic <= 1);
if (IntIsFontRenderingEnabled()) if (IntIsFontRenderingEnabled())
Cache.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf); Cache.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf);