LibGfx: ALWAYS_INLINE BitmapFont::unicode_view_width
This adds the ALWAYS_INLINE attribute to unicode_view_width. Also, it cleans up the BitmapFont::view() code a little bit. This should help performance of this hot code. Because the call to the width() methods is a virtual dispatch, it doesn't help to inline the width() methods themselves.
This commit is contained in:
parent
2afa35deb8
commit
4578ab3ed0
Notes:
sideshowbarker
2024-07-18 09:58:57 +09:00
Author: https://github.com/MaxWipfli Commit: https://github.com/SerenityOS/serenity/commit/4578ab3ed04 Pull-request: https://github.com/SerenityOS/serenity/pull/8558 Reviewed-by: https://github.com/awesomekling
1 changed files with 4 additions and 16 deletions
|
@ -248,14 +248,12 @@ int BitmapFont::glyph_or_emoji_width_for_variable_width_font(u32 code_point) con
|
|||
return emoji->size().width();
|
||||
}
|
||||
|
||||
int BitmapFont::width(const StringView& string) const
|
||||
{
|
||||
Utf8View utf8 { string };
|
||||
return width(utf8);
|
||||
}
|
||||
int BitmapFont::width(StringView const& view) const { return unicode_view_width(Utf8View(view)); }
|
||||
int BitmapFont::width(Utf8View const& view) const { return unicode_view_width(view); }
|
||||
int BitmapFont::width(Utf32View const& view) const { return unicode_view_width(view); }
|
||||
|
||||
template<typename T>
|
||||
int BitmapFont::unicode_view_width(T const& view) const
|
||||
ALWAYS_INLINE int BitmapFont::unicode_view_width(T const& view) const
|
||||
{
|
||||
if (view.is_empty())
|
||||
return 0;
|
||||
|
@ -280,16 +278,6 @@ int BitmapFont::unicode_view_width(T const& view) const
|
|||
return longest_width;
|
||||
}
|
||||
|
||||
int BitmapFont::width(const Utf8View& utf8) const
|
||||
{
|
||||
return unicode_view_width(utf8);
|
||||
}
|
||||
|
||||
int BitmapFont::width(const Utf32View& view) const
|
||||
{
|
||||
return unicode_view_width(view);
|
||||
}
|
||||
|
||||
void BitmapFont::set_type(FontTypes type)
|
||||
{
|
||||
if (type == m_type)
|
||||
|
|
Loading…
Add table
Reference in a new issue