diff options
author | wm4 <wm4@nowhere> | 2012-10-19 17:49:49 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-10-24 21:56:34 +0200 |
commit | bf68634d15c747fd05f118b1bd95e3017c1eb6bb (patch) | |
tree | 92395008313f2ce60c06189f2cd4a05a0dbaf9e7 /sub/sub.c | |
parent | 97c6425140aecc3910a622fb0ad7d79916cfebbe (diff) | |
download | mpv-bf68634d15c747fd05f118b1bd95e3017c1eb6bb.tar.bz2 mpv-bf68634d15c747fd05f118b1bd95e3017c1eb6bb.tar.xz |
sub: add cache to mp_draw_sub_bitmaps()
This caches scaled RGBA sub-bitmaps.
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; } |