1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-04 20:27:35 +00:00
serenity/Userland/Applications/Magnifier/MagnifierWidget.h
Andreas Kling cb295ab644 WindowServer+Magnifier: Make Magnifier buttery smooth :^)
This patch moves the magnifier rect computation over to the server side
to ensure that the mouse cursor position and the screen image never get
out of sync.
2021-06-07 10:22:25 +02:00

28 lines
568 B
C++

/*
* Copyright (c) 2021, Valtteri Koskivuori <vkoskiv@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Widget.h>
#include <LibGfx/Point.h>
class MagnifierWidget final : public GUI::Widget {
C_OBJECT(MagnifierWidget)
public:
MagnifierWidget();
virtual ~MagnifierWidget();
void set_scale_factor(int scale_factor);
void track_cursor_globally();
private:
virtual void paint_event(GUI::PaintEvent&) override;
void sync();
int m_scale_factor { 2 };
RefPtr<Gfx::Bitmap> m_grabbed_bitmap;
};