1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

FontEditor: Enforce boundaries of GlyphEditorWidget

Drawing out of bounds no longer affects any neighboring glyphs.
This commit is contained in:
Ben Wiederhake 2020-08-29 12:00:06 +02:00 committed by Andreas Kling
parent b742d593dd
commit 61521315ed

View file

@ -99,9 +99,9 @@ void GlyphEditorWidget::draw_at_mouse(const GUI::MouseEvent& event)
int x = (event.x() - 1) / m_scale;
int y = (event.y() - 1) / m_scale;
auto bitmap = font().glyph_bitmap(m_glyph);
if (x >= bitmap.width())
if (x < 0 || x >= bitmap.width())
return;
if (y >= bitmap.height())
if (y < 0 || y >= bitmap.height())
return;
if (bitmap.bit_at(x, y) == set)
return;