Merge lp:~3v1n0/compiz/grid-lowgfx-fixes into lp:compiz/0.9.13

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 4133
Merged at revision: 4123
Proposed branch: lp:~3v1n0/compiz/grid-lowgfx-fixes
Merge into: lp:compiz/0.9.13
Prerequisite: lp:~3v1n0/compiz/move-lowgfx-fixes
Diff against target: 125 lines (+19/-15)
3 files modified
debian/unity-lowgfx.ini (+2/-2)
plugins/grid/src/grid.cpp (+17/-12)
plugins/grid/src/grid.h (+0/-1)
To merge this branch: bzr merge lp:~3v1n0/compiz/grid-lowgfx-fixes
Reviewer Review Type Date Requested Status
Andrea Azzarone Approve
Review via email: mp+326487@code.launchpad.net

Commit message

grid: ignore alpha in colors when not blending, and fix animations

The fade-out animation was still happening when the duration was set to 1,
while it was broken when it was 0. Fixed both.

In unity-lowgfx.ini set the animation duration to 0 in grid and d not
draw stretched windows. Enable blending again as it's really not
expensive in this case, while not having it, really makes the user
experience a lot poorer.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/unity-lowgfx.ini'
2--- debian/unity-lowgfx.ini 2017-06-29 00:58:46 +0000
3+++ debian/unity-lowgfx.ini 2017-06-29 00:58:46 +0000
4@@ -12,8 +12,8 @@
5 s0_fade_time = 1
6
7 [grid]
8-s0_animation_duration = 1
9-s0_disable_blend = true
10+s0_animation_duration = 0
11+s0_draw_stretched_window = false
12
13 [resize]
14 s0_mode = 2
15
16=== modified file 'plugins/grid/src/grid.cpp'
17--- plugins/grid/src/grid.cpp 2016-09-07 11:10:35 +0000
18+++ plugins/grid/src/grid.cpp 2017-06-29 00:58:46 +0000
19@@ -532,7 +532,7 @@
20 Animation& anim = *iter;
21
22 float curve = powf (CURVE_ANIMATION, -anim.progress);
23- float alpha = (optionGetFillColorAlpha () / MaxUShortFloat) * anim.opacity;
24+ float alpha = blend ? (optionGetFillColorAlpha () / MaxUShortFloat) * anim.opacity : 0.85;
25 color = optionGetFillColor ();
26
27 colorData[0] = alpha * color[0];
28@@ -570,7 +570,7 @@
29 anim.currentRect.height () - 2);
30
31 /* draw outline */
32- alpha = (optionGetOutlineColorAlpha () / MaxUShortFloat) * anim.opacity;
33+ alpha = blend ? (optionGetOutlineColorAlpha () / MaxUShortFloat) * anim.opacity : 1;
34 color = optionGetOutlineColor ();
35
36 colorData[0] = alpha * color[0];
37@@ -603,7 +603,7 @@
38 if (!animating)
39 {
40 /* draw filled rectangle */
41- float alpha = optionGetFillColorAlpha () / MaxUShortFloat;
42+ float alpha = blend ? optionGetFillColorAlpha () / MaxUShortFloat : 0.85;
43 color = optionGetFillColor ();
44
45 colorData[0] = alpha * color[0];
46@@ -885,7 +885,7 @@
47 animations.at (current).fromRect = w->serverBorderRect ();
48 animations.at (current).currentRect = w->serverBorderRect ();
49 animations.at (current).duration = optionGetAnimationDuration ();
50- animations.at (current).timer = animations.at (current).duration;
51+ animations.at (current).progress = 0.0f;
52 animations.at (current).targetRect = desiredSlot;
53 animations.at (current).window = w->id();
54
55@@ -1199,18 +1199,24 @@
56 for (iter = animations.begin (); iter != animations.end (); ++iter)
57 {
58 Animation& anim = *iter;
59- anim.timer -= msSinceLastPaint;
60+ GLfloat msSinceLastPaintFloat = static_cast<GLfloat>(msSinceLastPaint);
61+ GLfloat animDurationFloat = static_cast<GLfloat>(anim.duration);
62+ GLfloat progress_delta = 1.0f;
63
64- if (anim.timer < 0)
65- anim.timer = 0;
66+ if (animDurationFloat > 0.0f)
67+ progress_delta = msSinceLastPaintFloat / animDurationFloat;
68
69 if (anim.fadingOut)
70- anim.opacity -= msSinceLastPaint * 0.002;
71+ {
72+ anim.opacity -= progress_delta;
73+ }
74 else
75+ {
76 if (anim.opacity < 1.0f)
77 anim.opacity = anim.progress * anim.progress;
78 else
79 anim.opacity = 1.0f;
80+ }
81
82 if (anim.opacity < 0)
83 {
84@@ -1219,10 +1225,10 @@
85 anim.complete = true;
86 }
87
88- anim.progress = (anim.duration - anim.timer) / anim.duration;
89+ anim.progress = std::min<GLfloat>(anim.progress + progress_delta, 1.0);
90 }
91
92- if (optionGetDrawStretchedWindow ())
93+ if (optionGetDrawStretchedWindow () && !optionGetDisableBlend ())
94 {
95 CompWindow *cw = screen->findWindow (CompOption::getIntOptionNamed (o, "window"));
96
97@@ -1292,7 +1298,6 @@
98 targetRect = CompRect (0, 0, 0, 0);
99 currentRect = CompRect (0, 0, 0, 0);
100 opacity = 0.0f;
101- timer = 0.0f;
102 duration = 0;
103 complete = false;
104 fadingOut = false;
105@@ -1400,7 +1405,7 @@
106 {
107 Animation& anim = *iter;
108
109- if (anim.timer > 0.0f && anim.window == window->id())
110+ if (anim.progress < 1.0f && anim.window == window->id())
111 {
112 GLWindowPaintAttrib wAttrib(attrib);
113 GLMatrix wTransform (matrix);
114
115=== modified file 'plugins/grid/src/grid.h'
116--- plugins/grid/src/grid.h 2013-04-30 00:18:41 +0000
117+++ plugins/grid/src/grid.h 2017-06-29 00:58:46 +0000
118@@ -96,7 +96,6 @@
119 CompRect targetRect;
120 CompRect currentRect;
121 GLfloat opacity;
122- GLfloat timer;
123 Window window;
124 int duration;
125 bool complete;

Subscribers

People subscribed via source and target branches