Merge lp:~3v1n0/unity/preprocess-on-icon-count-change into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3312
Proposed branch: lp:~3v1n0/unity/preprocess-on-icon-count-change
Merge into: lp:unity
Diff against target: 99 lines (+26/-8)
4 files modified
launcher/LauncherIcon.cpp (+7/-6)
unity-shared/IconRenderer.cpp (+3/-1)
unity-shared/IconTextureSource.cpp (+12/-1)
unity-shared/IconTextureSource.h (+4/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/preprocess-on-icon-count-change
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+160242@code.launchpad.net

Commit message

IconRenderer: preprocess an icon if its emblem has been shown/hidden

In that way we can update its transformation.

Description of the change

If an icon set/unset its emblem, we should update its transformation, otherwise it won't be drawn or it will be drawn with the wrong transformation.

Proposing against trunk since this won't touch any bit of the 100-scopes branch.

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
Brandon Schaefer (brandontschaefer) wrote :

LGTM, i wonder what the CI failure was...

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/LauncherIcon.cpp'
--- launcher/LauncherIcon.cpp 2013-03-21 16:29:34 +0000
+++ launcher/LauncherIcon.cpp 2013-04-23 00:52:29 +0000
@@ -1144,13 +1144,14 @@
1144 if (!remote->CountVisible())1144 if (!remote->CountVisible())
1145 return;1145 return;
11461146
1147 std::string text;1147 if (remote->Count() / 10000 != 0)
1148 if (remote->Count() > 9999)1148 {
1149 text = "****";1149 SetEmblemText("****");
1150 }
1150 else1151 else
1151 text = std::to_string(remote->Count());1152 {
11521153 SetEmblemText(std::to_string(remote->Count()));
1153 SetEmblemText(text);1154 }
1154}1155}
11551156
1156void1157void
11571158
=== modified file 'unity-shared/IconRenderer.cpp'
--- unity-shared/IconRenderer.cpp 2013-04-10 21:41:57 +0000
+++ unity-shared/IconRenderer.cpp 2013-04-23 00:52:29 +0000
@@ -300,7 +300,8 @@
300 if (it->render_center == launcher_icon->LastRenderCenter(monitor) &&300 if (it->render_center == launcher_icon->LastRenderCenter(monitor) &&
301 it->logical_center == launcher_icon->LastLogicalCenter(monitor) &&301 it->logical_center == launcher_icon->LastLogicalCenter(monitor) &&
302 it->rotation == launcher_icon->LastRotation(monitor) &&302 it->rotation == launcher_icon->LastRotation(monitor) &&
303 it->skip == launcher_icon->WasSkipping(monitor))303 it->skip == launcher_icon->WasSkipping(monitor) &&
304 (launcher_icon->Emblem() != nullptr) == launcher_icon->HadEmblem())
304 {305 {
305 continue;306 continue;
306 }307 }
@@ -308,6 +309,7 @@
308 launcher_icon->RememberCenters(monitor, it->render_center, it->logical_center);309 launcher_icon->RememberCenters(monitor, it->render_center, it->logical_center);
309 launcher_icon->RememberRotation(monitor, it->rotation);310 launcher_icon->RememberRotation(monitor, it->rotation);
310 launcher_icon->RememberSkip(monitor, it->skip);311 launcher_icon->RememberSkip(monitor, it->skip);
312 launcher_icon->RememberEmblem(launcher_icon->Emblem() != nullptr);
311313
312 float w = icon_size;314 float w = icon_size;
313 float h = icon_size;315 float h = icon_size;
314316
=== modified file 'unity-shared/IconTextureSource.cpp'
--- unity-shared/IconTextureSource.cpp 2013-04-12 23:33:52 +0000
+++ unity-shared/IconTextureSource.cpp 2013-04-23 00:52:29 +0000
@@ -32,7 +32,8 @@
32}32}
3333
34IconTextureSource::IconTextureSource()34IconTextureSource::IconTextureSource()
35 : skip_(RENDERERS_SIZE, false)35 : had_emblem_(false)
36 , skip_(RENDERERS_SIZE, false)
36 , last_render_center_(RENDERERS_SIZE)37 , last_render_center_(RENDERERS_SIZE)
37 , last_logical_center_(RENDERERS_SIZE)38 , last_logical_center_(RENDERERS_SIZE)
38 , last_rotation_(RENDERERS_SIZE)39 , last_rotation_(RENDERERS_SIZE)
@@ -80,5 +81,15 @@
80 return skip_[monitor];81 return skip_[monitor];
81}82}
8283
84void IconTextureSource::RememberEmblem(bool has_emblem)
85{
86 had_emblem_ = has_emblem;
87}
88
89bool IconTextureSource::HadEmblem() const
90{
91 return had_emblem_;
92}
93
83}94}
84}95}
85\ No newline at end of file96\ No newline at end of file
8697
=== modified file 'unity-shared/IconTextureSource.h'
--- unity-shared/IconTextureSource.h 2013-04-12 23:33:52 +0000
+++ unity-shared/IconTextureSource.h 2013-04-23 00:52:29 +0000
@@ -58,6 +58,9 @@
58 void RememberSkip(int monitor, bool skip);58 void RememberSkip(int monitor, bool skip);
59 bool WasSkipping(int monitor) const;59 bool WasSkipping(int monitor) const;
6060
61 void RememberEmblem(bool has_emblem);
62 bool HadEmblem() const;
63
61 virtual nux::Color BackgroundColor() const = 0;64 virtual nux::Color BackgroundColor() const = 0;
6265
63 virtual nux::Color GlowColor() = 0;66 virtual nux::Color GlowColor() = 0;
@@ -67,6 +70,7 @@
67 virtual nux::BaseTexture* Emblem() = 0;70 virtual nux::BaseTexture* Emblem() = 0;
6871
69private:72private:
73 bool had_emblem_;
70 std::vector<bool> skip_;74 std::vector<bool> skip_;
71 std::vector<nux::Point3> last_render_center_;75 std::vector<nux::Point3> last_render_center_;
72 std::vector<nux::Point3> last_logical_center_;76 std::vector<nux::Point3> last_logical_center_;