From c7fbe80b29d0e64c36ca0872b8ddc1f766f89f5a Mon Sep 17 00:00:00 2001 From: "Dr.Smile" Date: Tue, 31 Jan 2017 02:47:58 +0300 Subject: render: remove redundant has_clips has_clips was a workaround for the case where a new image reused the same memory address as another image used in the previous frame. In case of such reuse, comparison by pointer address failed to distinguish the different images in ass_detect_change(). After commit dd06ca30ea79ce50116a43cc5521d4eaf60a017e, images in the previous frame are no longer freed before the comparison with current frame. Thus no such reuse can occur, and the workaround is redundant. See https://github.com/libass/libass/pull/258. --- libass/ass_render.c | 22 ++++------------------ libass/ass_render.h | 1 - 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/libass/ass_render.c b/libass/ass_render.c index 101131e..4e97d2a 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -406,25 +406,17 @@ render_glyph(ASS_Renderer *render_priv, Bitmap *bm, int dst_x, int dst_y, b_y1 = bm->h; tmp = dst_x - clip_x0; - if (tmp < 0) { + if (tmp < 0) b_x0 = -tmp; - render_priv->state.has_clips = 1; - } tmp = dst_y - clip_y0; - if (tmp < 0) { + if (tmp < 0) b_y0 = -tmp; - render_priv->state.has_clips = 1; - } tmp = clip_x1 - dst_x - bm->w; - if (tmp < 0) { + if (tmp < 0) b_x1 = bm->w + tmp; - render_priv->state.has_clips = 1; - } tmp = clip_y1 - dst_y - bm->h; - if (tmp < 0) { + if (tmp < 0) b_y1 = bm->h + tmp; - render_priv->state.has_clips = 1; - } if ((b_y0 >= b_y1) || (b_x0 >= b_x1)) return tail; @@ -523,8 +515,6 @@ static void blend_vector_clip(ASS_Renderer *render_priv, int aleft, atop, bleft, btop; unsigned char *abuffer, *bbuffer, *nbuffer; - render_priv->state.has_clips = 1; - abuffer = cur->bitmap; bbuffer = clip_bm->buffer; ax = cur->dst_x; @@ -882,7 +872,6 @@ init_render_context(ASS_Renderer *render_priv, ASS_Event *event) { render_priv->state.event = event; render_priv->state.parsed_tags = 0; - render_priv->state.has_clips = 0; render_priv->state.evt_type = EVENT_NORMAL; reset_render_context(render_priv, NULL); @@ -2953,9 +2942,6 @@ static int ass_detect_change(ASS_Renderer *priv) ASS_Image *img, *img2; int diff; - if (priv->state.has_clips) - return 2; - img = priv->prev_images_root; img2 = priv->images_root; diff = 0; diff --git a/libass/ass_render.h b/libass/ass_render.h index d009128..65422e3 100644 --- a/libass/ass_render.h +++ b/libass/ass_render.h @@ -213,7 +213,6 @@ typedef struct { ASS_Event *event; ASS_Style *style; int parsed_tags; - int has_clips; // clips that conflict with cache change detection ASS_Font *font; double font_size; -- cgit v1.2.3