Skip to content

Commit 8bc06a2

Browse files
committed
Remove _FORCE_INLINE_ from TextServer*::_ensure* methods
Reduces binary size by ~1.5 MB when compiling with TextServerAdvanced, and ~800 KB for TextServerFallback
1 parent 108c603 commit 8bc06a2

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

modules/text_server_adv/text_server_adv.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ _FORCE_INLINE_ TextServerAdvanced::FontGlyph TextServerAdvanced::rasterize_bitma
11881188
/* Font Cache */
11891189
/*************************************************************************/
11901190

1191-
_FORCE_INLINE_ bool TextServerAdvanced::_ensure_glyph(FontAdvanced *p_font_data, const Vector2i &p_size, int32_t p_glyph) const {
1191+
bool TextServerAdvanced::_ensure_glyph(FontAdvanced *p_font_data, const Vector2i &p_size, int32_t p_glyph) const {
11921192
ERR_FAIL_COND_V(!_ensure_cache_for_size(p_font_data, p_size), false);
11931193

11941194
int32_t glyph_index = p_glyph & 0xffffff; // Remove subpixel shifts.
@@ -1347,7 +1347,7 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_glyph(FontAdvanced *p_font_data,
13471347
return false;
13481348
}
13491349

1350-
_FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontAdvanced *p_font_data, const Vector2i &p_size) const {
1350+
bool TextServerAdvanced::_ensure_cache_for_size(FontAdvanced *p_font_data, const Vector2i &p_size) const {
13511351
ERR_FAIL_COND_V(p_size.x <= 0, false);
13521352
if (p_font_data->cache.has(p_size)) {
13531353
return true;

modules/text_server_adv/text_server_adv.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ class TextServerAdvanced : public TextServerExtension {
359359
#ifdef MODULE_FREETYPE_ENABLED
360360
_FORCE_INLINE_ FontGlyph rasterize_bitmap(FontForSizeAdvanced *p_data, int p_rect_margin, FT_Bitmap p_bitmap, int p_yofs, int p_xofs, const Vector2 &p_advance, bool p_bgra) const;
361361
#endif
362-
_FORCE_INLINE_ bool _ensure_glyph(FontAdvanced *p_font_data, const Vector2i &p_size, int32_t p_glyph) const;
363-
_FORCE_INLINE_ bool _ensure_cache_for_size(FontAdvanced *p_font_data, const Vector2i &p_size) const;
362+
bool _ensure_glyph(FontAdvanced *p_font_data, const Vector2i &p_size, int32_t p_glyph) const;
363+
bool _ensure_cache_for_size(FontAdvanced *p_font_data, const Vector2i &p_size) const;
364364
_FORCE_INLINE_ void _font_clear_cache(FontAdvanced *p_font_data);
365365
static void _generateMTSDF_threaded(void *p_td, uint32_t p_y);
366366

modules/text_server_fb/text_server_fb.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ _FORCE_INLINE_ TextServerFallback::FontGlyph TextServerFallback::rasterize_bitma
624624
/* Font Cache */
625625
/*************************************************************************/
626626

627-
_FORCE_INLINE_ bool TextServerFallback::_ensure_glyph(FontFallback *p_font_data, const Vector2i &p_size, int32_t p_glyph) const {
627+
bool TextServerFallback::_ensure_glyph(FontFallback *p_font_data, const Vector2i &p_size, int32_t p_glyph) const {
628628
ERR_FAIL_COND_V(!_ensure_cache_for_size(p_font_data, p_size), false);
629629

630630
int32_t glyph_index = p_glyph & 0xffffff; // Remove subpixel shifts.
@@ -785,7 +785,7 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_glyph(FontFallback *p_font_data,
785785
return false;
786786
}
787787

788-
_FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontFallback *p_font_data, const Vector2i &p_size) const {
788+
bool TextServerFallback::_ensure_cache_for_size(FontFallback *p_font_data, const Vector2i &p_size) const {
789789
ERR_FAIL_COND_V(p_size.x <= 0, false);
790790
if (p_font_data->cache.has(p_size)) {
791791
return true;

modules/text_server_fb/text_server_fb.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ class TextServerFallback : public TextServerExtension {
308308
#ifdef MODULE_FREETYPE_ENABLED
309309
_FORCE_INLINE_ FontGlyph rasterize_bitmap(FontForSizeFallback *p_data, int p_rect_margin, FT_Bitmap p_bitmap, int p_yofs, int p_xofs, const Vector2 &p_advance, bool p_bgra) const;
310310
#endif
311-
_FORCE_INLINE_ bool _ensure_glyph(FontFallback *p_font_data, const Vector2i &p_size, int32_t p_glyph) const;
312-
_FORCE_INLINE_ bool _ensure_cache_for_size(FontFallback *p_font_data, const Vector2i &p_size) const;
311+
bool _ensure_glyph(FontFallback *p_font_data, const Vector2i &p_size, int32_t p_glyph) const;
312+
bool _ensure_cache_for_size(FontFallback *p_font_data, const Vector2i &p_size) const;
313313
_FORCE_INLINE_ void _font_clear_cache(FontFallback *p_font_data);
314314
static void _generateMTSDF_threaded(void *p_td, uint32_t p_y);
315315

0 commit comments

Comments
 (0)