Merge lp:~unity-team/unity/unity.dash-to-preview into lp:unity
- unity.dash-to-preview
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Neil J. Patel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2719 |
Proposed branch: | lp:~unity-team/unity/unity.dash-to-preview |
Merge into: | lp:unity |
Diff against target: |
1553 lines (+738/-155) 23 files modified
dash/CoverflowResultView.cpp (+16/-2) dash/DashView.cpp (+355/-17) dash/DashView.h (+28/-1) dash/FilterAllButton.cpp (+4/-0) dash/FilterBar.cpp (+5/-10) dash/FilterBasicButton.cpp (+21/-8) dash/FilterBasicButton.h (+2/-0) dash/FilterExpanderLabel.cpp (+48/-15) dash/FilterMultiRangeButton.cpp (+7/-0) dash/FilterRatingsButton.cpp (+7/-0) dash/LensBar.cpp (+34/-17) dash/LensBarIcon.cpp (+7/-7) dash/LensView.cpp (+1/-2) dash/PlacesGroup.cpp (+25/-36) dash/ResultViewGrid.cpp (+36/-2) dash/previews/PreviewContainer.cpp (+2/-2) manual-tests/DashToPreviewTransition.txt (+38/-0) plugins/unityshell/src/unityshell.cpp (+15/-7) plugins/unityshell/src/unityshell.h (+3/-3) unity-shared/DashStyle.h (+2/-0) unity-shared/PlacesVScrollBar.cpp (+16/-9) unity-shared/SearchBar.cpp (+64/-15) unity-shared/UBusMessages.h (+2/-2) |
To merge this branch: | bzr merge lp:~unity-team/unity/unity.dash-to-preview |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Neil J. Patel (community) | Approve | ||
Review via email: mp+124664@code.launchpad.net |
Commit message
This branch introduces dash to preview transitions. I relies on this nux branch: https:/
Animation from Dash to Preview slides out elements of the dash to make room for the previews. The process happens in 250ms.
Many changes were necessary to create this effects. It has to be said that the changes have an impact on the rendering engine and the way elements are drawn in the dash. Efforts are being made to reduce this impact.
Description of the change
This branch introduces dash to preview transitions. I relies on this nux branch: https:/
Animation from Dash to Preview slides out elements of the dash to make room for the previews. The process happens in 250ms.
Many changes were necessary to create this effects. It has to be said that the changes have an impact on the rendering engine and the way elements are drawn in the dash. Efforts are being made to reduce this impact.
Neil J. Patel (njpatel) wrote : | # |
Oh, please add the manual tests as discussed too, thanks.
Neil J. Patel (njpatel) : | # |
Unity Merger (unity-merger) wrote : | # |
The Jenkins job https:/
Not merging it.
Preview Diff
1 | === modified file 'dash/CoverflowResultView.cpp' |
2 | --- dash/CoverflowResultView.cpp 2012-09-17 16:59:51 +0000 |
3 | +++ dash/CoverflowResultView.cpp 2012-09-18 14:01:19 +0000 |
4 | @@ -135,7 +135,7 @@ |
5 | int size = model_->Items().size(); |
6 | |
7 | ubus_.SendMessage(UBUS_DASH_PREVIEW_INFO_PAYLOAD, |
8 | - g_variant_new("(iii)", 0, index, size - index)); |
9 | + g_variant_new("(iiii)", 0, 0, index, size - index)); |
10 | } |
11 | |
12 | CoverflowResultView::Impl::Impl(CoverflowResultView *parent) |
13 | @@ -193,7 +193,7 @@ |
14 | int right_results = num_results ? (num_results - current_index) - 1 : 0; |
15 | parent_->UriActivated.emit(GetUriForIndex(current_index), ActivateType::PREVIEW); |
16 | ubus_.SendMessage(UBUS_DASH_PREVIEW_INFO_PAYLOAD, |
17 | - g_variant_new("(iii)", 0, left_results, right_results)); |
18 | + g_variant_new("(iiii)", 0, 0, left_results, right_results)); |
19 | } |
20 | }); |
21 | } |
22 | @@ -269,6 +269,20 @@ |
23 | nux::Geometry base = GetGeometry(); |
24 | GfxContext.PushClippingRectangle(base); |
25 | |
26 | + if (RedirectedAncestor()) |
27 | + { |
28 | + // This is necessary when doing redirected rendering. Clean the area below this view. |
29 | + unsigned int current_alpha_blend; |
30 | + unsigned int current_src_blend_factor; |
31 | + unsigned int current_dest_blend_factor; |
32 | + GfxContext.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); |
33 | + |
34 | + GfxContext.GetRenderStates().SetBlend(false); |
35 | + GfxContext.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
36 | + |
37 | + GfxContext.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); |
38 | + } |
39 | + |
40 | if (GetCompositionLayout()) |
41 | { |
42 | nux::Geometry geo = GetCompositionLayout()->GetGeometry(); |
43 | |
44 | === modified file 'dash/DashView.cpp' |
45 | --- dash/DashView.cpp 2012-09-18 09:05:50 +0000 |
46 | +++ dash/DashView.cpp 2012-09-18 14:01:19 +0000 |
47 | @@ -16,6 +16,7 @@ |
48 | * Authored by: Neil Jagdish Patel <neil.patel@canonical.com> |
49 | */ |
50 | |
51 | + |
52 | #include "DashView.h" |
53 | #include "DashViewPrivate.h" |
54 | |
55 | @@ -36,6 +37,7 @@ |
56 | #include "unity-shared/UBusMessages.h" |
57 | #include "unity-shared/PreviewStyle.h" |
58 | |
59 | +#include "Nux/NuxTimerTickSource.h" |
60 | |
61 | namespace unity |
62 | { |
63 | @@ -89,7 +91,14 @@ |
64 | , search_in_progress_(false) |
65 | , activate_on_finish_(false) |
66 | , visible_(false) |
67 | + , fade_out_value_(0.0f) |
68 | + , fade_in_value_(0.0f) |
69 | + , opening_row_y_(-1) |
70 | + , opening_row_height_(0) |
71 | { |
72 | + //tick_source_.reset(new nux::NuxTimerTickSource); |
73 | + //animation_controller_.reset(new na::AnimationController(*tick_source_)); |
74 | + |
75 | renderer_.SetOwner(this); |
76 | renderer_.need_redraw.connect([this] () { |
77 | QueueDraw(); |
78 | @@ -107,6 +116,13 @@ |
79 | home_lens_->AddLenses(lenses_); |
80 | home_lens_->search_finished.connect(sigc::mem_fun(this, &DashView::OnGlobalSearchFinished)); |
81 | lens_bar_->Activate("home.lens"); |
82 | + |
83 | + // We are interested in the color of the desktop background. |
84 | + ubus_manager_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, sigc::mem_fun(this, &DashView::OnBGColorChanged)); |
85 | + |
86 | + // request the latest colour from bghash |
87 | + ubus_manager_.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT); |
88 | + |
89 | } |
90 | |
91 | DashView::~DashView() |
92 | @@ -116,6 +132,15 @@ |
93 | RemoveLayout(); |
94 | } |
95 | |
96 | +void DashView::OnBGColorChanged(GVariant *data) |
97 | +{ |
98 | + double red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f; |
99 | + |
100 | + g_variant_get(data, "(dddd)", &red, &green, &blue, &alpha); |
101 | + background_color_ = nux::Color(red, green, blue, alpha); |
102 | + QueueDraw(); |
103 | +} |
104 | + |
105 | void DashView::SetMonitorOffset(int x, int y) |
106 | { |
107 | renderer_.x_offset = x; |
108 | @@ -124,25 +149,87 @@ |
109 | |
110 | void DashView::ClosePreview() |
111 | { |
112 | + if (preview_displaying_) |
113 | + { |
114 | + layout_->SetPresentRedirectedView(true); |
115 | + animation_.Stop(); |
116 | + fade_out_connection_.disconnect(); |
117 | + fade_in_connection_.disconnect(); |
118 | + // Set fade animation |
119 | + animation_.SetDuration(250); |
120 | + animation_.SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::ExpoEaseIn)); |
121 | + fade_in_connection_ = animation_.updated.connect(sigc::mem_fun(this, &DashView::FadeInCallBack)); |
122 | + |
123 | + fade_in_value_ = 1.0f; |
124 | + animation_.SetStartValue(fade_in_value_); |
125 | + animation_.SetFinishValue(0.0f); |
126 | + animation_.Start(); |
127 | + } |
128 | + |
129 | preview_displaying_ = false; |
130 | |
131 | - // sanity check |
132 | - if (!preview_container_) |
133 | - return; |
134 | - RemoveChild(preview_container_.GetPointer()); |
135 | - preview_container_->UnParentObject(); |
136 | - preview_container_.Release(); // free resources |
137 | - preview_state_machine_.ClosePreview(); |
138 | - |
139 | // re-focus dash view component. |
140 | nux::GetWindowCompositor().SetKeyFocusArea(default_focus()); |
141 | QueueDraw(); |
142 | } |
143 | |
144 | +void DashView::FadeOutCallBack(float const& fade_out_value) |
145 | +{ |
146 | + fade_out_value_ = fade_out_value; |
147 | + QueueDraw(); |
148 | +} |
149 | + |
150 | +void DashView::FadeInCallBack(float const& fade_in_value) |
151 | +{ |
152 | + fade_in_value_ = fade_in_value; |
153 | + QueueDraw(); |
154 | + |
155 | + if (fade_in_value_ == 0.0f) |
156 | + { |
157 | + // sanity check |
158 | + if (!preview_container_) |
159 | + { |
160 | + return; |
161 | + } |
162 | + RemoveChild(preview_container_.GetPointer()); |
163 | + preview_container_->UnParentObject(); |
164 | + preview_container_.Release(); // free resources |
165 | + preview_state_machine_.ClosePreview(); |
166 | + |
167 | + // Closing the preview. Set opening_row_y_ to -1; |
168 | + // opening_row_y_ is updated once when the preview |
169 | + opening_row_y_ = -1; |
170 | + } |
171 | +} |
172 | + |
173 | void DashView::BuildPreview(Preview::Ptr model) |
174 | { |
175 | if (!preview_displaying_) |
176 | { |
177 | + // Make a copy of this DashView backup texture. |
178 | + if (layout_->RedirectRenderingToTexture()) |
179 | + { |
180 | + nux::TexCoordXForm texxform; |
181 | + nux::ObjectPtr<nux::IOpenGLBaseTexture> src_texture; |
182 | + |
183 | + layout_copy_ = src_texture = layout_->BackupTexture(); |
184 | + |
185 | + animation_.Stop(); |
186 | + fade_out_connection_.disconnect(); |
187 | + fade_in_connection_.disconnect(); |
188 | + // Set fade animation |
189 | + animation_.SetDuration(250); |
190 | + animation_.SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::ExpoEaseIn)); |
191 | + fade_out_connection_ = animation_.updated.connect(sigc::mem_fun(this, &DashView::FadeOutCallBack)); |
192 | + |
193 | + fade_out_value_ = 1.0f; |
194 | + animation_.SetStartValue(fade_out_value_); |
195 | + animation_.SetFinishValue(0.0f); |
196 | + animation_.Start(); |
197 | + |
198 | + layout_->SetPresentRedirectedView(false); |
199 | + } |
200 | + |
201 | preview_container_ = previews::PreviewContainer::Ptr(new previews::PreviewContainer()); |
202 | AddChild(preview_container_.GetPointer()); |
203 | preview_container_->SetParentObject(this); |
204 | @@ -261,6 +348,7 @@ |
205 | layout_->SetLeftAndRightPadding(style.GetVSeparatorSize(), 0); |
206 | layout_->SetTopAndBottomPadding(style.GetHSeparatorSize(), 0); |
207 | SetLayout(layout_); |
208 | + layout_->SetRedirectRenderingToTexture(true); |
209 | |
210 | content_layout_ = new DashLayout(NUX_TRACKER_LOCATION); |
211 | content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding(), 0); |
212 | @@ -310,12 +398,21 @@ |
213 | ubus_manager_.RegisterInterest(UBUS_DASH_PREVIEW_INFO_PAYLOAD, [&] (GVariant *data) |
214 | { |
215 | int position = -1; |
216 | + int row_height = 0; |
217 | int results_to_the_left = 0; |
218 | int results_to_the_right = 0; |
219 | - g_variant_get(data, "(iii)", &position, &results_to_the_left, &results_to_the_right); |
220 | + g_variant_get(data, "(iiii)", &position, &row_height, &results_to_the_left, &results_to_the_right); |
221 | preview_state_machine_.SetSplitPosition(SplitPosition::CONTENT_AREA, position); |
222 | preview_state_machine_.left_results = results_to_the_left; |
223 | preview_state_machine_.right_results = results_to_the_right; |
224 | + |
225 | + if (opening_row_y_ == -1) |
226 | + { |
227 | + // Update only when opening the previews |
228 | + opening_row_y_ = position; |
229 | + } |
230 | + opening_row_height_ = row_height; |
231 | + |
232 | }); |
233 | } |
234 | |
235 | @@ -394,27 +491,268 @@ |
236 | return nux::Geometry(0, 0, width, height); |
237 | } |
238 | |
239 | -void DashView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw) |
240 | +void DashView::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
241 | { |
242 | - renderer_.DrawFull(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry()); |
243 | + renderer_.DrawFull(graphics_engine, content_geo_, GetAbsoluteGeometry(), GetGeometry()); |
244 | } |
245 | |
246 | -void DashView::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw) |
247 | +void DashView::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) |
248 | { |
249 | - renderer_.DrawInner(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry()); |
250 | + renderer_.DrawInner(graphics_engine, content_geo_, GetAbsoluteGeometry(), GetGeometry()); |
251 | + |
252 | + bool display_ghost = false; |
253 | + bool preview_redraw = false; |
254 | + if (preview_container_) |
255 | + { |
256 | + preview_redraw = preview_container_->IsRedrawNeeded(); |
257 | + } |
258 | + |
259 | + if (!preview_displaying_ && layout_->RedirectRenderingToTexture() && (fade_in_value_ == 0.0f)) |
260 | + { |
261 | + nux::Geometry layout_geo = layout_->GetGeometry(); |
262 | + graphics_engine.PushClippingRectangle(layout_geo); |
263 | + nux::GetPainter().PaintBackground(graphics_engine, layout_geo); |
264 | + graphics_engine.PopClippingRectangle(); |
265 | + } |
266 | + |
267 | + if (preview_displaying_ && (IsFullRedraw() || force_draw || preview_redraw) && layout_->RedirectRenderingToTexture()) |
268 | + { |
269 | + display_ghost = true; |
270 | + nux::Geometry layout_geo = layout_->GetGeometry(); |
271 | + graphics_engine.PushClippingRectangle(layout_geo); |
272 | + nux::GetPainter().PaintBackground(graphics_engine, layout_geo); |
273 | + graphics_engine.PopClippingRectangle(); |
274 | + } |
275 | |
276 | if (IsFullRedraw()) |
277 | + { |
278 | nux::GetPainter().PushBackgroundStack(); |
279 | + } |
280 | + |
281 | |
282 | if (preview_displaying_) |
283 | - preview_container_->ProcessDraw(gfx_context, (!force_draw) ? IsFullRedraw() : force_draw); |
284 | - else |
285 | - layout_->ProcessDraw(gfx_context, force_draw); |
286 | + { |
287 | + // Progressively reveal the preview. |
288 | + nux::Geometry preview_clip_geo = preview_container_->GetGeometry(); |
289 | + preview_clip_geo.y = (preview_clip_geo.y + preview_clip_geo.height)/2.0f - |
290 | + (1.0f - fade_out_value_) * (preview_clip_geo.height)/2.0f; |
291 | + preview_clip_geo.height = (1.0f - fade_out_value_) * (preview_clip_geo.height); |
292 | + |
293 | + graphics_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(-preview_container_->GetWidth()/2.0f, -preview_container_->GetHeight()/2.0f, 0)); |
294 | + graphics_engine.PushModelViewMatrix(nux::Matrix4::SCALE(1.0f - fade_out_value_, 1.0f - fade_out_value_, 1.0f)); |
295 | + graphics_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(preview_container_->GetWidth()/2.0f, preview_container_->GetHeight()/2.0f, 0)); |
296 | + |
297 | + preview_container_->ProcessDraw(graphics_engine, (!force_draw) ? IsFullRedraw() : force_draw); |
298 | + |
299 | + graphics_engine.PopModelViewMatrix(); |
300 | + graphics_engine.PopModelViewMatrix(); |
301 | + graphics_engine.PopModelViewMatrix(); |
302 | + } |
303 | + else if (fade_in_value_ > 0.0f && preview_container_ && preview_container_.IsValid()) |
304 | + { |
305 | + graphics_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(-preview_container_->GetWidth()/2.0f, -preview_container_->GetHeight()/2.0f, 0)); |
306 | + graphics_engine.PushModelViewMatrix(nux::Matrix4::SCALE(fade_in_value_, fade_in_value_, 1.0f)); |
307 | + graphics_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(preview_container_->GetWidth()/2.0f, preview_container_->GetHeight()/2.0f, 0)); |
308 | + |
309 | + preview_container_->ProcessDraw(graphics_engine, (!force_draw) ? IsFullRedraw() : force_draw); |
310 | + |
311 | + graphics_engine.PopModelViewMatrix(); |
312 | + graphics_engine.PopModelViewMatrix(); |
313 | + graphics_engine.PopModelViewMatrix(); |
314 | + } |
315 | + else if (fade_in_value_ == 0.0f) |
316 | + { |
317 | + layout_->ProcessDraw(graphics_engine, force_draw); |
318 | + } |
319 | + |
320 | + // Animation effect rendering |
321 | + if (display_ghost || IsFullRedraw()) |
322 | + { |
323 | + unsigned int current_alpha_blend; |
324 | + unsigned int current_src_blend_factor; |
325 | + unsigned int current_dest_blend_factor; |
326 | + graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); |
327 | + |
328 | + float ghost_opacity = 0.25f; |
329 | + float tint_factor = 1.2f; |
330 | + float saturation_ref = 0.4f; |
331 | + nux::Color bg_color = background_color_; |
332 | + |
333 | + int position_offset = 40; |
334 | + |
335 | + if (preview_displaying_ && layout_ && layout_->RedirectRenderingToTexture()) |
336 | + { |
337 | + if (layout_copy_.IsValid()) |
338 | + { |
339 | + graphics_engine.PushClippingRectangle(layout_->GetGeometry()); |
340 | + graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
341 | + nux::TexCoordXForm texxform; |
342 | + |
343 | + texxform.FlipVCoord(true); |
344 | + |
345 | + int filter_width = 10; |
346 | + if (active_lens_view_ && active_lens_view_->filters_expanded) |
347 | + { |
348 | + texxform.uoffset = (active_lens_view_->filter_bar()->GetX() -layout_->GetX())/(float)layout_->GetWidth(); |
349 | + texxform.voffset = (active_lens_view_->filter_bar()->GetY() -layout_->GetY())/(float)layout_->GetHeight(); |
350 | + |
351 | + texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
352 | + |
353 | + graphics_engine.QRP_1Tex( |
354 | + active_lens_view_->filter_bar()->GetX() + (1.0f - fade_out_value_)*(active_lens_view_->filter_bar()->GetWidth() + 10), |
355 | + active_lens_view_->filter_bar()->GetY(), |
356 | + active_lens_view_->filter_bar()->GetWidth(), |
357 | + active_lens_view_->filter_bar()->GetHeight(), |
358 | + layout_copy_, texxform, |
359 | + nux::Color(fade_out_value_, fade_out_value_, fade_out_value_, fade_out_value_) |
360 | + ); |
361 | + filter_width += active_lens_view_->filter_bar()->GetWidth(); |
362 | + } |
363 | + |
364 | + float saturation = fade_out_value_ + (1.0f - fade_out_value_) * saturation_ref; |
365 | + float opacity = fade_out_value_ < ghost_opacity ? ghost_opacity : fade_out_value_; |
366 | + nux::Color tint = nux::Color( |
367 | + fade_out_value_ + (1.0f - fade_out_value_) * tint_factor*bg_color.red, |
368 | + fade_out_value_ + (1.0f - fade_out_value_) * tint_factor*bg_color.green, |
369 | + fade_out_value_ + (1.0f - fade_out_value_) * tint_factor*bg_color.blue, |
370 | + 1.0f); |
371 | + |
372 | + // Ghost row of items above the preview |
373 | + { |
374 | + int final_x = layout_->GetX(); |
375 | + int final_y = layout_->GetY() - (opening_row_y_) - position_offset ; |
376 | + |
377 | + texxform.uoffset = 0.0f; |
378 | + texxform.voffset = 0.0f; |
379 | + texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
380 | + |
381 | + graphics_engine.QRP_TexDesaturate( |
382 | + fade_out_value_ * layout_->GetX() + (1.0f - fade_out_value_) * final_x, |
383 | + fade_out_value_ * layout_->GetY() + (1.0f - fade_out_value_) * final_y, |
384 | + layout_->GetWidth() - filter_width, |
385 | + opening_row_y_ + opening_row_height_, |
386 | + layout_copy_, texxform, |
387 | + nux::Color(tint.red, tint.green, tint.blue, opacity), |
388 | + saturation |
389 | + ); |
390 | + } |
391 | + |
392 | + // Ghost row of items below the preview |
393 | + { |
394 | + int final_x = layout_->GetX(); |
395 | + int final_y = layout_->GetY() + layout_->GetHeight() - (position_offset*1.9); |
396 | + |
397 | + texxform.uoffset = (layout_->GetX() - layout_->GetX())/(float)layout_->GetWidth(); |
398 | + texxform.voffset = (opening_row_y_ + opening_row_height_ - layout_->GetY())/(float)layout_->GetHeight(); |
399 | + texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
400 | + |
401 | + graphics_engine.QRP_TexDesaturate( |
402 | + fade_out_value_ * layout_->GetX() + (1 - fade_out_value_) * final_x, |
403 | + fade_out_value_ * (opening_row_y_ + opening_row_height_) + (1 - fade_out_value_) * final_y, |
404 | + layout_->GetWidth() - filter_width, |
405 | + layout_->GetHeight() - opening_row_y_ - opening_row_height_, |
406 | + layout_copy_, texxform, |
407 | + nux::Color(tint.red, tint.green, tint.blue, opacity), |
408 | + saturation |
409 | + ); |
410 | + } |
411 | + |
412 | + graphics_engine.GetRenderStates().SetBlend(false); |
413 | + graphics_engine.PopClippingRectangle(); |
414 | + } |
415 | + |
416 | + |
417 | + } |
418 | + else if (layout_ && layout_->RedirectRenderingToTexture() && fade_in_value_ != 0.0f) |
419 | + { |
420 | + if (layout_copy_.IsValid()) |
421 | + { |
422 | + graphics_engine.PushClippingRectangle(layout_->GetGeometry()); |
423 | + graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
424 | + nux::TexCoordXForm texxform; |
425 | + |
426 | + texxform.FlipVCoord(true); |
427 | + |
428 | + int filter_width = 10; |
429 | + if (active_lens_view_ && active_lens_view_->filters_expanded) |
430 | + { |
431 | + texxform.uoffset = (active_lens_view_->filter_bar()->GetX() -layout_->GetX())/(float)layout_->GetWidth(); |
432 | + texxform.voffset = (active_lens_view_->filter_bar()->GetY() -layout_->GetY())/(float)layout_->GetHeight(); |
433 | + |
434 | + texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
435 | + |
436 | + graphics_engine.QRP_1Tex( |
437 | + active_lens_view_->filter_bar()->GetX() + (fade_in_value_)*(active_lens_view_->filter_bar()->GetWidth() + 10), |
438 | + active_lens_view_->filter_bar()->GetY(), |
439 | + active_lens_view_->filter_bar()->GetWidth(), |
440 | + active_lens_view_->filter_bar()->GetHeight(), |
441 | + layout_copy_, texxform, |
442 | + nux::Color(1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_) |
443 | + ); |
444 | + filter_width += active_lens_view_->filter_bar()->GetWidth(); |
445 | + } |
446 | + |
447 | + float saturation = fade_in_value_ * saturation_ref + (1.0f - fade_in_value_); |
448 | + float opacity = (1.0f - fade_in_value_) < ghost_opacity ? ghost_opacity : (1.0f - fade_in_value_); |
449 | + nux::Color tint = nux::Color( |
450 | + fade_in_value_ * tint_factor*bg_color.red + (1.0f - fade_in_value_), |
451 | + fade_in_value_ * tint_factor*bg_color.green + (1.0f - fade_in_value_), |
452 | + fade_in_value_ * tint_factor*bg_color.blue + (1.0f - fade_in_value_), |
453 | + 1.0f); |
454 | + |
455 | + // Ghost row of items above the preview |
456 | + { |
457 | + int final_x = layout_->GetX(); |
458 | + int final_y = layout_->GetY() - (opening_row_y_) - position_offset; |
459 | + |
460 | + texxform.uoffset = 0.0f; |
461 | + texxform.voffset = 0.0f; |
462 | + texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
463 | + |
464 | + graphics_engine.QRP_TexDesaturate( |
465 | + (1.0f - fade_in_value_) * layout_->GetX() + (fade_in_value_) * final_x, |
466 | + (1.0f - fade_in_value_) * layout_->GetY() + (fade_in_value_) * final_y, |
467 | + layout_->GetWidth() - filter_width, |
468 | + opening_row_y_ + opening_row_height_, |
469 | + layout_copy_, texxform, |
470 | + nux::Color(tint.red, tint.green, tint.blue, opacity), |
471 | + saturation |
472 | + ); |
473 | + } |
474 | + |
475 | + // Ghost row of items below the preview |
476 | + { |
477 | + int final_x = layout_->GetX(); |
478 | + int final_y = layout_->GetY() + layout_->GetHeight() -(position_offset*1.9); |
479 | + |
480 | + texxform.uoffset = (layout_->GetX() - layout_->GetX())/(float)layout_->GetWidth(); |
481 | + texxform.voffset = (opening_row_y_ + opening_row_height_ - layout_->GetY())/(float)layout_->GetHeight(); |
482 | + texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
483 | + |
484 | + graphics_engine.QRP_TexDesaturate( |
485 | + (1.0f - fade_in_value_) * layout_->GetX() + (fade_in_value_) * final_x, |
486 | + (1.0f - fade_in_value_) * (opening_row_y_ + opening_row_height_) + (fade_in_value_) * final_y, |
487 | + layout_->GetWidth() - filter_width, |
488 | + layout_->GetHeight() - opening_row_y_ - opening_row_height_, |
489 | + layout_copy_, texxform, |
490 | + nux::Color(tint.red, tint.green, tint.blue, opacity), |
491 | + saturation |
492 | + ); |
493 | + } |
494 | + graphics_engine.GetRenderStates().SetBlend(false); |
495 | + graphics_engine.PopClippingRectangle(); |
496 | + } |
497 | + } |
498 | + |
499 | + graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); |
500 | + } |
501 | |
502 | if (IsFullRedraw()) |
503 | + { |
504 | nux::GetPainter().PopBackgroundStack(); |
505 | + } |
506 | |
507 | - renderer_.DrawInnerCleanup(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry()); |
508 | + renderer_.DrawInnerCleanup(graphics_engine, content_geo_, GetAbsoluteGeometry(), GetGeometry()); |
509 | } |
510 | |
511 | void DashView::OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key) |
512 | |
513 | === modified file 'dash/DashView.h' |
514 | --- dash/DashView.h 2012-08-17 07:28:10 +0000 |
515 | +++ dash/DashView.h 2012-09-18 14:01:19 +0000 |
516 | @@ -23,6 +23,8 @@ |
517 | #include <Nux/PaintLayer.h> |
518 | #include <Nux/View.h> |
519 | #include <Nux/VLayout.h> |
520 | +#include <Nux/NuxTimerTickSource.h> |
521 | + |
522 | #include <UnityCore/FilesystemLenses.h> |
523 | #include <UnityCore/HomeLens.h> |
524 | #include <UnityCore/GLibSource.h> |
525 | @@ -30,6 +32,7 @@ |
526 | #include "unity-shared/BackgroundEffectHelper.h" |
527 | #include "unity-shared/SearchBar.h" |
528 | #include "unity-shared/Introspectable.h" |
529 | +#include "unity-shared/BGHash.h" |
530 | #include "LensBar.h" |
531 | #include "LensView.h" |
532 | #include "unity-shared/UBusWrapper.h" |
533 | @@ -38,6 +41,8 @@ |
534 | #include "previews/PreviewContainer.h" |
535 | #include "PreviewStateMachine.h" |
536 | |
537 | +namespace na = nux::animation; |
538 | + |
539 | namespace unity |
540 | { |
541 | namespace dash |
542 | @@ -79,7 +84,7 @@ |
543 | private: |
544 | void SetupViews(); |
545 | void SetupUBusConnections(); |
546 | - |
547 | + void OnBGColorChanged(GVariant *data); |
548 | nux::Geometry GetBestFitGeometry(nux::Geometry const& for_geo); |
549 | |
550 | void Draw(nux::GraphicsEngine& gfx_context, bool force_draw); |
551 | @@ -150,6 +155,28 @@ |
552 | |
553 | glib::Source::UniquePtr searching_timeout_; |
554 | glib::Source::UniquePtr hide_message_delay_; |
555 | + |
556 | + nux::ObjectPtr<nux::IOpenGLBaseTexture> dash_view_copy_; |
557 | + nux::ObjectPtr<nux::IOpenGLBaseTexture> search_view_copy_; |
558 | + nux::ObjectPtr<nux::IOpenGLBaseTexture> filter_view_copy_; |
559 | + nux::ObjectPtr<nux::IOpenGLBaseTexture> layout_copy_; |
560 | + |
561 | + float fade_out_value_; |
562 | + float fade_in_value_; |
563 | + std::unique_ptr<nux::NuxTimerTickSource> tick_source_; |
564 | + std::unique_ptr<na::AnimationController> animation_controller_; |
565 | + na::AnimateValue<float> animation_; |
566 | + |
567 | + void FadeOutCallBack(float const& fade_out_value); |
568 | + void FadeInCallBack(float const& fade_out_value); |
569 | + |
570 | + int opening_row_y_; |
571 | + int opening_row_height_; |
572 | + |
573 | + sigc::connection fade_in_connection_; |
574 | + sigc::connection fade_out_connection_; |
575 | + |
576 | + nux::Color background_color_; |
577 | }; |
578 | |
579 | |
580 | |
581 | === modified file 'dash/FilterAllButton.cpp' |
582 | --- dash/FilterAllButton.cpp 2012-09-13 17:33:52 +0000 |
583 | +++ dash/FilterAllButton.cpp 2012-09-18 14:01:19 +0000 |
584 | @@ -38,6 +38,10 @@ |
585 | SetInputEventSensitivity(false); |
586 | |
587 | state_change.connect(sigc::mem_fun(this, &FilterAllButton::OnStateChanged)); |
588 | + |
589 | + SetRedirectRenderingToTexture(true); |
590 | + //SetCopyPreviousFboTexture(false); |
591 | + SetClearBeforeDraw(true); |
592 | } |
593 | |
594 | FilterAllButton::~FilterAllButton() |
595 | |
596 | === modified file 'dash/FilterBar.cpp' |
597 | --- dash/FilterBar.cpp 2012-09-13 13:15:29 +0000 |
598 | +++ dash/FilterBar.cpp 2012-09-18 14:01:19 +0000 |
599 | @@ -99,21 +99,16 @@ |
600 | } |
601 | } |
602 | |
603 | -void FilterBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) |
604 | +void FilterBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
605 | { |
606 | - nux::Geometry const& geo = GetGeometry(); |
607 | |
608 | - GfxContext.PushClippingRectangle(geo); |
609 | - nux::GetPainter().PaintBackground(GfxContext, geo); |
610 | - GfxContext.PopClippingRectangle(); |
611 | } |
612 | |
613 | -void FilterBar::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) |
614 | +void FilterBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) |
615 | { |
616 | - GfxContext.PushClippingRectangle(GetGeometry()); |
617 | - GetLayout()->ProcessDraw(GfxContext, force_draw); |
618 | - |
619 | - GfxContext.PopClippingRectangle(); |
620 | + graphics_engine.PushClippingRectangle(GetGeometry()); |
621 | + GetLayout()->ProcessDraw(graphics_engine, force_draw); |
622 | + graphics_engine.PopClippingRectangle(); |
623 | } |
624 | |
625 | // |
626 | |
627 | === modified file 'dash/FilterBasicButton.cpp' |
628 | --- dash/FilterBasicButton.cpp 2012-09-13 17:46:04 +0000 |
629 | +++ dash/FilterBasicButton.cpp 2012-09-18 14:01:19 +0000 |
630 | @@ -71,6 +71,8 @@ |
631 | SetAcceptKeyNavFocusOnMouseDown(false); |
632 | SetAcceptKeyNavFocusOnMouseEnter(true); |
633 | |
634 | + clear_before_draw_ = true; |
635 | + |
636 | key_nav_focus_change.connect([&] (nux::Area*, bool, nux::KeyNavDirection) |
637 | { |
638 | QueueDraw(); |
639 | @@ -128,11 +130,15 @@ |
640 | return ret; |
641 | } |
642 | |
643 | -void FilterBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) |
644 | +void FilterBasicButton::SetClearBeforeDraw(bool clear_before_draw) |
645 | +{ |
646 | + clear_before_draw_ = clear_before_draw; |
647 | +} |
648 | + |
649 | +void FilterBasicButton::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
650 | { |
651 | nux::Geometry const& geo = GetGeometry(); |
652 | |
653 | - gPainter.PaintBackground(GfxContext, geo); |
654 | // set up our texture mode |
655 | nux::TexCoordXForm texxform; |
656 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); |
657 | @@ -140,12 +146,19 @@ |
658 | |
659 | // clear what is behind us |
660 | unsigned int alpha = 0, src = 0, dest = 0; |
661 | - GfxContext.GetRenderStates().GetBlend(alpha, src, dest); |
662 | - GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
663 | + graphics_engine.GetRenderStates().GetBlend(alpha, src, dest); |
664 | + if (RedirectedAncestor() && clear_before_draw_) |
665 | + { |
666 | + // This is necessary when doing redirected rendering. |
667 | + // Clean the area below this view before drawing anything. |
668 | + graphics_engine.GetRenderStates().SetBlend(false); |
669 | + graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
670 | + } |
671 | + graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
672 | |
673 | nux::Color col = nux::color::Black; |
674 | col.alpha = 0; |
675 | - GfxContext.QRP_Color(geo.x, |
676 | + graphics_engine.QRP_Color(geo.x, |
677 | geo.y, |
678 | geo.width, |
679 | geo.height, |
680 | @@ -159,7 +172,7 @@ |
681 | else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED) |
682 | texture = active_->GetTexture(); |
683 | |
684 | - GfxContext.QRP_1Tex(geo.x, |
685 | + graphics_engine.QRP_1Tex(geo.x, |
686 | geo.y, |
687 | geo.width, |
688 | geo.height, |
689 | @@ -169,7 +182,7 @@ |
690 | |
691 | if (HasKeyboardFocus()) |
692 | { |
693 | - GfxContext.QRP_1Tex(geo.x, |
694 | + graphics_engine.QRP_1Tex(geo.x, |
695 | geo.y, |
696 | geo.width, |
697 | geo.height, |
698 | @@ -178,7 +191,7 @@ |
699 | nux::Color(1.0f, 1.0f, 1.0f, 1.0f)); |
700 | } |
701 | |
702 | - GfxContext.GetRenderStates().SetBlend(alpha, src, dest); |
703 | + graphics_engine.GetRenderStates().SetBlend(alpha, src, dest); |
704 | } |
705 | |
706 | } // namespace dash |
707 | |
708 | === modified file 'dash/FilterBasicButton.h' |
709 | --- dash/FilterBasicButton.h 2012-05-06 23:48:38 +0000 |
710 | +++ dash/FilterBasicButton.h 2012-09-18 14:01:19 +0000 |
711 | @@ -40,6 +40,7 @@ |
712 | FilterBasicButton(NUX_FILE_LINE_PROTO); |
713 | virtual ~FilterBasicButton(); |
714 | |
715 | + void SetClearBeforeDraw(bool clear_before_draw); |
716 | protected: |
717 | virtual long ComputeContentSize(); |
718 | virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); |
719 | @@ -60,6 +61,7 @@ |
720 | |
721 | private: |
722 | std::string label_; |
723 | + bool clear_before_draw_; |
724 | }; |
725 | |
726 | } // namespace dash |
727 | |
728 | === modified file 'dash/FilterExpanderLabel.cpp' |
729 | --- dash/FilterExpanderLabel.cpp 2012-09-14 16:53:45 +0000 |
730 | +++ dash/FilterExpanderLabel.cpp 2012-09-18 14:01:19 +0000 |
731 | @@ -257,12 +257,22 @@ |
732 | return ((expander_view_ && expander_view_->HasKeyFocus())); |
733 | } |
734 | |
735 | -void FilterExpanderLabel::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) |
736 | +void FilterExpanderLabel::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
737 | { |
738 | nux::Geometry const& base = GetGeometry(); |
739 | |
740 | - GfxContext.PushClippingRectangle(base); |
741 | - nux::GetPainter().PaintBackground(GfxContext, base); |
742 | + graphics_engine.PushClippingRectangle(base); |
743 | + |
744 | + if (RedirectedAncestor()) |
745 | + { |
746 | + unsigned int alpha = 0, src = 0, dest = 0; |
747 | + graphics_engine.GetRenderStates().GetBlend(alpha, src, dest); |
748 | + // This is necessary when doing redirected rendering. |
749 | + // Clean the area below this view before drawing anything. |
750 | + graphics_engine.GetRenderStates().SetBlend(false); |
751 | + graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
752 | + graphics_engine.GetRenderStates().SetBlend(alpha, src, dest); |
753 | + } |
754 | |
755 | if (ShouldBeHighlighted()) |
756 | { |
757 | @@ -274,23 +284,46 @@ |
758 | highlight_layer_.reset(dash::Style::Instance().FocusOverlay(geo.width, geo.height)); |
759 | |
760 | highlight_layer_->SetGeometry(geo); |
761 | - highlight_layer_->Renderlayer(GfxContext); |
762 | + highlight_layer_->Renderlayer(graphics_engine); |
763 | } |
764 | |
765 | - GfxContext.PopClippingRectangle(); |
766 | + graphics_engine.PopClippingRectangle(); |
767 | } |
768 | |
769 | -void FilterExpanderLabel::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) |
770 | +void FilterExpanderLabel::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) |
771 | { |
772 | - GfxContext.PushClippingRectangle(GetGeometry()); |
773 | - |
774 | - if (ShouldBeHighlighted() && highlight_layer_ && !IsFullRedraw()) |
775 | - { |
776 | - nux::GetPainter().PushLayer(GfxContext, highlight_layer_->GetGeometry(), highlight_layer_.get()); |
777 | - } |
778 | - |
779 | - GetLayout()->ProcessDraw(GfxContext, force_draw); |
780 | - GfxContext.PopClippingRectangle(); |
781 | + graphics_engine.PushClippingRectangle(GetGeometry()); |
782 | + |
783 | + if (RedirectedAncestor() && !IsFullRedraw()) |
784 | + { |
785 | + unsigned int alpha = 0, src = 0, dest = 0; |
786 | + graphics_engine.GetRenderStates().GetBlend(alpha, src, dest); |
787 | + // This is necessary when doing redirected rendering. |
788 | + // Clean the area below this view before drawing anything. |
789 | + graphics_engine.GetRenderStates().SetBlend(false); |
790 | + graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
791 | + graphics_engine.GetRenderStates().SetBlend(alpha, src, dest); |
792 | + } |
793 | + |
794 | + int pushed_paint_layers = 0; |
795 | + if (RedirectedAncestor()) |
796 | + { |
797 | + if (ShouldBeHighlighted() && highlight_layer_ && !IsFullRedraw()) |
798 | + nux::GetPainter().RenderSinglePaintLayer(graphics_engine, highlight_layer_->GetGeometry(), highlight_layer_.get()); |
799 | + } |
800 | + else if (ShouldBeHighlighted() && highlight_layer_ && !IsFullRedraw()) |
801 | + { |
802 | + ++pushed_paint_layers; |
803 | + nux::GetPainter().PushLayer(graphics_engine, highlight_layer_->GetGeometry(), highlight_layer_.get()); |
804 | + } |
805 | + |
806 | + GetLayout()->ProcessDraw(graphics_engine, true); |
807 | + graphics_engine.PopClippingRectangle(); |
808 | + |
809 | + if (pushed_paint_layers) |
810 | + { |
811 | + nux::GetPainter().PopBackground(pushed_paint_layers); |
812 | + } |
813 | } |
814 | |
815 | // |
816 | |
817 | === modified file 'dash/FilterMultiRangeButton.cpp' |
818 | --- dash/FilterMultiRangeButton.cpp 2012-05-06 23:48:38 +0000 |
819 | +++ dash/FilterMultiRangeButton.cpp 2012-09-18 14:01:19 +0000 |
820 | @@ -226,6 +226,13 @@ |
821 | // clear what is behind us |
822 | unsigned int alpha = 0, src = 0, dest = 0; |
823 | GfxContext.GetRenderStates().GetBlend(alpha, src, dest); |
824 | + if (RedirectedAncestor()) |
825 | + { |
826 | + // This is necessary when doing redirected rendering. |
827 | + // Clean the area below this view before drawing anything. |
828 | + GfxContext.GetRenderStates().SetBlend(false); |
829 | + GfxContext.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
830 | + } |
831 | GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
832 | |
833 | nux::Color col = nux::color::Black; |
834 | |
835 | === modified file 'dash/FilterRatingsButton.cpp' |
836 | --- dash/FilterRatingsButton.cpp 2012-07-25 20:08:22 +0000 |
837 | +++ dash/FilterRatingsButton.cpp 2012-09-18 14:01:19 +0000 |
838 | @@ -107,6 +107,13 @@ |
839 | unsigned int alpha = 0, src = 0, dest = 0; |
840 | |
841 | GfxContext.GetRenderStates().GetBlend(alpha, src, dest); |
842 | + if (RedirectedAncestor()) |
843 | + { |
844 | + // This is necessary when doing redirected rendering. |
845 | + // Clean the area below this view before drawing anything. |
846 | + GfxContext.GetRenderStates().SetBlend(false); |
847 | + GfxContext.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
848 | + } |
849 | GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
850 | |
851 | nux::Color col = nux::color::Black; |
852 | |
853 | === modified file 'dash/LensBar.cpp' |
854 | --- dash/LensBar.cpp 2012-09-13 10:56:42 +0000 |
855 | +++ dash/LensBar.cpp 2012-09-18 14:01:19 +0000 |
856 | @@ -104,32 +104,49 @@ |
857 | } |
858 | } |
859 | |
860 | -void LensBar::Draw(nux::GraphicsEngine& gfx_context, bool force_draw) |
861 | +void LensBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
862 | { |
863 | nux::Geometry const& base = GetGeometry(); |
864 | |
865 | - gfx_context.PushClippingRectangle(base); |
866 | - nux::GetPainter().PaintBackground(gfx_context, base); |
867 | + graphics_engine.PushClippingRectangle(base); |
868 | |
869 | bg_layer_->SetGeometry(base); |
870 | - nux::GetPainter().RenderSinglePaintLayer(gfx_context, base, bg_layer_.get()); |
871 | + nux::GetPainter().RenderSinglePaintLayer(graphics_engine, base, bg_layer_.get()); |
872 | |
873 | - gfx_context.PopClippingRectangle(); |
874 | + graphics_engine.PopClippingRectangle(); |
875 | } |
876 | |
877 | -void LensBar::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw) |
878 | +void LensBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) |
879 | { |
880 | nux::Geometry const& base = GetGeometry(); |
881 | |
882 | - gfx_context.PushClippingRectangle(base); |
883 | - |
884 | - if (!IsFullRedraw()) |
885 | - nux::GetPainter().PushLayer(gfx_context, bg_layer_->GetGeometry(), bg_layer_.get()); |
886 | - |
887 | - layout_->ProcessDraw(gfx_context, force_draw); |
888 | - |
889 | - if (!IsFullRedraw()) |
890 | - nux::GetPainter().PopBackground(); |
891 | + graphics_engine.PushClippingRectangle(base); |
892 | + |
893 | + int pushed_paint_layers = 0; |
894 | + if(RedirectedAncestor()) |
895 | + { |
896 | + { |
897 | + unsigned int alpha = 0, src = 0, dest = 0; |
898 | + graphics_engine.GetRenderStates().GetBlend(alpha, src, dest); |
899 | + // This is necessary when doing redirected rendering. |
900 | + // Clean the area below this view before drawing anything. |
901 | + graphics_engine.GetRenderStates().SetBlend(false); |
902 | + graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
903 | + graphics_engine.GetRenderStates().SetBlend(alpha, src, dest); |
904 | + } |
905 | + |
906 | + nux::GetPainter().RenderSinglePaintLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get()); |
907 | + } |
908 | + else if (!IsFullRedraw()) |
909 | + { |
910 | + ++pushed_paint_layers; |
911 | + nux::GetPainter().PushLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get()); |
912 | + } |
913 | + |
914 | + layout_->ProcessDraw(graphics_engine, true); |
915 | + |
916 | + if (pushed_paint_layers) |
917 | + nux::GetPainter().PopBackground(pushed_paint_layers); |
918 | |
919 | for (auto icon: icons_) |
920 | { |
921 | @@ -142,7 +159,7 @@ |
922 | // bigger one and clip part of them using the "-1". |
923 | int y = base.y - 1; |
924 | |
925 | - nux::GetPainter().Draw2DTriangleColor(gfx_context, |
926 | + nux::GetPainter().Draw2DTriangleColor(graphics_engine, |
927 | middle - size, y, |
928 | middle, y + size, |
929 | middle + size, y, |
930 | @@ -152,7 +169,7 @@ |
931 | } |
932 | } |
933 | |
934 | - gfx_context.PopClippingRectangle(); |
935 | + graphics_engine.PopClippingRectangle(); |
936 | } |
937 | |
938 | void LensBar::SetActive(LensBarIcon* activated) |
939 | |
940 | === modified file 'dash/LensBarIcon.cpp' |
941 | --- dash/LensBarIcon.cpp 2012-05-06 23:48:38 +0000 |
942 | +++ dash/LensBarIcon.cpp 2012-09-18 14:01:19 +0000 |
943 | @@ -58,21 +58,21 @@ |
944 | |
945 | active.changed.connect(sigc::mem_fun(this, &LensBarIcon::OnActiveChanged)); |
946 | key_nav_focus_change.connect([&](nux::Area*, bool, nux::KeyNavDirection){ QueueDraw(); }); |
947 | + SetRedirectRenderingToTexture(true); |
948 | } |
949 | |
950 | LensBarIcon::~LensBarIcon() |
951 | {} |
952 | |
953 | -void LensBarIcon::Draw(nux::GraphicsEngine& gfx_context, bool force_draw) |
954 | +void LensBarIcon::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
955 | { |
956 | nux::Geometry const& geo = GetGeometry(); |
957 | |
958 | - gfx_context.PushClippingRectangle(geo); |
959 | - nux::GetPainter().PaintBackground(gfx_context, geo); |
960 | + graphics_engine.PushClippingRectangle(geo); |
961 | |
962 | if (!texture()) |
963 | { |
964 | - gfx_context.PopClippingRectangle(); |
965 | + graphics_engine.PopClippingRectangle(); |
966 | return; |
967 | } |
968 | |
969 | @@ -82,7 +82,7 @@ |
970 | nux::AbstractPaintLayer* layer = focus_layer_.get(); |
971 | |
972 | layer->SetGeometry(geo); |
973 | - layer->Renderlayer(gfx_context); |
974 | + layer->Renderlayer(graphics_engine); |
975 | } |
976 | |
977 | float opacity = active ? 1.0f : inactive_opacity_; |
978 | @@ -94,7 +94,7 @@ |
979 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
980 | texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER); |
981 | |
982 | - gfx_context.QRP_1Tex(geo.x + ((geo.width - width) / 2), |
983 | + graphics_engine.QRP_1Tex(geo.x + ((geo.width - width) / 2), |
984 | geo.y + ((geo.height - height) / 2), |
985 | width, |
986 | height, |
987 | @@ -102,7 +102,7 @@ |
988 | texxform, |
989 | col); |
990 | |
991 | - gfx_context.PopClippingRectangle(); |
992 | + graphics_engine.PopClippingRectangle(); |
993 | } |
994 | |
995 | void LensBarIcon::OnActiveChanged(bool is_active) |
996 | |
997 | === modified file 'dash/LensView.cpp' |
998 | --- dash/LensView.cpp 2012-09-14 14:59:09 +0000 |
999 | +++ dash/LensView.cpp 2012-09-18 14:01:19 +0000 |
1000 | @@ -174,7 +174,6 @@ |
1001 | if ((child && child->HasKeyFocus()) || |
1002 | (expand_label && expand_label->HasKeyFocus())) |
1003 | { |
1004 | - |
1005 | focused_pos.x += child->GetGeometry().x; |
1006 | focused_pos.y += child->GetGeometry().y - 30; |
1007 | focused_pos.height += 30; |
1008 | @@ -200,7 +199,7 @@ |
1009 | scroll_view_->EnableHorizontalScrollBar(false); |
1010 | layout_->AddView(scroll_view_); |
1011 | |
1012 | - scroll_view_->OnGeometryChanged.connect([this] (nux::Area *area, nux::Geometry& geo) |
1013 | + scroll_view_->geometry_changed.connect([this] (nux::Area *area, nux::Geometry& geo) |
1014 | { |
1015 | CheckScrollBarState(); |
1016 | }); |
1017 | |
1018 | === modified file 'dash/PlacesGroup.cpp' |
1019 | --- dash/PlacesGroup.cpp 2012-09-17 10:00:38 +0000 |
1020 | +++ dash/PlacesGroup.cpp 2012-09-18 14:01:19 +0000 |
1021 | @@ -458,10 +458,29 @@ |
1022 | void PlacesGroup::Draw(nux::GraphicsEngine& graphics_engine, |
1023 | bool forceDraw) |
1024 | { |
1025 | + |
1026 | +} |
1027 | + |
1028 | +void |
1029 | +PlacesGroup::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) |
1030 | +{ |
1031 | nux::Geometry const& base = GetGeometry(); |
1032 | graphics_engine.PushClippingRectangle(base); |
1033 | |
1034 | - |
1035 | + if (RedirectedAncestor()) |
1036 | + { |
1037 | + // This is necessary when doing redirected rendering. Clean the area below this view. |
1038 | + unsigned int current_alpha_blend; |
1039 | + unsigned int current_src_blend_factor; |
1040 | + unsigned int current_dest_blend_factor; |
1041 | + graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); |
1042 | + |
1043 | + graphics_engine.GetRenderStates().SetBlend(false); |
1044 | + graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
1045 | + |
1046 | + graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); |
1047 | + } |
1048 | + |
1049 | if (ShouldBeHighlighted()) |
1050 | { |
1051 | nux::Geometry geo(_header_layout->GetGeometry()); |
1052 | @@ -486,41 +505,11 @@ |
1053 | |
1054 | _background_layer->SetGeometry(bg_geo); |
1055 | _background_layer->Renderlayer(graphics_engine); |
1056 | - graphics_engine.PopClippingRectangle(); |
1057 | -} |
1058 | - |
1059 | -void |
1060 | -PlacesGroup::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) |
1061 | -{ |
1062 | - nux::Geometry const& base = GetGeometry(); |
1063 | - |
1064 | - graphics_engine.PushClippingRectangle(base); |
1065 | - nux::Geometry bg_geo = GetGeometry(); |
1066 | - |
1067 | - int bg_width = 0; |
1068 | - if (_using_nofilters_background) |
1069 | - bg_width = _background_nofilters->GetWidth(); |
1070 | - else |
1071 | - bg_width = _background->GetWidth(); |
1072 | - |
1073 | - // if the dash is smaller, resize to fit, otherwise move to the right edge |
1074 | - bg_geo.x = std::max(bg_geo.width - bg_width, 0); |
1075 | - bg_geo.width = std::min(bg_width, bg_geo.GetWidth()) + 1; // to render into a space left over by the scrollview |
1076 | - |
1077 | - bg_geo.height = _background->GetHeight(); |
1078 | - |
1079 | - if (!IsFullRedraw()) |
1080 | - { |
1081 | - nux::GetPainter().PushLayer(graphics_engine, bg_geo, _background_layer.get()); |
1082 | - } |
1083 | - if (ShouldBeHighlighted() && !IsFullRedraw() && _focus_layer) |
1084 | - { |
1085 | - nux::GetPainter().PushLayer(graphics_engine, _focus_layer->GetGeometry(), _focus_layer.get()); |
1086 | - } |
1087 | - |
1088 | - _group_layout->ProcessDraw(graphics_engine, force_draw); |
1089 | - |
1090 | - graphics_engine.PopClippingRectangle(); |
1091 | + |
1092 | + _group_layout->ProcessDraw(graphics_engine, true); |
1093 | + |
1094 | + graphics_engine.PopClippingRectangle(); |
1095 | + |
1096 | } |
1097 | |
1098 | void PlacesGroup::PostDraw(nux::GraphicsEngine& graphics_engine, |
1099 | |
1100 | === modified file 'dash/ResultViewGrid.cpp' |
1101 | --- dash/ResultViewGrid.cpp 2012-08-20 14:21:31 +0000 |
1102 | +++ dash/ResultViewGrid.cpp 2012-09-18 14:01:19 +0000 |
1103 | @@ -143,10 +143,28 @@ |
1104 | << " " << activated_uri_; |
1105 | int left_results = current_index; |
1106 | int right_results = num_results ? (num_results - current_index) - 1 : 0; |
1107 | + |
1108 | + int row_y = padding + GetRootGeometry().y; |
1109 | + int row_size = renderer_->height + vertical_spacing; |
1110 | + int row_height = row_size; |
1111 | + |
1112 | + if (GetItemsPerRow()) |
1113 | + { |
1114 | + int num_row = GetNumResults() / GetItemsPerRow(); |
1115 | + if (GetNumResults() % GetItemsPerRow()) |
1116 | + { |
1117 | + ++num_row; |
1118 | + } |
1119 | + int row_index = current_index / GetItemsPerRow(); |
1120 | + |
1121 | + row_y += row_index * row_size; |
1122 | + } |
1123 | + |
1124 | ubus_.SendMessage(UBUS_DASH_PREVIEW_INFO_PAYLOAD, |
1125 | - g_variant_new("(iii)", 0, left_results, right_results)); |
1126 | + g_variant_new("(iiii)", row_y, row_height, left_results, right_results)); |
1127 | UriActivated.emit(activated_uri_, ActivateType::PREVIEW); |
1128 | } |
1129 | + |
1130 | } |
1131 | |
1132 | g_free(uri); |
1133 | @@ -691,8 +709,24 @@ |
1134 | int left_results = index; |
1135 | int right_results = (num_results - index) - 1; |
1136 | //FIXME - just uses y right now, needs to use the absolute position of the bottom of the result |
1137 | + // (jay) Here is the fix: Compute the y position of the row where the item is located. |
1138 | + int row_y = padding + GetRootGeometry().y; |
1139 | + int row_size = renderer_->height + vertical_spacing; |
1140 | + int row_height = row_size; |
1141 | + |
1142 | + if (GetItemsPerRow()) |
1143 | + { |
1144 | + int num_row = GetNumResults() / GetItemsPerRow(); |
1145 | + if (GetNumResults() % GetItemsPerRow()) |
1146 | + { |
1147 | + ++num_row; |
1148 | + } |
1149 | + int row_index = index / GetItemsPerRow(); |
1150 | + |
1151 | + row_y += row_index * row_size; |
1152 | + } |
1153 | ubus_.SendMessage(UBUS_DASH_PREVIEW_INFO_PAYLOAD, |
1154 | - g_variant_new("(iii)", y, left_results, right_results)); |
1155 | + g_variant_new("(iiii)", row_y, row_height, left_results, right_results)); |
1156 | } |
1157 | else |
1158 | { |
1159 | |
1160 | === modified file 'dash/previews/PreviewContainer.cpp' |
1161 | --- dash/previews/PreviewContainer.cpp 2012-09-18 09:05:50 +0000 |
1162 | +++ dash/previews/PreviewContainer.cpp 2012-09-18 14:01:19 +0000 |
1163 | @@ -70,7 +70,7 @@ |
1164 | , nav_complete_(0) |
1165 | , relative_nav_index_(0) |
1166 | { |
1167 | - OnGeometryChanged.connect([&](nux::Area*, nux::Geometry& geo) |
1168 | + geometry_changed.connect([&](nux::Area*, nux::Geometry& geo) |
1169 | { |
1170 | // Need to update the preview geometries when updating the container geo. |
1171 | UpdateAnimationProgress(progress_, curve_progress_); |
1172 | @@ -323,7 +323,7 @@ |
1173 | } |
1174 | } |
1175 | |
1176 | - _queued_draw = false; |
1177 | + draw_cmd_queued_ = false; |
1178 | } |
1179 | |
1180 | nux::Area* KeyNavIteration(nux::KeyNavDirection direction) |
1181 | |
1182 | === added file 'manual-tests/DashToPreviewTransition.txt' |
1183 | --- manual-tests/DashToPreviewTransition.txt 1970-01-01 00:00:00 +0000 |
1184 | +++ manual-tests/DashToPreviewTransition.txt 2012-09-18 14:01:19 +0000 |
1185 | @@ -0,0 +1,38 @@ |
1186 | +Preview Open Animation |
1187 | +---------------------- |
1188 | +This tests the dash animation transition to the preview |
1189 | + |
1190 | +Setup: |
1191 | +#. Open dash super |
1192 | +#. Open a lens which supports previewing (e.g. Application, Music, File) |
1193 | + |
1194 | +Actions: |
1195 | +#. Right click on an icon in the dash |
1196 | + |
1197 | +Expected Result: |
1198 | + The central part of the dash split itself up just below the icon that was clicked, to reveal the preview window. It fades out but does not become fully transparent. |
1199 | + The Search Entry slides up and fades out. |
1200 | + If opened, the Filter Bar slides away to the right and fades. |
1201 | + Above the Preview, there is a faded out row of icons that include the icon that was right clicked. |
1202 | + |
1203 | + |
1204 | +Preview Close Animation |
1205 | +----------------------- |
1206 | +This tests the preview close animation |
1207 | + |
1208 | +Setup: |
1209 | +#. Open dash super |
1210 | +#. Open a lens which supports previewing (e.g. Application, Music, File) |
1211 | +#. Right-click the mouse on an icon to open its preview. |
1212 | +#. Wait for the preview window to open and finish animating. |
1213 | + |
1214 | +Actions: |
1215 | +#. Press Escape. |
1216 | + |
1217 | +Expected Result: |
1218 | + The Preview is progressively scaled down and disapears. |
1219 | + The search bar slides in from the top. |
1220 | + If the Filter Bar was opened when the Preview started, it will slide in from the right |
1221 | + to its normal position. |
1222 | + The splitted and faded out dash appears to close itself and regain it full opacity. |
1223 | + |
1224 | |
1225 | === modified file 'plugins/unityshell/src/unityshell.cpp' |
1226 | --- plugins/unityshell/src/unityshell.cpp 2012-09-18 01:41:46 +0000 |
1227 | +++ plugins/unityshell/src/unityshell.cpp 2012-09-18 14:01:19 +0000 |
1228 | @@ -24,6 +24,7 @@ |
1229 | #include <Nux/HLayout.h> |
1230 | #include <Nux/BaseWindow.h> |
1231 | #include <Nux/WindowCompositor.h> |
1232 | +#include <Nux/NuxTimerTickSource.h> |
1233 | |
1234 | #include "BaseWindowRaiserImp.h" |
1235 | #include "IconRenderer.h" |
1236 | @@ -113,7 +114,6 @@ |
1237 | , screen(screen) |
1238 | , cScreen(CompositeScreen::get(screen)) |
1239 | , gScreen(GLScreen::get(screen)) |
1240 | - , animation_controller_(tick_source_) |
1241 | , debugger_(this) |
1242 | , enable_shortcut_overlay_(true) |
1243 | , needsRelayout(false) |
1244 | @@ -125,6 +125,7 @@ |
1245 | , allowWindowPaint(false) |
1246 | , _key_nav_mode_requested(false) |
1247 | , _last_output(nullptr) |
1248 | + , _bghash(NULL) |
1249 | , grab_index_ (0) |
1250 | , painting_tray_ (false) |
1251 | , last_scroll_event_(0) |
1252 | @@ -235,8 +236,16 @@ |
1253 | this)); |
1254 | #endif |
1255 | |
1256 | + tick_source_.reset(new nux::NuxTimerTickSource); |
1257 | + animation_controller_.reset(new na::AnimationController(*tick_source_)); |
1258 | + |
1259 | wt->RedrawRequested.connect(sigc::mem_fun(this, &UnityScreen::onRedrawRequested)); |
1260 | |
1261 | + // _bghash is a pointer. We don't want it to be created before Nux system has had a chance |
1262 | + // to start. BGHash relies on animations. Nux animation system starts after the WindowThread |
1263 | + // has been created. |
1264 | + _bghash = new BGHash(); |
1265 | + |
1266 | unity_a11y_init(wt.get()); |
1267 | |
1268 | /* i18n init */ |
1269 | @@ -383,6 +392,7 @@ |
1270 | unity_a11y_finalize(); |
1271 | ::unity::ui::IconRenderer::DestroyTextures(); |
1272 | QuicklistManager::Destroy(); |
1273 | + delete _bghash; |
1274 | |
1275 | reset_glib_logging(); |
1276 | } |
1277 | @@ -1234,10 +1244,6 @@ |
1278 | { |
1279 | cScreen->preparePaint(ms); |
1280 | |
1281 | - // Emit the current time throught the tick_source. This moves any running |
1282 | - // animations along their path. |
1283 | - tick_source_.tick(g_get_monotonic_time()); |
1284 | - |
1285 | for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) |
1286 | wi->HandleAnimations (ms); |
1287 | |
1288 | @@ -1532,7 +1538,8 @@ |
1289 | if (event->xproperty.window == GDK_ROOT_WINDOW() && |
1290 | event->xproperty.atom == gdk_x11_get_xatom_by_name("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS")) |
1291 | { |
1292 | - _bghash.RefreshColor(); |
1293 | + if (_bghash) |
1294 | + _bghash->RefreshColor(); |
1295 | } |
1296 | break; |
1297 | default: |
1298 | @@ -2744,7 +2751,8 @@ |
1299 | override_color.red = override_color.red / override_color.alpha; |
1300 | override_color.green = override_color.green / override_color.alpha; |
1301 | override_color.blue = override_color.blue / override_color.alpha; |
1302 | - _bghash.OverrideColor(override_color); |
1303 | + if (_bghash) |
1304 | + _bghash->OverrideColor(override_color); |
1305 | break; |
1306 | } |
1307 | case UnityshellOptions::LauncherHideMode: |
1308 | |
1309 | === modified file 'plugins/unityshell/src/unityshell.h' |
1310 | --- plugins/unityshell/src/unityshell.h 2012-09-18 01:41:46 +0000 |
1311 | +++ plugins/unityshell/src/unityshell.h 2012-09-18 14:01:19 +0000 |
1312 | @@ -245,8 +245,8 @@ |
1313 | bool TopPanelBackgroundTextureNeedsUpdate() const; |
1314 | void UpdateTopPanelBackgroundTexture(); |
1315 | |
1316 | - nux::animation::TickSource tick_source_; |
1317 | - nux::animation::AnimationController animation_controller_; |
1318 | + std::unique_ptr<nux::NuxTimerTickSource> tick_source_; |
1319 | + std::unique_ptr<na::AnimationController> animation_controller_; |
1320 | |
1321 | Settings dash_settings_; |
1322 | dash::Style dash_style_; |
1323 | @@ -306,7 +306,7 @@ |
1324 | |
1325 | nux::Property<nux::Geometry> primary_monitor_; |
1326 | |
1327 | - BGHash _bghash; |
1328 | + BGHash* _bghash; |
1329 | |
1330 | ::GLFramebufferObject *oldFbo; |
1331 | |
1332 | |
1333 | === modified file 'unity-shared/DashStyle.h' |
1334 | --- unity-shared/DashStyle.h 2012-09-14 14:59:09 +0000 |
1335 | +++ unity-shared/DashStyle.h 2012-09-18 14:01:19 +0000 |
1336 | @@ -246,9 +246,11 @@ |
1337 | int GetCategorySeparatorLeftPadding() const; |
1338 | int GetCategorySeparatorRightPadding() const; |
1339 | |
1340 | + |
1341 | sigc::signal<void> changed; |
1342 | |
1343 | nux::Property<bool> always_maximised; |
1344 | + nux::Property<bool> preview_mode; |
1345 | |
1346 | private: |
1347 | class Impl; |
1348 | |
1349 | === modified file 'unity-shared/PlacesVScrollBar.cpp' |
1350 | --- unity-shared/PlacesVScrollBar.cpp 2012-07-20 13:28:26 +0000 |
1351 | +++ unity-shared/PlacesVScrollBar.cpp 2012-09-18 14:01:19 +0000 |
1352 | @@ -67,15 +67,23 @@ |
1353 | } |
1354 | |
1355 | void |
1356 | -PlacesVScrollBar::Draw(nux::GraphicsEngine& gfxContext, bool force_draw) |
1357 | +PlacesVScrollBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
1358 | { |
1359 | nux::Color color = nux::color::White; |
1360 | nux::Geometry const& base = GetGeometry(); |
1361 | nux::TexCoordXForm texxform; |
1362 | |
1363 | - gfxContext.PushClippingRectangle(base); |
1364 | + graphics_engine.PushClippingRectangle(base); |
1365 | + unsigned int alpha = 0, src = 0, dest = 0; |
1366 | + graphics_engine.GetRenderStates().GetBlend(alpha, src, dest); |
1367 | |
1368 | - nux::GetPainter().PaintBackground(gfxContext, base); |
1369 | + if(RedirectedAncestor()) |
1370 | + { |
1371 | + // This is necessary when doing redirected rendering. |
1372 | + // Clean the area below this view before drawing anything. |
1373 | + graphics_engine.GetRenderStates().SetBlend(false); |
1374 | + graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
1375 | + } |
1376 | |
1377 | // check if textures have been computed... if they haven't, exit function |
1378 | if (!_slider_texture) |
1379 | @@ -83,14 +91,14 @@ |
1380 | |
1381 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD); |
1382 | |
1383 | - gfxContext.GetRenderStates().SetBlend(true); |
1384 | - gfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
1385 | + graphics_engine.GetRenderStates().SetBlend(true); |
1386 | + graphics_engine.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
1387 | |
1388 | if (content_height_ > container_height_) |
1389 | { |
1390 | nux::Geometry const& slider_geo = _slider->GetGeometry(); |
1391 | |
1392 | - gfxContext.QRP_1Tex(slider_geo.x, |
1393 | + graphics_engine.QRP_1Tex(slider_geo.x, |
1394 | slider_geo.y, |
1395 | slider_geo.width, |
1396 | slider_geo.height, |
1397 | @@ -99,9 +107,8 @@ |
1398 | color); |
1399 | } |
1400 | |
1401 | - gfxContext.GetRenderStates().SetBlend(false); |
1402 | - gfxContext.PopClippingRectangle(); |
1403 | - gfxContext.GetRenderStates().SetBlend(true); |
1404 | + graphics_engine.PopClippingRectangle(); |
1405 | + graphics_engine.GetRenderStates().SetBlend(alpha, src, dest); |
1406 | } |
1407 | |
1408 | void PlacesVScrollBar::UpdateTexture() |
1409 | |
1410 | === modified file 'unity-shared/SearchBar.cpp' |
1411 | --- unity-shared/SearchBar.cpp 2012-09-14 16:53:45 +0000 |
1412 | +++ unity-shared/SearchBar.cpp 2012-09-18 14:01:19 +0000 |
1413 | @@ -355,17 +355,16 @@ |
1414 | } |
1415 | } |
1416 | |
1417 | -void SearchBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) |
1418 | +void SearchBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
1419 | { |
1420 | nux::Geometry const& base = GetGeometry(); |
1421 | |
1422 | UpdateBackground(false); |
1423 | |
1424 | - GfxContext.PushClippingRectangle(base); |
1425 | - nux::GetPainter().PaintBackground(GfxContext, base); |
1426 | + graphics_engine.PushClippingRectangle(base); |
1427 | |
1428 | bg_layer_->SetGeometry(nux::Geometry(base.x, base.y, last_width_, last_height_)); |
1429 | - nux::GetPainter().RenderSinglePaintLayer(GfxContext, |
1430 | + nux::GetPainter().RenderSinglePaintLayer(graphics_engine, |
1431 | bg_layer_->GetGeometry(), |
1432 | bg_layer_.get()); |
1433 | |
1434 | @@ -381,35 +380,85 @@ |
1435 | if (!highlight_layer_) |
1436 | highlight_layer_.reset(style.FocusOverlay(geo.width, geo.height)); |
1437 | |
1438 | + if (RedirectedAncestor()) |
1439 | + { |
1440 | + unsigned int alpha = 0, src = 0, dest = 0; |
1441 | + graphics_engine.GetRenderStates().GetBlend(alpha, src, dest); |
1442 | + // This is necessary when doing redirected rendering. |
1443 | + // Clean the area below this view before drawing anything. |
1444 | + graphics_engine.GetRenderStates().SetBlend(false); |
1445 | + graphics_engine.QRP_Color(geo.x, geo.y, geo.width, geo.height, nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
1446 | + graphics_engine.GetRenderStates().SetBlend(alpha, src, dest); |
1447 | + } |
1448 | + |
1449 | highlight_layer_->SetGeometry(geo); |
1450 | - highlight_layer_->Renderlayer(GfxContext); |
1451 | - } |
1452 | - |
1453 | - GfxContext.PopClippingRectangle(); |
1454 | + highlight_layer_->Renderlayer(graphics_engine); |
1455 | + } |
1456 | + else if (expander_view_ && expander_view_->IsVisible()) |
1457 | + { |
1458 | + nux::Geometry geo(expander_view_->GetGeometry()); |
1459 | + |
1460 | + geo.y -= (HIGHLIGHT_HEIGHT- geo.height) / 2; |
1461 | + geo.height = HIGHLIGHT_HEIGHT; |
1462 | + |
1463 | + if (RedirectedAncestor()) |
1464 | + { |
1465 | + unsigned int alpha = 0, src = 0, dest = 0; |
1466 | + graphics_engine.GetRenderStates().GetBlend(alpha, src, dest); |
1467 | + // This is necessary when doing redirected rendering. |
1468 | + // Clean the area below this view before drawing anything. |
1469 | + graphics_engine.GetRenderStates().SetBlend(false); |
1470 | + graphics_engine.QRP_Color(geo.x, geo.y, geo.width, geo.height, nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
1471 | + graphics_engine.GetRenderStates().SetBlend(alpha, src, dest); |
1472 | + } |
1473 | + } |
1474 | + graphics_engine.PopClippingRectangle(); |
1475 | } |
1476 | |
1477 | -void SearchBar::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) |
1478 | +void SearchBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) |
1479 | { |
1480 | nux::Geometry const& geo = GetGeometry(); |
1481 | |
1482 | - GfxContext.PushClippingRectangle(geo); |
1483 | + graphics_engine.PushClippingRectangle(geo); |
1484 | |
1485 | if (highlight_layer_ && ShouldBeHighlighted() && !IsFullRedraw()) |
1486 | { |
1487 | - nux::GetPainter().PushLayer(GfxContext, highlight_layer_->GetGeometry(), highlight_layer_.get()); |
1488 | + nux::GetPainter().PushLayer(graphics_engine, highlight_layer_->GetGeometry(), highlight_layer_.get()); |
1489 | } |
1490 | |
1491 | - |
1492 | if (!IsFullRedraw()) |
1493 | { |
1494 | - gPainter.PushLayer(GfxContext, bg_layer_->GetGeometry(), bg_layer_.get()); |
1495 | + unsigned int current_alpha_blend; |
1496 | + unsigned int current_src_blend_factor; |
1497 | + unsigned int current_dest_blend_factor; |
1498 | + graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); |
1499 | + |
1500 | + graphics_engine.GetRenderStates().SetBlend(false); |
1501 | + graphics_engine.QRP_Color( |
1502 | + pango_entry_->GetX(), |
1503 | + pango_entry_->GetY(), |
1504 | + pango_entry_->GetWidth(), |
1505 | + pango_entry_->GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
1506 | + |
1507 | + if (spinner_->IsRedrawNeeded()) |
1508 | + { |
1509 | + graphics_engine.QRP_Color( |
1510 | + spinner_->GetX(), |
1511 | + spinner_->GetY(), |
1512 | + spinner_->GetWidth(), |
1513 | + spinner_->GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
1514 | + } |
1515 | + |
1516 | + graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); |
1517 | + |
1518 | + gPainter.PushLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get()); |
1519 | } |
1520 | else |
1521 | { |
1522 | nux::GetPainter().PushPaintLayerStack(); |
1523 | } |
1524 | |
1525 | - layout_->ProcessDraw(GfxContext, force_draw); |
1526 | + layout_->ProcessDraw(graphics_engine, force_draw); |
1527 | |
1528 | if (!IsFullRedraw()) |
1529 | { |
1530 | @@ -420,7 +469,7 @@ |
1531 | nux::GetPainter().PopPaintLayerStack(); |
1532 | } |
1533 | |
1534 | - GfxContext.PopClippingRectangle(); |
1535 | + graphics_engine.PopClippingRectangle(); |
1536 | } |
1537 | |
1538 | void SearchBar::OnClearClicked(int x, int y, unsigned long button_fags, |
1539 | |
1540 | === modified file 'unity-shared/UBusMessages.h' |
1541 | --- unity-shared/UBusMessages.h 2012-09-13 09:15:15 +0000 |
1542 | +++ unity-shared/UBusMessages.h 2012-09-18 14:01:19 +0000 |
1543 | @@ -82,8 +82,8 @@ |
1544 | // FIXME - fix the nux focus api so we don't need this |
1545 | #define UBUS_RESULT_VIEW_KEYNAV_CHANGED "RESULT_VIEW_KEYNAV_CHANGED" |
1546 | |
1547 | -// for communicating positions to the preview state machine (iii) |
1548 | -// (split y coord in absolute geometry, results to the left, results to the right) |
1549 | +// for communicating positions to the preview state machine (iiii) |
1550 | +// (split y coord in absolute geometry, height of row where icon resides, results to the left, results to the right) |
1551 | #define UBUS_DASH_PREVIEW_INFO_PAYLOAD "DASH_PREVIEW_INFO_PAYLOAD" |
1552 | |
1553 | // called when previews wish to navigate left/right or close (is) |
Hey, looks good and works well, have been using it for about a week.
Some comments:
- You've added an 'i' to the UBusMessages.h but forgot to add what it's for :)
- Please remove the commented out code:
//tick_ source_ .reset( new nux::NuxTimerTi ckSource) ; controller_ .reset( new na::AnimationCo ntroller( *tick_source_ ));
//animation_
// nux::GetGraphic sDisplay( )->GetGraphicsE ngine() ->QRP_GetCopyTe xture( >GetWidth( ), src_texture- >GetHeight( ),
// src_texture-
// layout_copy_, src_texture,
// texxform, nux::color::White);
//layout_ ->SetCopyPrevio usFboTexture( false);
//(opening_row_y_ - layout_ ->GetY( ))/(float) layout_ ->GetHeight( );
//SetCopyPrevio usFboTexture( false);
//SetRedirectRe nderingToTextur e(true) ; usFboTexture( false);
//SetCopyPrevio
// if (RedirectedAnce stor()) alpha_blend; src_blend_ factor; dest_blend_ factor; GetRenderStates ().GetBlend( current_ alpha_blend, current_ src_blend_ factor, current_ dest_blend_ factor) ;
// {
// // This is necessary when doing redirected rendering. Clean the area below this view.
// unsigned int current_
// unsigned int current_
// unsigned int current_
// GfxContext.
// GfxContext. GetRenderStates ().SetBlend( false); QRP_Color( GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
// GfxContext.
// GfxContext. GetRenderStates ().SetBlend( current_ alpha_blend, current_ src_blend_ factor, current_ dest_blend_ factor) ;
// }
// tick_source_ .tick(g_ get_monotonic_ time()) ;
// nux::animation: :TickSource tick_source_; :AnimationContr oller animation_ controller_ ;
// nux::animation: