mirror of
https://github.com/RGBCube/serenity
synced 2025-06-25 10:12:07 +00:00
LibAccelGfx: Add 1px padding between glyphs in prepare_glyph_texture()
This fixes bug when tiny slice of another glyph appearing along with the required glyph.
This commit is contained in:
parent
fd3411c868
commit
f1824a524d
1 changed files with 3 additions and 2 deletions
|
@ -256,15 +256,16 @@ void Painter::prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> co
|
||||||
int current_y = 0;
|
int current_y = 0;
|
||||||
int row_height = 0;
|
int row_height = 0;
|
||||||
int texture_width = 512;
|
int texture_width = 512;
|
||||||
|
int padding = 1;
|
||||||
for (auto const& glyphs_texture_key : glyphs_sorted_by_height) {
|
for (auto const& glyphs_texture_key : glyphs_sorted_by_height) {
|
||||||
auto const& bitmap = *glyph_bitmaps.get(glyphs_texture_key);
|
auto const& bitmap = *glyph_bitmaps.get(glyphs_texture_key);
|
||||||
if (current_x + bitmap->width() > texture_width) {
|
if (current_x + bitmap->width() > texture_width) {
|
||||||
current_x = 0;
|
current_x = 0;
|
||||||
current_y += row_height;
|
current_y += row_height + padding;
|
||||||
row_height = 0;
|
row_height = 0;
|
||||||
}
|
}
|
||||||
m_glyphs_texture_map.set(glyphs_texture_key, { current_x, current_y, bitmap->width(), bitmap->height() });
|
m_glyphs_texture_map.set(glyphs_texture_key, { current_x, current_y, bitmap->width(), bitmap->height() });
|
||||||
current_x += bitmap->width();
|
current_x += bitmap->width() + padding;
|
||||||
row_height = max(row_height, bitmap->height());
|
row_height = max(row_height, bitmap->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue