1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:18:14 +00:00

PixelPaint: Clip the gradient tool preview to the active layer rect

This makes it easier to see what the result will be when using two
solid colors.
This commit is contained in:
Tim Ledbetter 2023-04-29 18:50:55 +01:00 committed by Jelle Raaijmakers
parent 55d573afa4
commit fd9b6878f6

View file

@ -176,7 +176,8 @@ void GradientTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event)
GUI::Painter painter(*m_editor);
painter.add_clip_rect(event.rect());
draw_gradient(painter, true, m_editor->content_to_frame_position(layer->location()), m_editor->scale(), m_editor->content_rect());
auto gradient_clip_rect = m_editor->content_to_frame_rect(layer->relative_rect()).to_type<int>().intersected(m_editor->content_rect());
draw_gradient(painter, true, m_editor->content_to_frame_position(layer->location()), m_editor->scale(), gradient_clip_rect);
}
void GradientTool::on_primary_color_change(Color)