]> granicus.if.org Git - libass/commitdiff
Fix change detection in presence of vector clips
authorwm4 <wm4@nowhere>
Thu, 6 Mar 2014 21:23:01 +0000 (22:23 +0100)
committerwm4 <wm4@nowhere>
Thu, 6 Mar 2014 21:31:48 +0000 (22:31 +0100)
Fixes this test case:

Dialogue: 0,0:00:00.00,0:00:02.00,,,0,0,0,,{\fs50\pos(250,250)\iclip(m 0 0 l 400 0 l 400 220 l0 220)}Hello
Dialogue: 0,0:00:02.00,0:10:00.00,,,0,0,0,,{\fs50\pos(250,250)\iclip(m 0 0 l 400 0 l 400 230 l0 230)}Hello

The problem here is that the rendered output bitmap list itself does
not change, only its contents (due to the different vector clip).
ass_render_frame() will not set *detect_change correctly, and an
application using this flag (like mplayer or mpv) will not update
the screen as needed.

Fix this with a very cheap hack: always report a full change if
there's a vector clip. This is basically an emergency fix until
we have a proper way to detect the change.

libass/ass_render.c
libass/ass_render.h

index f553b90f4728436acc0dbb61d9da8a74ac39532f..dc6d058cd94f0ca10577415372f9ccf8e51a1c9a 100644 (file)
@@ -534,6 +534,8 @@ static void blend_vector_clip(ASS_Renderer *render_priv,
         int aleft, atop, bleft, btop;
         unsigned char *abuffer, *bbuffer, *nbuffer;
 
+        render_priv->state.has_vector_clip = 1;
+
         abuffer = cur->bitmap;
         bbuffer = clip_bm->buffer;
         ax = cur->dst_x;
@@ -794,6 +796,7 @@ init_render_context(ASS_Renderer *render_priv, ASS_Event *event)
     render_priv->state.event = event;
     render_priv->state.style = render_priv->track->styles + event->Style;
     render_priv->state.parsed_tags = 0;
+    render_priv->state.has_vector_clip = 0;
 
     reset_render_context(render_priv, render_priv->state.style);
     render_priv->state.wrap_style = render_priv->track->WrapStyle;
@@ -2830,7 +2833,7 @@ static int ass_detect_change(ASS_Renderer *priv)
     ASS_Image *img, *img2;
     int diff;
 
-    if (priv->cache_cleared)
+    if (priv->cache_cleared || priv->state.has_vector_clip)
         return 2;
 
     img = priv->prev_images_root;
index 7b3b6d743f10f35b517cb96e659908db50672fd0..f17ad5f5425ab17aec66e6fc63ddcf5559ff4663 100644 (file)
@@ -231,6 +231,7 @@ typedef struct {
     ASS_Event *event;
     ASS_Style *style;
     int parsed_tags;
+    int has_vector_clip;
 
     ASS_Font *font;
     double font_size;