summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/group
diff options
context:
space:
mode:
authorroico <roico@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-13 20:59:07 +0000
committerroico <roico@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-13 20:59:07 +0000
commitd3872598e515bf161195501b4537a41e0a352500 (patch)
tree7700233fe39bdddb90a9d9439a032cb40e8643bd /beryl-plugins/src/group
parent633b527f3d3f595d4b257723115e2396050ea2a1 (diff)
downloadmarex-dev-d3872598e515bf161195501b4537a41e0a352500.tar.gz
marex-dev-d3872598e515bf161195501b4537a41e0a352500.tar.bz2
calculate saturation for glow
git-svn-id: file:///beryl/trunk@4042 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/group')
-rw-r--r--beryl-plugins/src/group/paint.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/beryl-plugins/src/group/paint.c b/beryl-plugins/src/group/paint.c
index 87423b3..1d06f0a 100644
--- a/beryl-plugins/src/group/paint.c
+++ b/beryl-plugins/src/group/paint.c
@@ -928,6 +928,20 @@ groupDrawWindow(CompWindow * w,
if (w->vCount) {
FragmentAttrib fAttrib = *attrib;
+
+ GLushort color[3] = {gw->group->color[0], gw->group->color[1], gw->group->color[2]};
+
+ // Apply brightness to color.
+ color[0] *= (float)attrib->brightness / 0xffff;
+ color[1] *= (float)attrib->brightness / 0xffff;
+ color[2] *= (float)attrib->brightness / 0xffff;
+
+ // Apply saturation to color.
+ GLushort avarage = (color[0] + color[1] + color[2]) / 3;
+
+ color[0] = avarage + (color[0] - avarage) * attrib->saturation / 0xffff;
+ color[1] = avarage + (color[1] - avarage) * attrib->saturation / 0xffff;
+ color[2] = avarage + (color[2] - avarage) * attrib->saturation / 0xffff;
fAttrib.opacity = OPAQUE;
fAttrib.saturation = COLOR;
@@ -936,9 +950,7 @@ groupDrawWindow(CompWindow * w,
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE); - maybe add an option for that...
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4us(gw->group->color[0] * attrib->brightness / 0xffff,
- gw->group->color[1] * attrib->brightness / 0xffff,
- gw->group->color[2] * attrib->brightness / 0xffff,
+ glColor4us(color[0], color[1], color[2],
attrib->opacity);
/* we use PAINT_WINDOW_TRANSFORMED_MASK here to force