diff --git a/Userland/Libraries/LibWeb/Painting/Command.h b/Userland/Libraries/LibWeb/Painting/Command.h index 3256c35a779..0a8dd6024cd 100644 --- a/Userland/Libraries/LibWeb/Painting/Command.h +++ b/Userland/Libraries/LibWeb/Painting/Command.h @@ -58,16 +58,6 @@ struct FillRect { void translate_by(Gfx::IntPoint const& offset) { rect.translate_by(offset); } }; -struct DrawScaledBitmap { - Gfx::IntRect dst_rect; - NonnullRefPtr bitmap; - Gfx::IntRect src_rect; - Gfx::ScalingMode scaling_mode; - - [[nodiscard]] Gfx::IntRect bounding_rect() const { return dst_rect; } - void translate_by(Gfx::IntPoint const& offset) { dst_rect.translate_by(offset); } -}; - struct DrawPaintingSurface { Gfx::IntRect dst_rect; NonnullRefPtr surface; @@ -427,7 +417,6 @@ struct ApplyMaskBitmap { using Command = Variant< DrawGlyphRun, FillRect, - DrawScaledBitmap, DrawPaintingSurface, DrawScaledImmutableBitmap, DrawRepeatedImmutableBitmap, diff --git a/Userland/Libraries/LibWeb/Painting/DisplayList.cpp b/Userland/Libraries/LibWeb/Painting/DisplayList.cpp index c9d40913c52..4883944a206 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayList.cpp +++ b/Userland/Libraries/LibWeb/Painting/DisplayList.cpp @@ -71,7 +71,6 @@ void DisplayListPlayer::execute(DisplayList& display_list) // clang-format off HANDLE_COMMAND(DrawGlyphRun, draw_glyph_run) else HANDLE_COMMAND(FillRect, fill_rect) - else HANDLE_COMMAND(DrawScaledBitmap, draw_scaled_bitmap) else HANDLE_COMMAND(DrawPaintingSurface, draw_painting_surface) else HANDLE_COMMAND(DrawScaledImmutableBitmap, draw_scaled_immutable_bitmap) else HANDLE_COMMAND(DrawRepeatedImmutableBitmap, draw_repeated_immutable_bitmap) diff --git a/Userland/Libraries/LibWeb/Painting/DisplayList.h b/Userland/Libraries/LibWeb/Painting/DisplayList.h index 733d006ba35..386743ec5b0 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayList.h +++ b/Userland/Libraries/LibWeb/Painting/DisplayList.h @@ -45,7 +45,6 @@ public: private: virtual void draw_glyph_run(DrawGlyphRun const&) = 0; virtual void fill_rect(FillRect const&) = 0; - virtual void draw_scaled_bitmap(DrawScaledBitmap const&) = 0; virtual void draw_painting_surface(DrawPaintingSurface const&) = 0; virtual void draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const&) = 0; virtual void draw_repeated_immutable_bitmap(DrawRepeatedImmutableBitmap const&) = 0; diff --git a/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp b/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp index 74acd1acd80..6508afe883f 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp +++ b/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp @@ -366,17 +366,6 @@ void DisplayListPlayerSkia::draw_painting_surface(DrawPaintingSurface const& com canvas.drawImageRect(image, src_rect, dst_rect, to_skia_sampling_options(command.scaling_mode), &paint, SkCanvas::kStrict_SrcRectConstraint); } -void DisplayListPlayerSkia::draw_scaled_bitmap(DrawScaledBitmap const& command) -{ - auto src_rect = to_skia_rect(command.src_rect); - auto dst_rect = to_skia_rect(command.dst_rect); - auto bitmap = to_skia_bitmap(command.bitmap); - auto image = SkImages::RasterFromBitmap(bitmap); - auto& canvas = surface().canvas(); - SkPaint paint; - canvas.drawImageRect(image, src_rect, dst_rect, to_skia_sampling_options(command.scaling_mode), &paint, SkCanvas::kStrict_SrcRectConstraint); -} - void DisplayListPlayerSkia::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command) { auto src_rect = to_skia_rect(command.src_rect); diff --git a/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.h b/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.h index 705073ad71f..2a1e2b50203 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.h +++ b/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.h @@ -33,7 +33,6 @@ private: void draw_glyph_run(DrawGlyphRun const&) override; void fill_rect(FillRect const&) override; void draw_painting_surface(DrawPaintingSurface const&) override; - void draw_scaled_bitmap(DrawScaledBitmap const&) override; void draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const&) override; void draw_repeated_immutable_bitmap(DrawRepeatedImmutableBitmap const&) override; void add_clip_rect(AddClipRect const&) override; diff --git a/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.cpp b/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.cpp index 9ae63a866cc..9bf413274b7 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.cpp +++ b/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.cpp @@ -168,18 +168,6 @@ void DisplayListRecorder::draw_rect(Gfx::IntRect const& rect, Color color, bool .rough = rough }); } -void DisplayListRecorder::draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode) -{ - if (dst_rect.is_empty()) - return; - append(DrawScaledBitmap { - .dst_rect = dst_rect, - .bitmap = bitmap, - .src_rect = src_rect, - .scaling_mode = scaling_mode, - }); -} - void DisplayListRecorder::draw_painting_surface(Gfx::IntRect const& dst_rect, NonnullRefPtr surface, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode) { if (dst_rect.is_empty()) diff --git a/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.h b/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.h index 76fc23af11a..c3e6b1cb26f 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.h +++ b/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.h @@ -87,7 +87,6 @@ public: void draw_rect(Gfx::IntRect const& rect, Color color, bool rough = false); - void draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode = Gfx::ScalingMode::NearestNeighbor); 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::ImmutableBitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode = Gfx::ScalingMode::NearestNeighbor); diff --git a/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp b/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp index 9059006cd8d..b9c2038644a 100644 --- a/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp @@ -130,7 +130,7 @@ void VideoPaintable::paint(PaintContext& context, PaintPhase phase) const auto paint_frame = [&](auto const& frame) { auto scaling_mode = to_gfx_scaling_mode(computed_values().image_rendering(), frame->rect(), video_rect.to_type()); - context.display_list_recorder().draw_scaled_bitmap(video_rect.to_type(), *frame, frame->rect(), scaling_mode); + context.display_list_recorder().draw_scaled_immutable_bitmap(video_rect.to_type(), Gfx::ImmutableBitmap::create(*frame), frame->rect(), scaling_mode); }; auto paint_transparent_black = [&]() {