]> granicus.if.org Git - libass/commitdiff
Slight optimizations for \be, \blur
authorGrigori Goronzy <greg@blackbox>
Fri, 10 Jul 2009 17:31:07 +0000 (19:31 +0200)
committerGrigori Goronzy <greg@blackbox>
Fri, 10 Jul 2009 17:31:07 +0000 (19:31 +0200)
Enlarge bitmap glyphs less for \be, this is especially effective for
lots of \be applications.
Also make sure that the gaussian blur buffers are only updated if
gaussian blur is actually used for a particular glyph.

libass/ass_bitmap.c
libass/ass_render.c

index 16d2b351e4d0767b3b8dc6b4ba51c3e39f17b0b5..d28d47b48ded3d53f6ab14fc6c8978921468148e 100644 (file)
@@ -355,7 +355,7 @@ int glyph_to_bitmap(ass_synth_priv_t *priv_blur,
                     bitmap_t **bm_g, bitmap_t **bm_o, bitmap_t **bm_s,
                     int be, double blur_radius, FT_Vector shadow_offset)
 {
-    int bord = be ? (be / 4 + 1) : 0;
+    int bord = be ? (be / 8 + 1) : 0;
     blur_radius *= 2;
     bord = (blur_radius > 0.0) ? blur_radius + 1 : bord;
     if (bord == 0 && (shadow_offset.x || shadow_offset.y))
@@ -377,9 +377,6 @@ int glyph_to_bitmap(ass_synth_priv_t *priv_blur,
             return 1;
         }
     }
-    if (*bm_o)
-        resize_tmp(priv_blur, (*bm_o)->w, (*bm_o)->h);
-    resize_tmp(priv_blur, (*bm_g)->w, (*bm_g)->h);
 
     if (be) {
         while (be--) {
@@ -390,6 +387,9 @@ int glyph_to_bitmap(ass_synth_priv_t *priv_blur,
         }
     } else {
         if (blur_radius > 0.0) {
+            if (*bm_o)
+                resize_tmp(priv_blur, (*bm_o)->w, (*bm_o)->h);
+            resize_tmp(priv_blur, (*bm_g)->w, (*bm_g)->h);
             generate_tables(priv_blur, blur_radius);
             if (*bm_o)
                 ass_gauss_blur((*bm_o)->buffer, priv_blur->tmp,
index e2eac7b4ae8f8f2cb0e02df455f98f06967bc3fe..f442b89790f5e7dc0a704a166024700fdea2a9ab 100644 (file)
@@ -41,7 +41,7 @@
 #define MAX_GLYPHS_INITIAL 1024
 #define MAX_LINES_INITIAL 64
 #define BLUR_MAX_RADIUS 100.0
-#define MAX_BE 100
+#define MAX_BE 127
 #define SUBPIXEL_MASK 63
 #define SUBPIXEL_ACCURACY 7    // d6 mask for subpixel accuracy adjustment