Merge lp:~unity-team/unity/unity.fix-noblur into lp:unity

Proposed by Jay Taoko
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 2226
Proposed branch: lp:~unity-team/unity/unity.fix-noblur
Merge into: lp:unity
Diff against target: 514 lines (+237/-74)
10 files modified
plugins/unityshell/src/BackgroundEffectHelper.cpp (+86/-0)
plugins/unityshell/src/BackgroundEffectHelper.h (+2/-0)
plugins/unityshell/src/Launcher.cpp (+41/-35)
plugins/unityshell/src/OverlayRenderer.cpp (+28/-26)
plugins/unityshell/src/PanelView.cpp (+12/-4)
plugins/unityshell/src/PlacesGroup.cpp (+0/-2)
plugins/unityshell/src/ResultViewGrid.cpp (+0/-2)
plugins/unityshell/src/ScreenEffectFramebufferObject.cpp (+0/-3)
plugins/unityshell/src/unityshell.cpp (+62/-2)
plugins/unityshell/src/unityshell.h (+6/-0)
To merge this branch: bzr merge lp:~unity-team/unity/unity.fix-noblur
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Brandon Schaefer (community) Approve
Jason Smith (community) Approve
Review via email: mp+99403@code.launchpad.net

Commit message

* Fix for bug #839480
* Fix rendering of the Dash, Launcher and Panel when "NO_BLUR" is selected in CCSM
* Added support to get a none blurred region of the display from BackgroundEffectHelper

Description of the change

* Fix for bug #839480
* Fix rendering of the Dash, Launcher and Panel when "NO_BLUR" is selected in CCSM
* Added support to get a none blurred region of the display from BackgroundEffectHelper

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

Works fine for me, +1

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

One thing, the 'dash_is_open_' in unityshell.cpp isn't correctly handled anymore (There are cases when the dash is open and dash_is_open is false). So there is the launcher_controller->IsOverlayOpen() which will return true if any overlay (hud/dash) is open on any monitor. Or we should add an IsVisible() in the DashController, so we don't have to worry about the dash_is_open boolean being correctly updated.

review: Needs Fixing
Revision history for this message
Gord Allott (gordallott) wrote :

330 + // nux::LayerBlendMode layer_blend_mode = nux::LAYER_BLEND_MODE_OVERLAY;
331 + // if (_menu_view->GetMaximizedWindow() != 0)
332 + // {
333 + // layer_blend_mode = nux::LAYER_BLEND_MODE_NORMAL;
334 + // }
335 +

just a few comments that were added but shouldn't be, lets remove those

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

Fixed those 2 issues, Thanks Jay awesome work! The panel looks soo much better!

Revision history for this message
Brandon Schaefer (brandontschaefer) :
review: Approve
Revision history for this message
Gord Allott (gordallott) :
review: Approve
Revision history for this message
Omer Akram (om26er) wrote :

