st: Add StScrollViewFade:fade-edges

Add a new property which controls whether edge areas are excluded
from the effect (the default and current behavior), or not.

https://bugzilla.gnome.org/show_bug.cgi?id=707409
This commit is contained in:
Florian Müllner
2013-09-04 17:53:41 +02:00
parent 6fb044f351
commit 4f5d3e00db
2 changed files with 46 additions and 5 deletions

View File

@ -24,6 +24,7 @@ uniform float vfade_offset;
uniform float hfade_offset;
uniform float vvalue;
uniform float hvalue;
uniform bool fade_edges;
uniform vec2 fade_area_topleft;
uniform vec2 fade_area_bottomright;
@ -44,10 +45,14 @@ void main ()
float ratio = 1.0;
float fade_bottom_start = fade_area_bottomright[1] - vfade_offset;
float fade_right_start = fade_area_bottomright[0] - hfade_offset;
bool fade_top = y < vfade_offset && vvalue > 0.0;
bool fade_bottom = y > fade_bottom_start && vvalue < 1.0;
bool fade_left = x < hfade_offset && hvalue > 0.0;
bool fade_right = x > fade_right_start && hvalue < 1.0;
bool fade_top = y < vfade_offset && (fade_edges ? vvalue >= 0.0
: vvalue > 0.0);
bool fade_bottom = y > fade_bottom_start && (fade_edges ? vvalue <= 1.0
: vvalue < 1.0);
bool fade_left = x < hfade_offset && (fade_edges ? hvalue >= 0.0
: hvalue > 0.0);
bool fade_right = x > fade_right_start && (fade_edges ? hvalue <= 1.0
: hvalue < 1.0);
float vfade_scale = height / vfade_offset;
if (fade_top) {