From ea68944149a13e176a53d3ecbb41731ac4007a04 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Tue, 15 Apr 2025 16:03:28 -0600 Subject: [PATCH] LibWeb: Store LibGfx objects in RefPtr to const for draw commands --- Libraries/LibWeb/Painting/Command.h | 12 ++++++------ Libraries/LibWeb/Painting/DisplayListRecorder.cpp | 2 +- Libraries/LibWeb/Painting/DisplayListRecorder.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Libraries/LibWeb/Painting/Command.h b/Libraries/LibWeb/Painting/Command.h index f8b3dbb4d37..cc55a5b0505 100644 --- a/Libraries/LibWeb/Painting/Command.h +++ b/Libraries/LibWeb/Painting/Command.h @@ -39,7 +39,7 @@ namespace Web::Painting { class DisplayList; struct DrawGlyphRun { - NonnullRefPtr glyph_run; + NonnullRefPtr glyph_run; double scale { 1 }; Gfx::IntRect rect; Gfx::FloatPoint translation; @@ -61,7 +61,7 @@ struct FillRect { struct DrawPaintingSurface { Gfx::IntRect dst_rect; - NonnullRefPtr surface; + NonnullRefPtr 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 bitmap; + NonnullRefPtr 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 bitmap; + NonnullRefPtr bitmap; Gfx::ScalingMode scaling_mode; Repeat repeat; @@ -170,7 +170,7 @@ struct PaintInnerBoxShadow { }; struct PaintTextShadow { - NonnullRefPtr glyph_run; + NonnullRefPtr 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 bitmap; + NonnullRefPtr bitmap; Gfx::Bitmap::MaskKind kind; void translate_by(Gfx::IntPoint const& offset) diff --git a/Libraries/LibWeb/Painting/DisplayListRecorder.cpp b/Libraries/LibWeb/Painting/DisplayListRecorder.cpp index e00e7ac04f4..48ee97345f0 100644 --- a/Libraries/LibWeb/Painting/DisplayListRecorder.cpp +++ b/Libraries/LibWeb/Painting/DisplayListRecorder.cpp @@ -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 bitmap, Gfx::ScalingMode scaling_mode, DrawRepeatedImmutableBitmap::Repeat repeat) +void DisplayListRecorder::draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr bitmap, Gfx::ScalingMode scaling_mode, DrawRepeatedImmutableBitmap::Repeat repeat) { append(DrawRepeatedImmutableBitmap { .dst_rect = dst_rect, diff --git a/Libraries/LibWeb/Painting/DisplayListRecorder.h b/Libraries/LibWeb/Painting/DisplayListRecorder.h index 86a0c022379..5689eb9d038 100644 --- a/Libraries/LibWeb/Painting/DisplayListRecorder.h +++ b/Libraries/LibWeb/Painting/DisplayListRecorder.h @@ -97,7 +97,7 @@ public: void draw_painting_surface(Gfx::IntRect const& dst_rect, NonnullRefPtr, 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 bitmap, Gfx::ScalingMode scaling_mode, DrawRepeatedImmutableBitmap::Repeat); + void draw_repeated_immutable_bitmap(Gfx::IntRect dst_rect, Gfx::IntRect clip_rect, NonnullRefPtr 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);