mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
draw_bmp: add a function to return a single-texture OSD overlay
Maybe this is useful for some of the lesser VOs. It's preferable over bad ad-hoc solutions based on the more complex sub_bitmap data structures (as observed e.g. in vo_vaapi.c), and does not use that much more code since draw_bmp already created such an overlay internally. But I still wanted something that avoids having to upload/render a full screen-sized overlay if for example there's only a tiny subtitle line on the bottom of the screen. So the new API can return a list of modified pixels (for upload) and non-transparent pixels (for display). The way these pixel rectangles are computed is a bit dumb and returns dumb results, but it should be usable, and the implementation can change.
This commit is contained in:
@@ -365,8 +365,8 @@ static bool try_draw_bmp(FILE *f, int imgfmt)
|
||||
.num_items = 1,
|
||||
};
|
||||
|
||||
struct mp_draw_sub_cache *c = NULL;
|
||||
if (mp_draw_sub_bitmaps(&c, dst, &sbs_list)) {
|
||||
struct mp_draw_sub_cache *c = mp_draw_sub_alloc(NULL);
|
||||
if (mp_draw_sub_bitmaps(c, dst, &sbs_list)) {
|
||||
char *info = mp_draw_sub_get_dbg_info(c);
|
||||
fprintf(f, "%s\n", info);
|
||||
talloc_free(info);
|
||||
|
||||
Reference in New Issue
Block a user