From 491dbc8638d3298aff4a4f76a9b1d9b54826a666 Mon Sep 17 00:00:00 2001 From: Sergey Chupligin Date: Wed, 31 Jul 2024 09:32:39 +0300 Subject: [PATCH] [NemoIcon] Fixup nemo icon color overlay --- src/controls/qml/ApplicationWindow.qml | 1 + src/controls/qml/shaders/NemoIcon.frag | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/controls/qml/ApplicationWindow.qml b/src/controls/qml/ApplicationWindow.qml index b423b85..27c8512 100644 --- a/src/controls/qml/ApplicationWindow.qml +++ b/src/controls/qml/ApplicationWindow.qml @@ -196,6 +196,7 @@ NemoWindow { id: mainMenuArea height: parent.height clip: true + visible: width != 0 width: if(sourceComponent === null) { return 0 } else if (applicationWindow.isUiPortrait) { diff --git a/src/controls/qml/shaders/NemoIcon.frag b/src/controls/qml/shaders/NemoIcon.frag index acf67ac..8e8835d 100644 --- a/src/controls/qml/shaders/NemoIcon.frag +++ b/src/controls/qml/shaders/NemoIcon.frag @@ -3,17 +3,18 @@ layout(location = 0) in vec2 qt_TexCoord0; layout(location = 0) out vec4 fragColor; -layout(binding = 1) uniform sampler2D source; - layout(std140, binding = 0) uniform buf { + // qt_Matrix and qt_Opacity must always be both present + // if the built-in vertex shader is used. mat4 qt_Matrix; float qt_Opacity; - vec4 color; -} ubuf; +}; + +layout(binding = 1) uniform sampler2D source; void main() { - vec4 c = texture(source, qt_TexCoord0); - fragColor = c * ubuf.color * ubuf.qt_Opacity; -} + vec4 pixelColor = texture(source, qt_TexCoord0); + fragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity; +} \ No newline at end of file