Merge lp:~mc-return/compiz/compiz.merge-shiftswitcher-one-if-statement-is-enough into lp:compiz/0.9.9

Proposed by MC Return
Status: Merged
Approved by: Ɓukasz Zemczak
Approved revision: 3447
Merged at revision: 3450
Proposed branch: lp:~mc-return/compiz/compiz.merge-shiftswitcher-one-if-statement-is-enough
Merge into: lp:compiz/0.9.9
Diff against target: 27 lines (+2/-8)
1 file modified
plugins/shift/src/shift.cpp (+2/-8)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-shiftswitcher-one-if-statement-is-enough
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Daniel van Vugt Approve
Sam Spilsbury Approve
Review via email: mp+132516@code.launchpad.net

Commit message

Shift Switcher: Minor optimization: As we return in both cases one if statement is enough here (x2).

Description of the change

Thanks for the suggestion, Daniel :) - you are right of course.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

If the intention is optimization then De Morgan's law [1] suggests there's a more efficient way with fewer operations:
    if (!(textAvailable && optionGetWindowTitle ()))
[1] http://en.wikipedia.org/wiki/De_Morgan's_laws

However I think the syntax you have already is more readable.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/shift/src/shift.cpp'
--- plugins/shift/src/shift.cpp 2012-10-24 09:33:31 +0000
+++ plugins/shift/src/shift.cpp 2012-11-01 11:21:22 +0000
@@ -139,10 +139,7 @@
139void139void
140ShiftScreen::renderWindowTitle ()140ShiftScreen::renderWindowTitle ()
141{141{
142 if (!textAvailable)142 if (!textAvailable || !optionGetWindowTitle ())
143 return;
144
145 if (!optionGetWindowTitle ())
146 return;143 return;
147144
148 CompText::Attrib tA;145 CompText::Attrib tA;
@@ -187,10 +184,7 @@
187void184void
188ShiftScreen::drawWindowTitle (const GLMatrix &transform)185ShiftScreen::drawWindowTitle (const GLMatrix &transform)
189{186{
190 if (!textAvailable)187 if (!textAvailable || !optionGetWindowTitle ())
191 return;
192
193 if (!optionGetWindowTitle ())
194 return;188 return;
195189
196 float width, height, border = 10.0f;190 float width, height, border = 10.0f;

Subscribers

People subscribed via source and target branches