1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-20 18:28:01 +00:00

opengl/context_win: make --alpha=yes work

Specify cAlphaBits in PIXELFORMATDESCRIPTOR makes the pixel format
transparent, as is already the case for d3d11. Also makes the
window transparent when --alpha=yes is used.

Works on --vo=gpu and --vo=gpu-next.
This commit is contained in:
nanahi 2024-01-02 16:49:52 -05:00 committed by Dudemanguy
parent a61026aec3
commit 117622cd4a

View File

@ -96,6 +96,8 @@ static bool create_dc(struct ra_ctx *ctx)
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
if (ctx->opts.want_alpha)
pfd.cAlphaBits = 8;
pfd.iLayerType = PFD_MAIN_PLANE;
int pf = ChoosePixelFormat(hdc, &pfd);
@ -293,6 +295,9 @@ static bool wgl_init(struct ra_ctx *ctx)
if (!vo_w32_init(ctx->vo))
goto fail;
if (ctx->opts.want_alpha)
vo_w32_set_transparency(ctx->vo, ctx->opts.want_alpha);
vo_w32_run_on_thread(ctx->vo, create_ctx, ctx);
if (!p->context)
goto fail;