st/scroll-view-fade: Don't assume fade area at (0,0)
The shader code currently only accounts for padding for the bottom and right fades, but not for top and left. As a result, we only fade the right edge when swiping through app picker pages, whoops. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1569>
This commit is contained in:
parent
ecf5e3d3ee
commit
5d65a424a8
@ -44,16 +44,18 @@ void main ()
|
|||||||
if (x > fade_area_topleft[0] && x < fade_area_bottomright[0] &&
|
if (x > fade_area_topleft[0] && x < fade_area_bottomright[0] &&
|
||||||
y > fade_area_topleft[1] && y < fade_area_bottomright[1]) {
|
y > fade_area_topleft[1] && y < fade_area_bottomright[1]) {
|
||||||
float ratio = 1.0;
|
float ratio = 1.0;
|
||||||
|
float fade_top_start = fade_area_topleft[1] + vfade_offset;
|
||||||
|
float fade_left_start = fade_area_topleft[0] + hfade_offset;
|
||||||
float fade_bottom_start = fade_area_bottomright[1] - vfade_offset;
|
float fade_bottom_start = fade_area_bottomright[1] - vfade_offset;
|
||||||
float fade_right_start = fade_area_bottomright[0] - hfade_offset;
|
float fade_right_start = fade_area_bottomright[0] - hfade_offset;
|
||||||
bool fade_top = y < vfade_offset && fade_edges_top;
|
bool fade_top = y < vfade_offset && fade_edges_top;
|
||||||
bool fade_bottom = y > fade_bottom_start && fade_edges_bottom;
|
bool fade_bottom = y > fade_bottom_start && fade_edges_bottom;
|
||||||
bool fade_left = x < hfade_offset && fade_edges_left;
|
bool fade_left = x < fade_left_start && fade_edges_left;
|
||||||
bool fade_right = x > fade_right_start && fade_edges_right;
|
bool fade_right = x > fade_right_start && fade_edges_right;
|
||||||
|
|
||||||
float vfade_scale = height / vfade_offset;
|
float vfade_scale = height / vfade_offset;
|
||||||
if (fade_top) {
|
if (fade_top) {
|
||||||
ratio *= y / vfade_offset;
|
ratio *= (fade_area_topleft[1] - y) / (fade_area_topleft[1] - fade_bottom_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fade_bottom) {
|
if (fade_bottom) {
|
||||||
@ -62,7 +64,7 @@ void main ()
|
|||||||
|
|
||||||
float hfade_scale = width / hfade_offset;
|
float hfade_scale = width / hfade_offset;
|
||||||
if (fade_left) {
|
if (fade_left) {
|
||||||
ratio *= x / hfade_offset;
|
ratio *= (fade_area_topleft[0] - x) / (fade_area_topleft[0] - fade_left_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fade_right) {
|
if (fade_right) {
|
||||||
|
Loading…
Reference in New Issue
Block a user