diff options
author | wm4 <wm4@nowhere> | 2015-12-20 11:40:10 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-12-20 13:26:25 +0100 |
commit | 31c29495ca7c95a7d5aa90ded9b53e3d7d504391 (patch) | |
tree | dcd45b8ca53ffd334d6ec78a2375cf643327dca3 /video/out/opengl | |
parent | a191712169be6ca93ccefeb5b59606787d21e725 (diff) | |
download | mpv-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.
Diffstat (limited to 'video/out/opengl')
-rw-r--r-- | video/out/opengl/context_x11.c | 5 |
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; |