Merge lp:~victored/unity/fixes into lp:unity

Proposed by Victor Martinez
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 1730
Proposed branch: lp:~victored/unity/fixes
Merge into: lp:unity
Diff against target: 21 lines (+2/-2)
1 file modified
plugins/unityshell/src/IconRenderer.cpp (+2/-2)
To merge this branch: bzr merge lp:~victored/unity/fixes
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Adolfo Jayme Barrientos (community) Approve
Review via email: mp+74891@code.launchpad.net

Commit message

Fix for lp:702989

Description of the change

This is an attempt to fix lp:702989

Since the height of the icons in the launcher is an even number, having something vertically centered is not possible. For the Tooltips and QuickLists, the y-center is located at '... + Height/2', so for a 48px icon height this would result in +24.

As similar algorithms are used to calculate the center of the icons everywhere, what needs to be fixed are not the tooltips and quicklists, but the icon indicators (arrows for active and open states), which are located at the middle using a different approach: the arrows are .png images of 19px height (whose center is located at +10 pixels from the top), so this time (as you can see in the function RenderIndicators) the y-coordinates are given by 'center - Height/2'.

For a 48px icon height, the operation would be: '24 - 19/2', rounded to '24 - 9' = 15. Then, the PNG image is put at +15 pixels from the top of the icon and therefore the center of the indicator at 15+10 = 25, creating a +1px offset.

Subtracting 1px to each y-coordinate at the end of the 'RenderIndicators' function solves the problem for every icon size.

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

Nice fix to the ugly truth that launcher-icons with and even height can't center-line align with the tooltips. Works as advertised.

I'm good to merge that into unity trunk, but I need to know if you've signed the Canonical contributor-agreement. If you haven't done yet so please follow the procedure described here: https://wiki.canonical.com/LegalServices/Forms/ContributorAgreement

Thanks in advance!

review: Needs Information
Revision history for this message
Victor Martinez (victored) wrote :

Thanks for the review.

I haven't yet signed the Canonical Contributor Agreement [because my scanner is broken]. I'm doing that ASAP, hopefully this week.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

@victor: a digital camera (or even a high quality phone camera) is
also fine if you have access to that

Revision history for this message
Victor Martinez (victored) wrote :

@Mikkel: thanks for the advice!

Revision history for this message
Victor Martinez (victored) wrote :

Mirco, I'm now a member of the Canonical Contributor Agreement team :)

Revision history for this message
Adolfo Jayme Barrientos (fitojb) :
review: Approve
Revision history for this message
Mirco Müller (macslow) wrote :

Approved... mergeing it now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/IconRenderer.cpp'
2--- plugins/unityshell/src/IconRenderer.cpp 2011-08-30 16:48:12 +0000
3+++ plugins/unityshell/src/IconRenderer.cpp 2011-09-10 18:49:23 +0000
4@@ -810,7 +810,7 @@
5 break;
6
7 GfxContext.QRP_1Tex(markerX,
8- center - ((texture->GetHeight() * scale) / 2),
9+ center - ((texture->GetHeight() * scale) / 2) - 1,
10 (float) texture->GetWidth() * scale,
11 (float) texture->GetHeight() * scale,
12 texture->GetDeviceTexture(),
13@@ -825,7 +825,7 @@
14
15 nux::Color color = nux::color::LightGrey * alpha;
16 GfxContext.QRP_1Tex((geo.x + geo.width) - local::arrow_rtl->GetWidth(),
17- markerCenter - (local::arrow_rtl->GetHeight() / 2),
18+ markerCenter - (local::arrow_rtl->GetHeight() / 2) - 1,
19 (float) local::arrow_rtl->GetWidth(),
20 (float) local::arrow_rtl->GetHeight(),
21 local::arrow_rtl->GetDeviceTexture(),