3d5f962566
More or less straight forward port from OpenGL to XRender. There is one small difference: the corners are not upscaled. REVIEW: 108939
70 lines
2.1 KiB
C++
70 lines
2.1 KiB
C++
/********************************************************************
|
|
KWin - the KDE window manager
|
|
This file is part of the KDE project.
|
|
|
|
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*********************************************************************/
|
|
#ifndef KWIN_SCREEN_EDGE_EFFECT_H
|
|
#define KWIN_SCREEN_EDGE_EFFECT_H
|
|
#include <kwineffects.h>
|
|
|
|
class QTimer;
|
|
namespace Plasma {
|
|
class Svg;
|
|
}
|
|
|
|
namespace KWin {
|
|
class Glow;
|
|
class GLTexture;
|
|
|
|
class ScreenEdgeEffect : public Effect
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
ScreenEdgeEffect();
|
|
virtual ~ScreenEdgeEffect();
|
|
virtual void prePaintScreen(ScreenPrePaintData &data, int time);
|
|
virtual void paintScreen(int mask, QRegion region, ScreenPaintData &data);
|
|
virtual bool isActive() const;
|
|
private Q_SLOTS:
|
|
void edgeApproaching(ElectricBorder border, qreal factor, const QRect &geometry);
|
|
void cleanup();
|
|
private:
|
|
Glow *createGlow(ElectricBorder border, qreal factor, const QRect &geometry);
|
|
template <typename T>
|
|
T *createCornerGlow(ElectricBorder border);
|
|
template <typename T>
|
|
T *createEdgeGlow(ElectricBorder border, const QSize &size);
|
|
QSize cornerGlowSize(ElectricBorder border) const;
|
|
Plasma::Svg *m_glow;
|
|
QHash<ElectricBorder, Glow*> m_borders;
|
|
QTimer *m_cleanupTimer;
|
|
};
|
|
|
|
class Glow
|
|
{
|
|
public:
|
|
QScopedPointer<GLTexture> texture;
|
|
QScopedPointer<XRenderPicture> picture;
|
|
qreal strength;
|
|
QRect geometry;
|
|
QSize pictureSize;
|
|
ElectricBorder border;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|