backends: glx: fix apply alpha of non y inverted images

This does not ever happen in practice. But conceptually, the GL backend
holds 2 kinds of images: those in GL coordinate system, and those in X
coordinate system. They are differentiated by the `y_inverted` variable,
and applying alpha to them needs differs in whether y needs to be
inverted. Right now we never invert y, because we only ever call apply
alpha on images in the X coordinate system.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2022-08-23 10:06:27 +01:00
parent a252cbf028
commit e0758eb5e5
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
1 changed files with 2 additions and 1 deletions

View File

@ -1949,7 +1949,8 @@ static void gl_image_apply_alpha(backend_t *base, struct backend_image *img,
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
inner->texture, 0);
glDrawBuffer(GL_COLOR_ATTACHMENT0);
_gl_fill(base, (struct color){0, 0, 0, 0}, reg_op, fbo, 0, false);
_gl_fill(base, (struct color){0, 0, 0, 0}, reg_op, fbo, inner->height,
!inner->y_inverted);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &fbo);