From 7ed4c209febb5c8dd5169cb4bc946aa5570edb6d Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Thu, 4 Sep 2025 11:06:54 -0400 Subject: [PATCH] Optims: replaced a bunch of Qt.rgba by Qt.alpha --- Modules/Background/Overview.qml | 4 +--- Modules/Background/ScreenCorners.qml | 15 +++++++-------- Modules/Bar/Bar.qml | 2 +- Modules/Launcher/Launcher.qml | 3 +-- Modules/LockScreen/LockScreen.qml | 4 ++-- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Modules/Background/Overview.qml b/Modules/Background/Overview.qml index fac841e..39e00cf 100644 --- a/Modules/Background/Overview.qml +++ b/Modules/Background/Overview.qml @@ -68,9 +68,7 @@ Variants { // Make the overview darker Rectangle { anchors.fill: parent - color: Settings.data.colorSchemes.darkMode ? Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b, - 0.5) : Qt.rgba(Color.mOnSurface.r, Color.mOnSurface.g, - Color.mOnSurface.b, 0.5) + color: Settings.data.colorSchemes.darkMode ? Qt.alpha(Color.mSurface, Style.opacityMedium) : Qt.alpha(Color.mOnSurface, Style.opacityMedium) } } } diff --git a/Modules/Background/ScreenCorners.qml b/Modules/Background/ScreenCorners.qml index c18a888..ae1709e 100644 --- a/Modules/Background/ScreenCorners.qml +++ b/Modules/Background/ScreenCorners.qml @@ -19,8 +19,7 @@ Loader { property real scaling: ScalingService.getScreenScale(screen) screen: modelData - property color cornerColor: Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b, - Settings.data.bar.backgroundOpacity) + property color cornerColor: Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity) property real cornerRadius: 20 * scaling property real cornerSize: 20 * scaling @@ -55,6 +54,8 @@ Loader { && Settings.data.bar.backgroundOpacity > 0 ? Math.round(Style.barHeight * scaling) : 0 } + mask: Region {} + // Top-left concave corner Canvas { id: topLeftCorner @@ -75,7 +76,7 @@ Loader { ctx.clearRect(0, 0, width, height) // Fill the entire area with the corner color - ctx.fillStyle = Qt.rgba(root.cornerColor.r, root.cornerColor.g, root.cornerColor.b, root.cornerColor.a) + ctx.fillStyle = root.cornerColor ctx.fillRect(0, 0, width, height) // Cut out the rounded corner using destination-out @@ -123,7 +124,7 @@ Loader { ctx.reset() ctx.clearRect(0, 0, width, height) - ctx.fillStyle = Qt.rgba(root.cornerColor.r, root.cornerColor.g, root.cornerColor.b, root.cornerColor.a) + ctx.fillStyle = root.cornerColor ctx.fillRect(0, 0, width, height) ctx.globalCompositeOperation = "destination-out" @@ -170,7 +171,7 @@ Loader { ctx.reset() ctx.clearRect(0, 0, width, height) - ctx.fillStyle = Qt.rgba(root.cornerColor.r, root.cornerColor.g, root.cornerColor.b, root.cornerColor.a) + ctx.fillStyle = root.cornerColor ctx.fillRect(0, 0, width, height) ctx.globalCompositeOperation = "destination-out" @@ -217,7 +218,7 @@ Loader { ctx.reset() ctx.clearRect(0, 0, width, height) - ctx.fillStyle = Qt.rgba(root.cornerColor.r, root.cornerColor.g, root.cornerColor.b, root.cornerColor.a) + ctx.fillStyle = root.cornerColor ctx.fillRect(0, 0, width, height) ctx.globalCompositeOperation = "destination-out" @@ -244,8 +245,6 @@ Loader { } } } - - mask: Region {} } } } diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index 7365227..18b7fc7 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -54,7 +54,7 @@ Variants { id: bar anchors.fill: parent - color: Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b, Settings.data.bar.backgroundOpacity) + color: Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity) layer.enabled: true } diff --git a/Modules/Launcher/Launcher.qml b/Modules/Launcher/Launcher.qml index 098b71b..b249820 100644 --- a/Modules/Launcher/Launcher.qml +++ b/Modules/Launcher/Launcher.qml @@ -23,8 +23,7 @@ NPanel { } panelKeyboardFocus: true - panelBackgroundColor: Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b, - Settings.data.appLauncher.backgroundOpacity) + panelBackgroundColor: Qt.alpha(Color.mSurface, Settings.data.appLauncher.backgroundOpacity) // Positioning readonly property string launcherPosition: Settings.data.appLauncher.position diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index c0d5ae0..83ed66f 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -134,7 +134,7 @@ Loader { width: Math.random() * 4 + 2 height: width radius: width * 0.5 - color: Qt.rgba(Color.mPrimary.r, Color.mPrimary.g, Color.mPrimary.b, 0.3) + color: Qt.alpha(Color.mPrimary, 0.3) x: Math.random() * parent.width y: Math.random() * parent.height @@ -333,7 +333,7 @@ Loader { height: parent.height + 24 * scaling radius: width * 0.5 color: Color.transparent - border.color: Qt.rgba(Color.mPrimary.r, Color.mPrimary.g, Color.mPrimary.b, 0.3) + border.color: Qt.alpha(Color.mPrimary, 0.3) border.width: Math.max(1, Style.borderM * scaling) z: -1 visible: !MediaService.isPlaying