mirror of
https://github.com/RGBCube/serenity
synced 2025-07-04 20:27:35 +00:00

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.
28 lines
568 B
C++
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;
|
|
};
|