summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-11-21 12:12:54 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-11-21 12:12:54 +0800
commit4f0e6949386529b26df81ef5f880f7299d85bda7 (patch)
treedb96e53fabad92eb641dd2434a17118bd96e13b5
parentbf2657806313abf867865c62bcbfcf2172a7170c (diff)
downloadvignetting-4f0e6949386529b26df81ef5f880f7299d85bda7.tar.gz
vignetting-4f0e6949386529b26df81ef5f880f7299d85bda7.tar.bz2
Set the clip reigon correctly. No more weirdness on expo
-rw-r--r--src/vignetting.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/vignetting.cpp b/src/vignetting.cpp
index 662b2d1..e1381a8 100644
--- a/src/vignetting.cpp
+++ b/src/vignetting.cpp
@@ -22,7 +22,7 @@ VigScreen::cairoClear (cairo_t *cr)
}
cairo = cairoContext ();
-
+
if (cairo)
{
cairo_save (cairo);
@@ -83,9 +83,9 @@ VigScreen::renderVignette ()
{
cairo_pattern_t *pat;
cairoClear (cairo);
-
+
unsigned int size = optionGetQuality () * 50;
-
+
/* Radial gradient - transparent center, opaque black outside */
pat = cairo_pattern_create_radial (size / 2, size / 2, size / 20,
size / 2, size / 2, size / 2);
@@ -102,9 +102,9 @@ VigScreen::renderVignette ()
(optionGetQuality () * 50));
cairo_set_source (cairo, pat);
cairo_fill (cairo);
-
+
cairo_pattern_destroy (pat);
-
+
}
/* Draw the window */
@@ -117,11 +117,11 @@ VigWindow::glDraw (const GLMatrix &transform,
{
/* Save the brightness, we will be using it later */
float brightness = fragment.getBrightness ();
-
+
/* We want to set the geometry of the vignette to the window
* region */
CompRegion reg = CompRegion (window->inputRect ());
-
+
/* Draw the window on the bottom, we will be drawing the
* vignette render on top */
bool status = gWindow->glDraw (transform, fragment, region, mask);
@@ -133,7 +133,7 @@ VigWindow::glDraw (const GLMatrix &transform,
GLTexture::MatrixList matl;
GLTexture::Matrix mat = tex->matrix ();
- /* We can reset the window geometry since it will be
+ /* We can reset the window geometry since it will be
* re-added later */
gWindow->geometry ().reset ();
@@ -141,23 +141,23 @@ VigWindow::glDraw (const GLMatrix &transform,
* to window size */
mat.xx *= (vs->optionGetQuality () * 50.0f) / window->inputRect ().width ();
mat.yy *= (vs->optionGetQuality () * 50.0f) / window->inputRect ().height ();
-
+
/* Not sure what this does, but it is necessary
* (adjusts for scale?) */
mat.x0 -= mat.xx * reg.boundingRect ().x1 ();
mat.y0 -= mat.yy * reg.boundingRect ().y1 ();
-
+
matl.push_back (mat);
-
+
/* Now allow plugins to mess with the geometry of our
* vignette (so we get a nice render for things like
* wobbly etc etc */
- gWindow->glAddGeometry (matl, reg, infiniteRegion);
-
+ gWindow->glAddGeometry (matl, reg, region);
+
/* Did it succeed? */
if (gWindow->geometry ().vertices)
{
- /* Set the opacity of the vignette render to
+ /* Set the opacity of the vignette render to
* the opposite of the real brightness of the window */
fragment.setOpacity ((OPAQUE - brightness) *
(fragment.getOpacity () / OPAQUE));
@@ -196,8 +196,8 @@ VigScreen::optionChanged (CompOption *opt,
break;
}
}
-
-
+
+
/* Constructors */
@@ -207,7 +207,7 @@ VigWindow::VigWindow (CompWindow *w) :
cWindow (CompositeWindow::get (w)),
gWindow (GLWindow::get (w))
{
- bool enabled =
+ bool enabled =
VigScreen::get (screen)->optionGetWindowMatch ().evaluate (w);
GLWindowInterface::setHandler (gWindow, enabled);
}
@@ -225,7 +225,7 @@ VigScreen::VigScreen (CompScreen *s) :
cairo (NULL)
{
renderVignette ();
-
+
optionSetQualityNotify (boost::bind (&VigScreen::optionChanged, this,
_1, _2));
};