diff options
Diffstat (limited to 'sub/sub.c')
-rw-r--r-- | sub/sub.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -284,6 +284,7 @@ void draw_osd_with_eosd(struct vo *vo, struct osd_state *osd) } struct draw_on_image_closure { + struct osd_state *osd; struct mp_image *dest; struct mp_csp_details *dest_csp; bool changed; @@ -292,7 +293,10 @@ struct draw_on_image_closure { static void draw_on_image(void *ctx, struct sub_bitmaps *imgs) { struct draw_on_image_closure *closure = ctx; - mp_draw_sub_bitmaps(closure->dest, imgs, closure->dest_csp); + struct osd_state *osd = closure->osd; + mp_draw_sub_bitmaps(&osd->draw_cache, closure->dest, imgs, + closure->dest_csp); + talloc_steal(osd, osd->draw_cache); closure->changed = true; } @@ -301,12 +305,9 @@ bool osd_draw_on_image(struct osd_state *osd, struct sub_render_params *params, int draw_flags, struct mp_image *dest, struct mp_csp_details *dest_csp) { - static const bool formats[SUBBITMAP_COUNT] = { - [SUBBITMAP_LIBASS] = true, - [SUBBITMAP_RGBA] = true, - }; - struct draw_on_image_closure closure = {dest, dest_csp}; - osd_draw(osd, params, draw_flags, formats, &draw_on_image, &closure); + struct draw_on_image_closure closure = {osd, dest, dest_csp}; + osd_draw(osd, params, draw_flags, mp_draw_sub_formats, + &draw_on_image, &closure); return closure.changed; } |