Merge lp:~townsend/unity/fix-icon-progress-bar into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3354
Proposed branch: lp:~townsend/unity/fix-icon-progress-bar
Merge into: lp:unity
Diff against target: 35 lines (+4/-3)
1 file modified
unity-shared/IconRenderer.cpp (+4/-3)
To merge this branch: bzr merge lp:~townsend/unity/fix-icon-progress-bar
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+166370@code.launchpad.net

Commit message

Fixes the issue where the filling in of the progress bar over Launcher icons does not scale when using smaller or larger icon sizes than the default size of 48.

Description of the change

= Issue =
When using smaller or larger ions in the Launcher, the progress bar over the icons (ie, when copying large files) does not scale and will either show a gap in the progress bar when using small icons or the fill will be farther left of the bar when using larger icons. The default size of the icons is 48 and this works well.

= Fix =
Based on icon size 48 working well, the offset of the fill portion of the bar is 6. This is a ratio of 0.125. Using this same ratio for smaller and larger icons, the fill portion begins where is should.

= Test =
As this is a visual bug, no automated test can be used. Use the manual test described in the bug for verification.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Allan LeSage (allanlesage) wrote :

I believe this is a spurious Jenkins failure, will kick off another test run.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

8 +

This space can be avoided...

18 + int fill_offset = (int)((float)image_size * fill_offset_ratio);;
It would be nice if you'd use static_cast<float> instead (while casting to int shouldn't be needed at the end (also please remove the double ";;").

Revision history for this message
Christopher Townsend (townsend) wrote :

> 8 +
>
> This space can be avoided...
Ok, will do.

>
> 18 + int fill_offset = (int)((float)image_size * fill_offset_ratio);;
> It would be nice if you'd use static_cast<float> instead (while casting to int
> shouldn't be needed at the end (also please remove the double ";;").
Ok. Not sure how the double ";;" got in there:)

Will have this updated soon. Thanks!

Revision history for this message
Christopher Townsend (townsend) wrote :
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Cool, LGTM.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-shared/IconRenderer.cpp'
2--- unity-shared/IconRenderer.cpp 2013-04-23 00:49:38 +0000
3+++ unity-shared/IconRenderer.cpp 2013-05-31 17:47:28 +0000
4@@ -178,6 +178,7 @@
5
6 const float edge_illumination_multiplier = 2.0f;
7 const float glow_multiplier = 2.3f;
8+const float fill_offset_ratio = 0.125f;
9 } // anonymous namespace
10
11 // The local namespace is purely for namespacing the file local variables below.
12@@ -1058,7 +1059,7 @@
13 int fill_width = image_size - (icon_size - image_size);
14 int fill_height = textures_->progress_bar_fill->GetHeight();
15
16- int fill_offset = (progress_width - fill_width) / 2;
17+ int fill_offset = static_cast<float>(image_size) * fill_offset_ratio;
18
19 // We need to perform a barn doors effect to acheive the slide in and out
20
21@@ -1068,12 +1069,12 @@
22 if (bias < 0.0f)
23 {
24 // pulls the right edge in
25- right_edge -= (int)(-bias * (float) progress_width);
26+ right_edge -= -bias * static_cast<float>(progress_width);
27 }
28 else if (bias > 0.0f)
29 {
30 // pulls the left edge in
31- left_edge += (int)(bias * progress_width);
32+ left_edge += bias * static_cast<float>(progress_width);
33 }
34
35 int fill_y = (height - fill_height) / 2;