From 61521315ed41e2659ec9252a9e636f487ab1e297 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 29 Aug 2020 12:00:06 +0200 Subject: FontEditor: Enforce boundaries of GlyphEditorWidget Drawing out of bounds no longer affects any neighboring glyphs. --- Applications/FontEditor/GlyphEditorWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Applications/FontEditor/GlyphEditorWidget.cpp b/Applications/FontEditor/GlyphEditorWidget.cpp index d1fcb13dd1..dc06a6a5e6 100644 --- a/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Applications/FontEditor/GlyphEditorWidget.cpp @@ -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; -- cgit v1.2.3