3
* Compiz magnifier plugin
7
* Copyright : (C) 2008 by Dennis Kasprzyk
8
* E-mail : onestone@opencompositing.org
11
* This program is free software; you can redistribute it and/or
12
* modify it under the terms of the GNU General Public License
13
* as published by the Free Software Foundation; either version 2
14
* of the License, or (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
25
#include <core/core.h>
26
#include <composite/composite.h>
27
#include <opengl/opengl.h>
28
#include <mousepoll/mousepoll.h>
29
#include <core/serialization.h>
31
#include "mag_options.h"
33
#define MAG_SCREEN(s) \
34
MagScreen *ms = MagScreen::get (s)
37
public PluginClassHandler <MagScreen, CompScreen>,
38
public PluginStateWriter <MagScreen>,
40
public ScreenInterface,
41
public CompositeScreenInterface,
42
public GLScreenInterface
45
MagScreen (CompScreen *screen);
48
CompositeScreen *cScreen;
60
enum MagOptions::Mode mode;
68
GLTexture::List overlay;
70
CompSize overlaySize, maskSize;
76
template <class Archive>
77
void serialize (Archive &ar, const unsigned int version)
92
preparePaint (int ms);
95
glPaintOutput (const GLScreenPaintAttrib &attrib,
96
const GLMatrix &transform,
97
const CompRegion ®ion,
108
loadFragmentProgram ();
114
optionChanged (CompOption *opt,
115
MagOptions::Options num);
121
positionUpdate (const CompPoint &pos);
124
adjustZoom (float chunk);
136
terminate (CompAction *action,
137
CompAction::State state,
138
CompOption::Vector options);
141
initiate (CompAction *action,
142
CompAction::State state,
143
CompOption::Vector options);
146
zoomIn (CompAction *action,
147
CompAction::State state,
148
CompOption::Vector options);
151
zoomOut (CompAction *action,
152
CompAction::State state,
153
CompOption::Vector options);
157
class MagPluginVTable :
158
public CompPlugin::VTableForScreen <MagScreen>
164
static const char *fisheyeFpString =
167
"PARAM p0 = program.env[0];"
168
"PARAM p1 = program.env[1];"
169
"PARAM p2 = program.env[2];"
171
"TEMP t0, t1, t2, t3;"
173
"SUB t1, p0.xyww, fragment.texcoord[0];"
179
"MAD t3, t3, p1.z, p2.z;"
185
"MAD t1, t1, t3, fragment.texcoord[0];"
187
"CMP t1, t0.z, fragment.texcoord[0], t1;"
189
"MAD t1, t1, p1, p2;"
190
"TEX result.color, t1, texture[0], %s;"