summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-08-01 18:23:28 +0200
committerwm4 <wm4@nowhere>2012-08-01 18:23:28 +0200
commit168293e0ae6f08dd82f0a1e6696c25233e2ce298 (patch)
tree9342a94f4bf94933ee403f697d932c41c08119cb /libvo
parent59b938c8aa7d903e849748b737d45ccd949ef419 (diff)
downloadmpv-168293e0ae6f08dd82f0a1e6696c25233e2ce298.tar.bz2
mpv-168293e0ae6f08dd82f0a1e6696c25233e2ce298.tar.xz
osd: minor simplification of vo_osd_changed()
vo_osd_changed() was a weird function: it was used both to query and mutate state, which is a bad combination. The VOs used it to query and reset the state, and the mplayer frontend mostly used it to set the state. In some cases, the frontend did both (that code used a variable "int hack" to backup the state and set it again). Simplify it and make the VOs use a vo_osd_has_changed() function to query whether the OSD bitmaps have to be recreated. vo_osd_changed() on the other hand is now used to update state only. The OSD change state is reset when osd_draw_text() is called. Update vo_corevideo.m to use vo_osd_resized() as well (forgotten change from libass-OSD merge). Simplify osd_set_text() and its usages.
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_corevideo.m4
-rw-r--r--libvo/vo_direct3d.c2
-rw-r--r--libvo/vo_gl.c2
-rw-r--r--libvo/vo_gl3.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m
index 5f5f3a0705..6e7699ef82 100644
--- a/libvo/vo_corevideo.m
+++ b/libvo/vo_corevideo.m
@@ -99,7 +99,7 @@ static void resize(struct vo *vo, int width, int height)
gl->MatrixMode(GL_MODELVIEW);
gl->LoadIdentity();
- vo_osd_changed(OSDTYPE_OSD);
+ vo_osd_resized();
gl->Clear(GL_COLOR_BUFFER_BIT);
vo->want_redraw = true;
@@ -232,7 +232,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd_s)
struct osd_p *osd = p->osd;
GL *gl = p->mpglctx->gl;
- if (vo_osd_changed(0)) {
+ if (vo_osd_has_changed()) {
clearOSD(vo);
osd_draw_text_ext(osd_s, vo->dwidth, vo->dheight, 0, 0, 0, 0,
p->image_width, p->image_height, create_osd_texture,
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c
index 872fdd376d..9a4f6e1e04 100644
--- a/libvo/vo_direct3d.c
+++ b/libvo/vo_direct3d.c
@@ -1991,7 +1991,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
if (!priv->d3d_device)
return;
- if (vo_osd_changed(0)) {
+ if (vo_osd_has_changed()) {
struct draw_osd_closure ctx = { priv };
/* clear the OSD */
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 4d98856ea9..d9c0a2dda5 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -785,7 +785,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
if (!p->use_osd)
return;
- if (vo_osd_changed(0)) {
+ if (vo_osd_has_changed(osd)) {
int osd_h, osd_w;
clearOSD(vo);
osd_w = p->scaled_osd ? p->image_width : vo->dwidth;
diff --git a/libvo/vo_gl3.c b/libvo/vo_gl3.c
index b61c7847ad..c3b09db695 100644
--- a/libvo/vo_gl3.c
+++ b/libvo/vo_gl3.c
@@ -1439,7 +1439,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
struct gl_priv *p = vo->priv;
GL *gl = p->gl;
- if (vo_osd_changed(0)) {
+ if (vo_osd_has_changed(osd)) {
clear_osd(p);
osd_draw_text_ext(osd, vo->dwidth, vo->dheight, p->border_x,
p->border_y, p->border_x,