diff options
author | nanahi <130121847+na-na-hi@users.noreply.github.com> | 2024-01-02 16:49:52 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-02-17 16:06:33 +0000 |
commit | 117622cd4ae4238bc00b60e8fbccdcc5c0baa724 (patch) | |
tree | 0b96f565aed617d9161e35c529c4c0e66180dbc4 | |
parent | a61026aec30102ae3f2f119253f73c9db8747937 (diff) | |
download | mpv-117622cd4ae4238bc00b60e8fbccdcc5c0baa724.tar.bz2 mpv-117622cd4ae4238bc00b60e8fbccdcc5c0baa724.tar.xz |
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.
-rw-r--r-- | video/out/opengl/context_win.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/video/out/opengl/context_win.c b/video/out/opengl/context_win.c index 968b1763bf..17b1cb491a 100644 --- a/video/out/opengl/context_win.c +++ b/video/out/opengl/context_win.c @@ -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; |