Switch DropShadow for RectangularGlow on lockscreen to improve performance

DropShadow requires actually sampling and blurring the source element, while RectangularGlow just creates a generic rectangle without caring about the source element. This greatly improves the speed of everything on the lockscreen, especially notifications (they aren't a laggy mess when you have a ton of them now)
This commit is contained in:
Devin Lin 2021-03-17 15:37:58 -04:00
parent f1ab00cb3c
commit 3f985548e8
2 changed files with 31 additions and 34 deletions

View file

@ -133,6 +133,16 @@ Rectangle {
}
}
RectangularGlow {
anchors.topMargin: 1
anchors.fill: topTextDisplay
cached: true
glowRadius: 4
spread: 0.2
color: keypadRoot.dropShadowColor
opacity: (Math.sin(2*((Math.PI / 2) * keypadRoot.swipeProgress + 1.5 * Math.PI)) + 1)
}
// rectangle "bar" on the top of the keypad
Rectangle {
id: topTextDisplay
@ -144,18 +154,6 @@ Rectangle {
opacity: (Math.sin(2*((Math.PI / 2) * keypadRoot.swipeProgress + 1.5 * Math.PI)) + 1)
}
DropShadow {
anchors.fill: topTextDisplay
source: topTextDisplay
cached: true
horizontalOffset: 0
verticalOffset: 1
radius: 4
samples: 6
color: keypadRoot.dropShadowColor
opacity: (Math.sin(2*((Math.PI / 2) * keypadRoot.swipeProgress + 1.5 * Math.PI)) + 1)
}
// pin dot display
Item {
anchors.verticalCenter: topTextDisplay.verticalCenter
@ -227,6 +225,17 @@ Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
RectangularGlow {
anchors.topMargin: 1
anchors.fill: keyRect
cornerRadius: keyRect.radius * 2
cached: true
glowRadius: 2
spread: 0.2
color: keypadRoot.dropShadowColor
opacity: (Math.sin(2*((Math.PI / 2) * keypadRoot.swipeProgress + 1.5 * Math.PI)) + 1)
}
Rectangle {
id: keyRect
anchors.centerIn: parent
@ -265,18 +274,6 @@ Rectangle {
}
}
DropShadow {
anchors.fill: keyRect
source: keyRect
cached: true
horizontalOffset: 0
verticalOffset: 1
radius: 4
samples: 6
color: keypadRoot.dropShadowColor
opacity: (Math.sin(2*((Math.PI / 2) * keypadRoot.swipeProgress + 1.5 * Math.PI)) + 1)
}
PlasmaComponents.Label {
visible: modelData !== "R" && modelData !== "E"
text: modelData

View file

@ -31,6 +31,16 @@ Item {
opacity: 1 - Math.min(1, 1.5 * Math.abs(rect.x) / width) // opacity during dismiss swipe
RectangularGlow {
anchors.topMargin: 1
anchors.leftMargin: 1
anchors.fill: rect
cornerRadius: rect.radius * 2
glowRadius: 2
spread: 0.2
color: "#616161"
}
// notification
Rectangle {
id: rect
@ -202,14 +212,4 @@ Item {
}
}
}
DropShadow {
anchors.fill: rect
source: rect
horizontalOffset: 1
verticalOffset: 1
radius: 4
samples: 6
color: "#616161"
}
}