Merge lp:~3v1n0/unity/callgrind-improvements into lp:unity
- callgrind-improvements
- Merge into trunk
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Andrea Azzarone | ||||||||||||||||
Approved revision: | no longer in the source branch. | ||||||||||||||||
Merged at revision: | 3300 | ||||||||||||||||
Proposed branch: | lp:~3v1n0/unity/callgrind-improvements | ||||||||||||||||
Merge into: | lp:unity | ||||||||||||||||
Diff against target: |
785 lines (+168/-112) 15 files modified
dash/LensView.cpp (+9/-15) dash/LensView.h (+1/-1) debian/control (+1/-1) launcher/Launcher.cpp (+5/-8) launcher/SwitcherView.cpp (+10/-8) panel/PanelController.cpp (+14/-24) panel/PanelController.h (+1/-1) panel/PanelTray.cpp (+1/-1) plugins/unityshell/src/unityshell.cpp (+1/-5) unity-shared/AbstractIconRenderer.h (+1/-6) unity-shared/FileManager.h (+1/-0) unity-shared/IconRenderer.cpp (+59/-27) unity-shared/IconRenderer.h (+0/-1) unity-shared/IconTextureSource.cpp (+48/-11) unity-shared/IconTextureSource.h (+16/-3) |
||||||||||||||||
To merge this branch: | bzr merge lp:~3v1n0/unity/callgrind-improvements | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Andrea Azzarone (community) | Approve | ||
Brandon Schaefer (community) | Approve | ||
Review via email: mp+158725@code.launchpad.net |
Commit message
Unity: reduce a lot the cost of some many-often called functions, thanks to callgrind
UnityScreen:
IconRenderer:
Launcher:
panel::
UnityScreen:
IconRenderer:
UnityScreen:
IconRenderer:
UnityScreen:
dash::LensView:
IconTexture:
See more at http://
Description of the change
Comparing these Callgrind results http://
UnityScreen:
IconRenderer:
Launcher:
panel::
UnityScreen:
IconRenderer:
UnityScreen:
IconRenderer:
UnityScreen:
dash::LensView:
IconTexture:
Plus other more generic operations such as vectors allocations or matrix operations.
All these are possible in combination with lp:~3v1n0/nux/callgrind-improvements
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> + nux::Point3 rotation;
>
> Why did you do it?
We had 3 floats instead that needed manual initialization (both in renderer and in Launcher), and that didn't allow to do equality check easily (in PreprocessIcon).
Using a nux::Point3 is just smarter and allows to do the same things better.
Brandon Schaefer (brandontschaefer) wrote : | # |
LGTM.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Andrea Azzarone (azzar1) wrote : | # |
> > + nux::Point3 rotation;
> >
> > Why did you do it?
>
> We had 3 floats instead that needed manual initialization (both in renderer
> and in Launcher), and that didn't allow to do equality check easily (in
> PreprocessIcon).
> Using a nux::Point3 is just smarter and allows to do the same things better.
What about a nux::Vector3(?) rotation?
Andrea Azzarone (azzar1) wrote : | # |
LGTM now. Thanks!!
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Adrian Wechner (adrian-wechner) wrote : | # |
197 + result.rotation.x = start.rotation.x + (end.rotation.x - start.rotation.x) * progress;
198 + result.rotation.y = start.rotation.y + (end.rotation.y - start.rotation.y) * progress;
199 + result.rotation.z = start.rotation.z + (end.rotation.z - start.rotation.z) * progress;
This could be shorten by:
basically what you do is +val1 + val2 - val1 => well val1 would then be 0
(maybe the compiler would optimize that anyway)
result.rotation.x = end.rotation.x * progress;
result.rotation.y = end.rotation.y * progress;
result.rotation.z = end.rotation.z * progress;
doesn't it?
Adrian Wechner (adrian-wechner) wrote : | # |
if you use 2 * M_PI a lot (i don't know if you do) and if M_PI is a constant, then I'd add another constant M2_PI (or something like that). then you would save a float operation :)
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Adrian, thanks for pointing that out... I didn't change a lot that part of code as I focused on things that were stealing more cycles (also, thankfully g++ is quite good at optimizing).
Anyway, it would be nice to improve these things too (old code)... Would you be so kind to do a merge proposal? :)
Adrian Wechner (adrian-wechner) wrote : | # |
what you mean with a merge proposal? to create a branch, change what I meant and then to propose to merge into this branch? if it is, then tomorrow i'll do that with pleasure.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3307
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Adrian Wechner (adrian-wechner) wrote : | # |
forget about what I said. the shorten does not work... sorry, it's just too late to think clear :) we add start after we multiplied, so that just works how it is. and i checked the M_PI constant. you don't use it that often and only once multiplied by 2.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
No need to retry this branch, it won't merge until the nux queue is cleared (and the merger seems to have some issues with that) as for the version bump there.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3307
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'dash/LensView.cpp' | |||
2 | --- dash/LensView.cpp 2013-01-15 21:53:55 +0000 | |||
3 | +++ dash/LensView.cpp 2013-04-12 23:35:32 +0000 | |||
4 | @@ -225,11 +225,6 @@ | |||
5 | 225 | scroll_view_->EnableHorizontalScrollBar(false); | 225 | scroll_view_->EnableHorizontalScrollBar(false); |
6 | 226 | layout_->AddView(scroll_view_); | 226 | layout_->AddView(scroll_view_); |
7 | 227 | 227 | ||
8 | 228 | scroll_view_->geometry_changed.connect([this] (nux::Area *area, nux::Geometry& geo) | ||
9 | 229 | { | ||
10 | 230 | CheckScrollBarState(); | ||
11 | 231 | }); | ||
12 | 232 | |||
13 | 233 | scroll_layout_ = new nux::VLayout(NUX_TRACKER_LOCATION); | 228 | scroll_layout_ = new nux::VLayout(NUX_TRACKER_LOCATION); |
14 | 234 | scroll_view_->SetLayout(scroll_layout_); | 229 | scroll_view_->SetLayout(scroll_layout_); |
15 | 235 | scroll_view_->SetRightArea(show_filters); | 230 | scroll_view_->SetRightArea(show_filters); |
16 | @@ -510,8 +505,7 @@ | |||
17 | 510 | std::string uri = result.uri; | 505 | std::string uri = result.uri; |
18 | 511 | LOG_TRACE(logger) << "Result added: " << uri; | 506 | LOG_TRACE(logger) << "Result added: " << uri; |
19 | 512 | 507 | ||
22 | 513 | counts_[group]++; | 508 | UpdateCounts(group, ++counts_[group]); |
21 | 514 | UpdateCounts(group); | ||
23 | 515 | // make sure we don't display the no-results-hint if we do have results | 509 | // make sure we don't display the no-results-hint if we do have results |
24 | 516 | if (G_UNLIKELY (no_results_active_)) | 510 | if (G_UNLIKELY (no_results_active_)) |
25 | 517 | { | 511 | { |
26 | @@ -543,8 +537,7 @@ | |||
27 | 543 | std::string uri = result.uri; | 537 | std::string uri = result.uri; |
28 | 544 | LOG_TRACE(logger) << "Result removed: " << uri; | 538 | LOG_TRACE(logger) << "Result removed: " << uri; |
29 | 545 | 539 | ||
32 | 546 | counts_[group]--; | 540 | UpdateCounts(group, --counts_[group]); |
31 | 547 | UpdateCounts(group); | ||
33 | 548 | } catch (std::out_of_range& oor) { | 541 | } catch (std::out_of_range& oor) { |
34 | 549 | LOG_WARN(logger) << "Result does not have a valid category index: " | 542 | LOG_WARN(logger) << "Result does not have a valid category index: " |
35 | 550 | << boost::lexical_cast<unsigned int>(result.category_index) | 543 | << boost::lexical_cast<unsigned int>(result.category_index) |
36 | @@ -552,13 +545,13 @@ | |||
37 | 552 | } | 545 | } |
38 | 553 | } | 546 | } |
39 | 554 | 547 | ||
41 | 555 | void LensView::UpdateCounts(PlacesGroup* group) | 548 | void LensView::UpdateCounts(PlacesGroup* group, unsigned int new_counts) |
42 | 556 | { | 549 | { |
43 | 557 | unsigned int columns = dash::Style::Instance().GetDefaultNColumns(); | 550 | unsigned int columns = dash::Style::Instance().GetDefaultNColumns(); |
44 | 558 | columns -= filters_expanded ? 2 : 0; | 551 | columns -= filters_expanded ? 2 : 0; |
45 | 559 | 552 | ||
48 | 560 | group->SetCounts(columns, counts_[group]); | 553 | group->SetCounts(columns, new_counts); |
49 | 561 | group->SetVisible(counts_[group]); | 554 | group->SetVisible(new_counts); |
50 | 562 | } | 555 | } |
51 | 563 | 556 | ||
52 | 564 | void LensView::CheckNoResults(Lens::Hints const& hints) | 557 | void LensView::CheckNoResults(Lens::Hints const& hints) |
53 | @@ -663,13 +656,13 @@ | |||
54 | 663 | 656 | ||
55 | 664 | void LensView::CheckScrollBarState() | 657 | void LensView::CheckScrollBarState() |
56 | 665 | { | 658 | { |
58 | 666 | if (scroll_layout_->GetGeometry().height > scroll_view_->GetGeometry().height) | 659 | if (scroll_layout_->GetHeight() > scroll_view_->GetHeight()) |
59 | 667 | { | 660 | { |
61 | 668 | scroll_view_->EnableVerticalScrollBar(true); | 661 | scroll_view_->EnableVerticalScrollBar(true); |
62 | 669 | } | 662 | } |
63 | 670 | else | 663 | else |
64 | 671 | { | 664 | { |
66 | 672 | scroll_view_->EnableVerticalScrollBar(false); | 665 | scroll_view_->EnableVerticalScrollBar(false); |
67 | 673 | } | 666 | } |
68 | 674 | } | 667 | } |
69 | 675 | 668 | ||
70 | @@ -735,6 +728,7 @@ | |||
71 | 735 | { | 728 | { |
72 | 736 | nux::Geometry const& geo(GetGeometry()); | 729 | nux::Geometry const& geo(GetGeometry()); |
73 | 737 | graphics_engine.PushClippingRectangle(geo); | 730 | graphics_engine.PushClippingRectangle(geo); |
74 | 731 | CheckScrollBarState(); | ||
75 | 738 | 732 | ||
76 | 739 | if (!IsFullRedraw() && RedirectedAncestor()) | 733 | if (!IsFullRedraw() && RedirectedAncestor()) |
77 | 740 | { | 734 | { |
78 | 741 | 735 | ||
79 | === modified file 'dash/LensView.h' | |||
80 | --- dash/LensView.h 2012-12-17 21:30:27 +0000 | |||
81 | +++ dash/LensView.h 2013-04-12 23:35:32 +0000 | |||
82 | @@ -97,7 +97,7 @@ | |||
83 | 97 | void OnCategoryOrderChanged(); | 97 | void OnCategoryOrderChanged(); |
84 | 98 | void OnResultAdded(Result const& result); | 98 | void OnResultAdded(Result const& result); |
85 | 99 | void OnResultRemoved(Result const& result); | 99 | void OnResultRemoved(Result const& result); |
87 | 100 | void UpdateCounts(PlacesGroup* group); | 100 | void UpdateCounts(PlacesGroup* group, unsigned int); |
88 | 101 | void OnGroupExpanded(PlacesGroup* group); | 101 | void OnGroupExpanded(PlacesGroup* group); |
89 | 102 | void CheckScrollBarState(); | 102 | void CheckScrollBarState(); |
90 | 103 | void OnColumnsChanged(); | 103 | void OnColumnsChanged(); |
91 | 104 | 104 | ||
92 | === modified file 'debian/control' | |||
93 | --- debian/control 2013-03-06 10:42:08 +0000 | |||
94 | +++ debian/control 2013-04-12 23:35:32 +0000 | |||
95 | @@ -28,7 +28,7 @@ | |||
96 | 28 | libunity-misc-dev (>= 4.0.4), | 28 | libunity-misc-dev (>= 4.0.4), |
97 | 29 | libgrail-dev (>= 1.0.20), | 29 | libgrail-dev (>= 1.0.20), |
98 | 30 | libxcb-icccm4-dev, | 30 | libxcb-icccm4-dev, |
100 | 31 | libnux-4.0-dev (>= 4.0.0daily13.01.18bzr752), | 31 | libnux-4.0-dev (>= 4.0.1), |
101 | 32 | compiz-dev (>= 1:0.9.9~daily13.01.25bzr3586), | 32 | compiz-dev (>= 1:0.9.9~daily13.01.25bzr3586), |
102 | 33 | libcompizconfig0-dev (>= 1:0.9.9~daily12.12.05-0ubuntu2), | 33 | libcompizconfig0-dev (>= 1:0.9.9~daily12.12.05-0ubuntu2), |
103 | 34 | xsltproc, | 34 | xsltproc, |
104 | 35 | 35 | ||
105 | === modified file 'launcher/Launcher.cpp' | |||
106 | --- launcher/Launcher.cpp 2013-04-09 02:18:08 +0000 | |||
107 | +++ launcher/Launcher.cpp 2013-04-12 23:35:32 +0000 | |||
108 | @@ -150,6 +150,7 @@ | |||
109 | 150 | , icon_renderer(std::make_shared<ui::IconRenderer>()) | 150 | , icon_renderer(std::make_shared<ui::IconRenderer>()) |
110 | 151 | { | 151 | { |
111 | 152 | m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION); | 152 | m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
112 | 153 | icon_renderer->monitor = monitor(); | ||
113 | 153 | 154 | ||
114 | 154 | bg_effect_helper_.owner = this; | 155 | bg_effect_helper_.owner = this; |
115 | 155 | bg_effect_helper_.enabled = false; | 156 | bg_effect_helper_.enabled = false; |
116 | @@ -783,9 +784,6 @@ | |||
117 | 783 | arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT); | 784 | arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT); |
118 | 784 | arg.draw_edge_only = IconDrawEdgeOnly(icon); | 785 | arg.draw_edge_only = IconDrawEdgeOnly(icon); |
119 | 785 | arg.active_colored = false; | 786 | arg.active_colored = false; |
120 | 786 | arg.x_rotation = 0.0f; | ||
121 | 787 | arg.y_rotation = 0.0f; | ||
122 | 788 | arg.z_rotation = 0.0f; | ||
123 | 789 | arg.skip = false; | 787 | arg.skip = false; |
124 | 790 | arg.stick_thingy = false; | 788 | arg.stick_thingy = false; |
125 | 791 | arg.keyboard_nav_hl = false; | 789 | arg.keyboard_nav_hl = false; |
126 | @@ -863,7 +861,7 @@ | |||
127 | 863 | 861 | ||
128 | 864 | if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT) && options()->urgent_animation() == URGENT_ANIMATION_WIGGLE) | 862 | if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT) && options()->urgent_animation() == URGENT_ANIMATION_WIGGLE) |
129 | 865 | { | 863 | { |
131 | 866 | arg.z_rotation = IconUrgentWiggleValue(icon, current); | 864 | arg.rotation.z = IconUrgentWiggleValue(icon, current); |
132 | 867 | } | 865 | } |
133 | 868 | 866 | ||
134 | 869 | if (IsInKeyNavMode()) | 867 | if (IsInKeyNavMode()) |
135 | @@ -941,7 +939,7 @@ | |||
136 | 941 | 939 | ||
137 | 942 | // icon is crossing threshold, start folding | 940 | // icon is crossing threshold, start folding |
138 | 943 | center.z += folded_z_distance * folding_progress; | 941 | center.z += folded_z_distance * folding_progress; |
140 | 944 | arg.x_rotation = animation_neg_rads * folding_progress; | 942 | arg.rotation.x = animation_neg_rads * folding_progress; |
141 | 945 | 943 | ||
142 | 946 | float spacing_overlap = CLAMP((float)(center.y + (2.0f * half_size * size_modifier) + (_space_between_icons * size_modifier) - folding_threshold) / (float) _icon_size, 0.0f, 1.0f); | 944 | float spacing_overlap = CLAMP((float)(center.y + (2.0f * half_size * size_modifier) + (_space_between_icons * size_modifier) - folding_threshold) / (float) _icon_size, 0.0f, 1.0f); |
143 | 947 | float spacing = (_space_between_icons * (1.0f - spacing_overlap) + folded_spacing * spacing_overlap) * size_modifier; | 945 | float spacing = (_space_between_icons * (1.0f - spacing_overlap) + folded_spacing * spacing_overlap) * size_modifier; |
144 | @@ -1399,6 +1397,7 @@ | |||
145 | 1399 | unity::panel::Style &panel_style = panel::Style::Instance(); | 1397 | unity::panel::Style &panel_style = panel::Style::Instance(); |
146 | 1400 | Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_style.panel_height), | 1398 | Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_style.panel_height), |
147 | 1401 | monitor_geo.height - panel_style.panel_height); | 1399 | monitor_geo.height - panel_style.panel_height); |
148 | 1400 | icon_renderer->monitor = new_monitor; | ||
149 | 1402 | } | 1401 | } |
150 | 1403 | 1402 | ||
151 | 1404 | void Launcher::UpdateOptions(Options::Ptr options) | 1403 | void Launcher::UpdateOptions(Options::Ptr options) |
152 | @@ -1688,8 +1687,6 @@ | |||
153 | 1688 | 1687 | ||
154 | 1689 | void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) | 1688 | void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) |
155 | 1690 | { | 1689 | { |
156 | 1691 | icon_renderer->monitor = monitor(); | ||
157 | 1692 | |||
158 | 1693 | nux::Geometry const& base = GetGeometry(); | 1690 | nux::Geometry const& base = GetGeometry(); |
159 | 1694 | nux::Geometry bkg_box; | 1691 | nux::Geometry bkg_box; |
160 | 1695 | std::list<RenderArg> args; | 1692 | std::list<RenderArg> args; |
161 | @@ -2458,7 +2455,7 @@ | |||
162 | 2458 | SetupRenderArg(icon, current, arg); | 2455 | SetupRenderArg(icon, current, arg); |
163 | 2459 | arg.render_center = nux::Point3(roundf(texture->GetWidth() / 2.0f), roundf(texture->GetHeight() / 2.0f), 0.0f); | 2456 | arg.render_center = nux::Point3(roundf(texture->GetWidth() / 2.0f), roundf(texture->GetHeight() / 2.0f), 0.0f); |
164 | 2460 | arg.logical_center = arg.render_center; | 2457 | arg.logical_center = arg.render_center; |
166 | 2461 | arg.x_rotation = 0.0f; | 2458 | arg.rotation.x = 0.0f; |
167 | 2462 | arg.running_arrow = false; | 2459 | arg.running_arrow = false; |
168 | 2463 | arg.active_arrow = false; | 2460 | arg.active_arrow = false; |
169 | 2464 | arg.skip = false; | 2461 | arg.skip = false; |
170 | 2465 | 2462 | ||
171 | === modified file 'launcher/SwitcherView.cpp' | |||
172 | --- launcher/SwitcherView.cpp 2013-02-13 01:45:00 +0000 | |||
173 | +++ launcher/SwitcherView.cpp 2013-04-12 23:35:32 +0000 | |||
174 | @@ -17,6 +17,7 @@ | |||
175 | 17 | */ | 17 | */ |
176 | 18 | 18 | ||
177 | 19 | #include "config.h" | 19 | #include "config.h" |
178 | 20 | #include "MultiMonitor.h" | ||
179 | 20 | #include "SwitcherView.h" | 21 | #include "SwitcherView.h" |
180 | 21 | #include "unity-shared/IconRenderer.h" | 22 | #include "unity-shared/IconRenderer.h" |
181 | 22 | #include "unity-shared/TimeUtil.h" | 23 | #include "unity-shared/TimeUtil.h" |
182 | @@ -57,6 +58,7 @@ | |||
183 | 57 | , target_sizes_set_(false) | 58 | , target_sizes_set_(false) |
184 | 58 | { | 59 | { |
185 | 59 | icon_renderer_->pip_style = OVER_TILE; | 60 | icon_renderer_->pip_style = OVER_TILE; |
186 | 61 | icon_renderer_->monitor = max_num_monitors; | ||
187 | 60 | 62 | ||
188 | 61 | text_view_->SetMaximumWidth(tile_size * spread_size); | 63 | text_view_->SetMaximumWidth(tile_size * spread_size); |
189 | 62 | text_view_->SetLines(1); | 64 | text_view_->SetLines(1); |
190 | @@ -224,9 +226,9 @@ | |||
191 | 224 | 226 | ||
192 | 225 | RenderArg result = end; | 227 | RenderArg result = end; |
193 | 226 | 228 | ||
197 | 227 | result.x_rotation = start.x_rotation + (end.x_rotation - start.x_rotation) * progress; | 229 | result.rotation.x = start.rotation.x + (end.rotation.x - start.rotation.x) * progress; |
198 | 228 | result.y_rotation = start.y_rotation + (end.y_rotation - start.y_rotation) * progress; | 230 | result.rotation.y = start.rotation.y + (end.rotation.y - start.rotation.y) * progress; |
199 | 229 | result.z_rotation = start.z_rotation + (end.z_rotation - start.z_rotation) * progress; | 231 | result.rotation.z = start.rotation.z + (end.rotation.z - start.rotation.z) * progress; |
200 | 230 | 232 | ||
201 | 231 | result.render_center.x = start.render_center.x + (end.render_center.x - start.render_center.x) * progress; | 233 | result.render_center.x = start.render_center.x + (end.render_center.x - start.render_center.x) * progress; |
202 | 232 | result.render_center.y = start.render_center.y + (end.render_center.y - start.render_center.y) * progress; | 234 | result.render_center.y = start.render_center.y + (end.render_center.y - start.render_center.y) * progress; |
203 | @@ -489,7 +491,7 @@ | |||
204 | 489 | 491 | ||
205 | 490 | x += (half_size + flat_spacing) * scalar; | 492 | x += (half_size + flat_spacing) * scalar; |
206 | 491 | 493 | ||
208 | 492 | arg.y_rotation = (1.0f - MIN (1.0f, scalar)); | 494 | arg.rotation.y = (1.0f - std::min<float>(1.0f, scalar)); |
209 | 493 | 495 | ||
210 | 494 | if (!should_flat && overflow > 0 && i != selection) | 496 | if (!should_flat && overflow > 0 && i != selection) |
211 | 495 | { | 497 | { |
212 | @@ -500,11 +502,11 @@ | |||
213 | 500 | else | 502 | else |
214 | 501 | { | 503 | { |
215 | 502 | arg.render_center.x += 20; | 504 | arg.render_center.x += 20; |
217 | 503 | arg.y_rotation = -arg.y_rotation; | 505 | arg.rotation.y = -arg.rotation.y; |
218 | 504 | } | 506 | } |
219 | 505 | } | 507 | } |
220 | 506 | 508 | ||
222 | 507 | arg.render_center.z = abs(80.0f * arg.y_rotation); | 509 | arg.render_center.z = abs(80.0f * arg.rotation.y); |
223 | 508 | arg.logical_center = arg.render_center; | 510 | arg.logical_center = arg.render_center; |
224 | 509 | 511 | ||
225 | 510 | if (i == selection && detail_selection) | 512 | if (i == selection && detail_selection) |
226 | @@ -588,13 +590,13 @@ | |||
227 | 588 | text_view_->SetBaseX(start_x); | 590 | text_view_->SetBaseX(start_x); |
228 | 589 | } | 591 | } |
229 | 590 | 592 | ||
231 | 591 | if (arg.y_rotation < 0) | 593 | if (arg.rotation.y < 0) |
232 | 592 | icon_renderer_->RenderIcon(GfxContext, arg, base, base); | 594 | icon_renderer_->RenderIcon(GfxContext, arg, base, base); |
233 | 593 | } | 595 | } |
234 | 594 | 596 | ||
235 | 595 | for (auto rit = last_args_.rbegin(); rit != last_args_.rend(); ++rit) | 597 | for (auto rit = last_args_.rbegin(); rit != last_args_.rend(); ++rit) |
236 | 596 | { | 598 | { |
238 | 597 | if (rit->y_rotation >= 0) | 599 | if (rit->rotation.y >= 0) |
239 | 598 | icon_renderer_->RenderIcon(GfxContext, *rit, base, base); | 600 | icon_renderer_->RenderIcon(GfxContext, *rit, base, base); |
240 | 599 | } | 601 | } |
241 | 600 | 602 | ||
242 | 601 | 603 | ||
243 | === modified file 'panel/PanelController.cpp' | |||
244 | --- panel/PanelController.cpp 2013-04-09 01:35:49 +0000 | |||
245 | +++ panel/PanelController.cpp 2013-04-12 23:35:32 +0000 | |||
246 | @@ -44,7 +44,6 @@ | |||
247 | 44 | void FirstMenuShow(); | 44 | void FirstMenuShow(); |
248 | 45 | void QueueRedraw(); | 45 | void QueueRedraw(); |
249 | 46 | 46 | ||
250 | 47 | std::vector<Window> GetTrayXids() const; | ||
251 | 48 | std::vector<nux::View*> GetPanelViews() const; | 47 | std::vector<nux::View*> GetPanelViews() const; |
252 | 49 | std::vector<nux::Geometry> GetGeometries() const; | 48 | std::vector<nux::Geometry> GetGeometries() const; |
253 | 50 | 49 | ||
254 | @@ -60,7 +59,6 @@ | |||
255 | 60 | 59 | ||
256 | 61 | void OnScreenChanged(unsigned int primary_monitor, std::vector<nux::Geometry>& monitors, Introspectable *iobj); | 60 | void OnScreenChanged(unsigned int primary_monitor, std::vector<nux::Geometry>& monitors, Introspectable *iobj); |
257 | 62 | 61 | ||
258 | 63 | private: | ||
259 | 64 | typedef nux::ObjectPtr<nux::BaseWindow> BaseWindowPtr; | 62 | typedef nux::ObjectPtr<nux::BaseWindow> BaseWindowPtr; |
260 | 65 | 63 | ||
261 | 66 | unity::PanelView* ViewForWindow(BaseWindowPtr const& window) const; | 64 | unity::PanelView* ViewForWindow(BaseWindowPtr const& window) const; |
262 | @@ -70,8 +68,8 @@ | |||
263 | 70 | nux::Geometry& geo, | 68 | nux::Geometry& geo, |
264 | 71 | void* user_data); | 69 | void* user_data); |
265 | 72 | 70 | ||
266 | 73 | private: | ||
267 | 74 | std::vector<BaseWindowPtr> windows_; | 71 | std::vector<BaseWindowPtr> windows_; |
268 | 72 | std::vector<Window> tray_xids_; | ||
269 | 75 | float opacity_; | 73 | float opacity_; |
270 | 76 | bool opacity_maximized_toggle_; | 74 | bool opacity_maximized_toggle_; |
271 | 77 | int menus_fadein_; | 75 | int menus_fadein_; |
272 | @@ -94,23 +92,11 @@ | |||
273 | 94 | , dbus_indicators_(std::make_shared<indicator::DBusIndicators>()) | 92 | , dbus_indicators_(std::make_shared<indicator::DBusIndicators>()) |
274 | 95 | {} | 93 | {} |
275 | 96 | 94 | ||
276 | 97 | std::vector<Window> Controller::Impl::GetTrayXids() const | ||
277 | 98 | { | ||
278 | 99 | std::vector<Window> xids; | ||
279 | 100 | |||
280 | 101 | for (auto window: windows_) | ||
281 | 102 | { | ||
282 | 103 | xids.push_back(ViewForWindow(window)->GetTrayXid()); | ||
283 | 104 | } | ||
284 | 105 | |||
285 | 106 | return xids; | ||
286 | 107 | } | ||
287 | 108 | |||
288 | 109 | std::vector<nux::View*> Controller::Impl::GetPanelViews() const | 95 | std::vector<nux::View*> Controller::Impl::GetPanelViews() const |
289 | 110 | { | 96 | { |
290 | 111 | std::vector<nux::View*> views; | 97 | std::vector<nux::View*> views; |
291 | 112 | views.reserve(windows_.size()); | 98 | views.reserve(windows_.size()); |
293 | 113 | for (auto window: windows_) | 99 | for (auto const& window: windows_) |
294 | 114 | views.push_back(ViewForWindow(window)); | 100 | views.push_back(ViewForWindow(window)); |
295 | 115 | return views; | 101 | return views; |
296 | 116 | } | 102 | } |
297 | @@ -119,7 +105,7 @@ | |||
298 | 119 | { | 105 | { |
299 | 120 | std::vector<nux::Geometry> geometries; | 106 | std::vector<nux::Geometry> geometries; |
300 | 121 | 107 | ||
302 | 122 | for (auto window : windows_) | 108 | for (auto const& window : windows_) |
303 | 123 | { | 109 | { |
304 | 124 | geometries.push_back(window->GetAbsoluteGeometry()); | 110 | geometries.push_back(window->GetAbsoluteGeometry()); |
305 | 125 | } | 111 | } |
306 | @@ -129,7 +115,7 @@ | |||
307 | 129 | 115 | ||
308 | 130 | void Controller::Impl::FirstMenuShow() | 116 | void Controller::Impl::FirstMenuShow() |
309 | 131 | { | 117 | { |
311 | 132 | for (auto window: windows_) | 118 | for (auto const& window: windows_) |
312 | 133 | { | 119 | { |
313 | 134 | if (ViewForWindow(window)->FirstMenuShow()) | 120 | if (ViewForWindow(window)->FirstMenuShow()) |
314 | 135 | break; | 121 | break; |
315 | @@ -140,7 +126,7 @@ | |||
316 | 140 | { | 126 | { |
317 | 141 | opacity_ = opacity; | 127 | opacity_ = opacity; |
318 | 142 | 128 | ||
320 | 143 | for (auto window: windows_) | 129 | for (auto const& window: windows_) |
321 | 144 | { | 130 | { |
322 | 145 | ViewForWindow(window)->SetOpacity(opacity_); | 131 | ViewForWindow(window)->SetOpacity(opacity_); |
323 | 146 | } | 132 | } |
324 | @@ -158,7 +144,7 @@ | |||
325 | 158 | { | 144 | { |
326 | 159 | opacity_maximized_toggle_ = enabled; | 145 | opacity_maximized_toggle_ = enabled; |
327 | 160 | 146 | ||
329 | 161 | for (auto window: windows_) | 147 | for (auto const& window: windows_) |
330 | 162 | { | 148 | { |
331 | 163 | ViewForWindow(window)->SetOpacityMaximizedToggle(opacity_maximized_toggle_); | 149 | ViewForWindow(window)->SetOpacityMaximizedToggle(opacity_maximized_toggle_); |
332 | 164 | } | 150 | } |
333 | @@ -173,7 +159,7 @@ | |||
334 | 173 | menus_discovery_fadein_ = discovery_fadein; | 159 | menus_discovery_fadein_ = discovery_fadein; |
335 | 174 | menus_discovery_fadeout_ = discovery_fadeout; | 160 | menus_discovery_fadeout_ = discovery_fadeout; |
336 | 175 | 161 | ||
338 | 176 | for (auto window: windows_) | 162 | for (auto const& window: windows_) |
339 | 177 | { | 163 | { |
340 | 178 | ViewForWindow(window)->SetMenuShowTimings(fadein, fadeout, discovery, | 164 | ViewForWindow(window)->SetMenuShowTimings(fadein, fadeout, discovery, |
341 | 179 | discovery_fadein, discovery_fadeout); | 165 | discovery_fadein, discovery_fadeout); |
342 | @@ -182,7 +168,7 @@ | |||
343 | 182 | 168 | ||
344 | 183 | void Controller::Impl::QueueRedraw() | 169 | void Controller::Impl::QueueRedraw() |
345 | 184 | { | 170 | { |
347 | 185 | for (auto window: windows_) | 171 | for (auto const& window: windows_) |
348 | 186 | { | 172 | { |
349 | 187 | window->QueueDraw(); | 173 | window->QueueDraw(); |
350 | 188 | } | 174 | } |
351 | @@ -205,6 +191,8 @@ | |||
352 | 205 | unsigned n_monitors = monitors.size(); | 191 | unsigned n_monitors = monitors.size(); |
353 | 206 | unsigned int i = 0; | 192 | unsigned int i = 0; |
354 | 207 | 193 | ||
355 | 194 | tray_xids_.resize(n_monitors); | ||
356 | 195 | |||
357 | 208 | for (it = windows_.begin(); it != windows_.end(); ++it) | 196 | for (it = windows_.begin(); it != windows_.end(); ++it) |
358 | 209 | { | 197 | { |
359 | 210 | if (i < n_monitors) | 198 | if (i < n_monitors) |
360 | @@ -222,6 +210,7 @@ | |||
361 | 222 | view = ViewForWindow(*it); | 210 | view = ViewForWindow(*it); |
362 | 223 | view->SetPrimary(i == primary_monitor); | 211 | view->SetPrimary(i == primary_monitor); |
363 | 224 | view->SetMonitor(i); | 212 | view->SetMonitor(i); |
364 | 213 | tray_xids_[i] = view->GetTrayXid(); | ||
365 | 225 | 214 | ||
366 | 226 | if (nux::GetWindowThread()->IsEmbeddedWindow()) | 215 | if (nux::GetWindowThread()->IsEmbeddedWindow()) |
367 | 227 | { | 216 | { |
368 | @@ -252,6 +241,7 @@ | |||
369 | 252 | menus_discovery_fadein_, menus_discovery_fadeout_); | 241 | menus_discovery_fadein_, menus_discovery_fadeout_); |
370 | 253 | view->SetPrimary(i == primary_monitor); | 242 | view->SetPrimary(i == primary_monitor); |
371 | 254 | view->SetMonitor(i); | 243 | view->SetMonitor(i); |
372 | 244 | tray_xids_[i] = view->GetTrayXid(); | ||
373 | 255 | 245 | ||
374 | 256 | layout->AddView(view, 1); | 246 | layout->AddView(view, 1); |
375 | 257 | layout->SetContentDistribution(nux::MAJOR_POSITION_START); | 247 | layout->SetContentDistribution(nux::MAJOR_POSITION_START); |
376 | @@ -362,9 +352,9 @@ | |||
377 | 362 | pimpl->QueueRedraw(); | 352 | pimpl->QueueRedraw(); |
378 | 363 | } | 353 | } |
379 | 364 | 354 | ||
381 | 365 | std::vector<Window> Controller::GetTrayXids() const | 355 | std::vector<Window> const& Controller::GetTrayXids() const |
382 | 366 | { | 356 | { |
384 | 367 | return pimpl->GetTrayXids(); | 357 | return pimpl->tray_xids_; |
385 | 368 | } | 358 | } |
386 | 369 | 359 | ||
387 | 370 | std::vector<nux::View*> Controller::GetPanelViews() const | 360 | std::vector<nux::View*> Controller::GetPanelViews() const |
388 | 371 | 361 | ||
389 | === modified file 'panel/PanelController.h' | |||
390 | --- panel/PanelController.h 2013-01-30 19:00:01 +0000 | |||
391 | +++ panel/PanelController.h 2013-04-12 23:35:32 +0000 | |||
392 | @@ -40,7 +40,7 @@ | |||
393 | 40 | void FirstMenuShow(); | 40 | void FirstMenuShow(); |
394 | 41 | void QueueRedraw(); | 41 | void QueueRedraw(); |
395 | 42 | 42 | ||
397 | 43 | std::vector<Window> GetTrayXids() const; | 43 | std::vector<Window> const& GetTrayXids() const; |
398 | 44 | std::vector<nux::View*> GetPanelViews() const; | 44 | std::vector<nux::View*> GetPanelViews() const; |
399 | 45 | std::vector<nux::Geometry> GetGeometries() const; | 45 | std::vector<nux::Geometry> GetGeometries() const; |
400 | 46 | 46 | ||
401 | 47 | 47 | ||
402 | === modified file 'panel/PanelTray.cpp' | |||
403 | --- panel/PanelTray.cpp 2013-02-06 12:32:28 +0000 | |||
404 | +++ panel/PanelTray.cpp 2013-04-12 23:35:32 +0000 | |||
405 | @@ -89,7 +89,7 @@ | |||
406 | 89 | 89 | ||
407 | 90 | Window PanelTray::xid() | 90 | Window PanelTray::xid() |
408 | 91 | { | 91 | { |
410 | 92 | if (!window_) | 92 | if (!window_ || !gtk_widget_get_realized(window_)) |
411 | 93 | return 0; | 93 | return 0; |
412 | 94 | 94 | ||
413 | 95 | return gdk_x11_window_get_xid(gtk_widget_get_window(window_)); | 95 | return gdk_x11_window_get_xid(gtk_widget_get_window(window_)); |
414 | 96 | 96 | ||
415 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
416 | --- plugins/unityshell/src/unityshell.cpp 2013-04-11 05:53:30 +0000 | |||
417 | +++ plugins/unityshell/src/unityshell.cpp 2013-04-12 23:35:32 +0000 | |||
418 | @@ -621,8 +621,6 @@ | |||
419 | 621 | 621 | ||
420 | 622 | panelShadowPainted |= redraw; | 622 | panelShadowPainted |= redraw; |
421 | 623 | 623 | ||
422 | 624 | nuxPrologue(); | ||
423 | 625 | |||
424 | 626 | for (auto const& r : redraw.rects()) | 624 | for (auto const& r : redraw.rects()) |
425 | 627 | { | 625 | { |
426 | 628 | for (GLTexture* tex : _shadow_texture) | 626 | for (GLTexture* tex : _shadow_texture) |
427 | @@ -685,7 +683,6 @@ | |||
428 | 685 | glDisable(GL_BLEND); | 683 | glDisable(GL_BLEND); |
429 | 686 | } | 684 | } |
430 | 687 | } | 685 | } |
431 | 688 | nuxEpilogue(); | ||
432 | 689 | } | 686 | } |
433 | 690 | 687 | ||
434 | 691 | void | 688 | void |
435 | @@ -1434,8 +1431,7 @@ | |||
436 | 1434 | * redraw even though the launcher's geometry is not in DrawList, and | 1431 | * redraw even though the launcher's geometry is not in DrawList, and |
437 | 1435 | * stop it. Then maybe we can revert back to the old code below #else. | 1432 | * stop it. Then maybe we can revert back to the old code below #else. |
438 | 1436 | */ | 1433 | */ |
441 | 1437 | std::vector<nux::Geometry> const& dirty = wt->GetDrawList(); | 1434 | if (!wt->GetDrawList().empty() || animation_controller_->HasRunningAnimations()) |
440 | 1438 | if (!dirty.empty() || animation_controller_->HasRunningAnimations()) | ||
442 | 1439 | { | 1435 | { |
443 | 1440 | cScreen->damageRegionSetEnabled(this, false); | 1436 | cScreen->damageRegionSetEnabled(this, false); |
444 | 1441 | cScreen->damageScreen(); | 1437 | cScreen->damageScreen(); |
445 | 1442 | 1438 | ||
446 | === modified file 'unity-shared/AbstractIconRenderer.h' | |||
447 | --- unity-shared/AbstractIconRenderer.h 2012-10-17 22:42:12 +0000 | |||
448 | +++ unity-shared/AbstractIconRenderer.h 2013-04-12 23:35:32 +0000 | |||
449 | @@ -41,9 +41,6 @@ | |||
450 | 41 | RenderArg() | 41 | RenderArg() |
451 | 42 | : icon(0) | 42 | : icon(0) |
452 | 43 | , colorify(nux::color::White) | 43 | , colorify(nux::color::White) |
453 | 44 | , x_rotation(0) | ||
454 | 45 | , y_rotation(0) | ||
455 | 46 | , z_rotation(0) | ||
456 | 47 | , alpha(1.0f) | 44 | , alpha(1.0f) |
457 | 48 | , saturation(1.0f) | 45 | , saturation(1.0f) |
458 | 49 | , backlight_intensity(0.0f) | 46 | , backlight_intensity(0.0f) |
459 | @@ -71,10 +68,8 @@ | |||
460 | 71 | IconTextureSource* icon; | 68 | IconTextureSource* icon; |
461 | 72 | nux::Point3 render_center; | 69 | nux::Point3 render_center; |
462 | 73 | nux::Point3 logical_center; | 70 | nux::Point3 logical_center; |
463 | 71 | nux::Vector3 rotation; | ||
464 | 74 | nux::Color colorify; | 72 | nux::Color colorify; |
465 | 75 | float x_rotation; | ||
466 | 76 | float y_rotation; | ||
467 | 77 | float z_rotation; | ||
468 | 78 | float alpha; | 73 | float alpha; |
469 | 79 | float saturation; | 74 | float saturation; |
470 | 80 | float backlight_intensity; | 75 | float backlight_intensity; |
471 | 81 | 76 | ||
472 | === modified file 'unity-shared/FileManager.h' | |||
473 | --- unity-shared/FileManager.h 2013-03-29 17:44:12 +0000 | |||
474 | +++ unity-shared/FileManager.h 2013-04-12 23:35:32 +0000 | |||
475 | @@ -22,6 +22,7 @@ | |||
476 | 22 | #define UNITYSHELL_FILEMANAGER_H | 22 | #define UNITYSHELL_FILEMANAGER_H |
477 | 23 | 23 | ||
478 | 24 | #include <memory> | 24 | #include <memory> |
479 | 25 | #include <vector> | ||
480 | 25 | #include <string> | 26 | #include <string> |
481 | 26 | #include <sigc++/sigc++.h> | 27 | #include <sigc++/sigc++.h> |
482 | 27 | 28 | ||
483 | 28 | 29 | ||
484 | === modified file 'unity-shared/IconRenderer.cpp' | |||
485 | --- unity-shared/IconRenderer.cpp 2013-04-08 14:35:06 +0000 | |||
486 | +++ unity-shared/IconRenderer.cpp 2013-04-12 23:35:32 +0000 | |||
487 | @@ -235,6 +235,13 @@ | |||
488 | 235 | nux::ObjectPtr<nux::IOpenGLAsmShaderProgram> asm_shader; | 235 | nux::ObjectPtr<nux::IOpenGLAsmShaderProgram> asm_shader; |
489 | 236 | #endif | 236 | #endif |
490 | 237 | 237 | ||
491 | 238 | int VertexLocation; | ||
492 | 239 | int VPMatrixLocation; | ||
493 | 240 | int TextureCoord0Location; | ||
494 | 241 | int FragmentColor; | ||
495 | 242 | int ColorifyColor; | ||
496 | 243 | int DesatFactor; | ||
497 | 244 | |||
498 | 238 | std::map<char, BaseTexturePtr> labels; | 245 | std::map<char, BaseTexturePtr> labels; |
499 | 239 | 246 | ||
500 | 240 | private: | 247 | private: |
501 | @@ -264,9 +271,6 @@ | |||
502 | 264 | pip_style = OUTSIDE_TILE; | 271 | pip_style = OUTSIDE_TILE; |
503 | 265 | } | 272 | } |
504 | 266 | 273 | ||
505 | 267 | IconRenderer::~IconRenderer() | ||
506 | 268 | {} | ||
507 | 269 | |||
508 | 270 | void IconRenderer::SetTargetSize(int tile_size, int image_size_, int spacing_) | 274 | void IconRenderer::SetTargetSize(int tile_size, int image_size_, int spacing_) |
509 | 271 | { | 275 | { |
510 | 272 | icon_size = tile_size; | 276 | icon_size = tile_size; |
511 | @@ -291,9 +295,20 @@ | |||
512 | 291 | int i; | 295 | int i; |
513 | 292 | for (it = args.begin(), i = 0; it != args.end(); ++it, ++i) | 296 | for (it = args.begin(), i = 0; it != args.end(); ++it, ++i) |
514 | 293 | { | 297 | { |
515 | 294 | |||
516 | 295 | IconTextureSource* launcher_icon = it->icon; | 298 | IconTextureSource* launcher_icon = it->icon; |
517 | 296 | 299 | ||
518 | 300 | if (it->render_center == launcher_icon->LastRenderCenter(monitor) && | ||
519 | 301 | it->logical_center == launcher_icon->LastLogicalCenter(monitor) && | ||
520 | 302 | it->rotation == launcher_icon->LastRotation(monitor) && | ||
521 | 303 | it->skip == launcher_icon->WasSkipping(monitor)) | ||
522 | 304 | { | ||
523 | 305 | continue; | ||
524 | 306 | } | ||
525 | 307 | |||
526 | 308 | launcher_icon->RememberCenters(monitor, it->render_center, it->logical_center); | ||
527 | 309 | launcher_icon->RememberRotation(monitor, it->rotation); | ||
528 | 310 | launcher_icon->RememberSkip(monitor, it->skip); | ||
529 | 311 | |||
530 | 297 | float w = icon_size; | 312 | float w = icon_size; |
531 | 298 | float h = icon_size; | 313 | float h = icon_size; |
532 | 299 | float x = it->render_center.x - w / 2.0f; // x: top left corner | 314 | float x = it->render_center.x - w / 2.0f; // x: top left corner |
533 | @@ -309,9 +324,9 @@ | |||
534 | 309 | } | 324 | } |
535 | 310 | 325 | ||
536 | 311 | ObjectMatrix = nux::Matrix4::TRANSLATE(geo.width / 2.0f, geo.height / 2.0f, z) * // Translate the icon to the center of the viewport | 326 | ObjectMatrix = nux::Matrix4::TRANSLATE(geo.width / 2.0f, geo.height / 2.0f, z) * // Translate the icon to the center of the viewport |
540 | 312 | nux::Matrix4::ROTATEX(it->x_rotation) * // rotate the icon | 327 | nux::Matrix4::ROTATEX(it->rotation.x) * // rotate the icon |
541 | 313 | nux::Matrix4::ROTATEY(it->y_rotation) * | 328 | nux::Matrix4::ROTATEY(it->rotation.y) * |
542 | 314 | nux::Matrix4::ROTATEZ(it->z_rotation) * | 329 | nux::Matrix4::ROTATEZ(it->rotation.z) * |
543 | 315 | nux::Matrix4::TRANSLATE(-x - w / 2.0f, -y - h / 2.0f, -z); // Put the center the icon to (0, 0) | 330 | nux::Matrix4::TRANSLATE(-x - w / 2.0f, -y - h / 2.0f, -z); // Put the center the icon to (0, 0) |
544 | 316 | 331 | ||
545 | 317 | ViewProjectionMatrix = PremultMatrix * ObjectMatrix; | 332 | ViewProjectionMatrix = PremultMatrix * ObjectMatrix; |
546 | @@ -369,9 +384,9 @@ | |||
547 | 369 | z = it->render_center.z; | 384 | z = it->render_center.z; |
548 | 370 | 385 | ||
549 | 371 | ObjectMatrix = nux::Matrix4::TRANSLATE(geo.width / 2.0f, geo.height / 2.0f, z) * // Translate the icon to the center of the viewport | 386 | ObjectMatrix = nux::Matrix4::TRANSLATE(geo.width / 2.0f, geo.height / 2.0f, z) * // Translate the icon to the center of the viewport |
553 | 372 | nux::Matrix4::ROTATEX(it->x_rotation) * // rotate the icon | 387 | nux::Matrix4::ROTATEX(it->rotation.x) * // rotate the icon |
554 | 373 | nux::Matrix4::ROTATEY(it->y_rotation) * | 388 | nux::Matrix4::ROTATEY(it->rotation.y) * |
555 | 374 | nux::Matrix4::ROTATEZ(it->z_rotation) * | 389 | nux::Matrix4::ROTATEZ(it->rotation.z) * |
556 | 375 | nux::Matrix4::TRANSLATE(-(it->render_center.x - w / 2.0f) - w / 2.0f, -(it->render_center.y - h / 2.0f) - h / 2.0f, -z); // Put the center the icon to (0, 0) | 390 | nux::Matrix4::TRANSLATE(-(it->render_center.x - w / 2.0f) - w / 2.0f, -(it->render_center.y - h / 2.0f) - h / 2.0f, -z); // Put the center the icon to (0, 0) |
557 | 376 | 391 | ||
558 | 377 | ViewProjectionMatrix = PremultMatrix * ObjectMatrix; | 392 | ViewProjectionMatrix = PremultMatrix * ObjectMatrix; |
559 | @@ -754,9 +769,9 @@ | |||
560 | 754 | if (icon.IsNull()) | 769 | if (icon.IsNull()) |
561 | 755 | return; | 770 | return; |
562 | 756 | 771 | ||
566 | 757 | if (std::abs(arg.x_rotation) < 0.01f && | 772 | if (std::abs(arg.rotation.x) < 0.01f && |
567 | 758 | std::abs(arg.y_rotation) < 0.01f && | 773 | std::abs(arg.rotation.y) < 0.01f && |
568 | 759 | std::abs(arg.z_rotation) < 0.01f && | 774 | std::abs(arg.rotation.z) < 0.01f && |
569 | 760 | !force_filter) | 775 | !force_filter) |
570 | 761 | { | 776 | { |
571 | 762 | icon->SetFiltering(GL_NEAREST, GL_NEAREST); | 777 | icon->SetFiltering(GL_NEAREST, GL_NEAREST); |
572 | @@ -823,20 +838,15 @@ | |||
573 | 823 | { | 838 | { |
574 | 824 | textures_->shader_program_uv_persp_correction->Begin(); | 839 | textures_->shader_program_uv_persp_correction->Begin(); |
575 | 825 | 840 | ||
588 | 826 | int TextureObjectLocation = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("TextureObject0"); | 841 | VertexLocation = textures_->VertexLocation; |
589 | 827 | VertexLocation = textures_->shader_program_uv_persp_correction->GetAttributeLocation("iVertex"); | 842 | TextureCoord0Location = textures_->TextureCoord0Location; |
590 | 828 | TextureCoord0Location = textures_->shader_program_uv_persp_correction->GetAttributeLocation("iTexCoord0"); | 843 | FragmentColor = textures_->FragmentColor; |
591 | 829 | FragmentColor = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("color0"); | 844 | ColorifyColor = textures_->ColorifyColor; |
592 | 830 | ColorifyColor = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("colorify_color"); | 845 | DesatFactor = textures_->DesatFactor; |
593 | 831 | DesatFactor = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("desat_factor"); | 846 | |
594 | 832 | 847 | if (textures_->VPMatrixLocation != -1) | |
583 | 833 | if (TextureObjectLocation != -1) | ||
584 | 834 | CHECKGL(glUniform1iARB(TextureObjectLocation, 0)); | ||
585 | 835 | |||
586 | 836 | int VPMatrixLocation = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("ViewProjectionMatrix"); | ||
587 | 837 | if (VPMatrixLocation != -1) | ||
595 | 838 | { | 848 | { |
597 | 839 | textures_->shader_program_uv_persp_correction->SetUniformLocMatrix4fv((GLint)VPMatrixLocation, 1, false, (GLfloat*) & (stored_projection_matrix_.m)); | 849 | textures_->shader_program_uv_persp_correction->SetUniformLocMatrix4fv((GLint)textures_->VPMatrixLocation, 1, false, (GLfloat*) & (stored_projection_matrix_.m)); |
598 | 840 | } | 850 | } |
599 | 841 | } | 851 | } |
600 | 842 | #ifndef USE_GLES | 852 | #ifndef USE_GLES |
601 | @@ -922,7 +932,7 @@ | |||
602 | 922 | nux::Geometry const& geo) | 932 | nux::Geometry const& geo) |
603 | 923 | { | 933 | { |
604 | 924 | int markerCenter = (int) arg.render_center.y; | 934 | int markerCenter = (int) arg.render_center.y; |
606 | 925 | markerCenter -= (int)(arg.x_rotation / (2 * M_PI) * icon_size); | 935 | markerCenter -= (int)(arg.rotation.x / (2 * M_PI) * icon_size); |
607 | 926 | 936 | ||
608 | 927 | 937 | ||
609 | 928 | if (running > 0) | 938 | if (running > 0) |
610 | @@ -1194,6 +1204,12 @@ | |||
611 | 1194 | 1204 | ||
612 | 1195 | IconRenderer::TexturesPool::TexturesPool() | 1205 | IconRenderer::TexturesPool::TexturesPool() |
613 | 1196 | : offscreen_progress_texture(nux::GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, nux::BITFMT_R8G8B8A8)) | 1206 | : offscreen_progress_texture(nux::GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, nux::BITFMT_R8G8B8A8)) |
614 | 1207 | , VertexLocation(-1) | ||
615 | 1208 | , VPMatrixLocation(0) | ||
616 | 1209 | , TextureCoord0Location(-1) | ||
617 | 1210 | , FragmentColor(0) | ||
618 | 1211 | , ColorifyColor(0) | ||
619 | 1212 | , DesatFactor(0) | ||
620 | 1197 | { | 1213 | { |
621 | 1198 | LoadTexture(progress_bar_trough, PKGDATADIR"/progress_bar_trough.png"); | 1214 | LoadTexture(progress_bar_trough, PKGDATADIR"/progress_bar_trough.png"); |
622 | 1199 | LoadTexture(progress_bar_fill, PKGDATADIR"/progress_bar_fill.png"); | 1215 | LoadTexture(progress_bar_fill, PKGDATADIR"/progress_bar_fill.png"); |
623 | @@ -1249,6 +1265,22 @@ | |||
624 | 1249 | shader_program_uv_persp_correction = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateShaderProgram(); | 1265 | shader_program_uv_persp_correction = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateShaderProgram(); |
625 | 1250 | shader_program_uv_persp_correction->LoadIShader(gPerspectiveCorrectShader.c_str()); | 1266 | shader_program_uv_persp_correction->LoadIShader(gPerspectiveCorrectShader.c_str()); |
626 | 1251 | shader_program_uv_persp_correction->Link(); | 1267 | shader_program_uv_persp_correction->Link(); |
627 | 1268 | |||
628 | 1269 | shader_program_uv_persp_correction->Begin(); | ||
629 | 1270 | |||
630 | 1271 | int TextureObjectLocation = shader_program_uv_persp_correction->GetUniformLocationARB("TextureObject0"); | ||
631 | 1272 | VertexLocation = shader_program_uv_persp_correction->GetAttributeLocation("iVertex"); | ||
632 | 1273 | TextureCoord0Location = shader_program_uv_persp_correction->GetAttributeLocation("iTexCoord0"); | ||
633 | 1274 | FragmentColor = shader_program_uv_persp_correction->GetUniformLocationARB("color0"); | ||
634 | 1275 | ColorifyColor = shader_program_uv_persp_correction->GetUniformLocationARB("colorify_color"); | ||
635 | 1276 | DesatFactor = shader_program_uv_persp_correction->GetUniformLocationARB("desat_factor"); | ||
636 | 1277 | |||
637 | 1278 | if (TextureObjectLocation != -1) | ||
638 | 1279 | CHECKGL(glUniform1iARB(TextureObjectLocation, 0)); | ||
639 | 1280 | |||
640 | 1281 | VPMatrixLocation = shader_program_uv_persp_correction->GetUniformLocationARB("ViewProjectionMatrix"); | ||
641 | 1282 | |||
642 | 1283 | shader_program_uv_persp_correction->End(); | ||
643 | 1252 | } | 1284 | } |
644 | 1253 | else | 1285 | else |
645 | 1254 | { | 1286 | { |
646 | 1255 | 1287 | ||
647 | === modified file 'unity-shared/IconRenderer.h' | |||
648 | --- unity-shared/IconRenderer.h 2013-03-19 13:24:45 +0000 | |||
649 | +++ unity-shared/IconRenderer.h 2013-04-12 23:35:32 +0000 | |||
650 | @@ -37,7 +37,6 @@ | |||
651 | 37 | { | 37 | { |
652 | 38 | public: | 38 | public: |
653 | 39 | IconRenderer(); | 39 | IconRenderer(); |
654 | 40 | virtual ~IconRenderer(); | ||
655 | 41 | 40 | ||
656 | 42 | void PreprocessIcons(std::list<RenderArg>& args, nux::Geometry const& target_window); | 41 | void PreprocessIcons(std::list<RenderArg>& args, nux::Geometry const& target_window); |
657 | 43 | 42 | ||
658 | 44 | 43 | ||
659 | === modified file 'unity-shared/IconTextureSource.cpp' | |||
660 | --- unity-shared/IconTextureSource.cpp 2012-05-07 00:49:31 +0000 | |||
661 | +++ unity-shared/IconTextureSource.cpp 2013-04-12 23:35:32 +0000 | |||
662 | @@ -26,21 +26,58 @@ | |||
663 | 26 | { | 26 | { |
664 | 27 | NUX_IMPLEMENT_OBJECT_TYPE(IconTextureSource); | 27 | NUX_IMPLEMENT_OBJECT_TYPE(IconTextureSource); |
665 | 28 | 28 | ||
666 | 29 | namespace | ||
667 | 30 | { | ||
668 | 31 | const unsigned RENDERERS_SIZE = max_num_monitors + 1; // +1 for the switcher | ||
669 | 32 | } | ||
670 | 33 | |||
671 | 29 | IconTextureSource::IconTextureSource() | 34 | IconTextureSource::IconTextureSource() |
675 | 30 | { | 35 | : skip_(RENDERERS_SIZE, false) |
676 | 31 | transform_map.resize(max_num_monitors); | 36 | , last_render_center_(RENDERERS_SIZE) |
677 | 32 | } | 37 | , last_logical_center_(RENDERERS_SIZE) |
678 | 38 | , last_rotation_(RENDERERS_SIZE) | ||
679 | 39 | , transformations_(RENDERERS_SIZE, decltype(transformations_)::value_type(TRANSFORM_SIZE, std::vector<nux::Vector4>(4))) | ||
680 | 40 | {} | ||
681 | 33 | 41 | ||
682 | 34 | std::vector<nux::Vector4> & IconTextureSource::GetTransform(TransformIndex index, int monitor) | 42 | std::vector<nux::Vector4> & IconTextureSource::GetTransform(TransformIndex index, int monitor) |
683 | 35 | { | 43 | { |
692 | 36 | auto iter = transform_map[monitor].find(index); | 44 | return transformations_[monitor][index]; |
693 | 37 | if (iter == transform_map[monitor].end()) | 45 | } |
694 | 38 | { | 46 | |
695 | 39 | auto iter2 = transform_map[monitor].insert(std::map<TransformIndex, std::vector<nux::Vector4> >::value_type(index, std::vector<nux::Vector4>(4))); | 47 | void IconTextureSource::RememberCenters(int monitor, nux::Point3 const& render, nux::Point3 const& logical) |
696 | 40 | return iter2.first->second; | 48 | { |
697 | 41 | } | 49 | last_render_center_[monitor] = render; |
698 | 42 | 50 | last_logical_center_[monitor] = logical; | |
699 | 43 | return iter->second; | 51 | } |
700 | 52 | |||
701 | 53 | void IconTextureSource::RememberRotation(int monitor, nux::Vector3 const& rotation) | ||
702 | 54 | { | ||
703 | 55 | last_rotation_[monitor] = rotation; | ||
704 | 56 | } | ||
705 | 57 | |||
706 | 58 | nux::Point3 const& IconTextureSource::LastRenderCenter(int monitor) const | ||
707 | 59 | { | ||
708 | 60 | return last_render_center_[monitor]; | ||
709 | 61 | } | ||
710 | 62 | |||
711 | 63 | nux::Point3 const& IconTextureSource::LastLogicalCenter(int monitor) const | ||
712 | 64 | { | ||
713 | 65 | return last_logical_center_[monitor]; | ||
714 | 66 | } | ||
715 | 67 | |||
716 | 68 | nux::Vector3 const& IconTextureSource::LastRotation(int monitor) const | ||
717 | 69 | { | ||
718 | 70 | return last_rotation_[monitor]; | ||
719 | 71 | } | ||
720 | 72 | |||
721 | 73 | void IconTextureSource::RememberSkip(int monitor, bool skip) | ||
722 | 74 | { | ||
723 | 75 | skip_[monitor] = skip; | ||
724 | 76 | } | ||
725 | 77 | |||
726 | 78 | bool IconTextureSource::WasSkipping(int monitor) const | ||
727 | 79 | { | ||
728 | 80 | return skip_[monitor]; | ||
729 | 44 | } | 81 | } |
730 | 45 | 82 | ||
731 | 46 | } | 83 | } |
732 | 47 | 84 | ||
733 | === modified file 'unity-shared/IconTextureSource.h' | |||
734 | --- unity-shared/IconTextureSource.h 2012-05-28 16:16:06 +0000 | |||
735 | +++ unity-shared/IconTextureSource.h 2013-04-12 23:35:32 +0000 | |||
736 | @@ -22,7 +22,6 @@ | |||
737 | 22 | #define ICONTEXTURESOURCE_H | 22 | #define ICONTEXTURESOURCE_H |
738 | 23 | 23 | ||
739 | 24 | #include <Nux/Nux.h> | 24 | #include <Nux/Nux.h> |
740 | 25 | #include <NuxCore/Property.h> | ||
741 | 26 | #include <NuxCore/Math/MathInc.h> | 25 | #include <NuxCore/Math/MathInc.h> |
742 | 27 | 26 | ||
743 | 28 | namespace unity | 27 | namespace unity |
744 | @@ -38,17 +37,27 @@ | |||
745 | 38 | 37 | ||
746 | 39 | enum TransformIndex | 38 | enum TransformIndex |
747 | 40 | { | 39 | { |
749 | 41 | TRANSFORM_TILE, | 40 | TRANSFORM_TILE = 0, |
750 | 42 | TRANSFORM_IMAGE, | 41 | TRANSFORM_IMAGE, |
751 | 43 | TRANSFORM_HIT_AREA, | 42 | TRANSFORM_HIT_AREA, |
752 | 44 | TRANSFORM_GLOW, | 43 | TRANSFORM_GLOW, |
753 | 45 | TRANSFORM_EMBLEM, | 44 | TRANSFORM_EMBLEM, |
754 | 45 | TRANSFORM_SIZE | ||
755 | 46 | }; | 46 | }; |
756 | 47 | 47 | ||
757 | 48 | IconTextureSource(); | 48 | IconTextureSource(); |
758 | 49 | 49 | ||
759 | 50 | std::vector<nux::Vector4> & GetTransform(TransformIndex index, int monitor); | 50 | std::vector<nux::Vector4> & GetTransform(TransformIndex index, int monitor); |
760 | 51 | 51 | ||
761 | 52 | nux::Point3 const& LastRenderCenter(int monitor) const; | ||
762 | 53 | nux::Point3 const& LastLogicalCenter(int monitor) const; | ||
763 | 54 | nux::Vector3 const& LastRotation(int monitor) const; | ||
764 | 55 | void RememberCenters(int monitor, nux::Point3 const& render, nux::Point3 const& logical); | ||
765 | 56 | void RememberRotation(int monitor, nux::Vector3 const& rotation); | ||
766 | 57 | |||
767 | 58 | void RememberSkip(int monitor, bool skip); | ||
768 | 59 | bool WasSkipping(int monitor) const; | ||
769 | 60 | |||
770 | 52 | virtual nux::Color BackgroundColor() const = 0; | 61 | virtual nux::Color BackgroundColor() const = 0; |
771 | 53 | 62 | ||
772 | 54 | virtual nux::Color GlowColor() = 0; | 63 | virtual nux::Color GlowColor() = 0; |
773 | @@ -58,7 +67,11 @@ | |||
774 | 58 | virtual nux::BaseTexture* Emblem() = 0; | 67 | virtual nux::BaseTexture* Emblem() = 0; |
775 | 59 | 68 | ||
776 | 60 | private: | 69 | private: |
778 | 61 | std::vector<std::map<TransformIndex, std::vector<nux::Vector4> > > transform_map; | 70 | std::vector<bool> skip_; |
779 | 71 | std::vector<nux::Point3> last_render_center_; | ||
780 | 72 | std::vector<nux::Point3> last_logical_center_; | ||
781 | 73 | std::vector<nux::Vector3> last_rotation_; | ||
782 | 74 | std::vector<std::vector<std::vector<nux::Vector4>>> transformations_; | ||
783 | 62 | }; | 75 | }; |
784 | 63 | 76 | ||
785 | 64 | } | 77 | } |
+ nux::Point3 rotation;
Why did you do it?