mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:07:35 +00:00
PixelPaint: Don't resize layers when resizing the canvas
Calling Image::resize() with ScalingMode::None now resizes the canvas without changing the size or position of any layers.
This commit is contained in:
parent
6c6af8ae4e
commit
92a0a7e3fa
1 changed files with 20 additions and 18 deletions
|
@ -663,6 +663,7 @@ ErrorOr<void> Image::resize(Gfx::IntSize new_size, Gfx::Painter::ScalingMode sca
|
|||
scale_y = new_size.height() / static_cast<float>(size().height());
|
||||
}
|
||||
|
||||
if (scaling_mode != Gfx::Painter::ScalingMode::None) {
|
||||
Vector<NonnullRefPtr<Layer>> resized_layers;
|
||||
TRY(resized_layers.try_ensure_capacity(m_layers.size()));
|
||||
|
||||
|
@ -687,6 +688,7 @@ ErrorOr<void> Image::resize(Gfx::IntSize new_size, Gfx::Painter::ScalingMode sca
|
|||
layer->did_modify_bitmap({}, Layer::NotifyClients::Yes);
|
||||
|
||||
select_layer(m_layers[selected_layer_index]);
|
||||
}
|
||||
|
||||
m_size = { new_size.width(), new_size.height() };
|
||||
did_change_rect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue