LibWeb: Store LibGfx objects in RefPtr to const for draw commands

This commit is contained in:
Andrew Kaster 2025-04-15 16:03:28 -06:00 committed by Andrew Kaster
commit ea68944149
Notes: github-actions[bot] 2025-04-16 16:43:06 +00:00
3 changed files with 8 additions and 8 deletions

View file

@ -39,7 +39,7 @@ namespace Web::Painting {
class DisplayList;
struct DrawGlyphRun {
NonnullRefPtr<Gfx::GlyphRun> glyph_run;
NonnullRefPtr<Gfx::GlyphRun const> glyph_run;
double scale { 1 };
Gfx::IntRect rect;
Gfx::FloatPoint translation;
@ -61,7 +61,7 @@ struct FillRect {
struct DrawPaintingSurface {
Gfx::IntRect dst_rect;
NonnullRefPtr<Gfx::PaintingSurface> surface;
NonnullRefPtr<Gfx::PaintingSurface const> surface;
Gfx::IntRect src_rect;
Gfx::ScalingMode scaling_mode;
@ -72,7 +72,7 @@ struct DrawPaintingSurface {
struct DrawScaledImmutableBitmap {
Gfx::IntRect dst_rect;
Gfx::IntRect clip_rect;
NonnullRefPtr<Gfx::ImmutableBitmap> bitmap;
NonnullRefPtr<Gfx::ImmutableBitmap const> bitmap;
Gfx::ScalingMode scaling_mode;
[[nodiscard]] Gfx::IntRect bounding_rect() const { return clip_rect; }
@ -91,7 +91,7 @@ struct DrawRepeatedImmutableBitmap {
Gfx::IntRect dst_rect;
Gfx::IntRect clip_rect;
NonnullRefPtr<Gfx::ImmutableBitmap> bitmap;
NonnullRefPtr<Gfx::ImmutableBitmap const> bitmap;
Gfx::ScalingMode scaling_mode;
Repeat repeat;
@ -170,7 +170,7 @@ struct PaintInnerBoxShadow {
};
struct PaintTextShadow {
NonnullRefPtr<Gfx::GlyphRun> glyph_run;
NonnullRefPtr<Gfx::GlyphRun const> glyph_run;
double glyph_run_scale { 1 };
Gfx::IntRect shadow_bounding_rect;
Gfx::IntRect text_rect;
@ -438,7 +438,7 @@ struct ApplyTransform {
struct ApplyMaskBitmap {
Gfx::IntPoint origin;
NonnullRefPtr<Gfx::ImmutableBitmap> bitmap;
NonnullRefPtr<Gfx::ImmutableBitmap const> bitmap;
Gfx::Bitmap::MaskKind kind;
void translate_by(Gfx::IntPoint const& offset)

View file

@ -206,7 +206,7 @@ void DisplayListRecorder::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_r
});
}
void DisplayListRecorder::draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr<Gfx::ImmutableBitmap> bitmap, Gfx::ScalingMode scaling_mode, DrawRepeatedImmutableBitmap::Repeat repeat)
void DisplayListRecorder::draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr<Gfx::ImmutableBitmap const> bitmap, Gfx::ScalingMode scaling_mode, DrawRepeatedImmutableBitmap::Repeat repeat)
{
append(DrawRepeatedImmutableBitmap {
.dst_rect = dst_rect,

View file

@ -97,7 +97,7 @@ public:
void draw_painting_surface(Gfx::IntRect const& dst_rect, NonnullRefPtr<Gfx::PaintingSurface>, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode = Gfx::ScalingMode::NearestNeighbor);
void draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::IntRect const& clip_rect, Gfx::ImmutableBitmap const& bitmap, Gfx::ScalingMode scaling_mode = Gfx::ScalingMode::NearestNeighbor);
void draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr<Gfx::ImmutableBitmap> bitmap, Gfx::ScalingMode scaling_mode, DrawRepeatedImmutableBitmap::Repeat);
void draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr<Gfx::ImmutableBitmap const> bitmap, Gfx::ScalingMode scaling_mode, DrawRepeatedImmutableBitmap::Repeat);
void draw_line(Gfx::IntPoint from, Gfx::IntPoint to, Color color, int thickness = 1, Gfx::LineStyle style = Gfx::LineStyle::Solid, Color alternate_color = Color::Transparent);