this branch seems to cause bug 974408

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/BackgroundEffectHelper.cpp'
--- plugins/unityshell/src/BackgroundEffectHelper.cpp 2012-03-14 06:24:18 +0000
+++ plugins/unityshell/src/BackgroundEffectHelper.cpp 2012-04-05 06:31:21 +0000
@@ -321,3 +321,89 @@
321 cache_dirty = false;321 cache_dirty = false;
322 return blur_texture_;322 return blur_texture_;
323}323}
324
325nux::ObjectPtr<nux::IOpenGLBaseTexture> BackgroundEffectHelper::GetRegion(nux::Geometry geo, bool force_update)
326{
327 bool should_update = force_update || cache_dirty;
328
329 /* Static blur: only update when the size changed */
330 if ((!should_update)
331 && blur_texture_.IsValid()
332 && (geo == blur_geometry_))
333 {
334 return blur_texture_;
335 }
336
337 nux::GraphicsEngine* graphics_engine = nux::GetGraphicsDisplay()->GetGraphicsEngine();
338
339 int monitor_width = BackgroundEffectHelper::monitor_rect_.width;
340 int monitor_height = BackgroundEffectHelper::monitor_rect_.height;
341
342 nux::Geometry temp = geo;
343 temp.OffsetPosition(-monitor_rect_.x, -monitor_rect_.y);
344 blur_geometry_ = nux::Geometry(0, 0, monitor_width, monitor_height).Intersect(temp);
345
346 nux::GpuDevice* gpu_device = nux::GetGraphicsDisplay()->GetGpuDevice();
347 if (blur_geometry_.IsNull() || !gpu_device->backup_texture0_.IsValid())
348 {
349 return nux::ObjectPtr<nux::IOpenGLBaseTexture>();
350 }
351
352 // save the current fbo
353 nux::ObjectPtr<nux::IOpenGLFrameBufferObject> current_fbo = gpu_device->GetCurrentFrameBufferObject();
354 gpu_device->DeactivateFrameBuffer();
355
356 // Set a viewport to the requested size
357 // FIXME: We need to do multiple passes for the dirty region
358 // on the underlying backup texture so that we're only updating
359 // the bits that we need
360 graphics_engine->SetViewport(0, 0, blur_geometry_.width, blur_geometry_.height);
361 graphics_engine->SetScissor(0, 0, blur_geometry_.width, blur_geometry_.height);
362 // Disable nux scissoring
363 graphics_engine->GetRenderStates ().EnableScissor (false);
364
365 // The background texture is the same size as the monitor where we are rendering.
366 nux::TexCoordXForm texxform__bg;
367 texxform__bg.flip_v_coord = false;
368 texxform__bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
369 texxform__bg.uoffset = ((float) blur_geometry_.x) / monitor_width;
370 texxform__bg.voffset = ((float) monitor_height - blur_geometry_.y - blur_geometry_.height) / monitor_height;
371
372 {
373 nux::ObjectPtr<nux::IOpenGLBaseTexture> device_texture = gpu_device->backup_texture0_;
374 nux::ObjectPtr<nux::CachedBaseTexture> noise_device_texture = graphics_engine->CacheResource(noise_texture_);
375
376 unsigned int offset = 0;
377 int quad_width = blur_geometry_.width;
378 int quad_height = blur_geometry_.height;
379
380 unsigned int buffer_width = quad_width + 2 * offset;
381 unsigned int buffer_height = quad_height + 2 * offset;
382
383 texxform__bg.SetFilter(nux::TEXFILTER_NEAREST, nux::TEXFILTER_NEAREST);
384 texxform__bg.flip_v_coord = true;
385
386 // Copy source texture
387 graphics_engine->QRP_GetCopyTexture(buffer_width, buffer_height,
388 blur_texture_, device_texture,
389 texxform__bg, nux::color::White);
390 }
391
392 if (current_fbo.IsValid())
393 {
394 current_fbo->Activate(true);
395 graphics_engine->Push2DWindow(current_fbo->GetWidth(), current_fbo->GetHeight());
396 graphics_engine->GetRenderStates ().EnableScissor (true);
397 }
398 else
399 {
400 graphics_engine->SetViewport(0, 0, monitor_width, monitor_height);
401 graphics_engine->Push2DWindow(monitor_width, monitor_height);
402
403 graphics_engine->ApplyClippingRectangle();
404 }
405
406 cache_dirty = false;
407 return blur_texture_;
408}
409
324410
=== modified file 'plugins/unityshell/src/BackgroundEffectHelper.h'
--- plugins/unityshell/src/BackgroundEffectHelper.h 2012-03-14 06:24:18 +0000
+++ plugins/unityshell/src/BackgroundEffectHelper.h 2012-04-05 06:31:21 +0000
@@ -50,6 +50,8 @@
50 // We could add more functions here to get different types of effects based on the background texture50 // We could add more functions here to get different types of effects based on the background texture
51 nux::ObjectPtr<nux::IOpenGLBaseTexture> GetPixelatedRegion(nux::Rect rect, int pixel_size, bool update);51 nux::ObjectPtr<nux::IOpenGLBaseTexture> GetPixelatedRegion(nux::Rect rect, int pixel_size, bool update);
5252
53 nux::ObjectPtr<nux::IOpenGLBaseTexture> GetRegion(nux::Geometry geo, bool force_update = false);
54
53 void DirtyCache();55 void DirtyCache();
5456
55 static void ProcessDamage(nux::Geometry geo);57 static void ProcessDamage(nux::Geometry geo);
5658
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2012-04-05 00:32:14 +0000
+++ plugins/unityshell/src/Launcher.cpp 2012-04-05 06:31:21 +0000
@@ -1944,48 +1944,54 @@
19441944
1945 if (IsOverlayOpen())1945 if (IsOverlayOpen())
1946 {1946 {
1947 nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height);
1948 nux::ObjectPtr<nux::IOpenGLBaseTexture> blur_texture;
1949
1947 if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && (bkg_box.x + bkg_box.width > 0))1950 if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && (bkg_box.x + bkg_box.width > 0))
1948 {1951 {
1949 nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height);1952 blur_texture = bg_effect_helper_.GetBlurRegion(blur_geo);
1950 auto blur_texture = bg_effect_helper_.GetBlurRegion(blur_geo);1953 }
19511954 else
1952 if (blur_texture.IsValid())1955 {
1953 {1956 blur_texture = bg_effect_helper_.GetRegion(blur_geo);
1954 nux::TexCoordXForm texxform_blur_bg;1957 }
1955 texxform_blur_bg.flip_v_coord = true;1958
1956 texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);1959 if (blur_texture.IsValid())
1957 texxform_blur_bg.uoffset = ((float) base.x) / geo_absolute.width;1960 {
1958 texxform_blur_bg.voffset = ((float) base.y) / geo_absolute.height;1961 nux::TexCoordXForm texxform_blur_bg;
19591962 texxform_blur_bg.flip_v_coord = true;
1960 GfxContext.PushClippingRectangle(bkg_box);1963 texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
1964 texxform_blur_bg.uoffset = ((float) base.x) / geo_absolute.width;
1965 texxform_blur_bg.voffset = ((float) base.y) / geo_absolute.height;
1966
1967 GfxContext.PushClippingRectangle(bkg_box);
19611968
1962#ifndef NUX_OPENGLES_201969#ifndef NUX_OPENGLES_20
1963 if (GfxContext.UsingGLSLCodePath())1970 if (GfxContext.UsingGLSLCodePath())
1964 gPainter.PushDrawCompositionLayer(GfxContext, base,1971 gPainter.PushDrawCompositionLayer(GfxContext, base,
1965 blur_texture,1972 blur_texture,
1966 texxform_blur_bg,1973 texxform_blur_bg,
1967 nux::color::White,1974 nux::color::White,
1968 _background_color, nux::LAYER_BLEND_MODE_OVERLAY,1975 _background_color, nux::LAYER_BLEND_MODE_OVERLAY,
1969 true, ROP);1976 true, ROP);
1970 else1977 else
1971 gPainter.PushDrawTextureLayer(GfxContext, base,1978 gPainter.PushDrawTextureLayer(GfxContext, base,
1972 blur_texture,1979 blur_texture,
1973 texxform_blur_bg,1980 texxform_blur_bg,
1974 nux::color::White,1981 nux::color::White,
1975 true,1982 true,
1976 ROP);1983 ROP);
1977#else1984#else
1978 gPainter.PushDrawCompositionLayer(GfxContext, base,1985 gPainter.PushDrawCompositionLayer(GfxContext, base,
1979 blur_texture,1986 blur_texture,
1980 texxform_blur_bg,1987 texxform_blur_bg,
1981 nux::color::White,1988 nux::color::White,
1982 _background_color, nux::LAYER_BLEND_MODE_OVERLAY,1989 _background_color, nux::LAYER_BLEND_MODE_OVERLAY,
1983 true, ROP);1990 true, ROP);
1984#endif1991#endif
1985 GfxContext.PopClippingRectangle();1992 GfxContext.PopClippingRectangle();
19861993
1987 push_count++;1994 push_count++;
1988 }
1989 }1995 }
19901996
1991 unsigned int alpha = 0, src = 0, dest = 0;1997 unsigned int alpha = 0, src = 0, dest = 0;
19921998
=== modified file 'plugins/unityshell/src/OverlayRenderer.cpp'
--- plugins/unityshell/src/OverlayRenderer.cpp 2012-03-21 14:18:06 +0000
+++ plugins/unityshell/src/OverlayRenderer.cpp 2012-04-05 06:31:21 +0000
@@ -251,39 +251,42 @@
251 texxform_absolute_bg.voffset = ((float) content_geo.y) / absolute_geo.height;251 texxform_absolute_bg.voffset = ((float) content_geo.y) / absolute_geo.height;
252 texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);252 texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);
253253
254 nux::Geometry blur_geo(absolute_geo.x, absolute_geo.y, content_geo.width, content_geo.height);
254 if (paint_blur)255 if (paint_blur)
255 {256 {
256 nux::Geometry blur_geo(absolute_geo.x, absolute_geo.y, content_geo.width, content_geo.height);
257 bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo);257 bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo);
258258 }
259 if (bg_blur_texture_.IsValid())259 else
260 {260 {
261 nux::Geometry bg_clip = geo;261 bg_blur_texture_ = bg_effect_helper_.GetRegion(blur_geo);
262 gfx_context.PushClippingRectangle(bg_clip);262 }
263263
264 gfx_context.GetRenderStates().SetBlend(false);264 if (bg_blur_texture_.IsValid())
265 {
266 nux::Geometry bg_clip = geo;
267 gfx_context.PushClippingRectangle(bg_clip);
268
269 gfx_context.GetRenderStates().SetBlend(false);
265#ifndef NUX_OPENGLES_20270#ifndef NUX_OPENGLES_20
266 if (gfx_context.UsingGLSLCodePath())271 if (gfx_context.UsingGLSLCodePath())
267 gfx_context.QRP_GLSL_ColorBlendOverTex (content_geo.x, content_geo.y,272 gfx_context.QRP_GLSL_ColorBlendOverTex (content_geo.x, content_geo.y,
268 content_geo.width, content_geo.height,273 content_geo.width, content_geo.height,
269 bg_blur_texture_, texxform_absolute_bg, nux::color::White,274 bg_blur_texture_, texxform_absolute_bg, nux::color::White,
270 bg_color_, nux::LAYER_BLEND_MODE_OVERLAY);275 bg_color_, nux::LAYER_BLEND_MODE_OVERLAY);
271276
272 else277 else
273 gfx_context.QRP_1Tex (content_geo.x, content_geo.y,278 gfx_context.QRP_1Tex (content_geo.x, content_geo.y,
274 content_geo.width, content_geo.height,279 content_geo.width, content_geo.height,
275 bg_blur_texture_, texxform_absolute_bg, nux::color::White);280 bg_blur_texture_, texxform_absolute_bg, nux::color::White);
276#else281#else
277 gfx_context.QRP_GLSL_ColorBlendOverTex (content_geo.x, content_geo.y,282 gfx_context.QRP_GLSL_ColorBlendOverTex (content_geo.x, content_geo.y,
278 content_geo.width, content_geo.height,283 content_geo.width, content_geo.height,
279 bg_blur_texture_, texxform_absolute_bg, nux::color::White,284 bg_blur_texture_, texxform_absolute_bg, nux::color::White,
280 bg_color_, nux::LAYER_BLEND_MODE_OVERLAY);285 bg_color_, nux::LAYER_BLEND_MODE_OVERLAY);
281286
282#endif287#endif
283 gPainter.PopBackground();
284288
285 gfx_context.PopClippingRectangle();289 gfx_context.PopClippingRectangle();
286 }
287 }290 }
288291
289 // Draw the left and top lines292 // Draw the left and top lines
@@ -376,7 +379,6 @@
376379
377void OverlayRendererImpl::DrawContent(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry)380void OverlayRendererImpl::DrawContent(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry)
378{381{
379 bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE;
380 nux::Geometry geo = geometry;382 nux::Geometry geo = geometry;
381 bgs = 0;383 bgs = 0;
382384
@@ -397,7 +399,7 @@
397 rop.SrcBlend = GL_ONE;399 rop.SrcBlend = GL_ONE;
398 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;400 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
399401
400 if (bg_blur_texture_.IsValid() && paint_blur)402 if (bg_blur_texture_.IsValid())
401 {403 {
402#ifndef NUX_OPENGLES_20404#ifndef NUX_OPENGLES_20
403 if (gfx_context.UsingGLSLCodePath())405 if (gfx_context.UsingGLSLCodePath())
404406
=== modified file 'plugins/unityshell/src/PanelView.cpp'
--- plugins/unityshell/src/PanelView.cpp 2012-03-29 03:07:39 +0000
+++ plugins/unityshell/src/PanelView.cpp 2012-04-05 06:31:21 +0000
@@ -237,12 +237,20 @@
237237
238 GfxContext.PushClippingRectangle(GetGeometry());238 GfxContext.PushClippingRectangle(GetGeometry());
239239
240 if (BackgroundEffectHelper::blur_type != BLUR_NONE && (_overlay_is_open || (_opacity != 1.0f && _opacity != 0.0f)))240 if ((_overlay_is_open || (_opacity != 1.0f && _opacity != 0.0f)))
241 {241 {
242 nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, geo.width, geo.height);242 nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, geo.width, geo.height);
243 bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo);243
244 if (BackgroundEffectHelper::blur_type != BLUR_NONE)
245 {
246 bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo);
247 }
248 else
249 {
250 bg_blur_texture_ = bg_effect_helper_.GetRegion(blur_geo);
251 }
244252
245 if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_overlay_is_open || _opacity != 1.0f))253 if (bg_blur_texture_.IsValid() && (_overlay_is_open || _opacity != 1.0f))
246 {254 {
247 nux::TexCoordXForm texxform_blur_bg;255 nux::TexCoordXForm texxform_blur_bg;
248 texxform_blur_bg.flip_v_coord = true;256 texxform_blur_bg.flip_v_coord = true;
@@ -318,7 +326,7 @@
318 GfxContext.GetRenderStates().SetBlend(true);326 GfxContext.GetRenderStates().SetBlend(true);
319 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);327 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
320328
321 if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_overlay_is_open || (_opacity != 1.0f && _opacity != 0.0f)))329 if (bg_blur_texture_.IsValid() && (_overlay_is_open || (_opacity != 1.0f && _opacity != 0.0f)))
322 {330 {
323 nux::Geometry geo_absolute = GetAbsoluteGeometry ();331 nux::Geometry geo_absolute = GetAbsoluteGeometry ();
324 nux::TexCoordXForm texxform_blur_bg;332 nux::TexCoordXForm texxform_blur_bg;
325333
=== modified file 'plugins/unityshell/src/PlacesGroup.cpp'
--- plugins/unityshell/src/PlacesGroup.cpp 2012-03-21 14:18:06 +0000
+++ plugins/unityshell/src/PlacesGroup.cpp 2012-04-05 06:31:21 +0000
@@ -426,8 +426,6 @@
426 nux::Geometry const& base = GetGeometry();426 nux::Geometry const& base = GetGeometry();
427 graphics_engine.PushClippingRectangle(base);427 graphics_engine.PushClippingRectangle(base);
428428
429 nux::GetPainter().PaintBackground(graphics_engine, base);
430
431 if (ShouldBeHighlighted())429 if (ShouldBeHighlighted())
432 {430 {
433 nux::Geometry geo(_header_layout->GetGeometry());431 nux::Geometry geo(_header_layout->GetGeometry());
434432
=== modified file 'plugins/unityshell/src/ResultViewGrid.cpp'
--- plugins/unityshell/src/ResultViewGrid.cpp 2012-03-21 14:18:06 +0000
+++ plugins/unityshell/src/ResultViewGrid.cpp 2012-04-05 06:31:21 +0000
@@ -620,8 +620,6 @@
620620
621void ResultViewGrid::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)621void ResultViewGrid::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
622{622{
623 gPainter.PaintBackground(GfxContext, GetGeometry());
624
625 int items_per_row = GetItemsPerRow();623 int items_per_row = GetItemsPerRow();
626 uint total_rows = (!expanded) ? 0 : (results_.size() / items_per_row) + 1;624 uint total_rows = (!expanded) ? 0 : (results_.size() / items_per_row) + 1;
627625
628626
=== modified file 'plugins/unityshell/src/ScreenEffectFramebufferObject.cpp'
--- plugins/unityshell/src/ScreenEffectFramebufferObject.cpp 2012-03-14 06:24:18 +0000
+++ plugins/unityshell/src/ScreenEffectFramebufferObject.cpp 2012-04-05 06:31:21 +0000
@@ -101,9 +101,6 @@
101101
102void unity::ScreenEffectFramebufferObject::bind (const nux::Geometry &output)102void unity::ScreenEffectFramebufferObject::bind (const nux::Geometry &output)
103{103{
104 if (!BackgroundEffectHelper::HasDirtyHelpers())
105 return;
106
107 /* Clear the error bit */104 /* Clear the error bit */
108 glGetError ();105 glGetError ();
109106
110107
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-04-05 03:28:27 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-04-05 06:31:21 +0000
@@ -128,6 +128,8 @@
128 , painting_tray_ (false)128 , painting_tray_ (false)
129 , last_scroll_event_(0)129 , last_scroll_event_(0)
130 , hud_keypress_time_(0)130 , hud_keypress_time_(0)
131 , panel_texture_has_changed_(true)
132 , paint_panel_(false)
131{133{
132 Timer timer;134 Timer timer;
133 gfloat version;135 gfloat version;
@@ -371,8 +373,11 @@
371373
372 RaiseInputWindows();374 RaiseInputWindows();
373 });375 });
374 LOG_INFO(logger) << "UnityScreen constructed: " << timer.ElapsedSeconds() << "s";376
377 LOG_INFO(logger) << "UnityScreen constructed: " << timer.ElapsedSeconds() << "s";
375 }378 }
379
380 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &UnityScreen::OnPanelStyleChanged));
376}381}
377382
378UnityScreen::~UnityScreen()383UnityScreen::~UnityScreen()
@@ -723,6 +728,12 @@
723 wy = y + (last_bound.height - height) / 2;728 wy = y + (last_bound.height - height) / 2;
724}729}
725730
731void
732UnityScreen::OnPanelStyleChanged()
733{
734 panel_texture_has_changed_ = true;
735}
736
726#ifdef USE_GLES737#ifdef USE_GLES
727void UnityScreen::paintDisplay()738void UnityScreen::paintDisplay()
728#else739#else
@@ -734,6 +745,37 @@
734745
735#ifndef USE_GLES746#ifndef USE_GLES
736 bool was_bound = _fbo->bound ();747 bool was_bound = _fbo->bound ();
748
749 if (was_bound && launcher_controller_->IsOverlayOpen() && paint_panel_)
750 {
751 if (panel_texture_has_changed_ || !panel_texture_.IsValid())
752 {
753 panel_texture_.Release();
754
755 nux::NBitmapData* bitmap = panel::Style::Instance().GetBackground(screen->width (), screen->height(), 1.0f);
756 nux::BaseTexture* texture2D = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture();
757 if (bitmap && texture2D)
758 {
759 texture2D->Update(bitmap);
760 panel_texture_ = texture2D->GetDeviceTexture();
761 texture2D->UnReference();
762 delete bitmap;
763 }
764 panel_texture_has_changed_ = false;
765 }
766
767 if (panel_texture_.IsValid())
768 {
769 nux::GetGraphicsDisplay()->GetGraphicsEngine()->ResetModelViewMatrixStack();
770 nux::GetGraphicsDisplay()->GetGraphicsEngine()->Push2DTranslationModelViewMatrix(0.0f, 0.0f, 0.0f);
771 nux::GetGraphicsDisplay()->GetGraphicsEngine()->ResetProjectionMatrix();
772 nux::GetGraphicsDisplay()->GetGraphicsEngine()->SetOrthographicProjectionMatrix(screen->width (), screen->height());
773
774 nux::TexCoordXForm texxform;
775 nux::GetGraphicsDisplay()->GetGraphicsEngine()->QRP_GLSL_1Tex(0, 0, screen->width (), 24, panel_texture_, texxform, nux::color::White);
776 }
777 }
778
737 _fbo->unbind ();779 _fbo->unbind ();
738780
739 /* Draw the bit of the relevant framebuffer for each output */781 /* Draw the bit of the relevant framebuffer for each output */
@@ -748,7 +790,7 @@
748 glPopMatrix ();790 glPopMatrix ();
749 }791 }
750792
751 nux::ObjectPtr<nux::IOpenGLTexture2D> device_texture =793 nux::ObjectPtr<nux::IOpenGLBaseTexture> device_texture =
752 nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(_fbo->texture(),794 nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(_fbo->texture(),
753 screen->width (), screen->height(), 1, nux::BITFMT_R8G8B8A8);795 screen->width (), screen->height(), 1, nux::BITFMT_R8G8B8A8);
754#else796#else
@@ -1217,6 +1259,7 @@
1217 doShellRepaint = true;1259 doShellRepaint = true;
1218 allowWindowPaint = true;1260 allowWindowPaint = true;
1219 _last_output = output;1261 _last_output = output;
1262 paint_panel_ = false;
12201263
1221#ifndef USE_GLES1264#ifndef USE_GLES
1222 /* bind the framebuffer here1265 /* bind the framebuffer here
@@ -2214,6 +2257,22 @@
2214 const CompRegion& region,2257 const CompRegion& region,
2215 unsigned int mask)2258 unsigned int mask)
2216{2259{
2260 if (uScreen->doShellRepaint && !uScreen->paint_panel_ && window->type() == CompWindowTypeNormalMask)
2261 {
2262 guint32 id = window->id();
2263 bool maximized = WindowManager::Default()->IsWindowMaximized(id);
2264 bool on_current = window->onCurrentDesktop();
2265 bool override_redirect = window->overrideRedirect();
2266 bool managed = window->managed();
2267 CompPoint viewport = window->defaultViewport();
2268 int output = window->outputDevice();
2269
2270 if (maximized && on_current && !override_redirect && managed && viewport == uScreen->screen->vp() && output == (int)uScreen->screen->currentOutputDev().id())
2271 {
2272 uScreen->paint_panel_ = true;
2273 }
2274 }
2275
2217 if (uScreen->doShellRepaint && !uScreen->forcePaintOnTop ())2276 if (uScreen->doShellRepaint && !uScreen->forcePaintOnTop ())
2218 {2277 {
2219 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();2278 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();
@@ -2222,6 +2281,7 @@
2222 for (CompWindow* w = window; w && uScreen->doShellRepaint; w = w->prev)2281 for (CompWindow* w = window; w && uScreen->doShellRepaint; w = w->prev)
2223 {2282 {
2224 auto id = w->id();2283 auto id = w->id();
2284
2225 for (unsigned int i = 0; i < size; ++i)2285 for (unsigned int i = 0; i < size; ++i)
2226 {2286 {
2227 if (xwns[i] == id)2287 if (xwns[i] == id)
22282288
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2012-04-05 03:21:31 +0000
+++ plugins/unityshell/src/unityshell.h 2012-04-05 06:31:21 +0000
@@ -273,6 +273,8 @@
273273
274 void InitHints();274 void InitHints();
275275
276 void OnPanelStyleChanged();
277
276 dash::Settings dash_settings_;278 dash::Settings dash_settings_;
277 dash::Style dash_style_;279 dash::Style dash_style_;
278 panel::Style panel_style_;280 panel::Style panel_style_;
@@ -342,6 +344,10 @@
342344
343 GLMatrix panel_shadow_matrix_;345 GLMatrix panel_shadow_matrix_;
344346
347 bool panel_texture_has_changed_;
348 bool paint_panel_;
349 nux::ObjectPtr<nux::IOpenGLBaseTexture> panel_texture_;
350
345#ifndef USE_GLES351#ifndef USE_GLES
346 ScreenEffectFramebufferObject::GLXGetProcAddressProc glXGetProcAddressP;352 ScreenEffectFramebufferObject::GLXGetProcAddressProc glXGetProcAddressP;
347#endif353#endif