LibAccelGfx: Fix stack use after scope in GlyphAtlas::update()

This commit is contained in:
Aliaksandr Kalenik 2023-12-17 01:21:25 +01:00 committed by Andreas Kling
parent 36f0499cc8
commit 38d62563b3
Notes: sideshowbarker 2024-07-17 18:23:22 +09:00

View file

@ -45,8 +45,8 @@ void GlyphAtlas::update(HashMap<Gfx::Font const*, HashTable<u32>> const& unique_
glyphs_sorted_by_height.append(atlas_key);
}
quick_sort(glyphs_sorted_by_height, [&](auto const& a, auto const& b) {
auto const& bitmap_a = *glyph_bitmaps.get(a);
auto const& bitmap_b = *glyph_bitmaps.get(b);
auto const* bitmap_a = *glyph_bitmaps.get(a);
auto const* bitmap_b = *glyph_bitmaps.get(b);
return bitmap_a->height() > bitmap_b->height();
});
@ -56,7 +56,7 @@ void GlyphAtlas::update(HashMap<Gfx::Font const*, HashTable<u32>> const& unique_
int const texture_width = 512;
int const padding = 1;
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) {
current_x = 0;
current_y += row_height + padding;