1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibGfx: Stop passing color stop spans by const reference

No idea why I did this, possibly because these were once vectors?
Anyway, the const reference is pointless here.
This commit is contained in:
MacDue 2023-01-29 13:28:36 +00:00 committed by Linus Groh
parent a75f9273b4
commit 285bd7a37a
2 changed files with 9 additions and 9 deletions

View file

@ -165,7 +165,7 @@ private:
TransformFunction m_transform_function;
};
static auto create_linear_gradient(IntRect const& physical_rect, Span<ColorStop const> const& color_stops, float angle, Optional<float> repeat_length)
static auto create_linear_gradient(IntRect const& physical_rect, Span<ColorStop const> color_stops, float angle, Optional<float> repeat_length)
{
float normalized_angle = normalized_gradient_angle_radians(angle);
float sin_angle, cos_angle;
@ -188,7 +188,7 @@ static auto create_linear_gradient(IntRect const& physical_rect, Span<ColorStop
};
}
static auto create_conic_gradient(Span<ColorStop const> const& color_stops, FloatPoint center_point, float start_angle, Optional<float> repeat_length, UsePremultipliedAlpha use_premultiplied_alpha = UsePremultipliedAlpha::Yes)
static auto create_conic_gradient(Span<ColorStop const> color_stops, FloatPoint center_point, float start_angle, Optional<float> repeat_length, UsePremultipliedAlpha use_premultiplied_alpha = UsePremultipliedAlpha::Yes)
{
// FIXME: Do we need/want sub-degree accuracy for the gradient line?
GradientLine gradient_line(360, color_stops, repeat_length, use_premultiplied_alpha);
@ -213,7 +213,7 @@ static auto create_conic_gradient(Span<ColorStop const> const& color_stops, Floa
};
}
static auto create_radial_gradient(IntRect const& physical_rect, Span<ColorStop const> const& color_stops, IntPoint center, IntSize size, Optional<float> repeat_length)
static auto create_radial_gradient(IntRect const& physical_rect, Span<ColorStop const> color_stops, IntPoint center, IntSize size, Optional<float> repeat_length)
{
// A conservative guesstimate on how many colors we need to generate:
auto max_dimension = max(physical_rect.width(), physical_rect.height());
@ -232,7 +232,7 @@ static auto create_radial_gradient(IntRect const& physical_rect, Span<ColorStop
};
}
void Painter::fill_rect_with_linear_gradient(IntRect const& rect, Span<ColorStop const> const& color_stops, float angle, Optional<float> repeat_length)
void Painter::fill_rect_with_linear_gradient(IntRect const& rect, Span<ColorStop const> color_stops, float angle, Optional<float> repeat_length)
{
auto a_rect = to_physical(rect);
if (a_rect.intersected(clip_rect() * scale()).is_empty())
@ -246,7 +246,7 @@ static FloatPoint pixel_center(IntPoint point)
return point.to_type<float>().translated(0.5f, 0.5f);
}
void Painter::fill_rect_with_conic_gradient(IntRect const& rect, Span<ColorStop const> const& color_stops, IntPoint center, float start_angle, Optional<float> repeat_length)
void Painter::fill_rect_with_conic_gradient(IntRect const& rect, Span<ColorStop const> color_stops, IntPoint center, float start_angle, Optional<float> repeat_length)
{
auto a_rect = to_physical(rect);
if (a_rect.intersected(clip_rect() * scale()).is_empty())
@ -257,7 +257,7 @@ void Painter::fill_rect_with_conic_gradient(IntRect const& rect, Span<ColorStop
conic_gradient.paint(*this, a_rect);
}
void Painter::fill_rect_with_radial_gradient(IntRect const& rect, Span<ColorStop const> const& color_stops, IntPoint center, IntSize size, Optional<float> repeat_length)
void Painter::fill_rect_with_radial_gradient(IntRect const& rect, Span<ColorStop const> color_stops, IntPoint center, IntSize size, Optional<float> repeat_length)
{
auto a_rect = to_physical(rect);
if (a_rect.intersected(clip_rect() * scale()).is_empty())

View file

@ -53,9 +53,9 @@ public:
void fill_rect_with_checkerboard(IntRect const&, IntSize, Color color_dark, Color color_light);
void fill_rect_with_gradient(Orientation, IntRect const&, Color gradient_start, Color gradient_end);
void fill_rect_with_gradient(IntRect const&, Color gradient_start, Color gradient_end);
void fill_rect_with_linear_gradient(IntRect const&, Span<ColorStop const> const&, float angle, Optional<float> repeat_length = {});
void fill_rect_with_conic_gradient(IntRect const&, Span<ColorStop const> const&, IntPoint center, float start_angle, Optional<float> repeat_length = {});
void fill_rect_with_radial_gradient(IntRect const&, Span<ColorStop const> const&, IntPoint center, IntSize size, Optional<float> repeat_length = {});
void fill_rect_with_linear_gradient(IntRect const&, Span<ColorStop const>, float angle, Optional<float> repeat_length = {});
void fill_rect_with_conic_gradient(IntRect const&, Span<ColorStop const>, IntPoint center, float start_angle, Optional<float> repeat_length = {});
void fill_rect_with_radial_gradient(IntRect const&, Span<ColorStop const>, IntPoint center, IntSize size, Optional<float> repeat_length = {});
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);
void fill_ellipse(IntRect const&, Color);