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
Notes: sideshowbarker 2024-07-19 03:01:01 +09:00

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;