Merge lp:~mc-return/compiz/compiz.merge-resizeinfo-minor-improvements into lp:compiz/0.9.9

Proposed by MC Return
Status: Rejected
Rejected by: Daniel van Vugt
Proposed branch: lp:~mc-return/compiz/compiz.merge-resizeinfo-minor-improvements
Merge into: lp:compiz/0.9.9
Diff against target: 34 lines (+4/-6)
1 file modified
plugins/resizeinfo/src/resizeinfo.cpp (+4/-6)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-resizeinfo-minor-improvements
Reviewer Review Type Date Requested Status
Daniel van Vugt Disapprove
MC Return Needs Resubmitting
Sam Spilsbury Approve
Review via email: mp+132506@code.launchpad.net

Commit message

Resizeinfo Plugin:

Simplified void InfoLayer::renderBackground () by removing the creation and assignment of the variables int height and width totally.
Using the already defined constants RESIZE_POPUP_HEIGHT and RESIZE_POPUP_WIDTH directly in the following calculations instead of height and width (like done in void InfoScreen::damagePaintRegion () already).

Description of the change

As requested by Daniel, I am separating the fixes for the resizeinfo problems.
This branch just changes the variable types of 'height' and 'width' from int to unsigned short.

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 :

Rejected unless there's a good reason for this.

Not just because "int" is short and sweet, but "int" is much more efficient for the compiler and CPU to handle than down-casting computation to an unsigned short (which is /usually/ 16-bit).

review: Disapprove
3448. By MC Return

Simplified void InfoLayer::renderBackground () by removing the creation and assignment of the variables int height and width totally and instead using the already defined constants RESIZE_POPUP_HEIGHT and RESIZE_POPUP_WIDTH directly in the following calculations (like done in void InfoScreen::damagePaintRegion () already)

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

> Rejected unless there's a good reason for this.
>

I have simplified everything a bit now. Hope this is okay...

Revision history for this message
MC Return (mc-return) :
review: Needs Resubmitting
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

With regular compiler optimizations, changes like this actually make no difference. And even without optimizations, this is not an area of code that benefits from optimization at all.

Actually, it just makes the code a little harder to read and doesn't really provide a benefit. So rejected, sorry.

review: Disapprove

Unmerged revisions

3448. By MC Return

Simplified void InfoLayer::renderBackground () by removing the creation and assignment of the variables int height and width totally and instead using the already defined constants RESIZE_POPUP_HEIGHT and RESIZE_POPUP_WIDTH directly in the following calculations (like done in void InfoScreen::damagePaintRegion () already)

3447. By MC Return

Changed variable type of the variables 'height' and 'width' from int to unsigned short

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/resizeinfo/src/resizeinfo.cpp'
2--- plugins/resizeinfo/src/resizeinfo.cpp 2012-09-07 23:29:42 +0000
3+++ plugins/resizeinfo/src/resizeinfo.cpp 2012-11-05 11:58:35 +0000
4@@ -178,8 +178,6 @@
5 {
6 cairo_pattern_t *pattern;
7 float border = 7.5;
8- int height = RESIZE_POPUP_HEIGHT;
9- int width = RESIZE_POPUP_WIDTH;
10 float r, g, b, a;
11
12 INFO_SCREEN (screen);
13@@ -197,7 +195,7 @@
14 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
15
16 /* Setup Gradient */
17- pattern = cairo_pattern_create_linear (0, 0, width, height);
18+ pattern = cairo_pattern_create_linear (0, 0, RESIZE_POPUP_WIDTH, RESIZE_POPUP_HEIGHT);
19
20 r = is->optionGetGradient1Red () / (float)0xffff;
21 g = is->optionGetGradient1Green () / (float)0xffff;
22@@ -220,10 +218,10 @@
23
24 /* Rounded Rectangle! */
25 cairo_arc (cr, border, border, border, PI, 1.5f * PI);
26- cairo_arc (cr, border + width - 2 * border, border, border,
27+ cairo_arc (cr, border + RESIZE_POPUP_WIDTH - 2 * border, border, border,
28 1.5f * PI, 2.0 * PI);
29- cairo_arc (cr, width - border, height - border, border, 0, PI / 2.0f);
30- cairo_arc (cr, border, height - border, border, PI / 2.0f, PI);
31+ cairo_arc (cr, RESIZE_POPUP_WIDTH - border, RESIZE_POPUP_HEIGHT - border, border, 0, PI / 2.0f);
32+ cairo_arc (cr, border, RESIZE_POPUP_HEIGHT - border, border, PI / 2.0f, PI);
33 cairo_close_path (cr);
34 cairo_fill_preserve (cr);
35

Subscribers

People subscribed via source and target branches