1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

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
parent bdd5f36121
commit 55feecee36

View file

@ -25,7 +25,7 @@ static void set_flood_selection(Gfx::Bitmap& bitmap, Image& image, Gfx::IntPoint
{
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) {
selection_mask.set(selection_offset.x() + location.x(), selection_offset.y() + location.y(), 0xFF);