on xenial help sign in
merge with spread-blur
a4e2fffMichael Zanetti
qml/Components/BlurLayer.qml+9−5
@@ -21,8 +21,9 @@ Item {
21 id: root
21 id: root
22
22
23 property alias source: shaderEffectSource.sourceItem
23 property alias source: shaderEffectSource.sourceItem
24− property alias saturation: desaturateEffect.saturationValue
24+ property real saturation: 1
25+ property real brightness: 1
25− property alias blurRadius: fastBlur.radius
26+ property real blurRadius: 0
26
27
27 readonly property alias ready: shaderEffectSource.ready
28 readonly property alias ready: shaderEffectSource.ready
28
29
@@ -30,7 +31,8 @@ Item {
30 id: desaturateEffect
31 id: desaturateEffect
31 anchors.fill: root
32 anchors.fill: root
32
33
33− property real saturationValue: 1
34+ property real saturationValue: Math.min(Math.max(root.saturation, 0), 1)
35+ property real brightnessValue: Math.min(Math.max(root.brightness, 0), 1)
34
36
35 property variant source: ShaderEffectSource {
37 property variant source: ShaderEffectSource {
36 id: shaderEffectSource
38 id: shaderEffectSource
@@ -50,12 +52,14 @@ Item {
50 varying highp vec2 qt_TexCoord0;
52 varying highp vec2 qt_TexCoord0;
51 uniform sampler2D source;
53 uniform sampler2D source;
52 uniform lowp float saturationValue;
54 uniform lowp float saturationValue;
55+ uniform lowp float brightnessValue;
53 void main(void)
56 void main(void)
54 {
57 {
55 highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
58 highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
56 highp vec4 scaledColor = sourceColor * vec4(0.3, 0.59, 0.11, 1.0);
59 highp vec4 scaledColor = sourceColor * vec4(0.3, 0.59, 0.11, 1.0);
57 lowp float luminance = scaledColor.r + scaledColor.g + scaledColor.b ;
60 lowp float luminance = scaledColor.r + scaledColor.g + scaledColor.b ;
58− gl_FragColor = mix(vec4(luminance, luminance, luminance, sourceColor.a), sourceColor, saturationValue);
61+ highp vec4 tmp = mix(vec4(luminance, luminance, luminance, sourceColor.a), sourceColor, saturationValue);
62+ gl_FragColor = mix(vec4(0, 0, 0, 1), tmp, brightnessValue);
59 }"
63 }"
60 }
64 }
61
65
@@ -64,6 +68,6 @@ Item {
64 anchors.fill: parent
68 anchors.fill: parent
65 source: desaturateEffect
69 source: desaturateEffect
66 visible: radius > 0
70 visible: radius > 0
67− radius: 0
71+ radius: Math.max(root.blurRadius, 0)
68 }
72 }
69}
73}
qml/Stage/Stage.qml+25−2
@@ -53,7 +53,7 @@ FocusScope {
53 property real leftEdgeDragProgress: 0
53 property real leftEdgeDragProgress: 0
54
54
55 // Used by the tutorial code
55 // Used by the tutorial code
56− readonly property real rightEdgeDragProgress: rightEdgeDragArea.progress // How far left the stage has been dragged
56+ readonly property real rightEdgeDragProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0 // How far left the stage has been dragged
57
57
58 // used by the snap windows (edge maximize) feature
58 // used by the snap windows (edge maximize) feature
59 readonly property alias previewRectangle: fakeRectangle
59 readonly property alias previewRectangle: fakeRectangle
@@ -413,12 +413,20 @@ FocusScope {
413 PropertyChanges { target: hoverMouseArea; enabled: true }
413 PropertyChanges { target: hoverMouseArea; enabled: true }
414 PropertyChanges { target: rightEdgeDragArea; enabled: false }
414 PropertyChanges { target: rightEdgeDragArea; enabled: false }
415 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
415 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
416+ PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65 }
416 },
417 },
417 State {
418 State {
418 name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
419 name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
420+ PropertyChanges {
421+ target: blurLayer;
422+ visible: true;
423+ blurRadius: 32
424+ brightness: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, .65, Math.max(rightEdgeDragArea.progress, edgeBarrier.progress))
425+ }
419 },
426 },
420 State {
427 State {
421 name: "sideStagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "stagedWithSideStage"
428 name: "sideStagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "stagedWithSideStage"
429+ extend: "stagedRightEdge"
422 PropertyChanges {
430 PropertyChanges {
423 target: sideStage
431 target: sideStage
424 opacity: priv.sideStageDelegate.x === sideStage.x ? 1 : 0
432 opacity: priv.sideStageDelegate.x === sideStage.x ? 1 : 0
@@ -427,9 +435,16 @@ FocusScope {
427 },
435 },
428 State {
436 State {
429 name: "windowedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "windowed"
437 name: "windowedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "windowed"
438+ PropertyChanges {
439+ target: blurLayer;
440+ visible: true
441+ blurRadius: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 32, Math.max(rightEdgeDragArea.progress, edgeBarrier.progress))
442+ brightness: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 1, .65, Math.max(rightEdgeDragArea.progress, edgeBarrier.progress))
443+ }
430 },
444 },
431 State {
445 State {
432 name: "staged"; when: root.mode === "staged"
446 name: "staged"; when: root.mode === "staged"
447+ PropertyChanges { target: wallpaper; visible: false }
433 },
448 },
434 State {
449 State {
435 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
450 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
@@ -444,6 +459,7 @@ FocusScope {
444 Transition {
459 Transition {
445 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
460 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
446 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
461 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
462+ PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
447 },
463 },
448 Transition {
464 Transition {
449 to: "spread"
465 to: "spread"
@@ -498,6 +514,13 @@ FocusScope {
498 z: -2
514 z: -2
499 }
515 }
500
516
517+ BlurLayer {
518+ id: blurLayer
519+ anchors.fill: parent
520+ source: wallpaper
521+ visible: false
522+ }
523+
501 Spread {
524 Spread {
502 id: spreadItem
525 id: spreadItem
503 objectName: "spreadItem"
526 objectName: "spreadItem"
@@ -1739,7 +1762,7 @@ FocusScope {
1739 property var gesturePoints: []
1762 property var gesturePoints: []
1740 property bool cancelled: false
1763 property bool cancelled: false
1741
1764
1742− property real progress: dragging ? -touchPosition.x / root.width : 0
1765+ property real progress: -touchPosition.x / root.width
1743 onProgressChanged: {
1766 onProgressChanged: {
1744 if (dragging) {
1767 if (dragging) {
1745 draggedProgress = progress;
1768 draggedProgress = progress;