Merge lp:~azzar1/unity/fix-1050959 into lp:unity

Proposed by Andrea Azzarone
Status: Work in progress
Proposed branch: lp:~azzar1/unity/fix-1050959
Merge into: lp:unity
Diff against target: 150 lines (+41/-38)
4 files modified
dash/LensView.cpp (+1/-0)
dash/PlacesGroup.cpp (+1/-1)
unity-shared/PlacesVScrollBar.cpp (+37/-34)
unity-shared/PlacesVScrollBar.h (+2/-3)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1050959
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Marco Trevisan (Treviño) Approve
Review via email: mp+128812@code.launchpad.net

Description of the change

== Problem ==
Bug #1050959: Dash - Fix Dash scrollbar so that it does not displace Dash background texture.

== Test ==
Visual change. Not applicable.

Depends on: lp:~andyrock/nux/fix-1050959

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

+1

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

FAILED: Autolanding.
No commit message was specified.

review: Needs Fixing (continuous-integration)

Unmerged revisions

2818. By Andrea Azzarone

Use overlay scrollbars in the lens view.

2817. By Andrea Azzarone

Cleanup PlacesVScrollBar.cpp

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/LensView.cpp'
2--- dash/LensView.cpp 2012-10-08 06:36:17 +0000
3+++ dash/LensView.cpp 2012-10-11 14:11:21 +0000
4@@ -57,6 +57,7 @@
5 , right_area_(nullptr)
6 , up_area_(nullptr)
7 {
8+ SetScrollBarStyle(nux::ScrollBarStyle::OVERLAY);
9 SetVScrollBar(scroll_bar);
10 }
11
12
13=== modified file 'dash/PlacesGroup.cpp'
14--- dash/PlacesGroup.cpp 2012-10-08 06:36:17 +0000
15+++ dash/PlacesGroup.cpp 2012-10-11 14:11:21 +0000
16@@ -59,7 +59,7 @@
17 const int kCategoryIconSize = 22;
18 // Category highlight
19 const int kHighlightHeight = 24;
20-const int kHighlightRightPadding = 10 - 3; // -3 because the scrollbar is not a real overlay scrollbar!
21+const int kHighlightRightPadding = 10;
22 const int kHighlightLeftPadding = 10;
23
24 // Font
25
26=== modified file 'unity-shared/PlacesVScrollBar.cpp'
27--- unity-shared/PlacesVScrollBar.cpp 2012-09-14 18:28:02 +0000
28+++ unity-shared/PlacesVScrollBar.cpp 2012-10-11 14:11:21 +0000
29@@ -51,60 +51,63 @@
30 _slider_texture->UnReference();
31 }
32
33-void
34-PlacesVScrollBar::PreLayoutManagement()
35-{
36- nux::VScrollBar::PreLayoutManagement();
37-}
38-
39 long
40 PlacesVScrollBar::PostLayoutManagement(long LayoutResult)
41 {
42 long ret = nux::VScrollBar::PostLayoutManagement(LayoutResult);
43
44- UpdateTexture();
45+ nux::Geometry const& geo = _slider->GetGeometry();
46+
47+ if (_cached_geometry.GetWidth() != geo.GetWidth() ||
48+ _cached_geometry.GetHeight() != geo.GetHeight())
49+ {
50+ UpdateTexture();
51+ _cached_geometry = geo;
52+ }
53+
54 return ret;
55 }
56
57 void
58 PlacesVScrollBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
59 {
60- nux::Color color = nux::color::White;
61+ // check if textures have been computed... if they haven't, exit function
62+ if (!_slider_texture)
63+ return;
64+
65 nux::Geometry const& base = GetGeometry();
66- nux::TexCoordXForm texxform;
67-
68 graphics_engine.PushClippingRectangle(base);
69+
70 unsigned int alpha = 0, src = 0, dest = 0;
71 graphics_engine.GetRenderStates().GetBlend(alpha, src, dest);
72
73- if(RedirectedAncestor())
74- {
75- // This is necessary when doing redirected rendering.
76- // Clean the area below this view before drawing anything.
77- graphics_engine.GetRenderStates().SetBlend(false);
78- graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
79- }
80-
81- // check if textures have been computed... if they haven't, exit function
82- if (!_slider_texture)
83- return;
84-
85- texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);
86-
87- graphics_engine.GetRenderStates().SetBlend(true);
88- graphics_engine.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
89-
90 if (content_height_ > container_height_)
91 {
92+ if(RedirectedAncestor())
93+ {
94+ // This is necessary when doing redirected rendering.
95+ // Clean the area below this view before drawing anything.
96+ nux::Geometry const& slider_geo = _slider->GetGeometry();
97+
98+ graphics_engine.GetRenderStates().SetBlend(false);
99+ graphics_engine.QRP_Color(slider_geo.x, slider_geo.y,
100+ slider_geo.width, slider_geo.height,
101+ nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
102+ }
103+
104+ nux::TexCoordXForm texxform;
105+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);
106+
107+ graphics_engine.GetRenderStates().SetBlend(true);
108+ graphics_engine.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
109+
110 nux::Geometry const& slider_geo = _slider->GetGeometry();
111+ nux::Color color = nux::color::White;
112
113- graphics_engine.QRP_1Tex(slider_geo.x,
114- slider_geo.y,
115- slider_geo.width,
116- slider_geo.height,
117- _slider_texture->GetDeviceTexture(),
118- texxform,
119- color);
120+ graphics_engine.QRP_1Tex(slider_geo.x, slider_geo.y,
121+ slider_geo.width, slider_geo.height,
122+ _slider_texture->GetDeviceTexture(),
123+ texxform, color);
124 }
125
126 graphics_engine.PopClippingRectangle();
127
128=== modified file 'unity-shared/PlacesVScrollBar.h'
129--- unity-shared/PlacesVScrollBar.h 2012-07-20 13:28:26 +0000
130+++ unity-shared/PlacesVScrollBar.h 2012-10-11 14:11:21 +0000
131@@ -39,17 +39,16 @@
132 ~PlacesVScrollBar();
133
134 protected:
135- virtual void PreLayoutManagement();
136 virtual long PostLayoutManagement(long LayoutResult);
137
138- void Draw(nux::GraphicsEngine& gfxContext,
139- bool forceDraw);
140+ void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw);
141
142 private:
143 void UpdateTexture();
144
145 private:
146 nux::BaseTexture* _slider_texture;
147+ nux::Geometry _cached_geometry;
148 };
149
150 } // namespace dash