[gnome-shell] St: Fix fade effect



commit c23786c73edae26247707ee0bea352d4866fed53
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Tue Sep 17 19:41:02 2013 +0200

    St: Fix fade effect
    
    Commit 4095a58eb9a2921c178b30c56d1fbe7662c2778a introduced a
    regression, since we have to take into account four cases,
    top, bottom, right, and left, and that can't be merged into
    two like that commit did.
    So fix it to make fade effect works again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708256

 src/st/st-scroll-view-fade.c    |    6 ++++--
 src/st/st-scroll-view-fade.glsl |   14 ++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/st/st-scroll-view-fade.c b/src/st/st-scroll-view-fade.c
index 9f267c3..ded8efb 100644
--- a/src/st/st-scroll-view-fade.c
+++ b/src/st/st-scroll-view-fade.c
@@ -142,11 +142,13 @@ st_scroll_view_fade_paint_target (ClutterOffscreenEffect *effect)
 
   st_adjustment_get_values (self->vadjustment, &value, &lower, &upper, NULL, NULL, &page_size);
   value = (value - lower) / (upper - page_size - lower);
-  clutter_shader_effect_set_uniform (shader, "fade_edges_v", G_TYPE_INT, 1, self->fade_edges ? value >= 0.0 
: value > 0.0);
+  clutter_shader_effect_set_uniform (shader, "fade_edges_top", G_TYPE_INT, 1, self->fade_edges ? value >= 
0.0 : value > 0.0);
+  clutter_shader_effect_set_uniform (shader, "fade_edges_bottom", G_TYPE_INT, 1, self->fade_edges ? value <= 
1.0 : value < 1.0);
 
   st_adjustment_get_values (self->hadjustment, &value, &lower, &upper, NULL, NULL, &page_size);
   value = (value - lower) / (upper - page_size - lower);
-  clutter_shader_effect_set_uniform (shader, "fade_edges_h", G_TYPE_INT, 1, self->fade_edges ? value >= 0.0 
: value > 0.0);
+  clutter_shader_effect_set_uniform (shader, "fade_edges_left", G_TYPE_INT, 1, self->fade_edges ? value >= 
0.0 : value > 0.0);
+  clutter_shader_effect_set_uniform (shader, "fade_edges_right", G_TYPE_INT, 1, self->fade_edges ? value <= 
1.0 : value < 1.0);
 
   clutter_shader_effect_set_uniform (shader, "vfade_offset", G_TYPE_FLOAT, 1, self->vfade_offset);
   clutter_shader_effect_set_uniform (shader, "hfade_offset", G_TYPE_FLOAT, 1, self->hfade_offset);
diff --git a/src/st/st-scroll-view-fade.glsl b/src/st/st-scroll-view-fade.glsl
index 23881fb..9180aa1 100644
--- a/src/st/st-scroll-view-fade.glsl
+++ b/src/st/st-scroll-view-fade.glsl
@@ -22,8 +22,10 @@ uniform float height;
 uniform float width;
 uniform float vfade_offset;
 uniform float hfade_offset;
-uniform bool  fade_edges_h;
-uniform bool  fade_edges_v;
+uniform bool  fade_edges_top;
+uniform bool  fade_edges_right;
+uniform bool  fade_edges_bottom;
+uniform bool  fade_edges_left;
 
 uniform vec2 fade_area_topleft;
 uniform vec2 fade_area_bottomright;
@@ -44,10 +46,10 @@ 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 && fade_edges_v;
-        bool fade_bottom = y > fade_bottom_start && fade_edges_v;
-        bool fade_left = x < hfade_offset && fade_edges_h;
-        bool fade_right = x > fade_right_start && fade_edges_h;
+        bool fade_top = y < vfade_offset && fade_edges_top;
+        bool fade_bottom = y > fade_bottom_start && fade_edges_bottom;
+        bool fade_left = x < hfade_offset && fade_edges_left;
+        bool fade_right = x > fade_right_start && fade_edges_right;
 
         float vfade_scale = height / vfade_offset;
         if (fade_top) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]