File indexing completed on 2024-11-10 04:57:09

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2007 Lubos Lunak <l.lunak@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "effect/effect.h"
0013 
0014 namespace KWin
0015 {
0016 
0017 class ShowPaintEffect : public Effect
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     ShowPaintEffect();
0023 
0024     void paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, Output *screen) override;
0025     void paintWindow(const RenderTarget &renderTarget, const RenderViewport &viewport, EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
0026 
0027     bool isActive() const override;
0028 
0029 private Q_SLOTS:
0030     void toggle();
0031 
0032 private:
0033     void paintGL(const QMatrix4x4 &projection, qreal scale);
0034     void paintQPainter();
0035 
0036     bool m_active = false;
0037     QRegion m_painted; // what's painted in one pass
0038     int m_colorIndex = 0;
0039 };
0040 
0041 } // namespace KWin