Changeset View
Changeset View
Standalone View
Standalone View
discover/qml/ApplicationScreenshots.qml
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Line(s) | 130 | Image { | |||
---|---|---|---|---|---|
135 | smooth: true | 135 | smooth: true | ||
136 | } | 136 | } | ||
137 | 137 | | |||
138 | } | 138 | } | ||
139 | 139 | | |||
140 | layer.enabled: true | 140 | layer.enabled: true | ||
141 | // This item should be used as the 'mask' | 141 | // This item should be used as the 'mask' | ||
142 | layer.effect: ShaderEffect { | 142 | layer.effect: ShaderEffect { | ||
143 | property var colorSource: root; | 143 | readonly property var colorSource: root; | ||
144 | property bool atLeft: root.atXBeginning; | 144 | readonly property real distLeft: Math.max(20, 2000/(root.contentX + 1) - 1) | ||
145 | property bool atRight: root.atXEnd; | 145 | readonly property real distRight: Math.max(20, 2000/Math.max(0, root.contentWidth - (root.contentX + root.width) + 1) - 1) | ||
146 | fragmentShader: " | 146 | fragmentShader: " | ||
147 | uniform lowp bool atLeft; | 147 | uniform lowp float distLeft; | ||
148 | uniform lowp bool atRight; | 148 | uniform lowp float distRight; | ||
149 | uniform lowp sampler2D colorSource; | 149 | uniform lowp sampler2D colorSource; | ||
150 | uniform lowp float qt_Opacity; | 150 | uniform lowp float qt_Opacity; | ||
151 | varying highp vec2 qt_TexCoord0; | 151 | varying highp vec2 qt_TexCoord0; | ||
152 | void main() { | 152 | void main() { | ||
153 | gl_FragColor = | 153 | gl_FragColor = | ||
154 | texture2D(colorSource, qt_TexCoord0) | 154 | texture2D(colorSource, qt_TexCoord0) | ||
155 | * (atRight ? 1. : min(1.0, qt_TexCoord0.x * -20.0 + 20.)) | 155 | * clamp(qt_TexCoord0.x * -distRight + distRight, 0., 1.) | ||
156 | * (atLeft ? 1. : min(1.0, qt_TexCoord0.x * 20.0)) | 156 | * clamp(qt_TexCoord0.x * distLeft, 0., 1.) | ||
157 | * qt_Opacity; | 157 | * qt_Opacity; | ||
158 | } | 158 | } | ||
159 | " | 159 | " | ||
160 | } | 160 | } | ||
161 | } | 161 | } |