on xenial help sign in
merge prereq
commita37b91abe3e7b5cdd3ba8a1aff010517ffc7e4f1 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 9 Nov 2016, 15:58 (10 years ago) parent096ba79fded335
2 files changed+14−45
qml/Components/BlurLayer.qml+7−41 qml/Stage/Stage.qml+7−4
qml/Components/BlurLayer.qml+7−41
@@ -20,54 +20,20 @@ import QtGraphicalEffects 1.0
2020Item {
2121 id: root
2222
23− property alias source: shaderEffectSource.sourceItem
24− property real saturation: 1
23+ property alias source: fastBlur.source
2524 property real brightness: 1
2625 property real blurRadius: 0
2726
28− readonly property alias ready: shaderEffectSource.ready
29−
30− ShaderEffect {
31− id: desaturateEffect
32− anchors.fill: root
33−
34− property real saturationValue: Math.min(Math.max(root.saturation, 0), 1)
35− property real brightnessValue: Math.min(Math.max(root.brightness, 0), 1)
36−
37− property variant source: ShaderEffectSource {
38− id: shaderEffectSource
39− hideSource: root.visible
40− live: !root.visible
41− property bool ready: false;
42− onLiveChanged: {
43− if (!live) {
44− ready = false;
45− scheduleUpdate();
46− }
47− }
48− onScheduledUpdateCompleted: ready = true;
49− }
50−
51− fragmentShader: "
52− varying highp vec2 qt_TexCoord0;
53− uniform sampler2D source;
54− uniform lowp float saturationValue;
55− uniform lowp float brightnessValue;
56− void main(void)
57− {
58− highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
59− highp vec4 scaledColor = sourceColor * vec4(0.3, 0.59, 0.11, 1.0);
60− lowp float luminance = scaledColor.r + scaledColor.g + scaledColor.b ;
61− highp vec4 tmp = mix(vec4(luminance, luminance, luminance, sourceColor.a), sourceColor, saturationValue);
62− gl_FragColor = mix(vec4(0, 0, 0, 1), tmp, brightnessValue);
63− }"
64− }
65−
6627 FastBlur {
6728 id: fastBlur
6829 anchors.fill: parent
69− source: desaturateEffect
7030 visible: radius > 0
7131 radius: Math.max(root.blurRadius, 0)
7232 }
33+
34+ Rectangle {
35+ anchors.fill: parent
36+ color: "black"
37+ opacity: 1 - root.brightness
38+ }
7339}
qml/Stage/Stage.qml+7−4
@@ -444,7 +444,8 @@ FocusScope {
444444 PropertyChanges { target: hoverMouseArea; enabled: true }
445445 PropertyChanges { target: rightEdgeDragArea; enabled: false }
446446 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
447− PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65 }
447+ PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
448+ PropertyChanges { target: wallpaper; visible: false }
448449 },
449450 State {
450451 name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
@@ -452,7 +453,8 @@ FocusScope {
452453 target: blurLayer;
453454 visible: true;
454455 blurRadius: 32
455− brightness: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, .65, Math.max(rightEdgeDragArea.progress, edgeBarrier.progress))
456+ brightness: .65
457+ opacity: 1
456458 }
457459 },
458460 State {
@@ -469,8 +471,9 @@ FocusScope {
469471 PropertyChanges {
470472 target: blurLayer;
471473 visible: true
472− blurRadius: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 32, Math.max(rightEdgeDragArea.progress, edgeBarrier.progress))
473− brightness: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 1, .65, Math.max(rightEdgeDragArea.progress, edgeBarrier.progress))
474+ blurRadius: 32
475+ brightness: .65
476+ opacity: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 1, Math.max(rightEdgeDragArea.progress, edgeBarrier.progress))
474477 }
475478 },
476479 State {