Merge lp:~azzar1/unity/fix-1035951 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 2590
Proposed branch: lp:~azzar1/unity/fix-1035951
Merge into: lp:unity
Diff against target: 86 lines (+7/-16)
3 files modified
hud/HudIcon.cpp (+5/-10)
hud/HudIcon.h (+1/-4)
hud/HudView.cpp (+1/-2)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1035951
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
Review via email: mp+120398@code.launchpad.net

Commit message

Use the same padding for the minimum width and height of hud::Icon.

Description of the change

== Problem ==
[regression] Hideous low-res icon when using the HUD with autohide enabled.

== Fix ==
Use the same padding for SetMinimumWidth and SetMinimumHeight.

== Screenshots ==
Before fix: https://bugs.launchpad.net/unity/+bug/1035951/+attachment/3268880/+files/Screenshot%20from%202012-08-20%2016%3A33%3A42.png

After fix: https://bugs.launchpad.net/unity/+bug/1035951/+attachment/3268881/+files/Screenshot%20from%202012-08-20%2016%3A28%3A37.png

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Confirm fixes problem and looks good. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hud/HudIcon.cpp'
2--- hud/HudIcon.cpp 2012-05-07 00:49:31 +0000
3+++ hud/HudIcon.cpp 2012-08-20 14:33:33 +0000
4@@ -24,8 +24,7 @@
5
6 namespace
7 {
8- nux::logging::Logger logger("unity.hud.icon");
9- const unsigned int vertical_padding = 4;
10+nux::logging::Logger logger("unity.hud.icon");
11 }
12
13 namespace unity
14@@ -36,10 +35,6 @@
15 Icon::Icon()
16 : IconTexture("", 0, true)
17 {
18- background_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/launcher_icon_back_54.png", -1, true));
19- gloss_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/launcher_icon_shine_54.png", -1, true));
20- edge_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/launcher_icon_edge_54.png", -1, true));
21-
22 texture_updated.connect([&] (nux::BaseTexture* texture)
23 {
24 icon_texture_source_ = new HudIconTextureSource(nux::ObjectPtr<nux::BaseTexture>(texture));
25@@ -49,12 +44,13 @@
26 });
27 }
28
29-void Icon::SetIcon(std::string const& icon_name, unsigned int icon_size, unsigned int tile_size)
30+void Icon::SetIcon(std::string const& icon_name, unsigned int icon_size, unsigned int tile_size, unsigned int padding)
31 {
32 IconTexture::SetByIconName(icon_name, icon_size);
33 icon_renderer_.SetTargetSize(tile_size, icon_size, 0);
34- SetMinimumWidth(tile_size);
35- SetMinimumHeight(tile_size + vertical_padding * 2);
36+
37+ SetMinimumHeight(tile_size + padding);
38+ SetMinimumWidth(tile_size + padding);
39 }
40
41 void Icon::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
42@@ -76,7 +72,6 @@
43 std::list<unity::ui::RenderArg> args;
44 args.push_front(arg);
45
46-
47 auto toplevel = GetToplevel();
48 icon_renderer_.PreprocessIcons(args, toplevel->GetGeometry());
49 icon_renderer_.RenderIcon(GfxContext, arg, toplevel->GetGeometry(), toplevel->GetGeometry());
50
51=== modified file 'hud/HudIcon.h'
52--- hud/HudIcon.h 2012-05-07 00:49:31 +0000
53+++ hud/HudIcon.h 2012-08-20 14:33:33 +0000
54@@ -37,7 +37,7 @@
55 typedef nux::ObjectPtr<Icon> Ptr;
56 Icon();
57
58- void SetIcon(std::string const& icon_name, unsigned int icon_size, unsigned int tile_size);
59+ void SetIcon(std::string const& icon_name, unsigned int icon_size, unsigned int tile_size, unsigned int padding);
60
61 protected:
62 void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
63@@ -45,9 +45,6 @@
64 std::string GetName() const;
65
66 private:
67- nux::ObjectPtr<nux::BaseTexture> background_;
68- nux::ObjectPtr<nux::BaseTexture> gloss_;
69- nux::ObjectPtr<nux::BaseTexture> edge_;
70 nux::ObjectPtr<HudIconTextureSource> icon_texture_source_;
71 unity::ui::IconRenderer icon_renderer_;
72 };
73
74=== modified file 'hud/HudView.cpp'
75--- hud/HudView.cpp 2012-07-10 03:27:49 +0000
76+++ hud/HudView.cpp 2012-08-20 14:33:33 +0000
77@@ -281,8 +281,7 @@
78
79 LOG_DEBUG(logger) << "Setting icon to " << icon_name;
80
81- icon_->SetIcon(icon_name, size, tile_size);
82- icon_->SetMinimumWidth(tile_size + padding);
83+ icon_->SetIcon(icon_name, size, tile_size, padding);
84
85 /* We need to compute this value manually, since the _content_layout height changes */
86 int content_height = search_bar_->GetBaseHeight() + top_padding + bottom_padding;