diff --git a/src/st/st-scroll-view-fade.c b/src/st/st-scroll-view-fade.c index 3d6639ae9..74e430de2 100644 --- a/src/st/st-scroll-view-fade.c +++ b/src/st/st-scroll-view-fade.c @@ -49,21 +49,23 @@ static const gchar *fade_glsl_shader = " vec4 color = cogl_color_in * texture2D (tex, vec2 (cogl_tex_coord_in[0].xy));\n" " float y = height * cogl_tex_coord_in[0].y;\n" " float x = width * cogl_tex_coord_in[0].x;\n" -" float ratio = 0.0;\n" +" float ratio = 1.0;\n" " float fade_bottom_start = height - offset_bottom;\n" -" \n" -" if (offset_top != 0.0 && y < offset_top && ((rtl && x > scrollbar_width) || (!rtl && x < (width - scrollbar_width)))) {\n" -" ratio = y / offset_top;\n" +" float ratio_top = y / offset_top;\n" +" float ratio_bottom = (height - y)/(height - fade_bottom_start);\n" +" bool in_scroll_area = ((rtl && x > scrollbar_width) || (!rtl && x < (width - scrollbar_width)));\n" +" bool fade_top = y < offset_top && in_scroll_area;\n" +" bool fade_bottom = y > fade_bottom_start && in_scroll_area;\n" +"\n" +" if (fade_top) {\n" +" ratio = ratio_top;\n" +" }\n" +" else if (fade_bottom) {\n" +" ratio = ratio_bottom;\n" +" }\n" +"\n" " cogl_color_out = color * ratio;\n" -" }\n" -" else if (offset_bottom != 0.0 && y > fade_bottom_start && ((rtl && x > scrollbar_width) || (!rtl && x < (width - scrollbar_width)))) {\n" -" ratio = (height - y)/(height - fade_bottom_start);\n" -" cogl_color_out = color * ratio;\n" -" }\n" -" else { \n" -" cogl_color_out = color;\n" -" }\n" -"}\n"; +"}"; struct _StScrollViewFade {