fix(shader): uv clamping NImageRounded. Fix #2288

This commit is contained in:
Lemmy
2026-03-24 19:39:18 -04:00
parent d9d5f2063c
commit 03d32b1368
2 changed files with 6 additions and 3 deletions
+6 -3
View File
@@ -90,9 +90,12 @@ void main() {
float alpha = 1.0 - smoothstep(-0.5, 0.5, distance);
// Sample the texture (or use transparent for letterbox)
vec4 color = inLetterbox ? vec4(0.0) : texture(source, imageUV);
// Clamp UV to prevent texture wrapping artifacts from floating-point imprecision
vec4 color = inLetterbox ? vec4(0.0) : texture(source, clamp(imageUV, vec2(0.0), vec2(1.0)));
// Apply the rounded mask and opacity
float finalAlpha = color.a * alpha * itemOpacity * ubuf.qt_Opacity;
fragColor = vec4(color.rgb * finalAlpha, finalAlpha);
// Qt textures use premultiplied alpha (color.rgb already contains rgb * alpha),
// so we only multiply by the external mask factors, not by color.a again
float mask = alpha * itemOpacity * ubuf.qt_Opacity;
fragColor = color * mask;
}
Binary file not shown.