Optims: replaced a bunch of Qt.rgba by Qt.alpha

This commit is contained in:
LemmyCook 2025-09-04 11:06:54 -04:00
parent 43bb3bdd0c
commit 7ed4c209fe
5 changed files with 12 additions and 16 deletions

View file

@ -68,9 +68,7 @@ Variants {
// Make the overview darker // Make the overview darker
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Settings.data.colorSchemes.darkMode ? Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b, color: Settings.data.colorSchemes.darkMode ? Qt.alpha(Color.mSurface, Style.opacityMedium) : Qt.alpha(Color.mOnSurface, Style.opacityMedium)
0.5) : Qt.rgba(Color.mOnSurface.r, Color.mOnSurface.g,
Color.mOnSurface.b, 0.5)
} }
} }
} }

View file

@ -19,8 +19,7 @@ Loader {
property real scaling: ScalingService.getScreenScale(screen) property real scaling: ScalingService.getScreenScale(screen)
screen: modelData screen: modelData
property color cornerColor: Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b, property color cornerColor: Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity)
Settings.data.bar.backgroundOpacity)
property real cornerRadius: 20 * scaling property real cornerRadius: 20 * scaling
property real cornerSize: 20 * scaling property real cornerSize: 20 * scaling
@ -55,6 +54,8 @@ Loader {
&& Settings.data.bar.backgroundOpacity > 0 ? Math.round(Style.barHeight * scaling) : 0 && Settings.data.bar.backgroundOpacity > 0 ? Math.round(Style.barHeight * scaling) : 0
} }
mask: Region {}
// Top-left concave corner // Top-left concave corner
Canvas { Canvas {
id: topLeftCorner id: topLeftCorner
@ -75,7 +76,7 @@ Loader {
ctx.clearRect(0, 0, width, height) ctx.clearRect(0, 0, width, height)
// Fill the entire area with the corner color // 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) ctx.fillRect(0, 0, width, height)
// Cut out the rounded corner using destination-out // Cut out the rounded corner using destination-out
@ -123,7 +124,7 @@ Loader {
ctx.reset() ctx.reset()
ctx.clearRect(0, 0, width, height) 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.fillRect(0, 0, width, height)
ctx.globalCompositeOperation = "destination-out" ctx.globalCompositeOperation = "destination-out"
@ -170,7 +171,7 @@ Loader {
ctx.reset() ctx.reset()
ctx.clearRect(0, 0, width, height) 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.fillRect(0, 0, width, height)
ctx.globalCompositeOperation = "destination-out" ctx.globalCompositeOperation = "destination-out"
@ -217,7 +218,7 @@ Loader {
ctx.reset() ctx.reset()
ctx.clearRect(0, 0, width, height) 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.fillRect(0, 0, width, height)
ctx.globalCompositeOperation = "destination-out" ctx.globalCompositeOperation = "destination-out"
@ -244,8 +245,6 @@ Loader {
} }
} }
} }
mask: Region {}
} }
} }
} }

View file

@ -54,7 +54,7 @@ Variants {
id: bar id: bar
anchors.fill: parent 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 layer.enabled: true
} }

View file

@ -23,8 +23,7 @@ NPanel {
} }
panelKeyboardFocus: true panelKeyboardFocus: true
panelBackgroundColor: Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b, panelBackgroundColor: Qt.alpha(Color.mSurface, Settings.data.appLauncher.backgroundOpacity)
Settings.data.appLauncher.backgroundOpacity)
// Positioning // Positioning
readonly property string launcherPosition: Settings.data.appLauncher.position readonly property string launcherPosition: Settings.data.appLauncher.position

View file

@ -134,7 +134,7 @@ Loader {
width: Math.random() * 4 + 2 width: Math.random() * 4 + 2
height: width height: width
radius: width * 0.5 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 x: Math.random() * parent.width
y: Math.random() * parent.height y: Math.random() * parent.height
@ -333,7 +333,7 @@ Loader {
height: parent.height + 24 * scaling height: parent.height + 24 * scaling
radius: width * 0.5 radius: width * 0.5
color: Color.transparent 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) border.width: Math.max(1, Style.borderM * scaling)
z: -1 z: -1
visible: !MediaService.isPlaying visible: !MediaService.isPlaying