Merge lp:~3v1n0/unity/callgrind-improvements into lp:unity

Proposed by Marco Trevisan (Treviño)
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
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::nuxEpilogue: -38.3%
IconRenderer::RenderElement: -5.8%
Launcher::DrawContent: -58.6%
panel::Controller::GetTrayXids: -100%
UnityScreen::nuxDamageCompiz: -70%
IconRenderer::PreprocessIcons: -74.3%
UnityScreen::nuxPrologue: -36.9%
IconRenderer::UpdateIconTransform: -87.7%
UnityScreen::paintPanelShadow: -64.3%
dash::LensView::OnResultAdded: -84.6%
IconTexture::GetTransform: -89.4%

See more at http://i.imgur.com/VHrthtt.png

Description of the change

Comparing these Callgrind results http://ubuntuone.com/1sSpDSF3Nljqbp5UuCI4h3 we get these improvements:

UnityScreen::nuxEpilogue: -38.3%
IconRenderer::RenderElement: -5.8%
Launcher::DrawContent: -58.6%
panel::Controller::GetTrayXids: -100%
UnityScreen::nuxDamageCompiz: -70%
IconRenderer::PreprocessIcons: -74.3%
UnityScreen::nuxPrologue: -36.9%
IconRenderer::UpdateIconTransform: -87.7%
UnityScreen::paintPanelShadow: -64.3%
dash::LensView::OnResultAdded: -84.6%
IconTexture::GetTransform: -89.4%

Plus other more generic operations such as vectors allocations or matrix operations.

All these are possible in combination with lp:~3v1n0/nux/callgrind-improvements

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+ nux::Point3 rotation;

Why did you do it?

review: Needs Information
Revision history for this message
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.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
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?

Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM now. Thanks!!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
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?

Revision history for this message
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 :)

Revision history for this message
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? :)

