windowManager: Incorporate invisible borders into window dimming effect

Without this, the dim "fade" will start at the top of the untrimmed actor. With
a large enough draggable_border_width setting, this will show no fade at all.

https://bugzilla.gnome.org/show_bug.cgi?id=659302
This commit is contained in:
Jasper St. Pierre
2011-09-17 15:56:59 -04:00
parent 82eccb566c
commit 127ef8383b
2 changed files with 22 additions and 12 deletions

View File

@ -1,5 +1,6 @@
#version 110
uniform sampler2D tex;
uniform float startY;
uniform float fraction;
uniform float height;
const float c = -0.2;
@ -18,10 +19,11 @@ void main()
// To reduce contrast, blend with a mid gray
cogl_color_out = color * contrast - off * c;
// We only fully dim at a distance of BORDER_MAX_HEIGHT from the edge and
// We only fully dim at a distance of BORDER_MAX_HEIGHT from startY and
// when the fraction is 1.0. For other locations and fractions we linearly
// interpolate back to the original undimmed color.
cogl_color_out = color + (cogl_color_out - color) * min(y / border_max_height, 1.0);
// interpolate back to the original undimmed color, so the top of the window
// is at full color.
cogl_color_out = color + (cogl_color_out - color) * max(min((y - startY) / border_max_height, 1.0), 0.0);
cogl_color_out = color + (cogl_color_out - color) * fraction;
cogl_color_out *= color.a;