~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kwin/effects/blur/blur.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
 
3
 *
 
4
 *   This program is free software; you can redistribute it and/or modify
 
5
 *   it under the terms of the GNU General Public License as published by
 
6
 *   the Free Software Foundation; either version 2 of the License, or
 
7
 *   (at your option) any later version.
 
8
 *
 
9
 *   This program is distributed in the hope that it will be useful,
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 *   General Public License for more details.
 
13
 *
 
14
 *   You should have received a copy of the GNU General Public License
 
15
 *   along with this program; see the file COPYING.  if not, write to
 
16
 *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
 *   Boston, MA 02110-1301, USA.
 
18
 */
 
19
 
 
20
#ifndef BLUR_H
 
21
#define BLUR_H
 
22
 
 
23
#include <kwineffects.h>
 
24
#include <kwinglplatform.h>
 
25
#include <kwinglutils.h>
 
26
 
 
27
#include <QVector>
 
28
#include <QVector2D>
 
29
 
 
30
namespace KWin
 
31
{
 
32
 
 
33
class BlurShader;
 
34
 
 
35
class BlurEffect : public KWin::Effect
 
36
{
 
37
    Q_OBJECT
 
38
public:
 
39
    BlurEffect();
 
40
    ~BlurEffect();
 
41
 
 
42
    static bool supported();
 
43
    static bool enabledByDefault();
 
44
 
 
45
    void reconfigure(ReconfigureFlags flags);
 
46
    void prePaintScreen(ScreenPrePaintData &data, int time);
 
47
    void drawWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data);
 
48
    void paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity);
 
49
 
 
50
public Q_SLOTS:
 
51
    void slotWindowAdded(EffectWindow *w);
 
52
    void slotPropertyNotify(EffectWindow *w, long atom);
 
53
 
 
54
private:
 
55
    QRect expand(const QRect &rect) const;
 
56
    QRegion expand(const QRegion &region) const;
 
57
    QRegion blurRegion(const EffectWindow *w) const;
 
58
    bool shouldBlur(const EffectWindow *w, int mask, const WindowPaintData &data) const;
 
59
    void updateBlurRegion(EffectWindow *w) const;
 
60
    void drawRegion(const QRegion &region);
 
61
    void doBlur(const QRegion &shape, const QRect &screen, const float opacity);
 
62
 
 
63
private:
 
64
    BlurShader *shader;
 
65
    QVector<QVector2D> vertices;
 
66
    GLRenderTarget *target;
 
67
    GLTexture *tex;
 
68
    long net_wm_blur_region;
 
69
};
 
70
 
 
71
} // namespace KWin
 
72
 
 
73
#endif
 
74