1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-13 14:36:32 -04:00

Refactor shadow handling & improve connected chrome rendering

This commit is contained in:
purian23
2026-06-10 09:34:42 -04:00
parent f8b32cc298
commit e95c80011f
20 changed files with 434 additions and 618 deletions
+10 -39
View File
@@ -1,13 +1,12 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Shapes
import qs.Common
// Frame perimeter ring: the full window rectangle with a rounded-rectangle
// cutout. Drawn as a single even-odd Shape so the ring is one primitive: no
// full-output mask textures, and a translucent fill never double-blends at the
// corners.
// cutout, rendered as a signed-distance field with analytic antialiasing.
// One primitive: no full-output mask textures, no corner double-blend, crisp
// edges at any scale without an FBO.
Item {
id: root
@@ -20,42 +19,14 @@ Item {
required property real cutoutRadius
property color borderColor: Qt.rgba(SettingsData.effectiveFrameColor.r, SettingsData.effectiveFrameColor.g, SettingsData.effectiveFrameColor.b, SettingsData.frameOpacity)
// Path elements can't reference `parent`; expose cutout edges as root props.
readonly property real _left: cutoutLeftInset
readonly property real _top: cutoutTopInset
readonly property real _right: width - cutoutRightInset
readonly property real _bottom: height - cutoutBottomInset
readonly property real _radius: Math.max(0, Math.min(cutoutRadius, (_right - _left) / 2, (_bottom - _top) / 2))
Shape {
ShaderEffect {
anchors.fill: parent
asynchronous: false
preferredRendererType: Shape.CurveRenderer
antialiasing: true
fragmentShader: Qt.resolvedUrl("../../Shaders/qsb/frame_arc.frag.qsb")
ShapePath {
fillColor: root.borderColor
strokeWidth: -1
fillRule: ShapePath.OddEvenFill
// Outer rectangle (window edge, square corners)
startX: 0
startY: 0
PathLine { x: root.width; y: 0 }
PathLine { x: root.width; y: root.height }
PathLine { x: 0; y: root.height }
PathLine { x: 0; y: 0 }
// Inner rounded-rectangle cutout (second subpath → even-odd hole)
PathMove { x: root._left + root._radius; y: root._top }
PathLine { x: root._right - root._radius; y: root._top }
PathArc { x: root._right; y: root._top + root._radius; radiusX: root._radius; radiusY: root._radius }
PathLine { x: root._right; y: root._bottom - root._radius }
PathArc { x: root._right - root._radius; y: root._bottom; radiusX: root._radius; radiusY: root._radius }
PathLine { x: root._left + root._radius; y: root._bottom }
PathArc { x: root._left; y: root._bottom - root._radius; radiusX: root._radius; radiusY: root._radius }
PathLine { x: root._left; y: root._top + root._radius }
PathArc { x: root._left + root._radius; y: root._top; radiusX: root._radius; radiusY: root._radius }
}
property real widthPx: width
property real heightPx: height
property real cutoutRadius: root.cutoutRadius
property vector4d cutout: Qt.vector4d(root.cutoutLeftInset, root.cutoutTopInset, root.width - root.cutoutRightInset, root.height - root.cutoutBottomInset)
property vector4d surfaceColor: Qt.vector4d(root.borderColor.r, root.borderColor.g, root.borderColor.b, root.borderColor.a)
}
}