Skip to content

Commit 283d624

Browse files
Ivy233deepin-bot[bot]
authored andcommitted
fix: use mask alpha channel for blending in ItemViewport shaders
Simplify the mask blending logic in quickitemviewport shaders by using only the mask's alpha channel instead of multiplying with the entire mask color. This ensures correct color output when the mask texture contains non-neutral RGB values and maintains consistency with the expected premultiplied alpha behavior. Log: Fix mask blending to use alpha channel only in ItemViewport shaders fix: 修复 ItemViewport shader 中 mask 混合逻辑 简化 quickitemviewport shader 中的 mask 混合逻辑,仅使用 mask 的 alpha 通道 而非整个 mask 颜色值进行混合。这确保了当 mask 纹理包含非中性 RGB 值时输出 颜色正确,并与预期的 premultiplied alpha 行为保持一致。 Log: 修复 ItemViewport shader 中 mask 混合应仅使用 alpha 通道 PMS: BUG-306847
1 parent 2459083 commit 283d624

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

qt6/src/shaders_ng/quickitemviewport-opaque.frag

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ void main()
4444
discard;
4545

4646
lowp vec4 tex = texture(qt_Texture, qt_TexCoord);
47-
// The input texture is already premultiplied. Multiplying by tex.a again
48-
// darkens the partially covered edge pixels and makes corner artifacts more
49-
// visible on transparent windows under fractional scaling.
50-
tex *= mask_tex;
51-
fragColor = tex;
47+
48+
fragColor = tex * mask_tex.a;
5249
}

qt6/src/shaders_ng/quickitemviewport.frag

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,5 @@ void main()
4646

4747
lowp vec4 tex = texture(qt_Texture, qt_TexCoord);
4848

49-
// The input texture is already premultiplied. Multiplying by tex.a again
50-
// darkens the partially covered edge pixels and makes corner artifacts more
51-
// visible on transparent windows under fractional scaling.
52-
tex *= mask_top_left * mask_bottom_left * mask_top_right * mask_bottom_right;
53-
fragColor = tex * ubuf.opacity;
49+
fragColor = tex * mask_tex.a * ubuf.opacity;
5450
}

0 commit comments

Comments
 (0)