From ba2496ca128fe6ded29fdbdea4fd5ce48582ad6c Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Wed, 16 Mar 2022 23:42:46 +0000 Subject: [PATCH] [aurorae] do not make any blur calculations when blur is not supported when an aurorae theme does not contain "mask" element we can safely assume that blur is not supported. In such case all blur calculations must not run at all. This will make all solid aurorae themes much lighter by default. --- src/plugins/kdecorations/aurorae/src/aurorae.cpp | 5 ++++- src/plugins/kdecorations/aurorae/src/aurorae.h | 2 ++ src/plugins/kdecorations/aurorae/src/qml/aurorae.qml | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/kdecorations/aurorae/src/aurorae.cpp b/src/plugins/kdecorations/aurorae/src/aurorae.cpp index 44217b2c83..663b0ebffa 100644 --- a/src/plugins/kdecorations/aurorae/src/aurorae.cpp +++ b/src/plugins/kdecorations/aurorae/src/aurorae.cpp @@ -321,6 +321,9 @@ void Decoration::init() connect(m_view->contentItem(), &QQuickItem::heightChanged, m_item, updateSize); connect(m_view, &KWin::OffscreenQuickView::repaintNeeded, this, &Decoration::updateBuffer); } + + m_supportsMask = m_item->property("supportsMask").toBool(); + setupBorders(m_item); @@ -572,7 +575,7 @@ void Decoration::updateExtendedBorders() void Decoration::updateBlur() { - if (!m_item) { + if (!m_item || !m_supportsMask) { return; } diff --git a/src/plugins/kdecorations/aurorae/src/aurorae.h b/src/plugins/kdecorations/aurorae/src/aurorae.h index 793a9ecd71..46c5a5ffd9 100644 --- a/src/plugins/kdecorations/aurorae/src/aurorae.h +++ b/src/plugins/kdecorations/aurorae/src/aurorae.h @@ -68,6 +68,8 @@ private: void updateBuffer(); void updateExtendedBorders(); + bool m_supportsMask{false}; + QRect m_contentRect; //the geometry of the part of the buffer that is not a shadow when buffer was created. QQuickItem *m_item = nullptr; QQmlContext *m_qmlContext = nullptr; diff --git a/src/plugins/kdecorations/aurorae/src/qml/aurorae.qml b/src/plugins/kdecorations/aurorae/src/qml/aurorae.qml index e167e5ec61..41c35b4474 100644 --- a/src/plugins/kdecorations/aurorae/src/qml/aurorae.qml +++ b/src/plugins/kdecorations/aurorae/src/qml/aurorae.qml @@ -11,6 +11,7 @@ Decoration { id: root property bool animate: false property alias decorationMask: maskItem.mask + property alias supportsMask: backgroundSvg.supportsMask Component.onCompleted: { borders.left = Qt.binding(function() { return Math.max(0, auroraeTheme.borderLeft);}); borders.right = Qt.binding(function() { return Math.max(0, auroraeTheme.borderRight);}); @@ -42,6 +43,7 @@ Decoration { } PlasmaCore.FrameSvg { property bool supportsInactive: hasElementPrefix("decoration-inactive") + property bool supportsMask: hasElementPrefix("mask") property bool supportsMaximized: hasElementPrefix("decoration-maximized") property bool supportsMaximizedInactive: hasElementPrefix("decoration-maximized-inactive") property bool supportsInnerBorder: hasElementPrefix("innerborder")