diff options
author | Dudemanguy <random342@airmail.cc> | 2024-02-16 10:40:52 -0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-02-26 16:46:00 +0000 |
commit | c72c47204d8b6f3a590e566325c9976f0774f591 (patch) | |
tree | ef9cb0dc0a26ea3d6ff48a18d29e457c0f6fd1c2 /video/out/vo_gpu.c | |
parent | c774b5f5173f8e43e2da0612437f7e3931df6acc (diff) | |
download | mpv-c72c47204d8b6f3a590e566325c9976f0774f591.tar.bz2 mpv-c72c47204d8b6f3a590e566325c9976f0774f591.tar.xz |
vo_gpu/vo_gpu_next: rework --alpha into --background option
The --alpha option currently covers two related but different concepts:
whether or not to ignore the alpha component and possibly blending it
with a background. Because of the way the option currently works, it is
impossible to have a transparent window (which requires setting
--alpha=yes) while blending it with the background at the same time. To
solve this, let's rework it so it it superseded by the background
option.
--background controls what kind of background to set for the image if
possible. It can be blended with the set background color, with tiles,
or not blended at all (the last one is still broken on X11/mesa except
for GLX, *sigh*). In this new paradigm, --alpha=no has no real purpose
because you can simply set the background to color and whatever color
you want for exactly the same effect. So the option is removed. Instead,
the hint set by windowing backends (i.e. setting
ra_ctx->opts.want_alpha) can by done with the --background option.
As an aside, the colors in vo_gpu are currently bugged due to not
pre-multiplying the alpha and it seems no one ever noticed. The next
commit fixes that. vo_gpu_next support happens latter since it requires
new things from libplacebo.
Fixes #9615.
Diffstat (limited to 'video/out/vo_gpu.c')
-rw-r--r-- | video/out/vo_gpu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/video/out/vo_gpu.c b/video/out/vo_gpu.c index ec70f45da9..2f62876db6 100644 --- a/video/out/vo_gpu.c +++ b/video/out/vo_gpu.c @@ -173,7 +173,9 @@ static void update_ra_ctx_options(struct vo *vo) { struct gpu_priv *p = vo->priv; struct gl_video_opts *gl_opts = mp_get_config_group(p->ctx, vo->global, &gl_video_conf); - p->ctx->opts.want_alpha = gl_opts->alpha_mode == 1; + p->ctx->opts.want_alpha = (gl_opts->background == BACKGROUND_COLOR && + gl_opts->background_color.a != 255) || + gl_opts->background == BACKGROUND_NONE; talloc_free(gl_opts); } |