From e0758eb5e572d5d7cf28f28e5e409f20e0bd2ded Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 23 Aug 2022 10:06:27 +0100 Subject: [PATCH] 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 --- src/backend/gl/gl_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index d1272b7b..9ec3f337 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -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);