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
1=== modified file 'launcher/LauncherIcon.cpp'
2--- launcher/LauncherIcon.cpp 2013-03-21 16:29:34 +0000
3+++ launcher/LauncherIcon.cpp 2013-04-23 00:52:29 +0000
4@@ -1144,13 +1144,14 @@
5 if (!remote->CountVisible())
6 return;
7
8- std::string text;
9- if (remote->Count() > 9999)
10- text = "****";
11+ if (remote->Count() / 10000 != 0)
12+ {
13+ SetEmblemText("****");
14+ }
15 else
16- text = std::to_string(remote->Count());
17-
18- SetEmblemText(text);
19+ {
20+ SetEmblemText(std::to_string(remote->Count()));
21+ }
22 }
23
24 void
25
26=== modified file 'unity-shared/IconRenderer.cpp'
27--- unity-shared/IconRenderer.cpp 2013-04-10 21:41:57 +0000
28+++ unity-shared/IconRenderer.cpp 2013-04-23 00:52:29 +0000
29@@ -300,7 +300,8 @@
30 if (it->render_center == launcher_icon->LastRenderCenter(monitor) &&
31 it->logical_center == launcher_icon->LastLogicalCenter(monitor) &&
32 it->rotation == launcher_icon->LastRotation(monitor) &&
33- it->skip == launcher_icon->WasSkipping(monitor))
34+ it->skip == launcher_icon->WasSkipping(monitor) &&
35+ (launcher_icon->Emblem() != nullptr) == launcher_icon->HadEmblem())
36 {
37 continue;
38 }
39@@ -308,6 +309,7 @@
40 launcher_icon->RememberCenters(monitor, it->render_center, it->logical_center);
41 launcher_icon->RememberRotation(monitor, it->rotation);
42 launcher_icon->RememberSkip(monitor, it->skip);
43+ launcher_icon->RememberEmblem(launcher_icon->Emblem() != nullptr);
44
45 float w = icon_size;
46 float h = icon_size;
47
48=== modified file 'unity-shared/IconTextureSource.cpp'
49--- unity-shared/IconTextureSource.cpp 2013-04-12 23:33:52 +0000
50+++ unity-shared/IconTextureSource.cpp 2013-04-23 00:52:29 +0000
51@@ -32,7 +32,8 @@
52 }
53
54 IconTextureSource::IconTextureSource()
55- : skip_(RENDERERS_SIZE, false)
56+ : had_emblem_(false)
57+ , skip_(RENDERERS_SIZE, false)
58 , last_render_center_(RENDERERS_SIZE)
59 , last_logical_center_(RENDERERS_SIZE)
60 , last_rotation_(RENDERERS_SIZE)
61@@ -80,5 +81,15 @@
62 return skip_[monitor];
63 }
64
65+void IconTextureSource::RememberEmblem(bool has_emblem)
66+{
67+ had_emblem_ = has_emblem;
68+}
69+
70+bool IconTextureSource::HadEmblem() const
71+{
72+ return had_emblem_;
73+}
74+
75 }
76 }
77\ No newline at end of file
78
79=== modified file 'unity-shared/IconTextureSource.h'
80--- unity-shared/IconTextureSource.h 2013-04-12 23:33:52 +0000
81+++ unity-shared/IconTextureSource.h 2013-04-23 00:52:29 +0000
82@@ -58,6 +58,9 @@
83 void RememberSkip(int monitor, bool skip);
84 bool WasSkipping(int monitor) const;
85
86+ void RememberEmblem(bool has_emblem);
87+ bool HadEmblem() const;
88+
89 virtual nux::Color BackgroundColor() const = 0;
90
91 virtual nux::Color GlowColor() = 0;
92@@ -67,6 +70,7 @@
93 virtual nux::BaseTexture* Emblem() = 0;
94
95 private:
96+ bool had_emblem_;
97 std::vector<bool> skip_;
98 std::vector<nux::Point3> last_render_center_;
99 std::vector<nux::Point3> last_logical_center_;