diff options
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; |
