diff options
| author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2013-11-21 16:06:58 +0000 |
|---|---|---|
| committer | Tarmac <> | 2013-11-21 16:06:58 +0000 |
| commit | 8e0868523fee70ac29bf7a9a3f25a7c75bf5317f (patch) | |
| tree | 1e67a8392c75602b20dca0bd801a26dde9fd6a7b /unity-shared | |
| parent | 4a7655cf6a14d050a1e6c4ef64e001a2c1cfcced (diff) | |
| parent | 9096dfeddc269fba8adaf6ca9ccd3265c727245c (diff) | |
SwitcherView: define a custom GeometryGetterFunc and notify helper on changes
Thanks to this the switcher won't make BackgroundEffectHelper to create a blurred area as big as the current monitor (with just a small padding), but an area big enough to draw its background. This get updated automagically when the switcher view changes its geometry... Also, use nux::AnimateValue for switcher animations, making compiz to orchestrate it and only redraw the view if an icon changed since the last progress iteration. We don't want the switcher to be drawn unless its geometry or an icon changes. Also we don't want to redraw the switcher multiple times if only a not-animated parameter of an icon (such as a pip or the selection glow) has changed. As bonus, reduce lots of list copies. Approved by Christopher Townsend, PS Jenkins bot. (bzr r3601)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/AbstractIconRenderer.h | 35 | ||||
| -rw-r--r-- | unity-shared/UnityWindowView.cpp | 27 | ||||
| -rw-r--r-- | unity-shared/UnityWindowView.h | 2 |
3 files changed, 56 insertions, 8 deletions
diff --git a/unity-shared/AbstractIconRenderer.h b/unity-shared/AbstractIconRenderer.h index 8cc1ae8d5..b5c922393 100644 --- a/unity-shared/AbstractIconRenderer.h +++ b/unity-shared/AbstractIconRenderer.h @@ -93,6 +93,41 @@ public: int window_indicators; char shortcut_label; + bool operator==(RenderArg const& other) const + { + return (icon == other.icon && + render_center == other.render_center && + logical_center == other.logical_center && + rotation == other.rotation && + colorify == other.colorify && + alpha == other.alpha && + saturation == other.saturation && + backlight_intensity == other.backlight_intensity && + glow_intensity == other.glow_intensity && + shimmer_progress == other.shimmer_progress && + progress == other.progress && + progress_bias == other.progress_bias && + running_arrow == other.running_arrow && + running_colored == other.running_colored && + running_on_viewport == other.running_on_viewport && + draw_edge_only == other.draw_edge_only && + active_arrow == other.active_arrow && + active_colored == other.active_colored && + skip == other.skip && + stick_thingy == other.stick_thingy && + keyboard_nav_hl == other.keyboard_nav_hl && + draw_shortcut == other.draw_shortcut && + system_item == other.system_item && + colorify_background == other.colorify_background && + window_indicators == other.window_indicators && + shortcut_label == other.shortcut_label); + } + + bool operator!=(RenderArg const& other) const + { + return !operator==(other); + } + protected: // Introspectable methods std::string GetName() const { return "RenderArgs"; } diff --git a/unity-shared/UnityWindowView.cpp b/unity-shared/UnityWindowView.cpp index d6c4beb33..576c0ac3c 100644 --- a/unity-shared/UnityWindowView.cpp +++ b/unity-shared/UnityWindowView.cpp @@ -61,6 +61,11 @@ UnityWindowView::~UnityWindowView() bounding_area_->UnParentObject(); } +void UnityWindowView::SetBackgroundHelperGeometryGetter(BackgroundEffectHelper::GeometryGetterFunc const& func) +{ + bg_helper_.SetGeometryGetter(func); +} + nux::Area* UnityWindowView::FindAreaUnderMouse(const nux::Point& mouse, nux::NuxEventType etype) { if (close_button_ && close_button_->TestMousePointerInclusionFilterMouseWheel(mouse, etype)) @@ -180,6 +185,11 @@ nux::Geometry UnityWindowView::GetInternalBackground() return GetBackgroundGeometry().GetExpand(-offset, -offset); } +nux::Geometry UnityWindowView::GetBlurredBackgroundGeometry() +{ + return GetBackgroundGeometry(); +} + nux::ObjectPtr<nux::InputArea> UnityWindowView::GetBoundingArea() { if (!bounding_area_) @@ -209,8 +219,6 @@ void UnityWindowView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) nux::Geometry const& internal_clip = GetInternalBackground(); GfxContext.PushClippingRectangle(internal_clip); ++push; - nux::Geometry const& blur_geo = GetAbsoluteGeometry(); - if (BackgroundEffectHelper::blur_type != BLUR_NONE) { bg_texture_ = bg_helper_.GetBlurRegion(); @@ -222,11 +230,10 @@ void UnityWindowView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) if (bg_texture_.IsValid()) { + nux::Geometry const& bg_geo = GetBlurredBackgroundGeometry(); nux::TexCoordXForm texxform_blur_bg; texxform_blur_bg.flip_v_coord = true; texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); - texxform_blur_bg.uoffset = base.x / static_cast<float>(blur_geo.width); - texxform_blur_bg.voffset = base.y / static_cast<float>(blur_geo.height); nux::ROPConfig rop; rop.Blend = false; @@ -237,27 +244,31 @@ void UnityWindowView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) if (GfxContext.UsingGLSLCodePath()) { auto temp_background_color = background_color(); + auto blend_mode = nux::LAYER_BLEND_MODE_OVERLAY; if (Settings::Instance().GetLowGfxMode()) + { temp_background_color.alpha = 1.0f; + blend_mode = nux::LAYER_BLEND_MODE_NORMAL; + } - gPainter.PushDrawCompositionLayer(GfxContext, base, + gPainter.PushDrawCompositionLayer(GfxContext, bg_geo, bg_texture_, texxform_blur_bg, nux::color::White, temp_background_color, - Settings::Instance().GetLowGfxMode() ? nux::LAYER_BLEND_MODE_NORMAL : nux::LAYER_BLEND_MODE_OVERLAY, + blend_mode, true, rop); } else - gPainter.PushDrawTextureLayer(GfxContext, base, + gPainter.PushDrawTextureLayer(GfxContext, bg_geo, bg_texture_, texxform_blur_bg, nux::color::White, true, rop); #else - gPainter.PushDrawCompositionLayer(GfxContext, base, + gPainter.PushDrawCompositionLayer(GfxContext, bg_geo, bg_texture_, texxform_blur_bg, nux::color::White, diff --git a/unity-shared/UnityWindowView.h b/unity-shared/UnityWindowView.h index 30a633d32..9e2042a09 100644 --- a/unity-shared/UnityWindowView.h +++ b/unity-shared/UnityWindowView.h @@ -61,6 +61,8 @@ protected: virtual void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry const& clip) = 0; nux::Geometry GetInternalBackground(); virtual nux::Geometry GetBackgroundGeometry() = 0; + virtual nux::Geometry GetBlurredBackgroundGeometry(); + void SetBackgroundHelperGeometryGetter(BackgroundEffectHelper::GeometryGetterFunc const&); // Introspectable methods std::string GetName() const; |
