[gnome-shell] scroll-view-fade: Only calculate the ratios if they're needed
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] scroll-view-fade: Only calculate the ratios if they're needed
- Date: Thu, 29 Nov 2012 21:17:51 +0000 (UTC)
commit 69347fff09964fc0dea591da83c5a627b6757f0a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Nov 28 19:56:02 2012 -0500
scroll-view-fade: Only calculate the ratios if they're needed
This prevents some calculations being done for poor drivers with
bad optimizers.
https://bugzilla.gnome.org/show_bug.cgi?id=689249
src/st/st-scroll-view-fade.glsl | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/st/st-scroll-view-fade.glsl b/src/st/st-scroll-view-fade.glsl
index 7897c7b..01e05f8 100644
--- a/src/st/st-scroll-view-fade.glsl
+++ b/src/st/st-scroll-view-fade.glsl
@@ -52,29 +52,25 @@ void main ()
float ratio = 1.0;
float fade_bottom_start = fade_area[1][1] - vfade_offset;
float fade_right_start = fade_area[1][0] - hfade_offset;
- float ratio_top = y / vfade_offset;
- float ratio_bottom = (fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start);
- float ratio_left = x / hfade_offset;
- float ratio_right = (fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start);
bool fade_top = y < vfade_offset && vvalue > 0;
bool fade_bottom = y > fade_bottom_start && vvalue < 1;
bool fade_left = x < hfade_offset && hvalue > 0;
bool fade_right = x > fade_right_start && hvalue < 1;
if (fade_top) {
- ratio *= ratio_top;
+ ratio *= (y / vfade_offset);
}
if (fade_bottom) {
- ratio *= ratio_bottom;
+ ratio *= (fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start);
}
if (fade_left) {
- ratio *= ratio_left;
+ ratio *= (x / hfade_offset);
}
if (fade_right) {
- ratio *= ratio_right;
+ ratio *= (fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start);
}
cogl_color_out *= ratio;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]