mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:57:47 +00:00
PixelPaint: Ensure bitmap contains selected pixel before deleting
This fixes a bug which shows up when a layer is offset and the selection range includes pixels that are outside the current layer bitmap rect. We would still try to delete that pixel from the bitmap since there was no contains() check.
This commit is contained in:
parent
53e4cc16ff
commit
7b163573e6
1 changed files with 1 additions and 1 deletions
|
@ -142,7 +142,7 @@ void Layer::erase_selection(Selection const& selection)
|
|||
for (int x = translated_to_layer_space.left(); x < translated_to_layer_space.left() + translated_to_layer_space.width(); ++x) {
|
||||
|
||||
// Selection is still in pre-translated coordinates, account for this by adding the layer's relative location
|
||||
if (selection.is_selected(x + location().x(), y + location().y())) {
|
||||
if (content_bitmap().rect().contains(x, y) && selection.is_selected(x + location().x(), y + location().y())) {
|
||||
content_bitmap().set_pixel(x, y, Color::Transparent);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue