Optimization: caching to GPU texture when no animations.

This commit is contained in:
ItsLemmy
2025-11-08 22:25:41 -05:00
parent 168bf54f41
commit 4b751df53f
2 changed files with 316 additions and 294 deletions
+112 -104
View File
@@ -25,125 +25,133 @@ Item {
anchors.fill: parent
// The unified Shape container
Shape {
id: backgroundsShape
// Wrapper with layer caching for better shadow performance
Item {
anchors.fill: parent
// Use curve renderer for smooth corners
preferredRendererType: Shape.CurveRenderer
// Enable layer caching to prevent continuous re-rendering
// This caches the Shape to a GPU texture, reducing GPU tessellation overhead
layer.enabled: true
// CRITICAL: Shape must not block mouse input!
// ShapePaths inside will render, but the Shape container itself should be transparent to input
enabled: false // Disable mouse input on the Shape itself
// The unified Shape container
Shape {
id: backgroundsShape
anchors.fill: parent
Component.onCompleted: {
Logger.d("AllBackgrounds", "AllBackgrounds initialized")
Logger.d("AllBackgrounds", " bar:", root.bar)
Logger.d("AllBackgrounds", " windowRoot:", root.windowRoot)
}
// Use curve renderer for smooth corners (GPU-accelerated)
preferredRendererType: Shape.CurveRenderer
enabled: false // Disable mouse input on the Shape itself
Component.onCompleted: {
Logger.d("AllBackgrounds", "AllBackgrounds initialized")
Logger.d("AllBackgrounds", " bar:", root.bar)
Logger.d("AllBackgrounds", " windowRoot:", root.windowRoot)
}
/**
/**
* Bar
*/
BarBackground {
bar: root.bar
shapeContainer: backgroundsShape
}
BarBackground {
bar: root.bar
shapeContainer: backgroundsShape
}
/**
/**
* Panels
*/
// Audio
PanelBackground {
panel: root.windowRoot.audioPanel
shapeContainer: backgroundsShape
// Audio
PanelBackground {
panel: root.windowRoot.audioPanel
shapeContainer: backgroundsShape
}
// Battery
PanelBackground {
panel: root.windowRoot.batteryPanel
shapeContainer: backgroundsShape
}
// Bluetooth
PanelBackground {
panel: root.windowRoot.bluetoothPanel
shapeContainer: backgroundsShape
}
// Calendar
PanelBackground {
panel: root.windowRoot.calendarPanel
shapeContainer: backgroundsShape
}
// Control Center
PanelBackground {
panel: root.windowRoot.controlCenterPanel
shapeContainer: backgroundsShape
}
// Launcher
PanelBackground {
panel: root.windowRoot.launcherPanel
shapeContainer: backgroundsShape
}
// Notification History
PanelBackground {
panel: root.windowRoot.notificationHistoryPanel
shapeContainer: backgroundsShape
}
// Session Menu
PanelBackground {
panel: root.windowRoot.sessionMenuPanel
shapeContainer: backgroundsShape
}
// Settings
PanelBackground {
panel: root.windowRoot.settingsPanel
shapeContainer: backgroundsShape
}
// Setup Wizard
PanelBackground {
panel: root.windowRoot.setupWizardPanel
shapeContainer: backgroundsShape
}
// TrayDrawer
PanelBackground {
panel: root.windowRoot.trayDrawerPanel
shapeContainer: backgroundsShape
}
// TrayMenu
PanelBackground {
panel: root.windowRoot.trayMenuPanel
shapeContainer: backgroundsShape
}
// Wallpaper
PanelBackground {
panel: root.windowRoot.wallpaperPanel
shapeContainer: backgroundsShape
}
// WiFi
PanelBackground {
panel: root.windowRoot.wifiPanel
shapeContainer: backgroundsShape
}
}
// Battery
PanelBackground {
panel: root.windowRoot.batteryPanel
shapeContainer: backgroundsShape
// Apply shadow to the cached layer
NDropShadows {
anchors.fill: parent
source: backgroundsShape
}
// Bluetooth
PanelBackground {
panel: root.windowRoot.bluetoothPanel
shapeContainer: backgroundsShape
}
// Calendar
PanelBackground {
panel: root.windowRoot.calendarPanel
shapeContainer: backgroundsShape
}
// Control Center
PanelBackground {
panel: root.windowRoot.controlCenterPanel
shapeContainer: backgroundsShape
}
// Launcher
PanelBackground {
panel: root.windowRoot.launcherPanel
shapeContainer: backgroundsShape
}
// Notification History
PanelBackground {
panel: root.windowRoot.notificationHistoryPanel
shapeContainer: backgroundsShape
}
// Session Menu
PanelBackground {
panel: root.windowRoot.sessionMenuPanel
shapeContainer: backgroundsShape
}
// Settings
PanelBackground {
panel: root.windowRoot.settingsPanel
shapeContainer: backgroundsShape
}
// Setup Wizard
PanelBackground {
panel: root.windowRoot.setupWizardPanel
shapeContainer: backgroundsShape
}
// TrayDrawer
PanelBackground {
panel: root.windowRoot.trayDrawerPanel
shapeContainer: backgroundsShape
}
// TrayMenu
PanelBackground {
panel: root.windowRoot.trayMenuPanel
shapeContainer: backgroundsShape
}
// Wallpaper
PanelBackground {
panel: root.windowRoot.wallpaperPanel
shapeContainer: backgroundsShape
}
// WiFi
PanelBackground {
panel: root.windowRoot.wifiPanel
shapeContainer: backgroundsShape
}
}
NDropShadows {
anchors.fill: parent
source: backgroundsShape
}
}