Merge lp:~mc-return/compiz/compiz.merge-fix1105969-showmouse-code-needs-cleanup into lp:compiz/0.9.9

Proposed by MC Return
Status: Merged
Approved by: Brandon Schaefer
Approved revision: 3587
Merged at revision: 3592
Proposed branch: lp:~mc-return/compiz/compiz.merge-fix1105969-showmouse-code-needs-cleanup
Merge into: lp:compiz/0.9.9
Diff against target: 24 lines (+2/-3)
1 file modified
plugins/showmouse/src/showmouse.cpp (+2/-3)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-fix1105969-showmouse-code-needs-cleanup
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
Sam Spilsbury Needs Information
PS Jenkins bot continuous-integration Pending
Review via email: mp+145062@code.launchpad.net

Commit message

Showmouse cleanup:

Made nE an unsigned int to begin with as optionGetEmitters ()
will just return u-int values from 1 to 10.
No need to calculate MIN (10, optionGetEmitters ()) for the
same reason.

Removed redundant calculation of one rVal (random value), because
this rVal is being recalculated a few lines later before being used
again.

(LP: #1105969)

Description of the change

No formatting changes. :)

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

This all looks fine, the only bit I have a concern over is:

18 - int nE = MIN (10, optionGetEmitters ());
19 + unsigned int nE = optionGetEmitters ();

That would change behaviour, but I guess the point is that the real minimum should be controlled by the user, yes?

review: Needs Information
Revision history for this message
MC Return (mc-return) wrote :

> This all looks fine, the only bit I have a concern over is:
>
> 18 - int nE = MIN (10, optionGetEmitters ());
> 19 + unsigned int nE = optionGetEmitters ();
>
> That would change behaviour, but I guess the point is that the real minimum
> should be controlled by the user, yes?

nE is just the number of Emitters, which is controlled by showmouse.xml.in anyway
and can just take values from 1 to 10, so there is no need for a type conversion
and also no need to calculate this minimum...

But I will set this branch to WIP for now as it will collide with the GL|ES
port anyway and I will probably have to fix conflicts before this can merge...

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/showmouse/src/showmouse.cpp'
2--- plugins/showmouse/src/showmouse.cpp 2013-01-27 19:34:52 +0000
3+++ plugins/showmouse/src/showmouse.cpp 2013-01-31 13:18:24 +0000
4@@ -368,10 +368,10 @@
5 unsigned int i, j;
6
7 float pos[10][2];
8- int nE = MIN (10, optionGetEmitters ());
9+ unsigned int nE = optionGetEmitters ();
10 float rA = (2 * M_PI) / nE;
11 int radius = optionGetRadius ();
12- for (i = 0; i < (unsigned int) nE; i++)
13+ for (i = 0; i < nE; i++)
14 {
15 pos[i][0] = sin (rot + (i * rA)) * radius;
16 pos[i][0] += mousePos.x ();
17@@ -392,7 +392,6 @@
18 // set size
19 part.width = partw;
20 part.height = parth;
21- rVal = (float)(random() & 0xff) / 255.0;
22 part.w_mod = part.h_mod = -1;
23
24 // choose random position

Subscribers

People subscribed via source and target branches