mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
PixelPaint: Put the main gradient color at the cursor
It doesn't seem right to me that we are 'holding' a transparent color, with the main color being on the opposite side.
This commit is contained in:
parent
d27d19f012
commit
1ce2d7e674
Notes:
sideshowbarker
2024-07-17 00:21:25 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/1ce2d7e674 Pull-request: https://github.com/SerenityOS/serenity/pull/17467
@ -283,17 +283,15 @@ void GradientTool::draw_gradient(GUI::Painter& painter, bool with_guidelines, co
|
||||
return;
|
||||
|
||||
auto gradient_half_width_percentage_offset = (m_gradient_half_length * scale) / overall_gradient_length_in_rect;
|
||||
auto color_to_use = m_editor->color_for(GUI::MouseButton::Primary);
|
||||
int base_opacity = color_to_use.alpha() * m_opacity / 100;
|
||||
color_to_use.set_alpha(base_opacity);
|
||||
auto gradient_start_color = color_to_use;
|
||||
gradient_start_color.set_alpha(0);
|
||||
auto start_color = m_editor->color_for(GUI::MouseButton::Primary);
|
||||
start_color.set_alpha(start_color.alpha() * m_opacity / 100);
|
||||
auto end_color = start_color.with_alpha(0);
|
||||
|
||||
{
|
||||
Gfx::PainterStateSaver saver(painter);
|
||||
if (gradient_clip.has_value())
|
||||
painter.add_clip_rect(*gradient_clip);
|
||||
painter.fill_rect_with_linear_gradient(gradient_rect, Array { Gfx::ColorStop { gradient_start_color, 0.5f - gradient_half_width_percentage_offset }, Gfx::ColorStop { color_to_use, 0.5f + gradient_half_width_percentage_offset } }, rotation_degrees);
|
||||
painter.fill_rect_with_linear_gradient(gradient_rect, Array { Gfx::ColorStop { start_color, 0.5f - gradient_half_width_percentage_offset }, Gfx::ColorStop { end_color, 0.5f + gradient_half_width_percentage_offset } }, rotation_degrees);
|
||||
}
|
||||
|
||||
if (with_guidelines) {
|
||||
|
Loading…
Reference in New Issue
Block a user