mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 08:18:55 +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
Notes:
sideshowbarker
2024-07-17 07:43:44 +09:00
Author: https://github.com/tslater2006
Commit: 7b163573e6
Pull-request: https://github.com/SerenityOS/serenity/pull/15113
Reviewed-by: https://github.com/MacDue ✅
Reviewed-by: https://github.com/linusg
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