Revision history for this message
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.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
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.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
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.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
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 'dash/LensView.cpp'
--- dash/LensView.cpp 2013-01-15 21:53:55 +0000
+++ dash/LensView.cpp 2013-04-12 23:35:32 +0000
@@ -225,11 +225,6 @@
225 scroll_view_->EnableHorizontalScrollBar(false);225 scroll_view_->EnableHorizontalScrollBar(false);
226 layout_->AddView(scroll_view_);226 layout_->AddView(scroll_view_);
227227
228 scroll_view_->geometry_changed.connect([this] (nux::Area *area, nux::Geometry& geo)
229 {
230 CheckScrollBarState();
231 });
232
233 scroll_layout_ = new nux::VLayout(NUX_TRACKER_LOCATION);228 scroll_layout_ = new nux::VLayout(NUX_TRACKER_LOCATION);
234 scroll_view_->SetLayout(scroll_layout_);229 scroll_view_->SetLayout(scroll_layout_);
235 scroll_view_->SetRightArea(show_filters);230 scroll_view_->SetRightArea(show_filters);
@@ -510,8 +505,7 @@
510 std::string uri = result.uri;505 std::string uri = result.uri;
511 LOG_TRACE(logger) << "Result added: " << uri;506 LOG_TRACE(logger) << "Result added: " << uri;
512507
513 counts_[group]++;508 UpdateCounts(group, ++counts_[group]);
514 UpdateCounts(group);
515 // make sure we don't display the no-results-hint if we do have results509 // make sure we don't display the no-results-hint if we do have results
516 if (G_UNLIKELY (no_results_active_))510 if (G_UNLIKELY (no_results_active_))
517 {511 {
@@ -543,8 +537,7 @@
543 std::string uri = result.uri;537 std::string uri = result.uri;
544 LOG_TRACE(logger) << "Result removed: " << uri;538 LOG_TRACE(logger) << "Result removed: " << uri;
545539
546 counts_[group]--;540 UpdateCounts(group, --counts_[group]);
547 UpdateCounts(group);
548 } catch (std::out_of_range& oor) {541 } catch (std::out_of_range& oor) {
549 LOG_WARN(logger) << "Result does not have a valid category index: "542 LOG_WARN(logger) << "Result does not have a valid category index: "
550 << boost::lexical_cast<unsigned int>(result.category_index)543 << boost::lexical_cast<unsigned int>(result.category_index)
@@ -552,13 +545,13 @@
552 }545 }
553}546}
554547
555void LensView::UpdateCounts(PlacesGroup* group)548void LensView::UpdateCounts(PlacesGroup* group, unsigned int new_counts)
556{549{
557 unsigned int columns = dash::Style::Instance().GetDefaultNColumns();550 unsigned int columns = dash::Style::Instance().GetDefaultNColumns();
558 columns -= filters_expanded ? 2 : 0;551 columns -= filters_expanded ? 2 : 0;
559552
560 group->SetCounts(columns, counts_[group]);553 group->SetCounts(columns, new_counts);
561 group->SetVisible(counts_[group]);554 group->SetVisible(new_counts);
562}555}
563556
564void LensView::CheckNoResults(Lens::Hints const& hints)557void LensView::CheckNoResults(Lens::Hints const& hints)
@@ -663,13 +656,13 @@
663656
664void LensView::CheckScrollBarState()657void LensView::CheckScrollBarState()
665{658{
666 if (scroll_layout_->GetGeometry().height > scroll_view_->GetGeometry().height)659 if (scroll_layout_->GetHeight() > scroll_view_->GetHeight())
667 {660 {
668 scroll_view_->EnableVerticalScrollBar(true); 661 scroll_view_->EnableVerticalScrollBar(true);
669 }662 }
670 else663 else
671 {664 {
672 scroll_view_->EnableVerticalScrollBar(false); 665 scroll_view_->EnableVerticalScrollBar(false);
673 }666 }
674}667}
675668
@@ -735,6 +728,7 @@
735{728{
736 nux::Geometry const& geo(GetGeometry());729 nux::Geometry const& geo(GetGeometry());
737 graphics_engine.PushClippingRectangle(geo);730 graphics_engine.PushClippingRectangle(geo);
731 CheckScrollBarState();
738732
739 if (!IsFullRedraw() && RedirectedAncestor())733 if (!IsFullRedraw() && RedirectedAncestor())
740 {734 {
741735
=== modified file 'dash/LensView.h'
--- dash/LensView.h 2012-12-17 21:30:27 +0000
+++ dash/LensView.h 2013-04-12 23:35:32 +0000
@@ -97,7 +97,7 @@
97 void OnCategoryOrderChanged();97 void OnCategoryOrderChanged();
98 void OnResultAdded(Result const& result);98 void OnResultAdded(Result const& result);
99 void OnResultRemoved(Result const& result);99 void OnResultRemoved(Result const& result);
100 void UpdateCounts(PlacesGroup* group);100 void UpdateCounts(PlacesGroup* group, unsigned int);
101 void OnGroupExpanded(PlacesGroup* group);101 void OnGroupExpanded(PlacesGroup* group);
102 void CheckScrollBarState();102 void CheckScrollBarState();
103 void OnColumnsChanged();103 void OnColumnsChanged();
104104
=== modified file 'debian/control'
--- debian/control 2013-03-06 10:42:08 +0000
+++ debian/control 2013-04-12 23:35:32 +0000
@@ -28,7 +28,7 @@
28 libunity-misc-dev (>= 4.0.4),28 libunity-misc-dev (>= 4.0.4),
29 libgrail-dev (>= 1.0.20),29 libgrail-dev (>= 1.0.20),
30 libxcb-icccm4-dev,30 libxcb-icccm4-dev,
31 libnux-4.0-dev (>= 4.0.0daily13.01.18bzr752),31 libnux-4.0-dev (>= 4.0.1),
32 compiz-dev (>= 1:0.9.9~daily13.01.25bzr3586),32 compiz-dev (>= 1:0.9.9~daily13.01.25bzr3586),
33 libcompizconfig0-dev (>= 1:0.9.9~daily12.12.05-0ubuntu2),33 libcompizconfig0-dev (>= 1:0.9.9~daily12.12.05-0ubuntu2),
34 xsltproc,34 xsltproc,
3535
=== modified file 'launcher/Launcher.cpp'
--- launcher/Launcher.cpp 2013-04-09 02:18:08 +0000
+++ launcher/Launcher.cpp 2013-04-12 23:35:32 +0000
@@ -150,6 +150,7 @@
150 , icon_renderer(std::make_shared<ui::IconRenderer>())150 , icon_renderer(std::make_shared<ui::IconRenderer>())
151{151{
152 m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION);152 m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION);
153 icon_renderer->monitor = monitor();
153154
154 bg_effect_helper_.owner = this;155 bg_effect_helper_.owner = this;
155 bg_effect_helper_.enabled = false;156 bg_effect_helper_.enabled = false;
@@ -783,9 +784,6 @@
783 arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT);784 arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT);
784 arg.draw_edge_only = IconDrawEdgeOnly(icon);785 arg.draw_edge_only = IconDrawEdgeOnly(icon);
785 arg.active_colored = false;786 arg.active_colored = false;
786 arg.x_rotation = 0.0f;
787 arg.y_rotation = 0.0f;
788 arg.z_rotation = 0.0f;
789 arg.skip = false;787 arg.skip = false;
790 arg.stick_thingy = false;788 arg.stick_thingy = false;
791 arg.keyboard_nav_hl = false;789 arg.keyboard_nav_hl = false;
@@ -863,7 +861,7 @@
863861
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)
865 {863 {
866 arg.z_rotation = IconUrgentWiggleValue(icon, current);864 arg.rotation.z = IconUrgentWiggleValue(icon, current);
867 }865 }
868866
869 if (IsInKeyNavMode())867 if (IsInKeyNavMode())
@@ -941,7 +939,7 @@
941939
942 // icon is crossing threshold, start folding940 // icon is crossing threshold, start folding
943 center.z += folded_z_distance * folding_progress;941 center.z += folded_z_distance * folding_progress;
944 arg.x_rotation = animation_neg_rads * folding_progress;942 arg.rotation.x = animation_neg_rads * folding_progress;
945943
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);
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;
@@ -1399,6 +1397,7 @@
1399 unity::panel::Style &panel_style = panel::Style::Instance();1397 unity::panel::Style &panel_style = panel::Style::Instance();
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),
1401 monitor_geo.height - panel_style.panel_height);1399 monitor_geo.height - panel_style.panel_height);
1400 icon_renderer->monitor = new_monitor;
1402}1401}
14031402
1404void Launcher::UpdateOptions(Options::Ptr options)1403void Launcher::UpdateOptions(Options::Ptr options)
@@ -1688,8 +1687,6 @@
16881687
1689void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)1688void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
1690{1689{
1691 icon_renderer->monitor = monitor();
1692
1693 nux::Geometry const& base = GetGeometry();1690 nux::Geometry const& base = GetGeometry();
1694 nux::Geometry bkg_box;1691 nux::Geometry bkg_box;
1695 std::list<RenderArg> args;1692 std::list<RenderArg> args;
@@ -2458,7 +2455,7 @@
2458 SetupRenderArg(icon, current, arg);2455 SetupRenderArg(icon, current, arg);
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);
2460 arg.logical_center = arg.render_center;2457 arg.logical_center = arg.render_center;
2461 arg.x_rotation = 0.0f;2458 arg.rotation.x = 0.0f;
2462 arg.running_arrow = false;2459 arg.running_arrow = false;
2463 arg.active_arrow = false;2460 arg.active_arrow = false;
2464 arg.skip = false;2461 arg.skip = false;
24652462
=== modified file 'launcher/SwitcherView.cpp'
--- launcher/SwitcherView.cpp 2013-02-13 01:45:00 +0000
+++ launcher/SwitcherView.cpp 2013-04-12 23:35:32 +0000
@@ -17,6 +17,7 @@
17 */17 */
1818
19#include "config.h"19#include "config.h"
20#include "MultiMonitor.h"
20#include "SwitcherView.h"21#include "SwitcherView.h"
21#include "unity-shared/IconRenderer.h"22#include "unity-shared/IconRenderer.h"
22#include "unity-shared/TimeUtil.h"23#include "unity-shared/TimeUtil.h"
@@ -57,6 +58,7 @@
57 , target_sizes_set_(false)58 , target_sizes_set_(false)
58{59{
59 icon_renderer_->pip_style = OVER_TILE;60 icon_renderer_->pip_style = OVER_TILE;
61 icon_renderer_->monitor = max_num_monitors;
6062
61 text_view_->SetMaximumWidth(tile_size * spread_size);63 text_view_->SetMaximumWidth(tile_size * spread_size);
62 text_view_->SetLines(1);64 text_view_->SetLines(1);
@@ -224,9 +226,9 @@
224226
225 RenderArg result = end;227 RenderArg result = end;
226228
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;
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;
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;
230232
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;
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;
@@ -489,7 +491,7 @@
489491
490 x += (half_size + flat_spacing) * scalar;492 x += (half_size + flat_spacing) * scalar;
491493
492 arg.y_rotation = (1.0f - MIN (1.0f, scalar));494 arg.rotation.y = (1.0f - std::min<float>(1.0f, scalar));
493495
494 if (!should_flat && overflow > 0 && i != selection)496 if (!should_flat && overflow > 0 && i != selection)
495 {497 {
@@ -500,11 +502,11 @@
500 else502 else
501 {503 {
502 arg.render_center.x += 20;504 arg.render_center.x += 20;
503 arg.y_rotation = -arg.y_rotation;505 arg.rotation.y = -arg.rotation.y;
504 }506 }
505 }507 }
506508
507 arg.render_center.z = abs(80.0f * arg.y_rotation);509 arg.render_center.z = abs(80.0f * arg.rotation.y);
508 arg.logical_center = arg.render_center;510 arg.logical_center = arg.render_center;
509511
510 if (i == selection && detail_selection)512 if (i == selection && detail_selection)
@@ -588,13 +590,13 @@
588 text_view_->SetBaseX(start_x);590 text_view_->SetBaseX(start_x);
589 }591 }
590592
591 if (arg.y_rotation < 0)593 if (arg.rotation.y < 0)
592 icon_renderer_->RenderIcon(GfxContext, arg, base, base);594 icon_renderer_->RenderIcon(GfxContext, arg, base, base);
593 }595 }
594596
595 for (auto rit = last_args_.rbegin(); rit != last_args_.rend(); ++rit)597 for (auto rit = last_args_.rbegin(); rit != last_args_.rend(); ++rit)
596 {598 {
597 if (rit->y_rotation >= 0)599 if (rit->rotation.y >= 0)
598 icon_renderer_->RenderIcon(GfxContext, *rit, base, base);600 icon_renderer_->RenderIcon(GfxContext, *rit, base, base);
599 }601 }
600602
601603
=== modified file 'panel/PanelController.cpp'
--- panel/PanelController.cpp 2013-04-09 01:35:49 +0000
+++ panel/PanelController.cpp 2013-04-12 23:35:32 +0000
@@ -44,7 +44,6 @@
44 void FirstMenuShow();44 void FirstMenuShow();
45 void QueueRedraw();45 void QueueRedraw();
4646
47 std::vector<Window> GetTrayXids() const;
48 std::vector<nux::View*> GetPanelViews() const;47 std::vector<nux::View*> GetPanelViews() const;
49 std::vector<nux::Geometry> GetGeometries() const;48 std::vector<nux::Geometry> GetGeometries() const;
5049
@@ -60,7 +59,6 @@
6059
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);
6261
63private:
64 typedef nux::ObjectPtr<nux::BaseWindow> BaseWindowPtr;62 typedef nux::ObjectPtr<nux::BaseWindow> BaseWindowPtr;
6563
66 unity::PanelView* ViewForWindow(BaseWindowPtr const& window) const;64 unity::PanelView* ViewForWindow(BaseWindowPtr const& window) const;
@@ -70,8 +68,8 @@
70 nux::Geometry& geo,68 nux::Geometry& geo,
71 void* user_data);69 void* user_data);
7270
73private:
74 std::vector<BaseWindowPtr> windows_;71 std::vector<BaseWindowPtr> windows_;
72 std::vector<Window> tray_xids_;
75 float opacity_;73 float opacity_;
76 bool opacity_maximized_toggle_;74 bool opacity_maximized_toggle_;
77 int menus_fadein_;75 int menus_fadein_;
@@ -94,23 +92,11 @@
94 , dbus_indicators_(std::make_shared<indicator::DBusIndicators>())92 , dbus_indicators_(std::make_shared<indicator::DBusIndicators>())
95{}93{}
9694
97std::vector<Window> Controller::Impl::GetTrayXids() const
98{
99 std::vector<Window> xids;
100
101 for (auto window: windows_)
102 {
103 xids.push_back(ViewForWindow(window)->GetTrayXid());
104 }
105
106 return xids;
107}
108
109std::vector<nux::View*> Controller::Impl::GetPanelViews() const95std::vector<nux::View*> Controller::Impl::GetPanelViews() const
110{96{
111 std::vector<nux::View*> views;97 std::vector<nux::View*> views;
112 views.reserve(windows_.size());98 views.reserve(windows_.size());
113 for (auto window: windows_)99 for (auto const& window: windows_)
114 views.push_back(ViewForWindow(window));100 views.push_back(ViewForWindow(window));
115 return views;101 return views;
116}102}
@@ -119,7 +105,7 @@
119{105{
120 std::vector<nux::Geometry> geometries;106 std::vector<nux::Geometry> geometries;
121107
122 for (auto window : windows_)108 for (auto const& window : windows_)
123 {109 {
124 geometries.push_back(window->GetAbsoluteGeometry());110 geometries.push_back(window->GetAbsoluteGeometry());
125 }111 }
@@ -129,7 +115,7 @@
129115
130void Controller::Impl::FirstMenuShow()116void Controller::Impl::FirstMenuShow()
131{117{
132 for (auto window: windows_)118 for (auto const& window: windows_)
133 {119 {
134 if (ViewForWindow(window)->FirstMenuShow())120 if (ViewForWindow(window)->FirstMenuShow())
135 break;121 break;
@@ -140,7 +126,7 @@
140{126{
141 opacity_ = opacity;127 opacity_ = opacity;
142128
143 for (auto window: windows_)129 for (auto const& window: windows_)
144 {130 {
145 ViewForWindow(window)->SetOpacity(opacity_);131 ViewForWindow(window)->SetOpacity(opacity_);
146 }132 }
@@ -158,7 +144,7 @@
158{144{
159 opacity_maximized_toggle_ = enabled;145 opacity_maximized_toggle_ = enabled;
160146
161 for (auto window: windows_)147 for (auto const& window: windows_)
162 {148 {
163 ViewForWindow(window)->SetOpacityMaximizedToggle(opacity_maximized_toggle_);149 ViewForWindow(window)->SetOpacityMaximizedToggle(opacity_maximized_toggle_);
164 }150 }
@@ -173,7 +159,7 @@
173 menus_discovery_fadein_ = discovery_fadein;159 menus_discovery_fadein_ = discovery_fadein;
174 menus_discovery_fadeout_ = discovery_fadeout;160 menus_discovery_fadeout_ = discovery_fadeout;
175161
176 for (auto window: windows_)162 for (auto const& window: windows_)
177 {163 {
178 ViewForWindow(window)->SetMenuShowTimings(fadein, fadeout, discovery,164 ViewForWindow(window)->SetMenuShowTimings(fadein, fadeout, discovery,
179 discovery_fadein, discovery_fadeout);165 discovery_fadein, discovery_fadeout);
@@ -182,7 +168,7 @@
182168
183void Controller::Impl::QueueRedraw()169void Controller::Impl::QueueRedraw()
184{170{
185 for (auto window: windows_)171 for (auto const& window: windows_)
186 {172 {
187 window->QueueDraw();173 window->QueueDraw();
188 }174 }
@@ -205,6 +191,8 @@
205 unsigned n_monitors = monitors.size();191 unsigned n_monitors = monitors.size();
206 unsigned int i = 0;192 unsigned int i = 0;
207193
194 tray_xids_.resize(n_monitors);
195
208 for (it = windows_.begin(); it != windows_.end(); ++it)196 for (it = windows_.begin(); it != windows_.end(); ++it)
209 {197 {
210 if (i < n_monitors)198 if (i < n_monitors)
@@ -222,6 +210,7 @@
222 view = ViewForWindow(*it);210 view = ViewForWindow(*it);
223 view->SetPrimary(i == primary_monitor);211 view->SetPrimary(i == primary_monitor);
224 view->SetMonitor(i);212 view->SetMonitor(i);
213 tray_xids_[i] = view->GetTrayXid();
225214
226 if (nux::GetWindowThread()->IsEmbeddedWindow())215 if (nux::GetWindowThread()->IsEmbeddedWindow())
227 {216 {
@@ -252,6 +241,7 @@
252 menus_discovery_fadein_, menus_discovery_fadeout_);241 menus_discovery_fadein_, menus_discovery_fadeout_);
253 view->SetPrimary(i == primary_monitor);242 view->SetPrimary(i == primary_monitor);
254 view->SetMonitor(i);243 view->SetMonitor(i);
244 tray_xids_[i] = view->GetTrayXid();
255245
256 layout->AddView(view, 1);246 layout->AddView(view, 1);
257 layout->SetContentDistribution(nux::MAJOR_POSITION_START);247 layout->SetContentDistribution(nux::MAJOR_POSITION_START);
@@ -362,9 +352,9 @@
362 pimpl->QueueRedraw();352 pimpl->QueueRedraw();
363}353}
364354
365std::vector<Window> Controller::GetTrayXids() const355std::vector<Window> const& Controller::GetTrayXids() const
366{356{
367 return pimpl->GetTrayXids();357 return pimpl->tray_xids_;
368}358}
369359
370std::vector<nux::View*> Controller::GetPanelViews() const360std::vector<nux::View*> Controller::GetPanelViews() const
371361
=== modified file 'panel/PanelController.h'
--- panel/PanelController.h 2013-01-30 19:00:01 +0000
+++ panel/PanelController.h 2013-04-12 23:35:32 +0000
@@ -40,7 +40,7 @@
40 void FirstMenuShow();40 void FirstMenuShow();
41 void QueueRedraw();41 void QueueRedraw();
4242
43 std::vector<Window> GetTrayXids() const;43 std::vector<Window> const& GetTrayXids() const;
44 std::vector<nux::View*> GetPanelViews() const;44 std::vector<nux::View*> GetPanelViews() const;
45 std::vector<nux::Geometry> GetGeometries() const;45 std::vector<nux::Geometry> GetGeometries() const;
4646
4747
=== modified file 'panel/PanelTray.cpp'
--- panel/PanelTray.cpp 2013-02-06 12:32:28 +0000
+++ panel/PanelTray.cpp 2013-04-12 23:35:32 +0000
@@ -89,7 +89,7 @@
8989
90Window PanelTray::xid()90Window PanelTray::xid()
91{91{
92 if (!window_)92 if (!window_ || !gtk_widget_get_realized(window_))
93 return 0;93 return 0;
9494
95 return gdk_x11_window_get_xid(gtk_widget_get_window(window_));95 return gdk_x11_window_get_xid(gtk_widget_get_window(window_));
9696
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2013-04-11 05:53:30 +0000
+++ plugins/unityshell/src/unityshell.cpp 2013-04-12 23:35:32 +0000
@@ -621,8 +621,6 @@
621621
622 panelShadowPainted |= redraw;622 panelShadowPainted |= redraw;
623623
624 nuxPrologue();
625
626 for (auto const& r : redraw.rects())624 for (auto const& r : redraw.rects())
627 {625 {
628 for (GLTexture* tex : _shadow_texture)626 for (GLTexture* tex : _shadow_texture)
@@ -685,7 +683,6 @@
685 glDisable(GL_BLEND);683 glDisable(GL_BLEND);
686 }684 }
687 }685 }
688 nuxEpilogue();
689}686}
690687
691void688void
@@ -1434,8 +1431,7 @@
1434 * redraw even though the launcher's geometry is not in DrawList, and1431 * redraw even though the launcher's geometry is not in DrawList, and
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.
1436 */1433 */
1437 std::vector<nux::Geometry> const& dirty = wt->GetDrawList();1434 if (!wt->GetDrawList().empty() || animation_controller_->HasRunningAnimations())
1438 if (!dirty.empty() || animation_controller_->HasRunningAnimations())
1439 {1435 {
1440 cScreen->damageRegionSetEnabled(this, false);1436 cScreen->damageRegionSetEnabled(this, false);
1441 cScreen->damageScreen();1437 cScreen->damageScreen();
14421438
=== modified file 'unity-shared/AbstractIconRenderer.h'
--- unity-shared/AbstractIconRenderer.h 2012-10-17 22:42:12 +0000
+++ unity-shared/AbstractIconRenderer.h 2013-04-12 23:35:32 +0000
@@ -41,9 +41,6 @@
41 RenderArg()41 RenderArg()
42 : icon(0)42 : icon(0)
43 , colorify(nux::color::White)43 , colorify(nux::color::White)
44 , x_rotation(0)
45 , y_rotation(0)
46 , z_rotation(0)
47 , alpha(1.0f)44 , alpha(1.0f)
48 , saturation(1.0f)45 , saturation(1.0f)
49 , backlight_intensity(0.0f)46 , backlight_intensity(0.0f)
@@ -71,10 +68,8 @@
71 IconTextureSource* icon;68 IconTextureSource* icon;
72 nux::Point3 render_center;69 nux::Point3 render_center;
73 nux::Point3 logical_center;70 nux::Point3 logical_center;
71 nux::Vector3 rotation;
74 nux::Color colorify;72 nux::Color colorify;
75 float x_rotation;
76 float y_rotation;
77 float z_rotation;
78 float alpha;73 float alpha;
79 float saturation;74 float saturation;
80 float backlight_intensity;75 float backlight_intensity;
8176
=== modified file 'unity-shared/FileManager.h'
--- unity-shared/FileManager.h 2013-03-29 17:44:12 +0000
+++ unity-shared/FileManager.h 2013-04-12 23:35:32 +0000
@@ -22,6 +22,7 @@
22#define UNITYSHELL_FILEMANAGER_H22#define UNITYSHELL_FILEMANAGER_H
2323
24#include <memory>24#include <memory>
25#include <vector>
25#include <string>26#include <string>
26#include <sigc++/sigc++.h>27#include <sigc++/sigc++.h>
2728
2829
=== modified file 'unity-shared/IconRenderer.cpp'
--- unity-shared/IconRenderer.cpp 2013-04-08 14:35:06 +0000
+++ unity-shared/IconRenderer.cpp 2013-04-12 23:35:32 +0000
@@ -235,6 +235,13 @@
235 nux::ObjectPtr<nux::IOpenGLAsmShaderProgram> asm_shader;235 nux::ObjectPtr<nux::IOpenGLAsmShaderProgram> asm_shader;
236#endif236#endif
237237
238 int VertexLocation;
239 int VPMatrixLocation;
240 int TextureCoord0Location;
241 int FragmentColor;
242 int ColorifyColor;
243 int DesatFactor;
244
238 std::map<char, BaseTexturePtr> labels;245 std::map<char, BaseTexturePtr> labels;
239246
240private:247private:
@@ -264,9 +271,6 @@
264 pip_style = OUTSIDE_TILE;271 pip_style = OUTSIDE_TILE;
265}272}
266273
267IconRenderer::~IconRenderer()
268{}
269
270void IconRenderer::SetTargetSize(int tile_size, int image_size_, int spacing_)274void IconRenderer::SetTargetSize(int tile_size, int image_size_, int spacing_)
271{275{
272 icon_size = tile_size;276 icon_size = tile_size;
@@ -291,9 +295,20 @@
291 int i;295 int i;
292 for (it = args.begin(), i = 0; it != args.end(); ++it, ++i)296 for (it = args.begin(), i = 0; it != args.end(); ++it, ++i)
293 {297 {
294
295 IconTextureSource* launcher_icon = it->icon;298 IconTextureSource* launcher_icon = it->icon;
296299
300 if (it->render_center == launcher_icon->LastRenderCenter(monitor) &&
301 it->logical_center == launcher_icon->LastLogicalCenter(monitor) &&
302 it->rotation == launcher_icon->LastRotation(monitor) &&
303 it->skip == launcher_icon->WasSkipping(monitor))
304 {
305 continue;
306 }
307
308 launcher_icon->RememberCenters(monitor, it->render_center, it->logical_center);
309 launcher_icon->RememberRotation(monitor, it->rotation);
310 launcher_icon->RememberSkip(monitor, it->skip);
311
297 float w = icon_size;312 float w = icon_size;
298 float h = icon_size;313 float h = icon_size;
299 float x = it->render_center.x - w / 2.0f; // x: top left corner314 float x = it->render_center.x - w / 2.0f; // x: top left corner
@@ -309,9 +324,9 @@
309 }324 }
310325
311 ObjectMatrix = nux::Matrix4::TRANSLATE(geo.width / 2.0f, geo.height / 2.0f, z) * // Translate the icon to the center of the viewport326 ObjectMatrix = nux::Matrix4::TRANSLATE(geo.width / 2.0f, geo.height / 2.0f, z) * // Translate the icon to the center of the viewport
312 nux::Matrix4::ROTATEX(it->x_rotation) * // rotate the icon327 nux::Matrix4::ROTATEX(it->rotation.x) * // rotate the icon
313 nux::Matrix4::ROTATEY(it->y_rotation) *328 nux::Matrix4::ROTATEY(it->rotation.y) *
314 nux::Matrix4::ROTATEZ(it->z_rotation) *329 nux::Matrix4::ROTATEZ(it->rotation.z) *
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)
316331
317 ViewProjectionMatrix = PremultMatrix * ObjectMatrix;332 ViewProjectionMatrix = PremultMatrix * ObjectMatrix;
@@ -369,9 +384,9 @@
369 z = it->render_center.z;384 z = it->render_center.z;
370385
371 ObjectMatrix = nux::Matrix4::TRANSLATE(geo.width / 2.0f, geo.height / 2.0f, z) * // Translate the icon to the center of the viewport386 ObjectMatrix = nux::Matrix4::TRANSLATE(geo.width / 2.0f, geo.height / 2.0f, z) * // Translate the icon to the center of the viewport
372 nux::Matrix4::ROTATEX(it->x_rotation) * // rotate the icon387 nux::Matrix4::ROTATEX(it->rotation.x) * // rotate the icon
373 nux::Matrix4::ROTATEY(it->y_rotation) *388 nux::Matrix4::ROTATEY(it->rotation.y) *
374 nux::Matrix4::ROTATEZ(it->z_rotation) *389 nux::Matrix4::ROTATEZ(it->rotation.z) *
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)
376391
377 ViewProjectionMatrix = PremultMatrix * ObjectMatrix;392 ViewProjectionMatrix = PremultMatrix * ObjectMatrix;
@@ -754,9 +769,9 @@
754 if (icon.IsNull())769 if (icon.IsNull())
755 return;770 return;
756771
757 if (std::abs(arg.x_rotation) < 0.01f &&772 if (std::abs(arg.rotation.x) < 0.01f &&
758 std::abs(arg.y_rotation) < 0.01f &&773 std::abs(arg.rotation.y) < 0.01f &&
759 std::abs(arg.z_rotation) < 0.01f &&774 std::abs(arg.rotation.z) < 0.01f &&
760 !force_filter)775 !force_filter)
761 {776 {
762 icon->SetFiltering(GL_NEAREST, GL_NEAREST);777 icon->SetFiltering(GL_NEAREST, GL_NEAREST);
@@ -823,20 +838,15 @@
823 {838 {
824 textures_->shader_program_uv_persp_correction->Begin();839 textures_->shader_program_uv_persp_correction->Begin();
825840
826 int TextureObjectLocation = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("TextureObject0");841 VertexLocation = textures_->VertexLocation;
827 VertexLocation = textures_->shader_program_uv_persp_correction->GetAttributeLocation("iVertex");842 TextureCoord0Location = textures_->TextureCoord0Location;
828 TextureCoord0Location = textures_->shader_program_uv_persp_correction->GetAttributeLocation("iTexCoord0");843 FragmentColor = textures_->FragmentColor;
829 FragmentColor = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("color0");844 ColorifyColor = textures_->ColorifyColor;
830 ColorifyColor = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("colorify_color");845 DesatFactor = textures_->DesatFactor;
831 DesatFactor = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("desat_factor");846
832847 if (textures_->VPMatrixLocation != -1)
833 if (TextureObjectLocation != -1)
834 CHECKGL(glUniform1iARB(TextureObjectLocation, 0));
835
836 int VPMatrixLocation = textures_->shader_program_uv_persp_correction->GetUniformLocationARB("ViewProjectionMatrix");
837 if (VPMatrixLocation != -1)
838 {848 {
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));
840 }850 }
841 }851 }
842#ifndef USE_GLES852#ifndef USE_GLES
@@ -922,7 +932,7 @@
922 nux::Geometry const& geo)932 nux::Geometry const& geo)
923{933{
924 int markerCenter = (int) arg.render_center.y;934 int markerCenter = (int) arg.render_center.y;
925 markerCenter -= (int)(arg.x_rotation / (2 * M_PI) * icon_size);935 markerCenter -= (int)(arg.rotation.x / (2 * M_PI) * icon_size);
926936
927937
928 if (running > 0)938 if (running > 0)
@@ -1194,6 +1204,12 @@
11941204
1195IconRenderer::TexturesPool::TexturesPool()1205IconRenderer::TexturesPool::TexturesPool()
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))
1207 , VertexLocation(-1)
1208 , VPMatrixLocation(0)
1209 , TextureCoord0Location(-1)
1210 , FragmentColor(0)
1211 , ColorifyColor(0)
1212 , DesatFactor(0)
1197{1213{
1198 LoadTexture(progress_bar_trough, PKGDATADIR"/progress_bar_trough.png");1214 LoadTexture(progress_bar_trough, PKGDATADIR"/progress_bar_trough.png");
1199 LoadTexture(progress_bar_fill, PKGDATADIR"/progress_bar_fill.png");1215 LoadTexture(progress_bar_fill, PKGDATADIR"/progress_bar_fill.png");
@@ -1249,6 +1265,22 @@
1249 shader_program_uv_persp_correction = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateShaderProgram();1265 shader_program_uv_persp_correction = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateShaderProgram();
1250 shader_program_uv_persp_correction->LoadIShader(gPerspectiveCorrectShader.c_str());1266 shader_program_uv_persp_correction->LoadIShader(gPerspectiveCorrectShader.c_str());
1251 shader_program_uv_persp_correction->Link();1267 shader_program_uv_persp_correction->Link();
1268
1269 shader_program_uv_persp_correction->Begin();
1270
1271 int TextureObjectLocation = shader_program_uv_persp_correction->GetUniformLocationARB("TextureObject0");
1272 VertexLocation = shader_program_uv_persp_correction->GetAttributeLocation("iVertex");
1273 TextureCoord0Location = shader_program_uv_persp_correction->GetAttributeLocation("iTexCoord0");
1274 FragmentColor = shader_program_uv_persp_correction->GetUniformLocationARB("color0");
1275 ColorifyColor = shader_program_uv_persp_correction->GetUniformLocationARB("colorify_color");
1276 DesatFactor = shader_program_uv_persp_correction->GetUniformLocationARB("desat_factor");
1277
1278 if (TextureObjectLocation != -1)
1279 CHECKGL(glUniform1iARB(TextureObjectLocation, 0));
1280
1281 VPMatrixLocation = shader_program_uv_persp_correction->GetUniformLocationARB("ViewProjectionMatrix");
1282
1283 shader_program_uv_persp_correction->End();
1252 }1284 }
1253 else1285 else
1254 {1286 {
12551287
=== modified file 'unity-shared/IconRenderer.h'
--- unity-shared/IconRenderer.h 2013-03-19 13:24:45 +0000
+++ unity-shared/IconRenderer.h 2013-04-12 23:35:32 +0000
@@ -37,7 +37,6 @@
37{37{
38public:38public:
39 IconRenderer();39 IconRenderer();
40 virtual ~IconRenderer();
4140
42 void PreprocessIcons(std::list<RenderArg>& args, nux::Geometry const& target_window);41 void PreprocessIcons(std::list<RenderArg>& args, nux::Geometry const& target_window);
4342
4443
=== modified file 'unity-shared/IconTextureSource.cpp'
--- unity-shared/IconTextureSource.cpp 2012-05-07 00:49:31 +0000
+++ unity-shared/IconTextureSource.cpp 2013-04-12 23:35:32 +0000
@@ -26,21 +26,58 @@
26{26{
27NUX_IMPLEMENT_OBJECT_TYPE(IconTextureSource);27NUX_IMPLEMENT_OBJECT_TYPE(IconTextureSource);
2828
29namespace
30{
31 const unsigned RENDERERS_SIZE = max_num_monitors + 1; // +1 for the switcher
32}
33
29IconTextureSource::IconTextureSource()34IconTextureSource::IconTextureSource()
30{35 : skip_(RENDERERS_SIZE, false)
31 transform_map.resize(max_num_monitors);36 , last_render_center_(RENDERERS_SIZE)
32}37 , last_logical_center_(RENDERERS_SIZE)
38 , last_rotation_(RENDERERS_SIZE)
39 , transformations_(RENDERERS_SIZE, decltype(transformations_)::value_type(TRANSFORM_SIZE, std::vector<nux::Vector4>(4)))
40{}
3341
34std::vector<nux::Vector4> & IconTextureSource::GetTransform(TransformIndex index, int monitor)42std::vector<nux::Vector4> & IconTextureSource::GetTransform(TransformIndex index, int monitor)
35{43{
36 auto iter = transform_map[monitor].find(index);44 return transformations_[monitor][index];
37 if (iter == transform_map[monitor].end())45}
38 {46
39 auto iter2 = transform_map[monitor].insert(std::map<TransformIndex, std::vector<nux::Vector4> >::value_type(index, std::vector<nux::Vector4>(4)));47void IconTextureSource::RememberCenters(int monitor, nux::Point3 const& render, nux::Point3 const& logical)
40 return iter2.first->second;48{
41 }49 last_render_center_[monitor] = render;
4250 last_logical_center_[monitor] = logical;
43 return iter->second;51}
52
53void IconTextureSource::RememberRotation(int monitor, nux::Vector3 const& rotation)
54{
55 last_rotation_[monitor] = rotation;
56}
57
58nux::Point3 const& IconTextureSource::LastRenderCenter(int monitor) const
59{
60 return last_render_center_[monitor];
61}
62
63nux::Point3 const& IconTextureSource::LastLogicalCenter(int monitor) const
64{
65 return last_logical_center_[monitor];
66}
67
68nux::Vector3 const& IconTextureSource::LastRotation(int monitor) const
69{
70 return last_rotation_[monitor];
71}
72
73void IconTextureSource::RememberSkip(int monitor, bool skip)
74{
75 skip_[monitor] = skip;
76}
77
78bool IconTextureSource::WasSkipping(int monitor) const
79{
80 return skip_[monitor];
44}81}
4582
46}83}
4784
=== modified file 'unity-shared/IconTextureSource.h'
--- unity-shared/IconTextureSource.h 2012-05-28 16:16:06 +0000
+++ unity-shared/IconTextureSource.h 2013-04-12 23:35:32 +0000
@@ -22,7 +22,6 @@
22#define ICONTEXTURESOURCE_H22#define ICONTEXTURESOURCE_H
2323
24#include <Nux/Nux.h>24#include <Nux/Nux.h>
25#include <NuxCore/Property.h>
26#include <NuxCore/Math/MathInc.h>25#include <NuxCore/Math/MathInc.h>
2726
28namespace unity27namespace unity
@@ -38,17 +37,27 @@
3837
39 enum TransformIndex38 enum TransformIndex
40 {39 {
41 TRANSFORM_TILE,40 TRANSFORM_TILE = 0,
42 TRANSFORM_IMAGE,41 TRANSFORM_IMAGE,
43 TRANSFORM_HIT_AREA,42 TRANSFORM_HIT_AREA,
44 TRANSFORM_GLOW,43 TRANSFORM_GLOW,
45 TRANSFORM_EMBLEM,44 TRANSFORM_EMBLEM,
45 TRANSFORM_SIZE
46 };46 };
4747
48 IconTextureSource();48 IconTextureSource();
4949
50 std::vector<nux::Vector4> & GetTransform(TransformIndex index, int monitor);50 std::vector<nux::Vector4> & GetTransform(TransformIndex index, int monitor);
5151
52 nux::Point3 const& LastRenderCenter(int monitor) const;
53 nux::Point3 const& LastLogicalCenter(int monitor) const;
54 nux::Vector3 const& LastRotation(int monitor) const;
55 void RememberCenters(int monitor, nux::Point3 const& render, nux::Point3 const& logical);
56 void RememberRotation(int monitor, nux::Vector3 const& rotation);
57
58 void RememberSkip(int monitor, bool skip);
59 bool WasSkipping(int monitor) const;
60
52 virtual nux::Color BackgroundColor() const = 0;61 virtual nux::Color BackgroundColor() const = 0;
5362
54 virtual nux::Color GlowColor() = 0;63 virtual nux::Color GlowColor() = 0;
@@ -58,7 +67,11 @@
58 virtual nux::BaseTexture* Emblem() = 0;67 virtual nux::BaseTexture* Emblem() = 0;
5968
60private:69private:
61 std::vector<std::map<TransformIndex, std::vector<nux::Vector4> > > transform_map;70 std::vector<bool> skip_;
71 std::vector<nux::Point3> last_render_center_;
72 std::vector<nux::Point3> last_logical_center_;
73 std::vector<nux::Vector3> last_rotation_;
74 std::vector<std::vector<std::vector<nux::Vector4>>> transformations_;
62};75};
6376
64}77}