1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibWeb: Use box sampling instead of bilinear scaling when downscaling

As a heuristic, either the width or height of the scaled image should
decrease for box sampling to be used. Otherwise, we use bilinear
scaling.
This commit is contained in:
Jelle Raaijmakers 2023-05-19 00:41:12 +02:00 committed by Andreas Kling
parent fae9a05039
commit 7652dbd983
5 changed files with 13 additions and 6 deletions

View file

@ -135,7 +135,8 @@ void VideoPaintable::paint(PaintContext& context, PaintPhase phase) const
}
auto paint_frame = [&](auto const& frame) {
context.painter().draw_scaled_bitmap(video_rect.to_type<int>(), *frame, frame->rect(), 1.0f, to_gfx_scaling_mode(computed_values().image_rendering()));
auto scaling_mode = to_gfx_scaling_mode(computed_values().image_rendering(), frame->rect(), video_rect.to_type<int>());
context.painter().draw_scaled_bitmap(video_rect.to_type<int>(), *frame, frame->rect(), 1.f, scaling_mode);
};
auto paint_transparent_black = [&]() {