osd: slightly simplify update logic

Remove the per-part force_redraw flags, and instead make the difference
between flagging dirty state and returning it to the player frontend
more explicit. The big issue is that 1. the OSD needs to know the dirty
state, and it should be cleared strictly when it is re-rendered
(force_redraw flag), and 2. the player core needs to be notified once,
and the notification must be reset (want_redraw flag).

The call in loadfile.c is replaced by making osd_set_sub() set the
change flag. Increasing the change flag on dirty state (the force_redraw
check in render_object()) should not be needed, because OSD part
renderers set it correctly (at least now).

Doing this just because someone pointed this out.
This commit is contained in:
wm4
2016-09-15 14:22:48 +02:00
parent 5968a307d5
commit 9c9cf125ad
6 changed files with 21 additions and 30 deletions

View File

@@ -28,8 +28,6 @@ struct osd_object {
int type; // OSDTYPE_*
bool is_sub;
bool force_redraw;
// OSDTYPE_OSD
char *text;
@@ -72,6 +70,7 @@ struct osd_state {
bool render_subs_in_filter;
bool want_redraw;
bool want_redraw_notification;
struct MPOpts *opts;
struct mpv_global *global;
@@ -80,6 +79,6 @@ struct osd_state {
struct mp_draw_sub_cache *draw_cache;
};
void osd_changed_unlocked(struct osd_state *osd, int obj);
void osd_changed_unlocked(struct osd_state *osd);
#endif