From 8489249af9823e45ce606403b6417f26869fa4a4 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Wed, 18 Aug 2021 16:51:05 +0300 Subject: 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) --- sub/osd_libass.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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); -- cgit v1.2.3