summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-21 14:58:46 +0200
committerwm4 <wm4@nowhere>2012-10-24 21:56:34 +0200
commit0c49ddc818fee8059d764f7fbd25820584f335a3 (patch)
tree156cc35c4c38aabbc886baadd89fea8202d21381 /sub
parent796e5638ac6bd5e13e0f69e2b9557ba0af1718cd (diff)
downloadmpv-0c49ddc818fee8059d764f7fbd25820584f335a3.tar.bz2
mpv-0c49ddc818fee8059d764f7fbd25820584f335a3.tar.xz
sub: simplify OSD redrawing logic
Normally, we can redraw the OSD any time. But some drivers don't support OSD redrawing (vo_null etc.), or only "sometimes" (vo_xv). For that, some additional logic is needed. Simplify that logic. This might also fix subtle bugs with the OSD not updating or endless frame stepping in unforseen corner cases. Do this by adding a new flag, which tells whether the OSD should be redrawn. Remove some minor code duplication.
Diffstat (limited to 'sub')
-rw-r--r--sub/sub.c16
-rw-r--r--sub/sub.h4
2 files changed, 3 insertions, 17 deletions
diff --git a/sub/sub.c b/sub/sub.c
index 5a39fbdf60..8281081334 100644
--- a/sub/sub.c
+++ b/sub/sub.c
@@ -280,21 +280,7 @@ void vo_osd_changed(int new_value)
if (osd->objs[n]->type == new_value)
osd->objs[n]->force_redraw = true;
}
-}
-
-bool osd_has_changed(struct osd_state *osd)
-{
- for (int n = 0; n < MAX_OSD_PARTS; n++) {
- if (osd->objs[n]->force_redraw)
- return true;
- }
- return false;
-}
-
-void osd_reset_changed(struct osd_state *osd)
-{
- for (int n = 0; n < MAX_OSD_PARTS; n++)
- osd->objs[n]->force_redraw = false;
+ osd->want_redraw = true;
}
bool sub_bitmaps_bb(struct sub_bitmaps *imgs, int *x1, int *y1,
diff --git a/sub/sub.h b/sub/sub.h
index 3ac160a323..88a49a2906 100644
--- a/sub/sub.h
+++ b/sub/sub.h
@@ -126,6 +126,8 @@ struct osd_state {
bool render_subs_in_filter;
+ bool want_redraw;
+
char *osd_text; // OSDTYPE_OSD
int progbar_type, progbar_value; // OSDTYPE_PROGBAR
@@ -203,8 +205,6 @@ extern int sub_justify;
struct osd_state *osd_create(struct MPOpts *opts, struct ass_library *asslib);
void osd_set_text(struct osd_state *osd, const char *text);
void vo_osd_changed(int new_value);
-void osd_reset_changed(struct osd_state *osd);
-bool osd_has_changed(struct osd_state *osd);
void osd_free(struct osd_state *osd);
enum mp_osd_draw_flags {