Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions src/qml/compositor/CircleMaskShader.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ import org.asteroid.controls 1.0
import org.asteroid.utils 1.0

ShaderEffect {
property real smoothness: 0.0007
property real smoothness: 0.05
property bool keepInner: true
property real radius: 0.51

property real end: 0.25
property real beginning: 0.25 - smoothness
property real end: radius * radius
property real beginning: (radius - smoothness) * (radius - smoothness)

fragmentShader: "
#extension GL_OES_standard_derivatives: enable
Expand All @@ -50,22 +51,22 @@ ShaderEffect {
uniform lowp sampler2D source;
uniform lowp float end;
uniform lowp float beginning;
uniform lowp float radius;
uniform bool keepInner;

void main(void) {
lowp float x, y;
x = (qt_TexCoord0.x - 0.5);
y = (qt_TexCoord0.y - 0.5);
if(keepInner) {
gl_FragColor = texture2D(source, qt_TexCoord0).rgba
* step(x * x + y * y, 0.25)
* smoothstep((x * x + y * y) , end, beginning)
* qt_Opacity;
lowp float x, y, distSquared;
x = qt_TexCoord0.x - 0.5;
y = qt_TexCoord0.y - 0.5;
distSquared = x * x + y * y;

lowp float vignette = step(distSquared, radius * radius)
* smoothstep(end, beginning, distSquared);

if (keepInner) {
gl_FragColor = texture2D(source, qt_TexCoord0).rgba * vignette * qt_Opacity;
} else {
gl_FragColor = texture2D(source, qt_TexCoord0).rgba
* (1.0 - (step(x * x + y * y, 0.25)
* smoothstep((x * x + y * y) , end, beginning)))
* qt_Opacity;
gl_FragColor = texture2D(source, qt_TexCoord0).rgba * (1.0 - vignette) * qt_Opacity;
}
}"
}
1 change: 0 additions & 1 deletion src/qml/compositor/compositor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ Item {
visible: DeviceInfo.hasRoundScreen
layer.enabled: DeviceInfo.hasRoundScreen
layer.effect: CircleMaskShader {
smoothness: 0.002
keepInner: false
}
}
Expand Down