/* KWin - the KDE window manager This file is part of the KDE project. SPDX-FileCopyrightText: 2007 Lubos Lunak SPDX-FileCopyrightText: 2011 Martin Gräßlin SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include "effect/effect.h" namespace KWin { class GLFramebuffer; class GLTexture; class MagnifierEffect : public Effect { Q_OBJECT Q_PROPERTY(QSize magnifierSize READ magnifierSize) Q_PROPERTY(qreal targetZoom READ targetZoom) public: MagnifierEffect(); ~MagnifierEffect() override; void reconfigure(ReconfigureFlags) override; void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override; void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion ®ion, Output *screen) override; void postPaintScreen() override; bool isActive() const override; static bool supported(); // for properties QSize magnifierSize() const; qreal targetZoom() const; private Q_SLOTS: void zoomIn(); void zoomOut(); void toggle(); void slotMouseChanged(const QPointF &pos, const QPointF &old, Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons, Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers); void slotWindowAdded(EffectWindow *w); void slotWindowDamaged(); private: QRect magnifierArea(QPointF pos = cursorPos()) const; double m_zoom; double m_targetZoom; std::chrono::milliseconds m_lastPresentTime; QSize m_magnifierSize; std::unique_ptr m_texture; std::unique_ptr m_fbo; }; } // namespace