mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 11:18:13 +00:00
Magnifier: Make the main widget a GUI::Frame
This makes the magnifier window look slightly nicer. :^)
This commit is contained in:
parent
782a5c88ce
commit
3e63633e1c
2 changed files with 11 additions and 8 deletions
|
@ -39,15 +39,18 @@ void MagnifierWidget::set_scale_factor(int scale_factor)
|
|||
|
||||
void MagnifierWidget::sync()
|
||||
{
|
||||
Gfx::IntSize grab_size { size().width() / m_scale_factor, size().height() / m_scale_factor };
|
||||
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();
|
||||
update();
|
||||
}
|
||||
|
||||
void MagnifierWidget::paint_event(GUI::PaintEvent&)
|
||||
void MagnifierWidget::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Frame::paint_event(event);
|
||||
|
||||
GUI::Painter painter(*this);
|
||||
|
||||
if (m_grabbed_bitmap)
|
||||
painter.draw_scaled_bitmap(rect(), *m_grabbed_bitmap, m_grabbed_bitmap->rect());
|
||||
painter.draw_scaled_bitmap(frame_inner_rect(), *m_grabbed_bitmap, m_grabbed_bitmap->rect());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue