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)
This commit is contained in:
Avi Halachmi (:avih) 2021-08-18 16:51:05 +03:00 committed by avih
parent c7cdd38ac9
commit 8489249af9
1 changed files with 16 additions and 0 deletions

View File

@ -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);