summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-02-16 01:08:43 -0500
committerDudemanguy <random342@airmail.cc>2024-02-17 16:06:33 +0000
commit095038b1bc0e997846d00bfe32fd4eceeddbedb4 (patch)
tree389e64258b32a00283564656eb9bcc30a9fe2288
parent8de67a4af50f9c51a4b643a5cbf343e656d27a27 (diff)
downloadmpv-095038b1bc0e997846d00bfe32fd4eceeddbedb4.tar.bz2
mpv-095038b1bc0e997846d00bfe32fd4eceeddbedb4.tar.xz
opengl/context_win: make --alpha runtime changeable
Same as d3d11, but since SetPixelFormat can be only called once, cAlphaBits in PIXELFORMATDESCRIPTOR must be set to make this work.
-rw-r--r--video/out/opengl/context_win.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/video/out/opengl/context_win.c b/video/out/opengl/context_win.c
index 17b1cb491a..a582e2834e 100644
--- a/video/out/opengl/context_win.c
+++ b/video/out/opengl/context_win.c
@@ -96,8 +96,7 @@ 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.cAlphaBits = 8;
pfd.iLayerType = PFD_MAIN_PLANE;
int pf = ChoosePixelFormat(hdc, &pfd);
@@ -373,11 +372,17 @@ static int wgl_control(struct ra_ctx *ctx, int *events, int request, void *arg)
return ret;
}
+static void wgl_update_render_opts(struct ra_ctx *ctx)
+{
+ vo_w32_set_transparency(ctx->vo, ctx->opts.want_alpha);
+}
+
const struct ra_ctx_fns ra_ctx_wgl = {
- .type = "opengl",
- .name = "win",
- .init = wgl_init,
- .reconfig = wgl_reconfig,
- .control = wgl_control,
- .uninit = wgl_uninit,
+ .type = "opengl",
+ .name = "win",
+ .init = wgl_init,
+ .reconfig = wgl_reconfig,
+ .control = wgl_control,
+ .update_render_opts = wgl_update_render_opts,
+ .uninit = wgl_uninit,
};