LibWebView: Unbreak content-scales-to-viewport mode for Presenter

Now that we allocate an oversized backing store during resizing of the
viewport, we need to constrain the source rect used when drawing a
scaled version of the content in the special mode used by Presenter.

Regressed with 85c542ab00.
This commit is contained in:
Andreas Kling 2023-06-01 08:53:46 +02:00
parent 62c7fcd836
commit f5f4daea9a
Notes: sideshowbarker 2024-07-17 21:26:19 +09:00

View file

@ -68,10 +68,17 @@ void OutOfProcessWebView::paint_event(GUI::PaintEvent& event)
if (auto* bitmap = m_client_state.has_usable_bitmap ? m_client_state.front_bitmap.bitmap.ptr() : m_backup_bitmap.ptr()) {
painter.add_clip_rect(frame_inner_rect());
painter.translate(frame_thickness(), frame_thickness());
if (m_content_scales_to_viewport)
painter.draw_scaled_bitmap(rect(), *bitmap, bitmap->rect());
else
if (m_content_scales_to_viewport) {
auto bitmap_rect = Gfx::IntRect {
{},
m_client_state.has_usable_bitmap
? m_client_state.front_bitmap.last_painted_size
: m_backup_bitmap_size
};
painter.draw_scaled_bitmap(rect(), *bitmap, bitmap_rect);
} else {
painter.blit({ 0, 0 }, *bitmap, bitmap->rect());
}
return;
}