PixelPaint: Make wand tool work when layer and image rects differ

Previously, the position of the mask used to calculate the new
selection did not match the position of the active layer. The program
would crash when trying to set a mask pixel outside the bounds of the
active layer.
This commit is contained in:
Tim Ledbetter 2023-02-27 22:36:14 +00:00 committed by Jelle Raaijmakers
commit 55feecee36
Notes: sideshowbarker 2024-07-17 11:33:34 +09:00

View file

@ -25,7 +25,7 @@ static void set_flood_selection(Gfx::Bitmap& bitmap, Image& image, Gfx::IntPoint
{ {
VERIFY(bitmap.bpp() == 32); VERIFY(bitmap.bpp() == 32);
Mask selection_mask = Mask::empty(bitmap.rect()); auto selection_mask = Mask::empty({ selection_offset, bitmap.size() });
auto pixel_reached = [&](Gfx::IntPoint location) { auto pixel_reached = [&](Gfx::IntPoint location) {
selection_mask.set(selection_offset.x() + location.x(), selection_offset.y() + location.y(), 0xFF); selection_mask.set(selection_offset.x() + location.x(), selection_offset.y() + location.y(), 0xFF);