mirror of
https://github.com/mpv-player/mpv
synced 2024-12-28 18:12:22 +00:00
vo_opengl: cocoa: output premultiplied alpha
Which is apparently what is expected here. (I'm pretty sure X11 compositors want stright alpha, so 2 code paths are needed.)
This commit is contained in:
parent
4cc1861378
commit
a0519f1d18
@ -92,6 +92,7 @@ struct GL {
|
||||
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
|
||||
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
|
||||
int fb_r, fb_g, fb_b; // frame buffer bit depth (0 if unknown)
|
||||
bool fb_premultiplied; // assumption about FB alpha compositor usage
|
||||
|
||||
void (GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei);
|
||||
void (GLAPIENTRY *Clear)(GLbitfield);
|
||||
|
@ -129,6 +129,7 @@ static bool create_gl_context(struct MPGLContext *ctx, int vo_flags)
|
||||
|
||||
mpgl_load_functions(ctx->gl, (void *)cocoa_glgetaddr, NULL, ctx->vo->log);
|
||||
ctx->gl->fb_r = ctx->gl->fb_g = ctx->gl->fb_b = cgl_color_size(ctx);
|
||||
ctx->gl->fb_premultiplied = true;
|
||||
|
||||
CGLReleasePixelFormat(p->pix);
|
||||
|
||||
|
@ -1527,6 +1527,8 @@ static void pass_convert_yuv(struct gl_video *p)
|
||||
GLSL(color.a = 1.0;)
|
||||
} else if (p->opts.alpha_mode == 2) { // blend
|
||||
GLSL(color = vec4(color.rgb * color.a, 1.0);)
|
||||
} else if (p->gl->fb_premultiplied) {
|
||||
GLSL(color = vec4(color.rgb * color.a, color.a);)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user