Merge lp:~hikiko/unity/unity.panel-draw-optimisation into lp:unity

Proposed by Eleni Maria Stea on 2016-05-19
Status: Merged
Approved by: Marco Trevisan (Treviño) on 2016-05-19
Approved revision: 4108
Merged at revision: 4120
Proposed branch: lp:~hikiko/unity/unity.panel-draw-optimisation
Merge into: lp:unity
Diff against target: 30 lines (+8/-2)
1 file modified
panel/PanelView.cpp (+8/-2)
To merge this branch: bzr merge lp:~hikiko/unity/unity.panel-draw-optimisation
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) 2016-05-19 Approve on 2016-05-19
PS Jenkins bot continuous-integration Pending
Review via email: mp+295187@code.launchpad.net

Commit Message

PanelView: Don't draw it if the geo doesn't intersect the monitor geo (as in ezoom)

added check to see if the panel geometry intersects the geometry of the monitor the panel belongs to. If there's no intersection there's no need to draw it (return). If there is intersection we should only draw the intersection area (clip the non visible parts).

Description of the Change

Optimisation in PanelView::Draw:
added check to see if the panel geometry intersects the geometry of the monitor the panel belongs to. If there's no intersection there's no need to draw it (return). If there is intersection we should only draw the intersection area (clip the non visible parts).

To post a comment you must log in.
Marco Trevisan (Treviño) (3v1n0) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panel/PanelView.cpp'
2--- panel/PanelView.cpp 2016-03-31 05:57:11 +0000
3+++ panel/PanelView.cpp 2016-05-19 10:31:21 +0000
4@@ -300,10 +300,16 @@
5 PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
6 {
7 nux::Geometry const& geo = GetGeometry();
8+ nux::Geometry const& mgeo = UScreen::GetDefault()->GetMonitorGeometry(monitor_);
9+ nux::Geometry isect = mgeo.Intersect(geo);
10+
11+ if(!isect.width || !isect.height)
12+ return;
13+
14 UpdateBackground();
15
16 bool overlay_mode = InOverlayMode();
17- GfxContext.PushClippingRectangle(geo);
18+ GfxContext.PushClippingRectangle(isect);
19
20 if (IsTransparent())
21 {
22@@ -331,7 +337,7 @@
23 rop.SrcBlend = GL_ONE;
24 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
25
26- GfxContext.PushClippingRectangle(geo);
27+ GfxContext.PushClippingRectangle(isect);
28
29 #ifndef NUX_OPENGLES_20
30 if (GfxContext.UsingGLSLCodePath())