summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-20 11:40:10 +0100
committerwm4 <wm4@nowhere>2015-12-20 13:26:25 +0100
commit31c29495ca7c95a7d5aa90ded9b53e3d7d504391 (patch)
treedcd45b8ca53ffd334d6ec78a2375cf643327dca3
parenta191712169be6ca93ccefeb5b59606787d21e725 (diff)
downloadmpv-31c29495ca7c95a7d5aa90ded9b53e3d7d504391.tar.bz2
mpv-31c29495ca7c95a7d5aa90ded9b53e3d7d504391.tar.xz
vo_opengl: x11: fix alpha windows
long is 64 bits on x86_64 on Linux, which means the check for the corner case of computing the depth mask is wrong. Also, X11 compositors seem to expect premultiplied alpha.
-rw-r--r--video/out/opengl/context_x11.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/video/out/opengl/context_x11.c b/video/out/opengl/context_x11.c
index 46e9f0cb7e..4327a8a025 100644
--- a/video/out/opengl/context_x11.c
+++ b/video/out/opengl/context_x11.c
@@ -173,8 +173,8 @@ static GLXFBConfig select_fb_config(struct vo *vo, const int *attribs, int flags
// a depth of 24, even if the pixels are padded to 32 bit. If the
// depth is higher than 24, the remaining bits must be alpha.
// Note: vinfo->bits_per_rgb appears to be useless (is always 8).
- unsigned long mask = v->depth == 32 ?
- (unsigned long)-1 : (1 << (unsigned long)v->depth) - 1;
+ unsigned long mask = v->depth == sizeof(unsigned long) * 8 ?
+ (unsigned long)-1 : (1UL << v->depth) - 1;
if (mask & ~(v->red_mask | v->green_mask | v->blue_mask)) {
fbconfig = fbc[n];
break;
@@ -272,6 +272,7 @@ static int glx_init(struct MPGLContext *ctx, int flags)
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_RED_SIZE, &ctx->gl->fb_r);
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_GREEN_SIZE, &ctx->gl->fb_g);
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_BLUE_SIZE, &ctx->gl->fb_b);
+ ctx->gl->fb_premultiplied = true;
return 0;