diff --git a/Userland/Applications/PixelPaint/Image.cpp b/Userland/Applications/PixelPaint/Image.cpp index 2de8f72d01..03940ad014 100644 --- a/Userland/Applications/PixelPaint/Image.cpp +++ b/Userland/Applications/PixelPaint/Image.cpp @@ -664,8 +664,8 @@ ErrorOr Image::resize(Gfx::IntSize new_size, Gfx::Painter::ScalingMode sca } if (scaling_mode != Gfx::Painter::ScalingMode::None) { - Vector> resized_layers; - TRY(resized_layers.try_ensure_capacity(m_layers.size())); + Vector> scaled_layers; + TRY(scaled_layers.try_ensure_capacity(m_layers.size())); VERIFY(m_layers.size() > 0); @@ -681,12 +681,12 @@ ErrorOr Image::resize(Gfx::IntSize new_size, Gfx::Painter::ScalingMode sca auto scaled_top_left = layer_rect.top_left().scaled(scale_x, scale_y).to_rounded(); auto scaled_bottom_right = layer_rect.bottom_right().translated(1).scaled(scale_x, scale_y).to_rounded(); auto scaled_layer_rect = Gfx::IntRect::from_two_points(scaled_top_left, scaled_bottom_right); - TRY(new_layer->resize(scaled_layer_rect, scaling_mode, Layer::NotifyClients::No)); + TRY(new_layer->scale(scaled_layer_rect, scaling_mode, Layer::NotifyClients::No)); - resized_layers.unchecked_append(new_layer); + scaled_layers.unchecked_append(new_layer); } - m_layers = move(resized_layers); + m_layers = move(scaled_layers); for (auto& layer : m_layers) layer->did_modify_bitmap({}, Layer::NotifyClients::Yes); diff --git a/Userland/Applications/PixelPaint/Layer.cpp b/Userland/Applications/PixelPaint/Layer.cpp index 1a1588816d..88e811f747 100644 --- a/Userland/Applications/PixelPaint/Layer.cpp +++ b/Userland/Applications/PixelPaint/Layer.cpp @@ -237,14 +237,14 @@ ErrorOr Layer::crop(Gfx::IntRect const& rect, NotifyClients notify_clients return {}; } -ErrorOr Layer::resize(Gfx::IntRect const& new_rect, Gfx::Painter::ScalingMode scaling_mode, NotifyClients notify_clients) +ErrorOr Layer::scale(Gfx::IntRect const& new_rect, Gfx::Painter::ScalingMode scaling_mode, NotifyClients notify_clients) { auto src_rect = Gfx::IntRect({}, size()); auto dst_rect = Gfx::IntRect({}, new_rect.size()); - auto resized_content_bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, new_rect.size())); + auto scaled_content_bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, new_rect.size())); { - Gfx::Painter painter(resized_content_bitmap); + Gfx::Painter painter(scaled_content_bitmap); if (scaling_mode == Gfx::Painter::ScalingMode::None) { painter.blit(src_rect.top_left(), *m_content_bitmap, src_rect, 1.0f); @@ -266,7 +266,7 @@ ErrorOr Layer::resize(Gfx::IntRect const& new_rect, Gfx::Painter::ScalingM m_mask_bitmap = move(dst); } - m_content_bitmap = move(resized_content_bitmap); + m_content_bitmap = move(scaled_content_bitmap); set_location(new_rect.location()); did_modify_bitmap({}, notify_clients); diff --git a/Userland/Applications/PixelPaint/Layer.h b/Userland/Applications/PixelPaint/Layer.h index 87fd0724c0..684004606c 100644 --- a/Userland/Applications/PixelPaint/Layer.h +++ b/Userland/Applications/PixelPaint/Layer.h @@ -67,7 +67,7 @@ public: ErrorOr flip(Gfx::Orientation orientation, NotifyClients notify_clients = NotifyClients::Yes); ErrorOr rotate(Gfx::RotationDirection direction, NotifyClients notify_clients = NotifyClients::Yes); ErrorOr crop(Gfx::IntRect const& rect, NotifyClients notify_clients = NotifyClients::Yes); - ErrorOr resize(Gfx::IntRect const& new_rect, Gfx::Painter::ScalingMode scaling_mode, NotifyClients notify_clients = NotifyClients::Yes); + ErrorOr scale(Gfx::IntRect const& new_rect, Gfx::Painter::ScalingMode scaling_mode, NotifyClients notify_clients = NotifyClients::Yes); Optional nonempty_content_bounding_rect() const; diff --git a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp index 10252259bc..ba3fe4960d 100644 --- a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp @@ -124,9 +124,9 @@ void MoveTool::on_mouseup(Layer* layer, MouseEvent& event) return; if (m_scaling) { - auto resized_or_error = m_editor->active_layer()->resize(m_new_layer_rect, Gfx::Painter::ScalingMode::BilinearBlend); - if (resized_or_error.is_error()) - GUI::MessageBox::show_error(m_editor->window(), MUST(String::formatted("Failed to resize layer: {}", resized_or_error.error().string_literal()))); + auto scaled_layer_or_error = m_editor->active_layer()->scale(m_new_layer_rect, Gfx::Painter::ScalingMode::BilinearBlend); + if (scaled_layer_or_error.is_error()) + GUI::MessageBox::show_error(m_editor->window(), MUST(String::formatted("Failed to resize layer: {}", scaled_layer_or_error.error().string_literal()))); else m_editor->layers_did_change(); }