summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2021-08-18 16:51:05 +0300
committeravih <avih@users.noreply.github.com>2021-08-19 15:39:07 +0300
commit8489249af9823e45ce606403b6417f26869fa4a4 (patch)
tree96176afafde66a2ba59b58090e6573a0ff12ddce
parentc7cdd38ac99882d3e41a26f275c920886df3569b (diff)
downloadmpv-8489249af9823e45ce606403b6417f26869fa4a4.tar.bz2
mpv-8489249af9823e45ce606403b6417f26869fa4a4.tar.xz
osd_libass: --osd-back-color: apply to the progress bar
This is an artificial background box with the original colors, rendered as a plain rectangle instead of libass's opaque-box. Fixes #9134 (together with the previous commit)
-rw-r--r--sub/osd_libass.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index 917bf2649c..c916c530c2 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -424,6 +424,22 @@ static void update_progbar(struct osd_state *osd, struct osd_object *obj)
talloc_free(buf.start);
struct ass_draw *d = &(struct ass_draw) { .scale = 4 };
+
+ if (osd->opts->osd_style->back_color.a) {
+ // the bar style always ignores the --osd-back-color config - it messes
+ // up the bar. draw an artificial box at the original back color.
+ struct m_color bc = osd->opts->osd_style->back_color;
+ d->text = talloc_asprintf_append(d->text,
+ "{\\pos(%f,%f)\\bord0\\1a&H%02X\\1c&H%02X%02X%02X&}",
+ px, py, 255 - bc.a, (int)bc.b, (int)bc.g, (int)bc.r);
+
+ ass_draw_start(d);
+ ass_draw_rect_cw(d, -border, -border, width + border, height + border);
+ ass_draw_stop(d);
+ add_osd_ass_event(track, "progbar", d->text);
+ ass_draw_reset(d);
+ }
+
// filled area
d->text = talloc_asprintf_append(d->text, "{\\bord0\\pos(%f,%f)}", px, py);
ass_draw_start(d);