Magnifier: Add 8x magnification and pausing

This adds an option for even more magnification, when you really need to
count pixels, as well as pausing the capture by pressing Space and
switching between magnification levels with keys 2, 4 & 8.
This commit is contained in:
Marcus Nilsson 2021-09-17 22:29:35 +02:00 committed by Andreas Kling
commit 401ea85655
Notes: sideshowbarker 2024-07-18 03:45:10 +09:00
3 changed files with 23 additions and 3 deletions

View file

@ -22,13 +22,16 @@ MagnifierWidget::~MagnifierWidget()
void MagnifierWidget::set_scale_factor(int scale_factor)
{
VERIFY(scale_factor == 2 || scale_factor == 4);
VERIFY(scale_factor == 2 || scale_factor == 4 || scale_factor == 8);
m_scale_factor = scale_factor;
update();
}
void MagnifierWidget::sync()
{
if (m_pause_capture)
return;
auto size = frame_inner_rect().size();
Gfx::IntSize grab_size { size.width() / m_scale_factor, size.height() / m_scale_factor };
m_grabbed_bitmap = GUI::WindowServerConnection::the().get_screen_bitmap_around_cursor(grab_size).bitmap();