diff options
-rw-r--r-- | res/effectlib/distancefieldtext.frag | 4 | ||||
-rw-r--r-- | res/effectlib/distancefieldtext_core.frag | 4 | ||||
-rw-r--r-- | res/effectlib/distancefieldtext_dropshadow.frag | 8 | ||||
-rw-r--r-- | res/effectlib/distancefieldtext_dropshadow_core.frag | 8 |
4 files changed, 12 insertions, 12 deletions
diff --git a/res/effectlib/distancefieldtext.frag b/res/effectlib/distancefieldtext.frag index 1d83490..2236f9c 100644 --- a/res/effectlib/distancefieldtext.frag +++ b/res/effectlib/distancefieldtext.frag @@ -20,8 +20,8 @@ void main() #ifdef use_fallback highp float alpha = smoothstep(alphas.x, alphas.y, distance); #else - highp float f = fwidth(distance); - highp float alpha = smoothstep(0.5 - f, 0.5, distance); + highp float f = fwidth(distance) * 0.5; + highp float alpha = smoothstep(0.5 - f, 0.5 + f, distance); #endif gl_FragColor = color * alpha; diff --git a/res/effectlib/distancefieldtext_core.frag b/res/effectlib/distancefieldtext_core.frag index f11dcc1..a3a25a2 100644 --- a/res/effectlib/distancefieldtext_core.frag +++ b/res/effectlib/distancefieldtext_core.frag @@ -6,6 +6,6 @@ uniform vec4 color; void main() { float distance = texture(_qt_texture, sampleCoord).r; - float f = fwidth(distance); - fragOutput = color * smoothstep(0.5 - f, 0.5, distance); + float f = fwidth(distance) * 0.5; + fragOutput = color * smoothstep(0.5 - f, 0.5 + f, distance); } diff --git a/res/effectlib/distancefieldtext_dropshadow.frag b/res/effectlib/distancefieldtext_dropshadow.frag index fdb68ba..2f6c9be 100644 --- a/res/effectlib/distancefieldtext_dropshadow.frag +++ b/res/effectlib/distancefieldtext_dropshadow.frag @@ -25,8 +25,8 @@ void main() #ifdef use_fallback highp float shadowAlpha = smoothstep(alphas.x, alphas.y, shadowDistance); #else - highp float shadowDistanceD = fwidth(shadowDistance); - highp float shadowAlpha = smoothstep(0.5 - shadowDistanceD, 0.5, shadowDistance); + highp float shadowDistanceD = fwidth(shadowDistance) * 0.5; + highp float shadowAlpha = smoothstep(0.5 - shadowDistanceD, 0.5 + shadowDistanceD, shadowDistance); #endif highp vec4 shadowPixel = color * shadowColor * shadowAlpha; @@ -38,8 +38,8 @@ void main() #ifdef use_fallback highp float textAlpha = smoothstep(alphas.x, alphas.y, textDistance); #else - highp float textDistanceD = fwidth(textDistance); - highp float textAlpha = smoothstep(0.5 - textDistanceD, 0.5, textDistance); + highp float textDistanceD = fwidth(textDistance) * 0.5; + highp float textAlpha = smoothstep(0.5 - textDistanceD, 0.5 + textDistanceD, textDistance); #endif highp vec4 textPixel = color * textAlpha; diff --git a/res/effectlib/distancefieldtext_dropshadow_core.frag b/res/effectlib/distancefieldtext_dropshadow_core.frag index e13182e..8e8c61d 100644 --- a/res/effectlib/distancefieldtext_dropshadow_core.frag +++ b/res/effectlib/distancefieldtext_dropshadow_core.frag @@ -12,16 +12,16 @@ void main() clamp(shadowSampleCoord, normalizedTextureBounds.xy, normalizedTextureBounds.zw)).r; - float shadowDistanceD = fwidth(shadowDistance); - float shadowAlpha = smoothstep(0.5 - shadowDistanceD, 0.5, shadowDistance); + float shadowDistanceD = fwidth(shadowDistance) * 0.5; + float shadowAlpha = smoothstep(0.5 - shadowDistanceD, 0.5 + shadowDistanceD, shadowDistance); vec4 shadowPixel = color * shadowColor * shadowAlpha; float textDistance = texture(_qt_texture, clamp(sampleCoord, normalizedTextureBounds.xy, normalizedTextureBounds.zw)).r; - float textDistanceD = fwidth(textDistance); - float textAlpha = smoothstep(0.5 - textDistanceD, 0.5, textDistance); + float textDistanceD = fwidth(textDistance) * 0.5; + float textAlpha = smoothstep(0.5 - textDistanceD, 0.5 + textDistanceD, textDistance); vec4 textPixel = color * textAlpha; fragOutput = mix(shadowPixel, textPixel, textPixel.a); |