diff options
-rw-r--r-- | sub/sd_lavc.c | 12 | ||||
-rw-r--r-- | sub/spudec.c | 4 | ||||
-rw-r--r-- | sub/sub.c | 13 |
3 files changed, 14 insertions, 15 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index a5fe23721a..4311db7dc5 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -187,7 +187,6 @@ static void get_bitmaps(struct sh_sub *sh, struct osd_state *osd, if (priv->bitmaps_changed && priv->count > 0) priv->outbitmaps = talloc_memdup(priv, priv->inbitmaps, talloc_get_size(priv->inbitmaps)); - bool pos_changed = false; int inw = priv->avctx->width; int inh = priv->avctx->height; guess_resolution(sh->type, &inw, &inh); @@ -197,18 +196,15 @@ static void get_bitmaps(struct sh_sub *sh, struct osd_state *osd, for (int i = 0; i < priv->count; i++) { struct sub_bitmap *bi = &priv->inbitmaps[i]; struct sub_bitmap *bo = &priv->outbitmaps[i]; -#define SET(var, val) pos_changed |= var != (int)(val); var = (val) - SET(bo->x, bi->x * xscale + d->ml); - SET(bo->y, bi->y * yscale + d->mt); - SET(bo->dw, bi->w * xscale); - SET(bo->dh, bi->h * yscale); + bo->x = bi->x * xscale + d->ml; + bo->y = bi->y * yscale + d->mt; + bo->dw = bi->w * xscale; + bo->dh = bi->h * yscale; } res->parts = priv->outbitmaps; res->num_parts = priv->count; if (priv->bitmaps_changed) res->bitmap_id = ++res->bitmap_pos_id; - else if (pos_changed) - res->bitmap_pos_id++; priv->bitmaps_changed = false; res->format = SUBBITMAP_INDEXED; res->scaled = xscale != 1 || yscale != 1; diff --git a/sub/spudec.c b/sub/spudec.c index e9084dcb32..4eea10ed8f 100644 --- a/sub/spudec.c +++ b/sub/spudec.c @@ -857,6 +857,10 @@ void spudec_get_indexed(void *this, struct mp_eosd_res *dim, res->num_parts = 1; res->scaled = true; } + if (spu->spu_changed) { + res->bitmap_id = res->bitmap_pos_id = 1; + spu->spu_changed = 0; + } } void spudec_draw(void *this, void (*draw_alpha)(void *ctx, int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride), void *ctx) @@ -176,11 +176,6 @@ static bool render_object(struct osd_state *osd, struct osd_object *obj, //spudec_get_bitmap(vo_spudec, osd->res.w, osd->res.h, out_imgs); spudec_get_indexed(vo_spudec, &osd->res, out_imgs); } - // Normal change-detection (sub. dec. calls vo_osd_changed(OSDTYPE_SPU)) - if (obj->force_redraw) { - out_imgs->bitmap_id++; - out_imgs->bitmap_pos_id++; - } } else if (obj->type == OSDTYPE_SUB) { struct sub_render_params p = *sub_params; if (p.pts != MP_NOPTS_VALUE) @@ -190,6 +185,11 @@ static bool render_object(struct osd_state *osd, struct osd_object *obj, osd_object_get_bitmaps(osd, obj, out_imgs); } + if (obj->force_redraw) { + out_imgs->bitmap_id++; + out_imgs->bitmap_pos_id++; + } + obj->force_redraw = false; obj->vo_bitmap_id += out_imgs->bitmap_id; obj->vo_bitmap_pos_id += out_imgs->bitmap_pos_id; @@ -197,8 +197,7 @@ static bool render_object(struct osd_state *osd, struct osd_object *obj, if (out_imgs->num_parts == 0) return false; - if (out_imgs->bitmap_id == 0 && out_imgs->bitmap_pos_id == 0 - && obj->cached.bitmap_id == obj->vo_bitmap_id + if (obj->cached.bitmap_id == obj->vo_bitmap_id && obj->cached.bitmap_pos_id == obj->vo_bitmap_pos_id && formats[obj->cached.format]) { |