summaryrefslogtreecommitdiffstats
path: root/sub/sub.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-22 17:50:15 +0100
committerwm4 <wm4@nowhere>2013-01-13 20:04:12 +0100
commit3d6d549dac2aa06ecd07bb04902f55140661ace3 (patch)
tree80d548014a2363fe236ca061c87282a5c05ee8c2 /sub/sub.c
parent1c65428d6f70f05333ecc8284e3f235c679fff26 (diff)
downloadmpv-3d6d549dac2aa06ecd07bb04902f55140661ace3.tar.bz2
mpv-3d6d549dac2aa06ecd07bb04902f55140661ace3.tar.xz
vo_xv, vo_x11: simplify OSD redrawing
In order to support OSD redrawing for vo_xv and vo_x11, draw_bmp.c included an awkward "backup" mechanism to copy and restore image regions that have been changed by OSD/subtitles. Replace this by a much simpler mechanism: keep a reference to the original image, and use that to restore the Xv/X framebuffers. In the worst case, this may increase cache pressure and memory usage, even if no OSD or subtitles are rendered. In practice, it seems to be always faster.
Diffstat (limited to 'sub/sub.c')
-rw-r--r--sub/sub.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/sub/sub.c b/sub/sub.c
index 4baf4f1487..ea9c51a758 100644
--- a/sub/sub.c
+++ b/sub/sub.c
@@ -275,7 +275,6 @@ void osd_draw(struct osd_state *osd, struct mp_osd_res res,
struct draw_on_image_closure {
struct osd_state *osd;
struct mp_image *dest;
- struct mp_draw_sub_backup *bk;
struct mp_image_pool *pool;
bool changed;
};
@@ -284,8 +283,6 @@ static void draw_on_image(void *ctx, struct sub_bitmaps *imgs)
{
struct draw_on_image_closure *closure = ctx;
struct osd_state *osd = closure->osd;
- if (closure->bk)
- mp_draw_sub_backup_add(closure->bk, closure->dest, imgs);
if (closure->pool) {
mp_image_pool_make_writeable(closure->pool, closure->dest);
} else {
@@ -314,16 +311,7 @@ void osd_draw_on_image_p(struct osd_state *osd, struct mp_osd_res res,
double video_pts, int draw_flags,
struct mp_image_pool *pool, struct mp_image *dest)
{
- struct draw_on_image_closure closure = {osd, dest, .pool = pool};
- osd_draw(osd, res, video_pts, draw_flags, mp_draw_sub_formats,
- &draw_on_image, &closure);
-}
-
-void osd_draw_on_image_bk(struct osd_state *osd, struct mp_osd_res res,
- double video_pts, int draw_flags,
- struct mp_draw_sub_backup *bk, struct mp_image *dest)
-{
- struct draw_on_image_closure closure = {osd, dest, bk};
+ struct draw_on_image_closure closure = {osd, dest, pool};
osd_draw(osd, res, video_pts, draw_flags, mp_draw_sub_formats,
&draw_on_image, &closure);
}