diff options
author | Marko Niemelä <marko.a.niemela@nokia.com> | 2012-02-01 11:08:03 +0200 |
---|---|---|
committer | Marko Niemelä <marko.a.niemela@nokia.com> | 2012-02-01 11:08:03 +0200 |
commit | da5d1860abd4c4bb821b02404f1709bca3d51b58 (patch) | |
tree | 3fbde6361156843c7f151e3099485f0c8f0da982 /src | |
parent | d6b4eb8b9989dcd2e5716ec2aa296169836d8049 (diff) | |
download | qtgraphicaleffects-da5d1860abd4c4bb821b02404f1709bca3d51b58.tar.gz |
RadialBlur offset and angle interpretation changed
Diffstat (limited to 'src')
-rw-r--r-- | src/effects/RadialBlur.qml | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/effects/RadialBlur.qml b/src/effects/RadialBlur.qml index b44d134..0e63c7b 100644 --- a/src/effects/RadialBlur.qml +++ b/src/effects/RadialBlur.qml @@ -74,6 +74,8 @@ Item { property bool transparentBorder: rootItem.transparentBorder && rootItem.samples > 1 property int samples: rootItem.samples property real weight: 1.0 / Math.max(1.0, rootItem.samples) + property real angleSin: Math.sin(rootItem.angle/2 * Math.PI/180) + property real angleCos: Math.cos(rootItem.angle/2 * Math.PI/180) property real angleSinStep: Math.sin(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1)) property real angleCosStep: Math.cos(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1)) property variant expandPixels: transparentBorder ? Qt.size(0.5 * parent.height, 0.5 * parent.width) : Qt.size(0,0) @@ -91,6 +93,8 @@ Item { varying highp vec2 qt_TexCoord0; uniform highp float qt_Opacity; uniform sampler2D source; + uniform highp float angleSin; + uniform highp float angleCos; uniform highp float angleSinStep; uniform highp float angleCosStep; uniform highp float weight; @@ -102,14 +106,18 @@ Item { void main(void) { highp mat2 m; - m[0] = vec2(angleCosStep, -angleSinStep); - m[1] = vec2(angleSinStep, angleCosStep); gl_FragColor = vec4(0.0); mediump vec2 texCoord = qt_TexCoord0; PLACEHOLDER_EXPAND_STEPS - highp vec2 dir = vec2(texCoord.s * w - w * 0.5, texCoord.t * h - h * 0.5); + highp vec2 dir = vec2(texCoord.s * w - w * center.x, texCoord.t * h - h * center.y); + m[0] = vec2(angleCos, -angleSin); + m[1] = vec2(angleSin, angleCos); + dir *= m; + + m[0] = vec2(angleCosStep, -angleSinStep); + m[1] = vec2(angleSinStep, angleCosStep); PLACEHOLDER_UNROLLED_LOOP |