mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibGfx: Rename draw_ellipse/circle to fill_ellipse/circle
This makes these functions more consistent with the non-aa painter.
This commit is contained in:
parent
f578247cdf
commit
8ac5f625e9
Notes:
sideshowbarker
2024-07-17 10:32:31 +09:00
Author: https://github.com/MacDue
Commit: 8ac5f625e9
Pull-request: https://github.com/SerenityOS/serenity/pull/14163
Reviewed-by: https://github.com/linusg ✅
4 changed files with 14 additions and 13 deletions
|
@ -42,7 +42,7 @@ void EllipseTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_p
|
|||
break;
|
||||
case FillMode::FillAntiAliased: {
|
||||
Gfx::AntiAliasingPainter aa_painter { painter };
|
||||
aa_painter.draw_ellipse(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button));
|
||||
aa_painter.fill_ellipse(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -41,9 +41,9 @@ void EyesWidget::render_eyeball(int row, int column, Gfx::AntiAliasingPainter& p
|
|||
auto height_thickness = max(int(eye_height / 5.5), 1);
|
||||
|
||||
bounds.shrink(int(eye_width / 12.5), 0);
|
||||
painter.draw_ellipse(bounds, palette().base_text());
|
||||
painter.fill_ellipse(bounds, palette().base_text());
|
||||
bounds.shrink(width_thickness, height_thickness);
|
||||
painter.draw_ellipse(bounds, palette().base());
|
||||
painter.fill_ellipse(bounds, palette().base());
|
||||
|
||||
Gfx::IntPoint pupil_center = this->pupil_center(bounds);
|
||||
Gfx::IntSize pupil_size {
|
||||
|
@ -57,7 +57,7 @@ void EyesWidget::render_eyeball(int row, int column, Gfx::AntiAliasingPainter& p
|
|||
pupil_size.height()
|
||||
};
|
||||
|
||||
painter.draw_ellipse(pupil, palette().base_text());
|
||||
painter.fill_ellipse(pupil, palette().base_text());
|
||||
}
|
||||
|
||||
Gfx::IntPoint EyesWidget::pupil_center(Gfx::IntRect& eyeball_bounds) const
|
||||
|
|
|
@ -192,14 +192,14 @@ void Gfx::AntiAliasingPainter::draw_cubic_bezier_curve(FloatPoint const& control
|
|||
});
|
||||
}
|
||||
|
||||
void Gfx::AntiAliasingPainter::draw_circle(IntPoint const& center, int radius, Color color)
|
||||
void Gfx::AntiAliasingPainter::fill_circle(IntPoint const& center, int radius, Color color)
|
||||
{
|
||||
if (radius <= 0)
|
||||
return;
|
||||
draw_ellipse_part(center, radius, radius, color, false, {});
|
||||
}
|
||||
|
||||
void Gfx::AntiAliasingPainter::draw_ellipse(IntRect const& a_rect, Color color)
|
||||
void Gfx::AntiAliasingPainter::fill_ellipse(IntRect const& a_rect, Color color)
|
||||
{
|
||||
auto center = a_rect.center();
|
||||
auto radius_a = a_rect.width() / 2;
|
||||
|
@ -207,7 +207,7 @@ void Gfx::AntiAliasingPainter::draw_ellipse(IntRect const& a_rect, Color color)
|
|||
if (radius_a <= 0 || radius_b <= 0)
|
||||
return;
|
||||
if (radius_a == radius_b)
|
||||
return draw_circle(center, radius_a, color);
|
||||
return fill_circle(center, radius_a, color);
|
||||
auto x_paint_range = draw_ellipse_part(center, radius_a, radius_b, color, false, {});
|
||||
// FIXME: This paints some extra fill pixels that are clipped
|
||||
draw_ellipse_part(center, radius_b, radius_a, color, true, x_paint_range);
|
||||
|
@ -471,11 +471,11 @@ void Gfx::AntiAliasingPainter::fill_rect_with_rounded_corners(IntRect const& a_r
|
|||
|
||||
// FIXME: Don't draw a whole circle each time
|
||||
if (top_left_radius)
|
||||
draw_circle(top_left_corner, top_left_radius, color);
|
||||
fill_circle(top_left_corner, top_left_radius, color);
|
||||
if (top_right_radius)
|
||||
draw_circle(top_right_corner, top_right_radius, color);
|
||||
fill_circle(top_right_corner, top_right_radius, color);
|
||||
if (bottom_left_radius)
|
||||
draw_circle(bottom_left_corner, bottom_left_radius, color);
|
||||
fill_circle(bottom_left_corner, bottom_left_radius, color);
|
||||
if (bottom_right_radius)
|
||||
draw_circle(bottom_right_corner, bottom_right_radius, color);
|
||||
fill_circle(bottom_right_corner, bottom_right_radius, color);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,9 @@ public:
|
|||
void translate(float dx, float dy) { m_transform.translate(dx, dy); }
|
||||
void translate(FloatPoint const& delta) { m_transform.translate(delta); }
|
||||
|
||||
void draw_circle(IntPoint const& center, int radius, Color);
|
||||
void draw_ellipse(IntRect const& a_rect, Color);
|
||||
void fill_circle(IntPoint const& center, int radius, Color);
|
||||
void fill_ellipse(IntRect const& a_rect, Color);
|
||||
|
||||
void fill_rect_with_rounded_corners(IntRect const&, Color, int radius);
|
||||
void fill_rect_with_rounded_corners(IntRect const&, Color, int top_left_radius, int top_right_radius, int bottom_right_radius, int bottom_left_radius);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue