summaryrefslogtreecommitdiffstats
path: root/libvo/eosd_packer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-08-28 19:12:27 +0300
committerwm4 <wm4@nowhere>2012-09-18 21:04:46 +0200
commitfd52cb65f43d262493724899c7b0fb49971f745d (patch)
treeae6b38171d67b26ad05aaf107fb48ab8e63ab96e /libvo/eosd_packer.c
parent62ccf6c5cccdf1a34a4b85f91615f0f8305b5279 (diff)
downloadmpv-fd52cb65f43d262493724899c7b0fb49971f745d.tar.bz2
mpv-fd52cb65f43d262493724899c7b0fb49971f745d.tar.xz
subs, vo: do sub bitmap change detection by comparing IDs
vo_vdpau and vo_gl cache the last subtitle bitmaps uploaded to video card in case they stay the same over multiple frames. Detecting whether the bitmaps have changed and should be re-uploaded was somewhat fragile. Change the VO API to provide a bitmap ID which can be compared with what the VO has to determine whether a new upload of the bitmaps is needed. Conflicts: libvo/vo_gl.c Note: the changes for vo_gl.c were not merged. Instead, eosd_packer is modified to use the new way of detecting EOSD changes. This takes care of vo_gl, vo_gl3 and vo_direct3d, which all render EOSD. They don't need to be updated in turn.
Diffstat (limited to 'libvo/eosd_packer.c')
-rw-r--r--libvo/eosd_packer.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libvo/eosd_packer.c b/libvo/eosd_packer.c
index 103648b7c4..8f831d512e 100644
--- a/libvo/eosd_packer.c
+++ b/libvo/eosd_packer.c
@@ -147,17 +147,18 @@ void eosd_packer_generate(struct eosd_packer *state, mp_eosd_images_t *imgs,
ASS_Image *p;
struct eosd_surface *sfc = &state->surface;
- *out_need_reposition = false;
- *out_need_upload = false;
+ *out_need_reposition = imgs->bitmap_pos_id != state->last_bitmap_pos_id;
+ *out_need_upload = imgs->bitmap_id != state->last_bitmap_id;
*out_need_reallocate = false;
- int change_state = imgs->changed;
+ state->last_bitmap_pos_id = imgs->bitmap_pos_id;
+ state->last_bitmap_id = imgs->bitmap_id;
// eosd_reinit() was probably called, force full reupload.
if (state->targets_count == 0 && img)
- change_state = 2;
+ *out_need_upload = true;
- if (change_state == 0)
+ if (!(*out_need_reposition) && !(*out_need_upload))
return; // Nothing changed, no need to redraw
state->targets_count = 0;
@@ -167,7 +168,7 @@ void eosd_packer_generate(struct eosd_packer *state, mp_eosd_images_t *imgs,
if (!img)
return; // There's nothing to render!
- if (change_state == 1)
+ if (!(*out_need_upload))
goto eosd_skip_upload;
*out_need_upload = true;