mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:57:34 +00:00
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
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();
|
return emoji->size().width();
|
||||||
}
|
}
|
||||||
|
|
||||||
int BitmapFont::width(const StringView& string) const
|
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); }
|
||||||
Utf8View utf8 { string };
|
int BitmapFont::width(Utf32View const& view) const { return unicode_view_width(view); }
|
||||||
return width(utf8);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
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())
|
if (view.is_empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -280,16 +278,6 @@ int BitmapFont::unicode_view_width(T const& view) const
|
||||||
return longest_width;
|
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)
|
void BitmapFont::set_type(FontTypes type)
|
||||||
{
|
{
|
||||||
if (type == m_type)
|
if (type == m_type)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue