2021-05-10 00:15:35 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Valtteri Koskivuori <vkoskiv@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-12-15 14:26:47 +01:00
|
|
|
#include <AK/CircularQueue.h>
|
2021-07-04 22:33:28 +02:00
|
|
|
#include <LibGUI/Frame.h>
|
2021-05-10 00:15:35 +03:00
|
|
|
|
2021-07-04 22:33:28 +02:00
|
|
|
class MagnifierWidget final : public GUI::Frame {
|
|
|
|
C_OBJECT(MagnifierWidget);
|
2021-05-10 00:15:35 +03:00
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~MagnifierWidget();
|
|
|
|
void set_scale_factor(int scale_factor);
|
2021-12-15 14:26:47 +01:00
|
|
|
void pause_capture(bool pause)
|
|
|
|
{
|
|
|
|
m_pause_capture = pause;
|
|
|
|
if (!pause)
|
|
|
|
m_frame_offset_from_head = 0;
|
|
|
|
}
|
|
|
|
void display_previous_frame();
|
|
|
|
void display_next_frame();
|
2021-05-10 00:15:35 +03:00
|
|
|
|
|
|
|
private:
|
2021-07-04 22:33:28 +02:00
|
|
|
MagnifierWidget();
|
|
|
|
|
2021-05-10 00:15:35 +03:00
|
|
|
virtual void paint_event(GUI::PaintEvent&) override;
|
|
|
|
|
2021-06-07 09:35:07 +02:00
|
|
|
void sync();
|
|
|
|
|
2021-05-10 00:15:35 +03:00
|
|
|
int m_scale_factor { 2 };
|
2021-06-07 09:35:07 +02:00
|
|
|
RefPtr<Gfx::Bitmap> m_grabbed_bitmap;
|
2021-12-15 14:26:47 +01:00
|
|
|
CircularQueue<RefPtr<Gfx::Bitmap>, 512> m_grabbed_bitmaps {};
|
|
|
|
ssize_t m_frame_offset_from_head { 0 };
|
2021-09-17 22:29:35 +02:00
|
|
|
bool m_pause_capture { false };
|
2021-05-10 00:15:35 +03:00
|
|
|
};
|