Fix faint toolbar icons on Wayland (#13723)

Use glBlendFuncSeparate in GLTexture::render_sub_texture so destination
  alpha stays at 1.0. The Wayland compositor honors framebuffer alpha for     window compositing; the previous straight-alpha blend reduced dst alpha
  at anti-aliased icon edges, making them semi-transparent against the
  desktop. RGB blending is unchanged, so X11/Windows/macOS are unaffected.
This commit is contained in:
SoftFever
2026-05-19 01:38:37 +08:00
committed by GitHub
parent 88b4a63228
commit d8369e5f75

View File

@@ -663,7 +663,9 @@ void GLTexture::render_texture(unsigned int tex_id, float left, float right, flo
void GLTexture::render_sub_texture(unsigned int tex_id, float left, float right, float bottom, float top, const GLTexture::Quad_UVs& uvs)
{
glsafe(::glEnable(GL_BLEND));
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
// Orca: fix washed-out toolbar icons on Wayland: keep destination alpha at 1.0 so the compositor
// does not treat anti-aliased icon edges as window transparency.
glsafe(::glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
glsafe(::glEnable(GL_TEXTURE_2D));
glsafe(::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE));